http://askubuntu.com/questions/585736/cant-clean-a-full-boot-because-of-unmet-dependencies
root@LXAPP01:~# df -h
Bestandssysteem Grootte Gebruikt Besch Geb% Aangekoppeld op
/dev/sda1 236M 232M 0 100% /boot
root@LXAPP01:~# kernelver=$(uname -r | sed -r 's/-[a-z]+//')
root@LXAPP01:~# dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve $kernelver
linux-headers-3.13.0-51
linux-headers-3.13.0-51-generic
linux-headers-3.13.0-63
linux-headers-3.13.0-63-generic
linux-headers-3.13.0-65
linux-headers-3.13.0-65-generic
linux-headers-3.13.0-66
linux-headers-3.13.0-66-generic
linux-headers-3.13.0-67
linux-headers-3.13.0-67-generic
linux-headers-3.13.0-68
linux-headers-3.13.0-68-generic
linux-headers-3.13.0-70
linux-headers-3.13.0-70-generic
linux-headers-3.13.0-73
linux-headers-3.13.0-73-generic
linux-image-3.13.0-63-generic
linux-image-3.13.0-65-generic
linux-image-3.13.0-66-generic
linux-image-3.13.0-67-generic
linux-image-3.13.0-68-generic
linux-image-3.13.0-70-generic
root@LXAPP01:~# uname -r
3.13.0-71-generic
Remove all unecessary kernel headers and images
root@LXAPP01:~# sudo dpkg --force-all -P linux-headers-3.13.0-51
root@LXAPP01:~# sudo dpkg --force-all -P linux-headers-3.13.0-51-generic
root@LXAPP01:~# sudo dpkg --force-all -P linux-headers-3.13.0-63
root@LXAPP01:~# sudo dpkg --force-all -P linux-image-3.13.0-63-generic
.........etc
root@LXAPP01:~# dpkg -l | grep linux-image
rc linux-image-3.13.0-34-generic 3.13.0-34.60 amd64 Linux kernel image for version 3.13.0 on 64 bit x86 SMP
rc linux-image-3.13.0-35-generic 3.13.0-35.62 amd64 Linux kernel image for version 3.13.0 on 64 bit x86 SMP
rc linux-image-3.13.0-36-generic 3.13.0-36.63 amd64 Linux kernel image for version 3.13.0 on 64 bit x86 SMP
rc linux-image-3.13.0-37-generic 3.13.0-37.64 amd64 Linux kernel image for version 3.13.0 on 64 bit x86 SMP
rc linux-image-3.13.0-39-generic 3.13.0-39.66 amd64 Linux kernel image for version 3.13.0 on 64 bit x86 SMP
root@LXAPP01:~# sudo apt-get purge linux-image-3.13.0-34-generic
root@LXAPP01:~# sudo apt-get purge linux-image-3.13.0-35-generic
.......etc
root@LXAPP01:~# cd /var/cache/apt/archives
root@LXAPP01:~# sudo rm linux-headers-*
root@LXAPP01:~# apt-get install -f
Finally, issue the "cleanup old kernels" command
sudo apt-get purge $(dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve "$(uname -r | sed -r 's/-[a-z]+//')")
Above command will remove ALL the kernels except the one that is currently loaded.
No Comments