lsb_release: command not found on Ubuntu 20.04

8.3k Views Asked by At

Hello I'm trying to install postgreSQL on Ubuntu 20.04, but when I exexute the very first command in order to create file repository configuration:

$ sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'

I get bash: lsb_release: command not found.

It might be useful to point out that I uninstalled Python 3.6.0 and then I installed Python 3.8.5 before postgresql so I think that this could be the reason of the hassle.

Here I post some commands and its outputs I executed that can help for a better understanding of the actual problem.

sudo apt-cache policy lsb-release

lsb-release:
  Installed: (none)
  Candidates:  (none)
  Version Table:
     11.1.0ubuntu2 -1
        100 /var/lib/dpkg/status

sudo apt-get install lsb-release

Reading package lists... Done
Building dependency tree
Reading state information... Done
Package lsb-release is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package "lsb-release" does not have a candidate for installation

lsb_release

bash: lsb_release: command not found

Please let me know if I should provide further information that might be useful in order to figure out what's the origin of the issue.

Thank you very much in advance

1

There are 1 best solutions below

10
On

Use sudo apt install lsb-release or sudo apt install lsb-core.

I think a quick search might have saved.

Edit:

  1. You could try installing via the .deb file which can be downloaded from Ubuntu

  2. I believe the lsb_release package might still exists on your system but it's somehow no longer in PATH

  3. Find lsb_release(usually in usr/bin) and then symlink. You can refer to link

Sorry for my first answer.