On Mon, Oct 24, 2011 at 12:46:13PM -0500, John Vestrum wrote: > On 08/10/11 12:36, Mark Panen wrote: > > Hi, > > > > I noticed my kernel has been upgraded two or three times but i am still > > sitting on the original: > > > > "uname -r > > 2.6.32-5-amd64" > > > > Sorry for the belated reply, but having recently switched from another distro > this bothered me as well. The typical advice to use dpkg/apt-query/aptitude > only tells half the story - those tools only know which kernel is installed, > not what is running. I finally found what I was looking for in /proc/version. > > $ cat /proc/version > Linux version 2.6.32-5-amd64 (Debian 2.6.32-38) (b...@decadent.org.uk) (gcc > version 4.3.5 (Debian 4.3.5-4) ) #1 SMP Mon Oct 3 03:59:20 UTC 2011 > > > Based on that I wrote a shell script to tell me if a machine needs a reboot, > the heart of which is: > > RUNNINGKERNEL=`awk '{print $5}' /proc/version | tr -d ')'` > INSTALLEDKERNEL=`dpkg-query --show --showformat='${Version}\n' linux-base` > if [ "$INSTALLEDKERNEL" != "$RUNNINGKERNEL" ]; then > echo "Running kernel (version $RUNNINGKERNEL) not the same as latest > installed kernel (version $INSTALLEDKERNEL)." > fi > > At least this works on amd64 Squeeze.
I'm not sure when the functionality was added (disclaimer: I run Sid, but have had this for quite a while now), but there is now a distribution-lead way of telling the user when a reboot is required. When a package such as linux-base is updated, the postinstall script touches /var/run/reboot-required and appends its name (i.e. 'linux-base') to /var/run/reboot-required.pkgs. So, if you have a package such as update-notifier (or even Byobu if you work headless), these will watch for the presense of /var/run/reboot-required and let you know that you should reboot soon. You might want to see if /var/run/reboot-required exists on your system as this should be a more robust measure of whether you need to reboot than simply an out of date kernel (For example, I see that DBus also wants me to reboot). -- Darac Marjal
signature.asc
Description: Digital signature