GNU/Linux >> LINUX-Kenntnisse >  >> Cent OS

„lsb_release:Befehl nicht gefunden“ – Fix in CentOS/RHEL

Das Problem

Beim Ausführen des Befehls „lsb_release -r“, um die Versionsnummer der aktuell installierten Distribution anzuzeigen, erhält der Benutzer die folgende Fehlermeldung:

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

Wie kann dies gelöst werden?

Die Lösung

Um die RedHat/CentOS-Version zu überprüfen, kann man den Befehl „lsb_release“ verwenden. In den meisten Fällen wird das Paket, das diesen Befehl bereitstellt, nicht standardmäßig auf den Systemen installiert. Um zu überprüfen, welches Paket den Befehl lsb_release bereitstellt, verwenden Sie den folgenden Befehl:

Für CentOS/RHEL 7

# yum whatprovides lsb_release
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
epel/x86_64/metalink                                                                                                                                                                 |  16 kB  00:00:00
 * base: mirrors.advancedhosters.com
 * epel: mirror.umd.edu
 * extras: mirrors.advancedhosters.com
 * nux-dextop: li.nux.ro
 * updates: mirrors.advancedhosters.com

...

redhat-lsb-core-4.1-27.el7.centos.1.i686 : LSB Core module support
Repo        : base
Matched from:
Filename    : /usr/bin/lsb_release

Für CentOS/RHEL 8:

# yum whatprovides lsb_release
Last metadata expiration check: 28 days, 20:55:23 ago on Sat 07 Sep 2019 04:57:53 PM UTC.
redhat-lsb-core-4.1-47.el8.x86_64 : LSB Core module support
Repo        : rhel-8-appstream-rhui-rpms
Matched from:
Filename    : /usr/bin/lsb_release

redhat-lsb-core-4.1-47.el8.i686 : LSB Core module support
Repo        : rhel-8-appstream-rhui-rpms
Matched from:
Filename    : /usr/bin/lsb_release

Wie oben gezeigt, wird der Befehl lsb_release vom Paket „redhat-lsb-core bereitgestellt “. Dieses Paket ist möglicherweise nicht standardmäßig auf dem System vorhanden und Sie müssen es möglicherweise zuerst installieren. Verwenden Sie den folgenden Befehl, um das Paket in CentOS/RHEL 7- und 8-Systemen zu installieren:

# yum install redhat-lsb-core 

Oder

# yum install redhat-lsb

Ich bevorzuge die Installation von „redhat-lsb-core“ anstelle von „redhat-lsb“, da es weniger Paketabhängigkeiten erfordert. Wenn Sie das Paket „redhat-lsb“ nicht ausdrücklich benötigen, würde ich vorschlagen, nur das Kernpaket zu installieren.

Für CentOS/RHEL 8 können Sie auch dnf verwenden, um das Paket zu installieren:

# dnf install redhat-lsb-core

Beispielausgabe:

# dnf install redhat-lsb-core
Last metadata expiration check: 0:15:19 ago on Sun 06 Oct 2019 01:57:17 PM UTC.
Dependencies resolved.
============================================================================================================================================================================================================
 Package                                                 Arch                                Version                                          Repository                                               Size
============================================================================================================================================================================================================
Installing:
 redhat-lsb-core                                         x86_64                              4.1-47.el8                                       rhel-8-appstream-rhui-rpms                               45 k
Installing dependencies:
 cups-client                                             x86_64                              1:2.2.6-25.el8                                   rhel-8-appstream-rhui-rpms                              167 k
 redhat-lsb-submod-security                              x86_64                              4.1-47.el8                                       rhel-8-appstream-rhui-rpms                               22 k
 bc                                                      x86_64                              1.07.1-5.el8                                     rhel-8-baseos-rhui-rpms                                 129 k
 mailx                                                   x86_64                              12.5-29.el8                                      rhel-8-baseos-rhui-rpms                                 257 k
 spax                                                    x86_64                              1.5.3-13.el8                                     rhel-8-baseos-rhui-rpms                                 217 k
 ncurses-compat-libs                                     x86_64                              6.1-7.20180224.el8                               rhel-8-baseos-rhui-rpms                                 331 k
 time                                                    x86_64                              1.9-3.el8                                        rhel-8-baseos-rhui-rpms                                  54 k
 util-linux-user                                         x86_64                              2.32.1-8.el8                                     rhel-8-baseos-rhui-rpms                                  97 k
 postfix                                                 x86_64                              2:3.3.1-8.el8                                    rhel-8-baseos-rhui-rpms                                 1.5 M
 ed                                                      x86_64                              1.14.2-4.el8                                     rhel-8-baseos-rhui-rpms                                  82 k
 at                                                      x86_64                              3.1.20-11.el8                                    rhel-8-baseos-rhui-rpms                                  81 k
 patch                                                   x86_64                              2.7.6-9.el8_0                                    rhel-8-baseos-rhui-rpms                                 138 k

Transaction Summary
============================================================================================================================================================================================================
Install  13 Packages

Total download size: 3.0 M
Installed size: 7.6 M
Is this ok [y/N]: y
Downloading Packages:
(1/13): redhat-lsb-submod-security-4.1-47.el8.x86_64.rpm                                                                                                                    220 kB/s |  22 kB     00:00
(2/13): redhat-lsb-core-4.1-47.el8.x86_64.rpm                                                                                                                               448 kB/s |  45 kB     00:00
(3/13): cups-client-2.2.6-25.el8.x86_64.rpm                                                                                                                                 1.4 MB/s | 167 kB     00:00
(4/13): bc-1.07.1-5.el8.x86_64.rpm                                                                                                                                          1.2 MB/s | 129 kB     00:00
(5/13): mailx-12.5-29.el8.x86_64.rpm                                                                                                                                        2.2 MB/s | 257 kB     00:00
(6/13): spax-1.5.3-13.el8.x86_64.rpm                                                                                                                                        1.9 MB/s | 217 kB     00:00
(7/13): ncurses-compat-libs-6.1-7.20180224.el8.x86_64.rpm                                                                                                                   3.0 MB/s | 331 kB     00:00
(8/13): time-1.9-3.el8.x86_64.rpm                                                                                                                                           506 kB/s |  54 kB     00:00
(9/13): util-linux-user-2.32.1-8.el8.x86_64.rpm                                                                                                                             908 kB/s |  97 kB     00:00
(10/13): ed-1.14.2-4.el8.x86_64.rpm                                                                                                                                         825 kB/s |  82 kB     00:00
(11/13): at-3.1.20-11.el8.x86_64.rpm                                                                                                                                        817 kB/s |  81 kB     00:00
(12/13): postfix-3.3.1-8.el8.x86_64.rpm                                                                                                                                      11 MB/s | 1.5 MB     00:00
(13/13): patch-2.7.6-9.el8_0.x86_64.rpm                                                                                                                                     1.3 MB/s | 138 kB     00:00
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                       1.9 MB/s | 3.0 MB     00:01
....

Sie sollten jetzt bereit sein zu gehen. Versuchen Sie, den Befehl lsb_release auszuführen:

# lsb_release
LSB Version:	:core-4.1-amd64:core-4.1-noarch

Verschiedene Optionen mit dem Befehl lsb_release sind:

# 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.


Cent OS
  1. So beheben Sie den Fehler „semanage command“ Not Found in CentOS

  2. CentOS – semanage command not found error – Die Lösung ist da!

  3. „firewall-cmd:command not found“ unter CentOS 8 [Gelöst]

  4. ifconfig-Befehl nicht gefunden – CentOS/RHEL 7

  5. „-bash:Firewall:Befehl nicht gefunden“ – Lösung in CentOS/RHEL 7

So beheben Sie den Befehl add-apt-repository, der unter Ubuntu und Debian nicht gefunden wurde

semanage-Befehl nicht gefunden in CentOS 7/6 &RHEL 7/6 – Quick Fix

netstat-Befehl unter CentOS 8 / RHEL 8 nicht gefunden – Quick Fix

ifconfig-Befehl nicht gefunden auf CentOS 8 / RHEL 8 – Quick Fix

Linux-Fehlerbehebung – Der Befehl netstat wurde in CentOS 7/8 und RHEL 7/8 nicht gefunden

So beheben Sie, dass der Befehl „Ifconfig“ unter CentOS 7 nicht gefunden wurde