“lsb_release command not found” – how to fix it and everything you need to know

lsb_release is a command-line utility that prints a detailed list of LSB (Linux Standard Base) and Distribution information. The utility can be used to display information about your Linux installation such as the currently installed Linux distribution, the specific version, and codename.

Users who are beginning with Linux often think that lsb_release is included in all Linux distribution right out of the box, but in reality, it’s not the case.

Running lsb_release in Linux distros which didn’t include it, you’ll certainly get the following error message.

# lsb_release -v
-bash: lsb_release: command not found

This article is going to show you how to fix "lsb_release command not found" error quickly.

Install lsb-core (lsb_release included)

The error can be fixed by installing the Lsb-core package. You can find this package in almost all Ubuntu/Debian based default OS repositories.

On Ubuntu, run:

sudo apt install lsb-core

For Fedora or derivates, you have to run

sudo dnf install lsb-core

For CentOS or derivatives, you have to run

sudo yum install lsb-core

For Arch Linux or derivatives, you have to run

sudo pacman -S lsb-core

image-20210625111134410

Check lsb_release path for its binary

"lsb_release command not found" indicates that the system is not able to access lsb_release at its usual path. In order to make sure that lsb_release is installed, you have to check its path manually to see if it’s there.

Type the following command in the terminal to locate where lsb_release reside in the disk:

locate lsb_release

The following output should look like the following image or contain this string : /usr/bin/lsb_release

image-20210625111808468

If the command returns no output, then you have no lsb_release package installed and have to install it manually using a .deb file.

Reinstall lsb_release using dpkg

To do that, you need to grab the corresponding .deb package that was compiled for your OS version. If you’re using Ubuntu like me, go to one of its Archive Mirror. In this case, we are going to http://us.archive.ubuntu.com/ubuntu/.

lsb_release command not found - access Ubuntu mirror archive

Access /pool/main/l/lsb/ path and you’ll see a bunch of .deb package. Select the one that is suitable with your architecture (and64/i386)

lsb_release command not found - Reinstall lsb_release using dpkg

There is a directory named lsb_release inside /pool/main/l/, but it contains nothing, the actual command is included in lsb-core package

Once it finishes downloading, you can install lsb-core DEB file by running the following command :

sudo dpkg -i /path/to/apt_deb_file.deb

Remember to replace the /path/to/apt_deb_file.deb with the path of the file you’ve just downloaded.

Last resort : Reinstall OS

Reinstalling the operating system is the fastest solution if you’ve tried the two methods above with no luck. For a fresh start on a server, you can simply re-image it.

Before reinstalling, make sure you have backed up all your data and settings. rclone, a robust, mature backup solution supported by the open-source community, would be our recommendation if you did not already have one.

Rclone installation on Ubuntu was covered previously on our site, along with a few Rclone examples to get you quickly started.

Conclusion

Hopefully, you will be able to solve your problem effectively and quickly with this tutorial. Please consider rate the article below if it does.

You may also want to read our guide on how to fix "Unable to lock the administration directory (/var/lib/dpkg/)" error in apt, which is another common error among Linux newbies.

Leave a Comment