Why can I not run lsb_release without -a parameter on ubuntu? - linux

Why can I not run lsb_release without -a parameter on ubuntu? Because When I run lsb_release command, I am taking message "No LSB modules are available".

Explanation: lsb_release command - prints you the linux distribution version on machine.
Solution: -v (version) is in default when no parameters are in. For watching linux distribution full information always use the -a flag or -r for release number.
examples:
$lsb_release -a
#output:
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.5 LTS
Release: 18.04
Codename: bionic
$lsb_release -r
#output:
Release: 18.04
Flags are:
-v, --version
Show the version of the LSB against which your current installation is compliant. The version is expressed as a colon separated list of LSB module descriptions.
-i, --id
Display the distributor's ID.
-d, --description
Display a description of the currently installed distribution.
-r, --release
Display the release number of the currently installed distribution.
-c, --codename
Display the code name of the currently installed distribution.
-a, --all
Display all of the above information.
-s, --short
Use the short output format for any information displayed. This format omits the leading header(s).
-h, --help
Show summary of options.

From the man page for lsb_release:
If no options are given, the -v option is assumed.
The -v option:
-v, --version
Show the version of the LSB against which your current installa‐
tion is compliant. The version is expressed as a colon sepa‐
rated list of LSB module descriptions.
If you don't have any lsb modules installed you'll get the message you describe. The -a switch shows all information available.

Related

Get minor version of debian-slim

I am setting up my container creation pipeline and I need to be able to get the major AND minor version of the debian-slim build my container is built on.
I tried the following command:
docker run -it --rm -a stdout --entrypoint lsb_release MyContainer:1.0.0 -a
but that just returns:
Distributor ID: Debian
Description: Debian GNU/Linux 10 (buster)
Release: 10
Codename: buster
No minor version listed.
I have also tried:
docker run -it --rm -a stdout --entrypoint cat MyContainer:1.0.0 "/etc/os-release"
but that only outputs:
PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
again, no minor version.
Is there a way to get the minor version? Does the container OS even know its full version number?
In fact, in the old days on Debian9, you could use lsb_release -a to get the minor version as next:
$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 9.5 (stretch)
Release: 9.5
Codename: stretch
You may know, /usr/bin/lsb_release will finally call /usr/lib/python3/dist-packages/lsb_release.py, the realization diff for this script between debian9 & debian10 made the difference.
In debian9, it's next:
def get_distro_information():
lsbinfo = get_lsb_information()
# OS is only used inside guess_debian_release anyway
for key in ('ID', 'RELEASE', 'CODENAME', 'DESCRIPTION',):
if key not in lsbinfo:
distinfo = guess_debian_release()
distinfo.update(lsbinfo)
return distinfo
else:
return lsbinfo
get_lsb_release will fetch the contents of /etc/lsb-release, but there is no file in debian release, so it returns none. Then the procedure have to fallback to guess_debian_release which will fetch the contents from /etc/debian_version, so you get the minor version.
In debian10, it's next:
def get_distro_information():
lsbinfo = get_os_release()
# OS is only used inside guess_debian_release anyway
for key in ('ID', 'RELEASE', 'CODENAME', 'DESCRIPTION',):
if key not in lsbinfo:
distinfo = guess_debian_release()
distinfo.update(lsbinfo)
return distinfo
else:
return lsbinfo
get_os_release will fetch the contents of /usr/lib/os-release, the contens is next:
PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
As it already get the version, so nolonger fallback to guess_debian_release, so you did not get the minor version. The advantage I guess is if not use guess_debian_release, it will use less IO operation, but in my opinion, really countless (Also maybe some hardcoding for guess).
Finally, as a workaround, on debian10, you could use next to get the same behavior as debian 9:
$ LSB_OS_RELEASE="" lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 10.4 (buster)
Release: 10.4
Codename: buster
Should have looked a bit harder. (Found it right after posting)
Debian does it their own way by putting it in the custom, nonstandard, Debian specific file /etc/debian_version found only on Debian Linux:
docker run -it --rm -a stdout --entrypoint cat MyContainer:1.0.0 "/etc/debian_version"
<rant>Why do they not follow the standard of using lsb_release?</rant>

clang 3.8+ -fopenmp on linux: ld cannot find -lomp

I have installed clang 3.8 from the base repositories for both Debian Jessie and Fedora 24. When I try to compile a simple HelloWorld.cpp test program with clang++, and i pass the -fopenmp flag, in both cases i get the same error:
/usr/bin/ld: cannot find -lomp
clang-3.8: error: linker command failed with exit code 1 (use -v to see invocation)
I see that if I instead pass -fopenmp=libgomp, it works. However, the Clang OpenMP website says that the OpenMP runtime is shipped with Clang 3.8. Why, then, can it not find the default libomp library? I do not see this library anywhere on my system.
There is good chances that the OpenMP development package is missing on your system.
On Ubuntu: sudo apt install libomp-dev
If you have libomp installed correctly you will need to use -fopenmp=libomp. libgomp is for gcc. You might check that clang isn't symbollically linked to gcc on your computer.
TL;DR
If you have libomp.so for llvm in somewhere like /usr/lib/llvm-12/lib make file /etc/ld.so.conf.d/libomp.conf with the line /usr/lib/llvm-12/lib in it, then run sudo ldconfig.
Intro
In my case, I had libomp-12-dev installed, but it was not in my linker's library path. See the footnote on how I found the library. There are a couple solutions in this scenario:
Add library path with ldconfig
If you want this in your default library path, consider using ldconfig [man page].
This will look for files in /etc/ld.so.conf. For me, running Ubuntu 20.04, this file only points to including files in the directory /etc/ld.so.conf.d.
$ cat /etc/ld.so.conf
include /etc/ld.so.conf.d/*.conf
As such, I made a config llvm-libomp-12 in my /etc/ld.so.conf.d directory that looks like this:
$ cat /etc/ld.so.conf.d/libomp.conf
# libomp.so for llvm
/usr/lib/llvm-12/lib
Then I asked ldconfig to update the paths with sudo ldconfig. You can add the -v flag and it will print all libraries and paths it is aware of.
Add library to environment variable
We can also direct the linker to our library using the $LD_LIBRARY_PATH environment variable
This may be advantageous if you're on a multiuser system and don't want to impact others, or if you have temporary changes to your library paths you would like to make in your shell.
See what your current $LD_LIBRARY_PATH is with echo $LD_LIBRARY_PATH. You may not have this set by default. Add paths to this variable, each delimited by a colon.
For your current shell session, simply append or prepend to your $LD_LIBRARY_PATH like this (assuming bash, zsh, or fish >v3.0):
export "$LD_LIBRARY_PATH:/path/to/lib"
Or for a more permanent change limited to your user, add the above export to your shell's config file (e.g. ~/.bashrc).
Manually specify library path(s) in compiler flags
Nice for a one-off specific library that you don't always want in your default library paths. Specify the path to the library as a flag like this:
-L/path/to/lib
For example:
clang++ -L/usr/lib/llvm-12/lib [...]
make -L/usr/lib/llvm-12/lib
Footnotes
On searching
If you don't know where a given library you need is, you can use things like find. Personally though, I used a package called mlocate that indexes files on my machine and allows you to search them.
Installing mlocate
sudo apt install mlocate
Updating the indexes
sudo updatedb
Searching for a substring
locate libomp.so
When I searched for where my libomp libraries were, I did this:
$ locate libomp.so
/usr/lib/llvm-12/lib/libomp.so
/usr/lib/llvm-12/lib/libomp.so.5
/usr/lib/x86_64-linux-gnu/libomp.so.5
Notably it seemed like clang was using the libomp.so.5 in the linux-gnu directory, but I needed it to be using the llvm library.
Environment used in this post
$ lsb_release --all
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.2 LTS
Release: 20.04
Codename: focal
$ uname -a
Linux bip 5.8.0-48-generic #54~20.04.1-Ubuntu SMP Sat Mar 20 13:40:25 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
TODO
Some notes that could be added to this question:
Confirm and list priority of env vars vs config files vs flags (does this vary between compilers and linkers?)
Ordering library paths when using multiple config files (can we prefix with numbers to ensure the order libraries are parsed?)

which fuse version in my kernel?

I want to know which fuse version do I have, when attempting to execute:
locate -i -r /fuse
I get:
/lib/modules/3.0.0-12-generic/kernel/fs/fuse
/lib/modules/3.0.0-12-generic/kernel/fs/fuse/cuse.ko
/lib/modules/3.0.0-32-generic/kernel/fs/fuse
/lib/modules/3.0.0-32-generic/kernel/fs/fuse/cuse.ko
/usr/include/fuse
/usr/include/fuse.h
/usr/include/fuse/cuse_lowlevel.h
/usr/include/fuse/fuse.h
/usr/include/fuse/fuse_common.h
/usr/include/fuse/fuse_common_compat.h
/usr/include/fuse/fuse_compat.h
/usr/include/fuse/fuse_lowlevel.h
/usr/include/fuse/fuse_lowlevel_compat.h
/usr/include/fuse/fuse_opt.h
/usr/include/linux/fuse.h
/usr/lib/pkgconfig/fuse.pc
/usr/share/app-install/desktop/fuse-emulator-gtk:fuse-gtk.desktop
/usr/share/app-install/desktop/fuse-emulator-sdl:fuse-sdl.desktop
/usr/share/app-install/icons/fuse.png
/usr/share/doc/fuse-utils
/usr/share/doc/libfuse-dev/examples/fusexmp.c
/usr/share/doc/libfuse-dev/examples/fusexmp_fh.c
/usr/share/initramfs-tools/hooks/fuse_utils
/usr/share/lintian/overrides/fuse-utils
/usr/share/man/man1/fuser.1.gz
/usr/share/man/man1/fusermount.1.gz
/usr/src/linux-headers-3.0.0-12/fs/fuse
/usr/src/linux-headers-3.0.0-12/fs/fuse/Kconfig
/usr/src/linux-headers-3.0.0-12/fs/fuse/Makefile
/usr/src/linux-headers-3.0.0-12/include/linux/fuse.h
/usr/src/linux-headers-3.0.0-12-generic/include/config/fuse
/usr/src/linux-headers-3.0.0-12-generic/include/config/aufs/br/fuse.h
/usr/src/linux-headers-3.0.0-12-generic/include/config/fuse/fs.h
/usr/src/linux-headers-3.0.0-12-generic/include/linux/fuse.h
/usr/src/linux-headers-3.0.0-32/fs/fuse
/usr/src/linux-headers-3.0.0-32/fs/fuse/Kconfig
/usr/src/linux-headers-3.0.0-32/fs/fuse/Makefile
/usr/src/linux-headers-3.0.0-32/include/linux/fuse.h
/usr/src/linux-headers-3.0.0-32-generic/include/config/fuse
/usr/src/linux-headers-3.0.0-32-generic/include/config/aufs/br/fuse.h
/usr/src/linux-headers-3.0.0-32-generic/include/config/fuse/fs.h
/usr/src/linux-headers-3.0.0-32-generic/include/linux/fuse.h
/var/lib/dpkg/info/fuse-utils.conffiles
/var/lib/dpkg/info/fuse-utils.list
/var/lib/dpkg/info/fuse-utils.md5sums
/var/lib/dpkg/info/fuse-utils.postinst
/var/lib/dpkg/info/fuse-utils.postrm
/var/lib/dpkg/info/fuse-utils.preinst
Any idea where the information I need is located ?
You can get the version of the fusermount utility like this:
fusermount -V
The selected answer should be jdlourenco's one.
Boh's anwser isn't bad, but not clear enough for newbies and the shell line is too specific (in my case, Ubuntu 16.04, no results)
On Debian / Ubuntu, check using dpkg
dpkg --get-selections | grep fuse
In addition to fusermount -V, as presented by #jdlourenco, you can also run sshfs -V. It shows the fusermount -V output as the last line.
Example runs and output on my Ubuntu 20.04 machine:
$ fusermount -V
fusermount3 version: 3.9.0
and:
$ sshfs -V
SSHFS version 3.7.1
FUSE library version 3.9.0
using FUSE kernel interface version 7.31
fusermount3 version: 3.9.0
Other References:
My answer here: Ask Ubuntu: How to prevent SSHFS mount freeze after changing connection after suspend?

systemtap profiling gc node.js

I installed node.js(0.9.4) via nvm, which according to changelog has systemtap support.
I installed systemtap on my Fedora linux distro.
$ sudo yum install systemtap
I used this gist from Ben Noordhuis.
$ stap -l 'process("node")'
produces nothing.
$ sudo stap gc.stp -c 'node test.js'
semantic error: while resolving probe point: identifier 'process' at gc.stp:7:7
source: probe process("node").mark("gc__start")
^
semantic error: no match
semantic error: while resolving probe point: identifier 'process' at :12:7
source: probe process("node").mark("gc__done")
I have no experience at all with systemtap, but like to toy with it? What is possible with it? Can I see how much memory is consumed by code(http://stackoverflow.com/questions/13126808/whats-the-node-js-memory-breakdown)?
Update to answer comment.
$ readelf -n node
readelf: Error: 'node': No such file
$ which node
~/nvm/v0.9.4/bin/node
$ readelf -n ~/nvm/v0.9.4/bin/node
Notes at offset 0x0000021c with length 0x00000020:
Owner Data size Description
GNU 0x00000010 NT_GNU_ABI_TAG (ABI version tag)
OS: Linux, ABI: 2.6.32
Notes at offset 0x0000023c with length 0x00000024:
Owner Data size Description
GNU 0x00000014 NT_GNU_BUILD_ID (unique build ID bitstring)
Build ID: 294da933883eaeaf7e848073dc3db6bff6762fb4
$ uname -a
[alfred#alfred81-AMILO-Pi-2515 gc-stap]$ uname -a
Linux alfred81-AMILO-Pi-2515.lan 3.6.3-1.fc17.x86_64 #1 SMP Mon Oct 22 15:32:35 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
$ stap -V
Systemtap translator/driver (version 2.0/0.154, rpm 2.0-1.fc17)
Copyright (C) 2005-2012 Red Hat, Inc. and others
This is free software; see the source for copying conditions.
enabled features: AVAHI LIBRPM LIBSQLITE3 NSS TR1_UNORDERED_MAP NLS
Your copy of node appears to be compiled without sys/sdt.h markers. If they were compiled in, readelf -n would show something like ...
stapsdt 0x00000040 NT_STAPSDT (SystemTap probe descriptors)
Provider: stap
Name: stap_system__spawn
Location: 0x000000000012e1b0, Base: 0x00000000001cb886, Semaphore: 0x0000000000000000
Arguments: -4#%ebx -4#%eax
Perhaps it was configured with --without-dtrace.

How to determine the OS version for which was compiled rpm?

How can i determine the Linux version (distribution) for which was compiled rpm packet?
I believe this is what you are after.
$ rpm -q gnome-speech --queryformat '%10{NAME} %20{VENDOR} %20{RELEASE} %20{ARCH}\n'
gnome-speech Red Hat, Inc. 1.fc6 i386
$ rpm -q hwdata --queryformat '%10{NAME} %20{VENDOR} %20{RELEASE} %20{ARCH}\n'
hwdata Red Hat, Inc. 1.el5 noarch
There are lots of nifty bits you can go after with queryformat, see this guide for a reference.
General reference on rpm-philosophy-multi-architecture.
There is no such ways to determine the OS name and version from the content of the file.
Normally a RPM file name contains all these details. According to the RPM file naming convention the file name must be like :
name-version-release.architecture.rpm
Please check this link for details.
You can use rpm -q to get the OS data from the OS tag in the RPM, but you need to specify a queryformat as it is not in the normal -i output. You can use -p to refer to a specific RPM file for the testing.
$ rpm -q -p myfiletotest.rpm --queryformat '%10{NAME} %10{OS} %10{VERSION} %10{RELEASE} %10{ARCH}\n'
mypackage linux 2.2.10 1_14.el6 x86_64
The OS name is the second field in this output. The RPM does not distinguish between releases of the OS though; you will only see 'linux', 'aix', 'darwin', and so on - not 'centos-6'.

Resources