0

My problem:

I got this message when trying to install updates:

The upgrade needs a total of 176 M free space on disk '/boot'. Please free at least an additional 176 M of disk space on '/boot'. Empty your trash and remove temporary packages of former installations using 'sudo apt-get clean'.

About my System:

The result of cat /etc/fstab looke like this:

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
/dev/mapper/ubuntu--vg-root /               ext4    errors=remount-ro 0       1
# /boot was on /dev/nvme0n1p2 during installation
UUID=30d084a8-283a-4450-b101-c1c60819364a /boot           ext2    defaults        0       2
# /boot/efi was on /dev/nvme0n1p1 during installation
UUID=B6F8-3AD2  /boot/efi       vfat    umask=0077      0       1
/dev/mapper/ubuntu--vg-swap_1 none            swap    sw              0       0

The result of df -h looks like this:

Filesystem                   Size  Used Avail Use% Mounted on
udev                          12G     0   12G   0% /dev
tmpfs                        2,4G  9,8M  2,4G   1% /run
/dev/mapper/ubuntu--vg-root  894G   95G  754G  12% /
tmpfs                         12G  439M   12G   4% /dev/shm
tmpfs                        5,0M  4,0K  5,0M   1% /run/lock
tmpfs                         12G     0   12G   0% /sys/fs/cgroup
/dev/nvme0n1p2               473M  465M     0 100% /boot
/dev/nvme0n1p1               511M  3,4M  508M   1% /boot/efi
cgmfs                        100K     0  100K   0% /run/cgmanager/fs
tmpfs                        2,4G   88K  2,4G   1% /run/user/1000

Result of uname -a looks like this:

Linux ##### 4.8.0-58-generic #63~16.04.1-Ubuntu SMP Mon Jun 26 18:08:51 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

Result of dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' looks like this:

linux-headers-4.10.0-27
linux-headers-4.10.0-27-generic
linux-headers-4.4.0-78
linux-headers-4.4.0-78-generic-tuxonice
linux-headers-4.4.0-83
linux-headers-4.4.0-83-generic-tuxonice
linux-headers-4.8.0-36
linux-headers-4.8.0-36-generic
linux-headers-4.8.0-53
linux-headers-4.8.0-53-generic
linux-headers-4.8.0-54
linux-headers-4.8.0-54-generic
linux-headers-4.8.0-56
linux-headers-4.8.0-56-generic
linux-image-4.4.0-78-generic-tuxonice
linux-image-4.4.0-83-generic-tuxonice
linux-image-4.8.0-36-generic
linux-image-4.8.0-53-generic
linux-image-4.8.0-54-generic
linux-image-4.8.0-56-generic
linux-image-extra-4.4.0-78-generic-tuxonice
linux-image-extra-4.8.0-36-generic
linux-image-extra-4.8.0-53-generic
linux-image-extra-4.8.0-54-generic
linux-image-extra-4.8.0-56-generic
linux-libc-dev:amd64
linux-signed-image-4.8.0-53-generic
linux-signed-image-4.8.0-54-generic
linux-signed-image-4.8.0-56-generic

What I tried:

From posts like these, e.g.: How do I free up more space in /boot?

I assume, I can remove the following images:

linux-image-4.8.0-36-generic
linux-image-4.8.0-53-generic
linux-image-4.8.0-54-generic

with this command: sudo apt-get purge linux-image-4.8.0-{36,53,54}-generic

I now got the following questions:

  1. The result of sudo apt-get purge linux-image-4.8.0-{36,53,54}-generic was this:
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-extra-4.10.0-28-generic : Depends: linux-image-4.10.0-28-generic but it is not going to be installed
 linux-image-extra-4.8.0-36-generic : Depends: linux-image-4.8.0-36-generic but it is not going to be installed
 linux-image-extra-4.8.0-53-generic : Depends: linux-image-4.8.0-53-generic but it is not going to be installed
 linux-image-extra-4.8.0-54-generic : Depends: linux-image-4.8.0-54-generic but it is not going to be installed
 linux-image-generic-hwe-16.04 : Depends: linux-image-4.10.0-28-generic but it is not going to be installed
 linux-signed-image-4.10.0-28-generic : Depends: linux-image-4.10.0-28-generic (= 4.10.0-28.32~16.04.2) but it is not going to be installed
 linux-signed-image-4.8.0-53-generic : Depends: linux-image-4.8.0-53-generic (= 4.8.0-53.56~16.04.1) but it is not going to be installed
 linux-signed-image-4.8.0-54-generic : Depends: linux-image-4.8.0-54-generic (= 4.8.0-54.57~16.04.1) but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

Why do I have to install something when I want to delete images? And how do I delete the images. As it looks like the images are still there after I typed in the command dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d'

  1. Do I also have to delete the files with linux-headers-* and linux-signed-image-*? For example if I delete linux-image-4.8.0-36-generic, then I probably don't need
linux-headers-4.8.0-36
linux-headers-4.8.0-36-generic
linux-image-extra-4.8.0-36-generic
  1. Shouldn't Ubuntu handle the deletion of not needed kernels automatically or what is the reason I have to do it manually? I used ubuntu on a different machine before for a few years and never had to do this. Now I got a new machine and suddenly after a few months I'm facing with this issue.

    I have to encrypt my hard drive. Could this be the reason?

UPDATE:

I ran these commands:

  • sudo apt-get -f install
  • sudo apt-get clean
  • sudo apt autoremove -f

but all resulted in the this error:

Unpacking linux-image-4.10.0-28-generic (4.10.0-28.32~16.04.2) ...
dpkg: error processing archive /var/cache/apt/archives/linux-image-4.10.0-28-generic_4.10.0-28.32~16.04.2_amd64.deb (--unpack):
 cannot copy extracted data for './boot/System.map-4.10.0-28-generic' to '/boot/System.map-4.10.0-28-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.10.0-28-generic /boot/vmlinuz-4.10.0-28-generic run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.10.0-28-generic /boot/vmlinuz-4.10.0-28-generic Errors were encountered while processing: /var/cache/apt/archives/linux-image-4.10.0-28-generic_4.10.0-28.32~16.04.2_amd64.deb E: Sub-process /usr/bin/dpkg returned an error code (1)

2 Answers2

1

Why do I have to install something when I want to delete images?

You don't have to install something. It won't let you delete the images unless you delete the ones that depend on them at the same time. For example you need to use:

$ sudo apt-get purge linux-headers-4.4.33-040433* linux-headers-4.4.33-040433-generic* linux-image-4.4.33-040433-generic*
The following packages will be REMOVED:
  linux-headers-4.4.33-040433* linux-headers-4.4.33-040433-generic*
  linux-image-4.4.33-040433-generic*

To avoid this manual work try my bash script which automates the process. Yes it may be a shameless plug but I spent many hours in development and fine-tuning so would like to see as many use it as possible.

Do I also have to delete the files with linux-headers-* and linux-signed-image-*?

Yes as answered in the previous section.

Shouldn't Ubuntu handle the deletion of not needed kernels automatically or what is the reason I have to do it manually?

Ubuntu does remove kernels automatically that it installed automatically when you use:

sudo apt-get autoremove

If you manually installed a kernel using a technique like this: How do I update kernel to the latest mainline version? then you have to manually remove the kernel as well.

I have to encrypt my hard drive. Could this be the reason?

No. But I wouldn't encrypt my hard drive.

0
  1. The installation when you tried to get the new kernel failed from the low space on /boot you first have to solve the incomplete this install, as the error said, start by running:

    sudo apt-get -f install

    Then remove the old kernels

  2. apt should take care of that

  3. You can remove old kernels with:

    sudo apt-get autoremove --purge

    more info: RemoveOldKernels

arturodr
  • 111