-2

I have installed the new postgresql-12 on my ubuntu 22 and set the path but when I want to know the postgrsql status it is giving me this Error.

Can anyone help me with that? Error Image

Thank you.

  • 1
    1) Don't do the `export PATH = ...`. 2) Add the result of running `pg_lsclusters` to your question, **as text NOT as an image**. – Adrian Klaver Jul 23 '23 at 15:25

10 Answers10

1

You are getting this error because sudo is not in path, Everything is a file in linux system, even commands as well.

You can check content of PATH variable by executing command $ echo $PATH If you do not find /usr/bin in the output than you can append /usr/bin in PATH variable by executing command

export PATH=$PATH:/usr/bin

because sudo file is located in 2 places, i.e /usr/bin or /bin directories.

It's happening because of some missing line in .bashrc file or which ever shell you are using, you can check that by echo $SHELL Just add the export line in your respective shell config file and it'll be permanent solution.

For Reference see this answer on AskUbuntu.

Sarthak
  • 380
  • 7
0

Since sudo is looking is trying to locate /bin:usr/bin in PATH, you can try exporting this in the PATH environment variable.

export PATH=$PATH:/bin:/usr/bin

Note: If you want to make this change permanent, try adding it at the end of ~/.bashrc file and then saving the changes using source ~/.bashrc.

Safi50
  • 379
  • 1
  • 7
0

sudo cannot find the especified path, to solve it just modify your ~/.bashrc file adding in the last line:

export PATH="/bin:/usr/bin:$PATH"

and after it run the command: source ~/.bashrc

Marcos Silva
  • 115
  • 5
0

/usr/bin is not included in your environment PATH.

export PATH="/usr/bin:$PATH"

exit out the terminal and try again.

Arunesh
  • 1
  • 1
  • 2
0

Do not just copy-paste the command "export PATH=/usr/lib/postgresql/12/bin/:PATH".

Please ensure that you provide the correct path to the PostgreSQL bin directory. You can find the path of the bin directory by running the command inside the bin directory.

pwd

Also you can follow this blog tutorial which is a step-by-step tutorial for installing PostgreSQL from source.

0

The error already tells you the problem. sudo is not in the PATH. Hence, you should add sudo to PATH in ~/.bashrc and run source ~/.bashrc.

This should solve this issue.

Tito
  • 289
  • 8
0

The error in the screenshot is saying that /bin:/usr/bin is not included in the PATH environment variable. So, you need to add this directory to the PATH variable:

export PATH="/bin:/usr/bin:$PATH"
adil shahid
  • 125
  • 4
0

Your system is unable to locate a particular file.

Run this command export PATH="/bin:/usr/bin:$PATH" before checking the status of PostgreSQL in your system.

-1

You get this error because you are you using systemctl when you did not install Postgres as a system service. Since you installed from source code you have to navigate into your Postgres directory and run bin/pg_ctl status -D /path/to/data_directory to ascertain the status of your Postgres instance.

-1

I think according to the error you should just add the /bin:/usr/bin paths to the PATH as stated, you can do that by running the following command:

export PATH=$PATH:/bin:/usr/bin

What the command does, is that it adds the /bin:/usr/bin paths to PATH.

Hope that was helpful, let me know how it goes with you!.

ahmed_131313
  • 142
  • 6