Updates:

Similar topics mod installed, currently shown at the end of a topic

Boot partition full (Solved)

Started by Rich J, April 04, 2015, 12:05:02 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Rich J

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

SeZo

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


Mark Greaves (PCNetSpec)

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
WARNING: You are logged into reality as 'root'
logging in as 'insane' is the only safe option.
pcnetspec.co.uk

Rich J

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

[email protected]:~$ 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

[email protected]:~$ 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
[email protected]:~$


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





SeZo

QuoteIf 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.


Mark Greaves (PCNetSpec)

Now what's the output from:
dpkg -l | grep 3.13.0 | awk -F' ' '{ print $1 "  --  "$2 "  --  " $3 }'
WARNING: You are logged into reality as 'root'
logging in as 'insane' is the only safe option.
pcnetspec.co.uk

Rich J

Quote from: Mark Greaves (PCNetSpec) on April 06, 2015, 06:51:22 PM
Now what's the output from:
dpkg -l | grep 3.13.0 | awk -F' ' '{ print $1 "  --  "$2 "  --  " $3 }'

As requested

[email protected]:~$ 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
[email protected]:~$


Like I said - it's a long list!   :D

chemicalfan

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  :P

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

Mark Greaves (PCNetSpec)

#8
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
WARNING: You are logged into reality as 'root'
logging in as 'insane' is the only safe option.
pcnetspec.co.uk


Rich J

Quote from: chemicalfan on April 07, 2015, 12:13:10 PM
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  :P

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

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.  ;)

Rich

Rich J

Hi Mark - thanks for that, it seems to have done the trick!   ;)  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

Mark Greaves (PCNetSpec)

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 :)
WARNING: You are logged into reality as 'root'
logging in as 'insane' is the only safe option.
pcnetspec.co.uk

Rich J

All done and dusted!

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

Rich