FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 04-12-2012, 03:59 PM
Bernhard Schmidt
 
Default Checking for kernel freshness

Hi,

the company I work for has a script on SLES/SuSE, that checks the
following three kernel versions

- latest version available in the repository
- version installed in /boot and thus likely to be loaded on next boot
- version running

and warns (and/or fixes) if there is a mismatch. I've been trying to
think of a way to do the same, but failed so far.

Latest version available in the repository is easy enough, just check
for the version the metapackage depends on (or, even easier, check for
updates of the kernel package).

Checking for the version in /boot is semi-easy (check the package
version installed and hope the user did not fiddle with grub), too.

The hard part seems to be matching the running kernel against the
version installed. I cannot figure out a good way so far. Nothing in the
running kernel seems to show the Debian version (i.e.
2.6.32-41squeeze2), thus I cannot compare it. It is printed in the
bootup messages

[ 0.000000] Linux version 2.6.32-5-amd64 (Debian 2.6.32-39squeeze1)
(dannf@debian.org) (gcc version 4.3.5 (Debian 4.3.5-4) ) #1 SMP Mon Jan
9 20:49:59 UTC 2012

but that might be long gone when I check. I could not find this version
string in /proc or /sys yet.

Any idea how to solve that?

Bernhard


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: jm6u5o$rmm$1@dough.gmane.org">http://lists.debian.org/jm6u5o$rmm$1@dough.gmane.org
 
Old 04-12-2012, 04:13 PM
Bob Proulx
 
Default Checking for kernel freshness

Bernhard Schmidt wrote:
> The hard part seems to be matching the running kernel against the
> version installed. I cannot figure out a good way so far. Nothing in the
> running kernel seems to show the Debian version (i.e.
> 2.6.32-41squeeze2), thus I cannot compare it. It is printed in the
> bootup messages

Try this:

$ cat /proc/version
Linux version 2.6.32-5-686 (Debian 2.6.32-41squeeze2) (dannf@debian.org) (gcc version 4.3.5 (Debian 4.3.5-4) ) #1 SMP Mon Mar 26 05:20:33 UTC 2012

$ perl -lne '$_ =~ m/Linux version (S+-S+)/ && print "linux-image-", $1;' /proc/version
linux-image-2.6.32-5-686

$ dpkg --status linux-image-2.6.32-5-686 | awk '/^Version:/{print$2}'
2.6.32-41squeeze2

Bob
 
Old 04-12-2012, 04:14 PM
Sven Joachim
 
Default Checking for kernel freshness

On 2012-04-12 17:59 +0200, Bernhard Schmidt wrote:

> The hard part seems to be matching the running kernel against the
> version installed. I cannot figure out a good way so far. Nothing in the
> running kernel seems to show the Debian version (i.e.
> 2.6.32-41squeeze2), thus I cannot compare it. It is printed in the
> bootup messages
>
> [ 0.000000] Linux version 2.6.32-5-amd64 (Debian 2.6.32-39squeeze1)
> (dannf@debian.org) (gcc version 4.3.5 (Debian 4.3.5-4) ) #1 SMP Mon Jan
> 9 20:49:59 UTC 2012
>
> but that might be long gone when I check. I could not find this version
> string in /proc or /sys yet.

It's in /proc/version.

Cheers,
Sven


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 87mx6hvsen.fsf@turtle.gmx.de">http://lists.debian.org/87mx6hvsen.fsf@turtle.gmx.de
 
Old 04-12-2012, 04:21 PM
Bernhard Schmidt
 
Default Checking for kernel freshness

Bob Proulx <bob@proulx.com> wrote:

>> The hard part seems to be matching the running kernel against the
>> version installed. I cannot figure out a good way so far. Nothing in the
>> running kernel seems to show the Debian version (i.e.
>> 2.6.32-41squeeze2), thus I cannot compare it. It is printed in the
>> bootup messages
>
> Try this:
>
> $ cat /proc/version
> Linux version 2.6.32-5-686 (Debian 2.6.32-41squeeze2) (dannf@debian.org) (gcc version 4.3.5 (Debian 4.3.5-4) ) #1 SMP Mon Mar 26 05:20:33 UTC 2012

God damnit. I was looking in /proc/sys/kernel and /sys/kernel, but not
in /proc/version. Thanks! :-(

Bernhard


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: jm6vdr$72t$1@dough.gmane.org">http://lists.debian.org/jm6vdr$72t$1@dough.gmane.org
 

Thread Tools




All times are GMT. The time now is 07:46 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org