I have a bunch of different Linux Operating Systems for many different architectures and for each of them I would like to determine their Linux kernel version. I can only access the filesystem but I cannot boot the system as it is for a different architecture. Is there a particular file in Linux that contains the Kernel version that I could possibly cat or strings?
-
Can't use the uname command ? – Mali Jul 09 '19 at 14:43
-
these are not running filesystems, they are unpacked squashfs, etc. Therefore I can not natively execute commands on it, just interrogate files. – Lexicon Jul 19 '19 at 19:29
1 Answers
There's no one file you could read that would tell you this on every Linux system you might look at. Each distribution identifies itself to the world in it's own way, though there are some conventions.
If you really are only interested in the version of the kernel and you really don't have clues about which distro you're looking at, I would start by looking for kernel itself and hope the distro named it with it's version. For example, on my Linux Mint 19 system, the kernels are in /boot/:
mdiehn@frank ~ $ ls -ltr /boot/vmlinuz*
-rw-r--r-- 1 root root 7407392 Nov 24 2017 /boot/vmlinuz-4.10.0-38-generic
-rw------- 1 root root 7712560 May 30 2018 /boot/vmlinuz-4.13.0-45-generic
Another place to look is in files named /etc/*-release, if such exist. Redhat, Fedora, CentOS, SuSE, openSuSE all have a file named like that - /etc/redhat-release and /etc/centos-release.
Not all distros install the LSB packages, but those that do, like Mint, will have a file named /etc/os-release and one named /etc/lsb-release. Those have what you're looking for.
See in Linux Land, the OS is the kernel and it's toys. The distribution is what you are thinking of as "the OS" and the distros vary quite a bit.

- 879
- 4
- 8
-
This is primarily for IoT firmware, not finding either vmlinuz or *-release... – Lexicon Jul 19 '19 at 19:16