I have a challenge to clean the boot drive that is 100% full.
I list previous versions:
dpkg -l linux-image*
And will get list of 12 versions,
rc linux-image-4.4.0-45-generic 4.4.0-45.66 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-47-generic 4.4.0-47.68 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
here the tail:
[…]
ii linux-image-4.4.0-78-generic 4.4.0-78.99 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
iF linux-image-4.4.0-79-generic 4.4.0-79.100 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
iF linux-image-4.4.0-81-generic 4.4.0-81.104 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
in linux-image-4.4.0-83-generic <none> amd64 (no description available)
iU linux-image-virtual 4.4.0.83.89 amd64 This package will always depend on the latest minimal generic kerne
Ok, so I want to delete the old versions and keep the latest one.
I am currently on:
uname -r
4.4.0-78-generic
So I want to delete the old versions:
apt-get autoremove -f
The following NEW packages will be installed:
linux-image-4.4.0-83-generic
0 upgraded, 1 newly installed, 0 to remove and 48 not upgraded.
10 not fully installed or removed.
[...]
Unpacking linux-image-4.4.0-83-generic (4.4.0-83.106) ...
dpkg: error processing archive /var/cache/apt/archives/linux-image-4.4.0-83-generic_4.4.0-83.106_amd64.deb (--unpack):
cannot copy extracted data for './boot/vmlinuz-4.4.0-83-generic' to '/boot/vmlinuz-4.4.0-83-generic.dpkg-new': failed to write (No space left on device)
No apport report written because the error message indicates a disk full error
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.4.0-83-generic /boot/vmlinuz-4.4.0-83-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.4.0-83-generic /boot/vmlinuz-4.4.0-83-generic
Errors were encountered while processing:
/var/cache/apt/archives/linux-image-4.4.0-83-generic_4.4.0-83.106_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
So that didn't work out – for some reason it says: 0 to remove.
I try manually
apt-get remove linux-image- (tab)
and get these options
linux-image-4.4.0-62-generic linux-image-4.4.0-70-generic linux-image-4.4.0-75-generic
linux-image-4.4.0-64-generic linux-image-4.4.0-71-generic linux-image-4.4.0-78-generic
linux-image-4.4.0-66-generic linux-image-4.4.0-72-generic linux-image-virtual
So all of them do not appear there.
I try to remove one of them
apt-get remove linux-image-4.4.0-62-generic
Result:
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
linux-image-virtual : Depends: linux-image-4.4.0-83-generic but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
??? I want to delete those and what it suggests here is to use install instead? Which I cannot do that as the boot drive is 100% full…
Best Answer
You need to free up some disk space under
/boot
partition. You can remove the files related to specific Linux kernel image that you want to uninstall. You just need to make sure you don't remove the default Linux image to be booted during system startup (usually the lastest version should be kept).Then, you can try to
apt-get remove linux-image-version
andapt-get -f install
to fix the broken dependencies.