1

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

2
  • The key is No space left on device. make some space somewhere else and try again. Jul 20, 2017 at 8:26
  • indeed /dev/xvda1 240M 240M 0 100% /boot is completely full. If I go to /boot. I can see: all this: abi-4.4.0-62-generic abi-4.4.0-79-generic config-4.4.0-75-generic initrd.img-4.4.0-70-generic System.map-4.4.0-66-generic vmlinuz-4.4.0-62-generic vmlinuz-4.4.0-79-generic abi-4.4.0-64-generic abi-4.4.0-81-generic config-4.4.0-78-generic initrd.img-4.4.0-71-generic System.map-4.4.0-70-generic vmlinuz-4.4.0-64-generic vmlinuz-4.4.0-81-generic[.......] But is it safe to delete directly from the boot like "rm abi-4.4.0-62-generic" ?
    – Gideons
    Jul 20, 2017 at 8:43

1 Answer 1

1

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 and apt-get -f install to fix the broken dependencies.

3
  • Exactly. So what else can I remove from /boot than old kernels? As I have written, I cannot remove the old kernels ("apt-get autoremove -f" or "apt-get remove linux-image-4.4.0-62-generic") ?
    – Gideons
    Jul 20, 2017 at 9:00
  • @Gideons: You can remove all files ending with -version like initrd.img-, abi-, config-, vmlinuz-, etc. This should provide enough free space.
    – Khaled
    Jul 20, 2017 at 9:24
  • Great. The issue was that the boot was so full, that the files had to be removed manually. So I removed all these (except the current version) and now it's possible to do things again... Thank you
    – Gideons
    Jul 20, 2017 at 9:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .