Determine active kernel package version on machine with multiple versions
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Determine active kernel package version on machine with multiple versions
I have been doing some research and as far as I know, it's possible to have multiple versions of kernel and other kernel packages and to know the version of the active running kernel, the uname command can be used. But how about the other kernel packages like kernel-devel? I have listed some of my questions below.
1. When the kernel is installed or updated, does the other kernel packages like kernel-devel or kernel-headers also installed or updated with the same version like the kernel?
2. If multiple versions of kernel packages exists like the kernel-devel, does it latest version automatically becomes the active? If not, is there a way to know what version is active or running?
I have been doing some research and as far as I know, it's possible to have multiple versions of kernel and other kernel packages and to know the version of the active running kernel, the uname command can be used. But how about the other kernel packages like kernel-devel? I have listed some of my questions below.
1. When the kernel is installed or updated, does the other kernel packages like kernel-devel or kernel-headers also installed or updated with the same version like the kernel?
2. If multiple versions of kernel packages exists like the kernel-devel, does it latest version automatically becomes the active? If not, is there a way to know what version is active or running?
Thank you in advance.
You give no information, so an answer here is not possible. Different distributions do things differently. What distribution are you running?
In Debian, the appropriate devel packages may or may not be updated, depending on how you installed the kernel in the first place.
Emphasises why it isn't a great idea to post in several places - whether here or elsewhere.
Conflicting - not necessarily wrong - answers are likely to continue the confusion.
my apologies for not giving enough information and for posting in two different places. I'm just trying to find answers from people who are much more experienced in linux than I am. By the way, I'm referring to red hat enterprise linux. I have also looked at the 'similar threads' below, however I didn't find the answer I am looking for..and just one last question, is there a way to see or to know what is the running version of the other kernel packages like kernel-devel? I know uname shows the running version of the kernel and rpm -qa able to list it, but is there a command that shows the running version of the other kernel packages?
I don't know much about these things, but as far as I am aware, the other packages such as kernel-headers and kernel-devel are not "running" as such on your machine. You may have various versions of these installed, and if you carry out an action such as compiling kernel modules, the packages that match the current running kernel are brought into play i.e. used (unless of course you specify otherwise).
It very much depends on the system, and technique used on that system, whether or not the headers etc. are installed when you install and/or use a new kernel. For Red Hat, searching on the web for "Red Hat upgrading kernel" produces, for example, the following links:
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,233
Rep:
not to sound silly but doesn't running 'uname' find the version of the running kernel which can then be compared against the package manager to see if the headers are installed properly?
not to sound silly but doesn't running 'uname' find the version of the running kernel which can then be compared against the package manager to see if the headers are installed properly?
Exactly how I'd do it, but as we have no info on the distribution, etc, there's no way to give the OP a direct answer.
On debian, for example,
Code:
anthony**~**dpkg -l "linux-*-$(uname -r)"
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==============-============-============-=================================
ii linux-headers- 4.9.6-3 amd64 Header files for Linux 4.9.0-1-am
ii linux-image-4. 4.9.6-3 amd64 Linux 4.9 for 64-bit PCs (signed)
1. If you have compiled modules separately from the source tree
you will need to recompile each module against the new kernel version,
and place the special module(s) in /lib/modules/(new-kernel-version)/kernel/drivers/.../driver.ko
I usually have source trees in /usr/src with a symlink to the currently used source tree
e.g.
old source tree/usr/src/4.1.40
/usr/src/linux -> 4.1.40
new source tree /usr/src/4.1.42
ln -sfnv /usr/src/4.1.42 /usr/src/linux
/usr/src/linux -> 4.1.42
headers are in the source tree and devel looks at /usr/src/linux (not 4.1.42)
2. In the good old days of lilo boot loader,
you would add a new bootable image and label to choose from,
and select from the lilo boot menu
and once you are happy your new kernel works, make it default.
You can do a similar thing with grub.
and you know about uname -a and /proc/version, etc
I'm actually really lazy and do much of this fiddly file stuff in mc (midnight commander)
(any new system)
apt-get update
apt-get install mc
apt-get upgrade
Last edited by coltree; 02-18-2017 at 06:05 PM.
Reason: bit more detail
Exactly how I'd do it, but as we have no info on the distribution, etc, there's no way to give the OP a direct answer.
On debian, for example,
Code:
anthony**~**dpkg -l "linux-*-$(uname -r)"
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==============-============-============-=================================
ii linux-headers- 4.9.6-3 amd64 Header files for Linux 4.9.0-1-am
ii linux-image-4. 4.9.6-3 amd64 Linux 4.9 for 64-bit PCs (signed)
my apologies, was referring to red hat distribution. is this also appilcable to red hat distro? thank you in advance.
referring to Redhat....
a little while since looking at RH. but things are basically in the same places.
my last bit of apt-getting was separate to your 2 questions, mc is a useful utility for looking around and making changes
another place to look is /lib/modules/version (e.g. 4.1.42)
inside you'll find two simlinks build and source which tie the particular kernel modules back to the relevant source/headers tree
you'll find the modules (drivers, etc) in /lib/modules/version/kernel/........
in /boot you'll see the compiled kernels, e.g. vmlinuz-generic-4.1.42
and the config file which says what was compiled in each kernel/modules version
not sure about RH, might also be an initrd file in /boot which is the first file loaded when booting
your boot program, lilo or grub, etc can select from multiple kernels available in /boot
Hi. Kernel, modules and sources is a good idea to install manually and no use dpkg, apt-get, rpm or other soft. You can download source tarball and extract it under /usr/src . Then you can compile it or patch it and install new kernel and modules (it is easy job). When you use 'uname -a ' OS give to you name and version of running kernel, then you can look under '/lib/modules' for modules version, and under '/usr/src' for sources.
It is a simple way to use and to control kernel and compiled kernels (better than install with package tools, which only can install/work only one version).
If you wish to compile a software and need to use kernel sources, you can put in the software './configures' options the kernel source directory.
Have a nice day
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.