You are not logged in.

#1 2009-10-01 00:30:01

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,354

[solved] Canonical way to detect what kernels are installed?

Planning to do a PKGBUILD for the nvidia modules which would install modules for all installed kernels (would basically steal the current PKGBUILD but run it separately for every kernel and have the modules installed seperately in each /lib/modules/<kernel_name>. Mainly for personal use, as I don't think it's 'allowable' for the AUR (please correct me if I'm wrong).

Currently I already have one PKGBUILD doing this, for phc-intel, where I basically do:-

for _KERNEL in `ls /lib/modules` ; do

Is this the 'correct' way to detect all installed kernels, or should I sed on the contents of /usr/src?:-

for _KERNEL in `ls /usr/src | sed 's/linux-//'` ; do

Or is there some other FHS-compliant manner of detecting all kernels installed?

Last edited by ngoonee (2009-10-02 10:08:44)


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#2 2009-10-01 01:24:49

tavianator
Member
From: Waterloo, ON, Canada
Registered: 2007-08-21
Posts: 858
Website

Re: [solved] Canonical way to detect what kernels are installed?

I like the /lib/modules way better, but there is an issue with both methods: some kernel packages, like kernel26-git from AUR, create symlinks in /lib/modules (i.e. /lib/modules/linux-2.6.32-git -> /lib/modules/linux-2.6.32-rc2-00562-g63cadc4-dirty), so you'd hit the same directory twice.  `cd /lib/modules && find * -maxdepth 0 -type d` occurs to me off the top of my head, and seems to work.  I don't think there's any authoritative way, as anyone could hypothetically install a kernel's modules to whatever silly place they wanted, but looking in /lib/modules should be fine for your needs.

Offline

#3 2009-10-01 01:31:00

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,354

Re: [solved] Canonical way to detect what kernels are installed?

urgh, symlinks....

Why is that done, by the way? What about /usr/src?


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#4 2009-10-01 01:32:20

ataraxia
Member
From: Pittsburgh
Registered: 2007-05-06
Posts: 1,553

Re: [solved] Canonical way to detect what kernels are installed?

Why don't you look at the contents of /boot directly?

Offline

#5 2009-10-01 01:40:46

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,354

Re: [solved] Canonical way to detect what kernels are installed?

ataraxia wrote:

Why don't you look at the contents of /boot directly?

Any way to parse the .img files there to give me the actual version number of the kernel? For example, for most PKGBUILDS we need something along the lines of 2.6.30-ARCH, but in /boot it will obviously be listed as kernel26 and vmlinuz26...


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#6 2009-10-01 05:30:42

ugkbunb
Member
Registered: 2009-02-26
Posts: 227

Re: [solved] Canonical way to detect what kernels are installed?

Well not sure if this is relevant... but n my /lib/modules folder I still have 2.6.29-ARCH and 2.6.30-ARCH although the current and only kernel installed is 2.6.31-ARCH. Is it safe to remove these? And would your method attempt to install it for these older/no longer installed kernels?

Offline

#7 2009-10-01 05:36:24

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,354

Re: [solved] Canonical way to detect what kernels are installed?

ugkbunb wrote:

Well not sure if this is relevant... but n my /lib/modules folder I still have 2.6.29-ARCH and 2.6.30-ARCH although the current and only kernel installed is 2.6.31-ARCH. Is it safe to remove these? And would your method attempt to install it for these older/no longer installed kernels?

I would think that if you still have 2.6.29-ARCH and 2.6.30-ARCH they would be empty? Or only contain separately compiled modules. Could you please ls the contents, and check whether you have corresponding /usr/src folders.


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#8 2009-10-01 13:32:28

raf_kig
Member
Registered: 2008-11-28
Posts: 143

Re: [solved] Canonical way to detect what kernels are installed?

file /boot/* | grep 'Linux kernel.*boot executable' | sed 's/.*version \([^ ]\+\).*/\1/'

There you go, all kernel versions in boot.

Regards,

raf

Last edited by raf_kig (2009-10-01 13:33:02)

Offline

#9 2009-10-01 14:48:25

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,354

Re: [solved] Canonical way to detect what kernels are installed?

raf_kig wrote:
file /boot/* | grep 'Linux kernel.*boot executable' | sed 's/.*version \([^ ]\+\).*/\1/'

There you go, all kernel versions in boot.

Regards,

raf

That is just awesome. Thanks raf!


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#10 2009-10-02 09:45:08

raf_kig
Member
Registered: 2008-11-28
Posts: 143

Re: [solved] Canonical way to detect what kernels are installed?

You are welcome. :-)
Don't forget to mark the thread as solved ;-)

Regards,

raf

Offline

#11 2009-10-02 10:08:51

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,354

Re: [solved] Canonical way to detect what kernels are installed?

Solved smile.


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

Board footer

Powered by FluxBB