lsb_release
Linux

lsb_release: command not found on CentOS

lsb_release is a command that displays information about the version of the installed Linux distribution name. In some distribution this command does not exist and the error below is displayed :

[root@server ~]# lsb_release -a
-bash: lsb_release: command not found

In this guide we will see how to solve this problem on CentOS.

Installing lsb_release :

By default the package providing this command is not installed on CentOS / RedHat. to see the package corresponding to this command run the command below :

CentOS 7 :

[root@server ~]# yum whatprovides lsb_release
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
base: mirror.airenetworks.es
extras: mirror.airenetworks.es
updates: mirror.marwan.ma
base/7/x86_64/filelists_db | 7.2 MB 00:00:05
extras/7/x86_64/filelists_db | 235 kB 00:00:00
updates/7/x86_64/filelists_db | 6.2 MB 00:00:04
redhat-lsb-core-4.1-27.el7.centos.1.i686 : LSB Core module support
Repo : base
Matched from:
Filename : /usr/bin/lsb_release
redhat-lsb-core-4.1-27.el7.centos.1.x86_64 : LSB Core module support
Repo : base
Matched from:
Filename : /usr/bin/lsb_release

CentOS 8 :

[root@server ~]# dnf whatprovides lsb_release
Last metadata expiration check: 12 days, 23:44:27 ago on Sat 21 Aug 2021 08:43:07 AM EDT.
redhat-lsb-core-4.1-47.0.1.el8.i686 : LSB Core module support
Repo : ol8_appstream
Matched from:
Filename : /usr/bin/lsb_release
redhat-lsb-core-4.1-47.0.1.el8.x86_64 : LSB Core module support
Repo : ol8_appstream
Matched from:
Filename : /usr/bin/lsb_release

As shown above, the name of the package is redhat-lsb-core. To install it, type the command below :

[root@server ~]# yum install redhat-lsb-core
Oracle Linux 8 BaseOS Latest (x86_64) 7.6 kB/s | 3.6 kB 00:00
Oracle Linux 8 BaseOS Latest (x86_64) 892 kB/s | 34 MB 00:39
Oracle Linux 8 Application Stream (x86_64) 8.9 kB/s | 3.9 kB 00:00
Oracle Linux 8 Application Stream (x86_64) 913 kB/s | 26 MB 00:29
Latest Unbreakable Enterprise Kernel Release 6 for Oracle Linux 8 (x86_64) 7.1 kB/s | 3.0 kB 00:00
Latest Unbreakable Enterprise Kernel Release 6 for Oracle Linux 8 (x86_64) 1.0 MB/s | 23 MB 00:22
Last metadata expiration check: 0:00:04 ago on Fri 03 Sep 2021 08:29:53 AM EDT.
Dependencies resolved.

Or with dnf command :

[root@server ~]# dnf install redhat-lsb-core

The command should work now :

[root@server ~]# lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: OracleServer
Description: Oracle Linux Server release 8.4
Release: 8.4
Codename: n/a

You can use lsb_release with several options :

[root@server ~]# lsb_release --help
FSG lsb_release v2.0 prints certain LSB (Linux Standard Base) and
Distribution information.
Usage: lsb_release [OPTION]…
With no OPTION specified defaults to -v.
Options:
-v, --version
Display the version of the LSB specification against which the distribution is compliant.
-i, --id
Display the string id of the distributor.
-d, --description
Display the single line text description of the distribution.
-r, --release
Display the release number of the distribution.
-c, --codename
Display the codename according to the distribution release.
-a, --all
Display all of the above information.
-s, --short
Use short output format for information requested by other options (or version if none).
-h, --help
Display this message.

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *