Boot partition full (Solved)

Hi all - happy Easter!

My lappy has Zorin 9 installed and will no longer accept updates, stating there is no room on the /boot partition. Checking Grub menu shows 15 entries!

I want to remove all kernels bar the latest kernel + the one before it (for insurance!) I’ve researched the net and there are many (confusing) recommendations of how to achieve this. How may I safely do the necessary and would it be advisable to expand the size of the boot partition for the future, though I did manually set the partition sizes before installation as per instructions from this site? Or is there a method to automatically purge Grub of redundant kernels when the list gets to a particular length?

Thanks as ever for advice!

Rich

This is how I do it but your mileage might vary. Use it at your risk.
Find out the kernel version that you’re currently running:

uname -r

Next list what kernels are installed:

ls /boot | grep vmlinuz | cut -d'-' -f2,3

Find out which packages are installed relative to the kernel you want to remove (substitute 3.16.0-4 with your kernel):

dpkg -l | grep ^ii | grep 3.16.0-4 | awk -F' ' '{ print $2 }'

Now that you know what packages to remove you can remove them individually or in group with apt-get (substitute linux-image-3.16.0-4-amd64 etc…):

sudo apt-get remove linux-image-3.16.0-4-amd64

Do this for every kernel you want to remove (leaving the latest two in place)
This should trigger grub update but if not then run:

sudo update-grub

if you’re still unsure what to remove, start by letting us know what your current kernel is by posting the output from:

uname -a

Hi both - and thanks for the replies

@ SeZo

The kernels listed go from 3.13.0-45 (current) then -44/-43/-40/-39/-37/-36/-35/-34

As an example - 3.13.0-34 entries are as follows

richard@richard-Latitude-D520:~$ dpkg -l | grep ^ii | grep 3.13.0-34 | awk -F’ ’ ‘{ print $2 }’
linux-headers-3.13.0-34
linux-headers-3.13.0-34-generic
linux-image-3.13.0-34-generic
linux-image-extra-3.13.0-34-generic

This is repeated exactly the same way for all other numbered versions.

I want to remove all versions except 3.13.0-45 and -44 to make room for the latest updates which (I believe) are 3.16.*****.

If I remove them, is there a risk that v45/44 might be compromised by packages being deleted that they require?

@ Mark

As requested

richard@richard-Latitude-D520:~$ uname -a
Linux richard-Latitude-D520 3.13.0-45-generic #74-Ubuntu SMP Tue Jan 13 19:37:48 UTC 2015 i686 i686 i686 GNU/Linux
richard@richard-Latitude-D520:~$

Is this a feature of Linux distros in general, that they keep all previously installed kernels? I haven’t had this problem on my main computer (running Mint 17) and I pre-set the partition sizes on there in much the same way as I did on this lappy?

thanks

Rich

If I remove them, is there a risk that v45/44 might be compromised by packages being deleted that they require?

Try removing the oldest (3.13.0-34) kernel, then reboot and see if anything is affected.
I very much doubt any will be as packages do not directly link to the kernel minor versions.

You could try to free up some space by running:

sudo apt-get clean

That should remove all packages from the package cache.

Now what’s the output from:

dpkg -l | grep 3.13.0 | awk -F' ' '{ print $1 "  --  "$2 "  --  " $3 }'

As requested

richard@richard-Latitude-D520:~$ dpkg -l | grep 3.13.0 | awk -F’ ’ ‘{ print $1 " – "$2 " – " $3 }’
ii – linux-headers-3.13.0-34 – 3.13.0-34.60
ii – linux-headers-3.13.0-34-generic – 3.13.0-34.60
ii – linux-headers-3.13.0-35 – 3.13.0-35.62
ii – linux-headers-3.13.0-35-generic – 3.13.0-35.62
ii – linux-headers-3.13.0-36 – 3.13.0-36.63
ii – linux-headers-3.13.0-36-generic – 3.13.0-36.63
ii – linux-headers-3.13.0-37 – 3.13.0-37.64
ii – linux-headers-3.13.0-37-generic – 3.13.0-37.64
ii – linux-headers-3.13.0-39 – 3.13.0-39.66
ii – linux-headers-3.13.0-39-generic – 3.13.0-39.66
ii – linux-headers-3.13.0-40 – 3.13.0-40.69
ii – linux-headers-3.13.0-40-generic – 3.13.0-40.69
ii – linux-headers-3.13.0-43 – 3.13.0-43.72
ii – linux-headers-3.13.0-43-generic – 3.13.0-43.72
ii – linux-headers-3.13.0-44 – 3.13.0-44.73
ii – linux-headers-3.13.0-44-generic – 3.13.0-44.73
ii – linux-headers-3.13.0-45 – 3.13.0-45.74
ii – linux-headers-3.13.0-45-generic – 3.13.0-45.74
ii – linux-headers-generic – 3.13.0.45.52
rc – linux-image-3.13.0-30-generic – 3.13.0-30.55
ii – linux-image-3.13.0-34-generic – 3.13.0-34.60
ii – linux-image-3.13.0-35-generic – 3.13.0-35.62
ii – linux-image-3.13.0-36-generic – 3.13.0-36.63
ii – linux-image-3.13.0-37-generic – 3.13.0-37.64
ii – linux-image-3.13.0-39-generic – 3.13.0-39.66
ii – linux-image-3.13.0-40-generic – 3.13.0-40.69
ii – linux-image-3.13.0-43-generic – 3.13.0-43.72
ii – linux-image-3.13.0-44-generic – 3.13.0-44.73
ii – linux-image-3.13.0-45-generic – 3.13.0-45.74
rc – linux-image-extra-3.13.0-30-generic – 3.13.0-30.55
ii – linux-image-extra-3.13.0-34-generic – 3.13.0-34.60
ii – linux-image-extra-3.13.0-35-generic – 3.13.0-35.62
ii – linux-image-extra-3.13.0-36-generic – 3.13.0-36.63
ii – linux-image-extra-3.13.0-37-generic – 3.13.0-37.64
ii – linux-image-extra-3.13.0-39-generic – 3.13.0-39.66
ii – linux-image-extra-3.13.0-40-generic – 3.13.0-40.69
ii – linux-image-extra-3.13.0-43-generic – 3.13.0-43.72
ii – linux-image-extra-3.13.0-44-generic – 3.13.0-44.73
ii – linux-image-extra-3.13.0-45-generic – 3.13.0-45.74
ii – linux-image-generic – 3.13.0.45.52
ii – linux-libc-dev:i386 – 3.13.0-45.74
richard@richard-Latitude-D520:~$

Like I said - it’s a long list! :smiley:

I’ve always manually deleted them from /boot (also, the corresponding initrd & config files), then ran an update-grub. It’s not the right way to do it, but it’s easier and it’s my system :stuck_out_tongue:

FYI - Mint doesn’t install any kernel updates at all by default now. In order to install kernel updates, you need to open the “Kernel updates” part in mintupdate (I think it’s in the View menu). It’s done in the name of stability (to avoid regressions), although it does leave one vulnerable to security issues if a patch is written, as it won’t be installed. Can’t say I agree with their philosophy, so I always keep an eye on it. You can also remove kernels using the same GUI

OK, run

sudo apt-get remove --purge linux-headers-3.13.0-34 linux-headers-3.13.0-34-generic linux-headers-3.13.0-35 linux-headers-3.13.0-35-generic linux-headers-3.13.0-36 linux-headers-3.13.0-36-generic linux-headers-3.13.0-37 linux-headers-3.13.0-37-generic linux-headers-3.13.0-39 linux-headers-3.13.0-39-generic linux-headers-3.13.0-40 linux-headers-3.13.0-40-generic linux-headers-3.13.0-43 linux-headers-3.13.0-43-generic linux-image-3.13.0-30-generic linux-image-3.13.0-34-generic linux-image-3.13.0-35-generic linux-image-3.13.0-36-generic linux-image-3.13.0-37-generic linux-image-3.13.0-39-generic linux-image-3.13.0-40-generic linux-image-3.13.0-43-generic linux-image-extra-3.13.0-30-generic linux-image-extra-3.13.0-34-generic linux-image-extra-3.13.0-35-generic linux-image-extra-3.13.0-36-generic linux-image-extra-3.13.0-37-generic linux-image-extra-3.13.0-39-generic linux-image-extra-3.13.0-40-generic linux-image-extra-3.13.0-43-generic

That’ll clear out all kernels (and support packages) for everything except 3.13.0-44 and 3.13.0-45

Hi chemicalfan and thanks for the heads up! I’ll do as you advise with Mint asap and report back if there’s any issues. :wink:

Rich

Hi Mark - thanks for that, it seems to have done the trick! :wink: The lappy booted fine into v45 and there’s only that and v44 listed.

Now, to update to the latest kernel - which is the best way? Via the updater or via apt? Or is it the same thing?

Regards

Rich

either way doesn’t matter

Personally I do:

sudo apt-get update

then

sudo apt-get upgrade

the

sudo apt-get dist-upgrade

If this solves the issue, can you remember to mark the topic (SOLVED) … TIA :slight_smile:

All done and dusted!

Thanks Mark, Sezo and chemicalfan - there’s a pint each of your favourite tipple waiting on the bar for you! :slight_smile:

Rich