24 November, 2014

Intel SS4200 NAS doesn't start, because old linux images, modules and headers


Some days ago, my SS4200, running Ubuntu 1404 server from an USB pendrive did not start :-(

The investigation was painful, because I had to take out the VGA card from my desktop computer and put it to the SS4200 with all the cables for PCI-E and power, and after doing all this changes, I could see, that the machine is still not starting.

To handle the situation I have booted up a systemrescuecd from a second USB pendrive, and after some investigation it turned out, that the root disk on the original 4 Gigabyte pendrive become full :-(

Some more investigation revealed that the reason was a lot of unused linux kernel versions with all of their headers, modules and other files. To fix the problem I manually removed them:

 dpkg --get-selections linux*

to list them, and

sudo apt-get  purge *package*

to delete all not needed.

But today I have put back the VGA card to my computer and searched for a better solution, end there is a very nice script to do it in one step:

dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge
So for my future comfort I will add a small script to the cron_daily which will send an email to me each time the free disk space goes below 10%.

Source:  http://ubuntugenius.wordpress.com/2011/01/08/ubuntu-cleanup-how-to-remove-all-unused-linux-kernel-headers-images-and-modules/

No comments: