LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Determine active kernel package version on machine with multiple versions (https://www.linuxquestions.org/questions/linux-newbie-8/determine-active-kernel-package-version-on-machine-with-multiple-versions-4175599814/)

userAC 02-15-2017 08:07 AM

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?

Thank you in advance.

pandanuma 02-15-2017 03:55 PM

a quick search of the interweb [mint find which kernel] lead me to hear...

https://www.linux.com/learn/how-find...why-it-matters
scroll down and see if dpkg -l k* might help

this link also has some answers for you...
http://unix.stackexchange.com/questi...ackages/345207

the 'similar threads' at the bottom of your thread might be good to check out also...

goumba 02-15-2017 04:24 PM

Quote:

Originally Posted by userAC (Post 5670907)
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.

syg00 02-15-2017 04:43 PM

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.

userAC 02-16-2017 12:37 AM

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?

hydrurga 02-16-2017 05:05 AM

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:

https://access.redhat.com/documentat...he_Kernel.html

https://access.redhat.com/solutions/20366

frieza 02-16-2017 07:38 AM

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?

goumba 02-17-2017 11:03 AM

Quote:

Originally Posted by frieza (Post 5671480)
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)


Habitual 02-17-2017 02:51 PM

http://www.tecmint.com/useful-basic-...ge-management/
http://www.binarytides.com/apt-get-t...u-commandline/

Enjoy the goodness.

coltree 02-18-2017 05:12 PM

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

userAC 02-20-2017 12:49 AM

Quote:

Originally Posted by goumba (Post 5672115)
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.

userAC 02-20-2017 12:54 AM

Quote:

Originally Posted by goumba (Post 5671133)
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.

was referring to red hat distribution..

coltree 02-20-2017 02:28 AM

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

pan64 02-20-2017 02:53 AM

yes, see post #7, uname should work. also see man uname about usage

cesarbergara 03-01-2017 08:05 AM

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

Rickkkk 03-01-2017 09:26 AM

Quote:

Originally Posted by pan64 (Post 5673373)
yes, see post #7, uname should work. also see man uname about usage

+1 +1 +1 ... Yup. uname -a will give you running kernel info and your package manager will undoubtedly have a query command permitting you to find installed packages. As mentioned - kernel headers and docs aren't actually "running" - the kernel is. And yes, you may have several kernels installed and available to boot on your system - to be chosen at boot time.

Cheers :-)

chrism01 03-03-2017 05:57 AM

I would look at it this way (on a RHEL/Centos/... distro):

Code:

# running kernel : also usually matches the 1st entry in /boot/grub/grub.conf
uname -a

# Other installed & avail kernels : see also other entries in /boot/grub/grub.conf
rpm -qa| grep -i kernel

NB: I don't have v7, so the above may not be true for v7.

HTH


All times are GMT -5. The time now is 12:57 PM.