gosu command not found

In this troubleshooting guide we learn how to fix gosu command not found error message

Introduction

When you run more command in linux terminal / console, you get the following error message

gosu: command not found

or when using sudo you get the following error message

sudo: gosu: command not found

Solutions to gosu: command not found

How To Fix gosu: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu gosu is provided by gosu package.

gosu is:

This is a simple tool grown out of the simple fact that “su” and “sudo” have very strange and often annoying TTY and signal-forwarding behavior. They’re also somewhat complex to setup and use (especially in the case of “sudo”), which allows for a great deal of expressivity, but falls flat if all you need is “run this specific application as this specific user and get out of the pipeline”.

The core of how “gosu” works is stolen directly from how Docker/libcontainer itself starts an application inside a container (and in fact, is using the “/etc/passwd” processing code directly from libcontainer’s codebase).

Once the user/group is processed, we switch to that user, then we “exec” the specified process and “gosu” itself is no longer resident or involved in the process lifecycle at all. This avoids all the issues of signal passing and TTY, and punts them to the process invoking “gosu” and the process being invoked by “gosu”, where they belong.

To fix this problem, we can install more using the command below.

sudo apt-get -y install gosu

This command might take some time to finish depending on your machine internet connection.

You can also use apt command to install gosu.

sudo apt -y install gosu

Or if you have aptitude installed you can use the following command.

sudo aptitude install gosu

Summary

In this tutorial we learn how to fix gosu command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.