15

I just ran:

sudo apt-get update && sudo apt-get dist-upgrade

And this is the output I got from the second commands:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following NEW packages will be installed
  linux-headers-4.4.0-38 linux-headers-4.4.0-38-generic
  linux-image-4.4.0-38-generic linux-image-extra-4.4.0-38-generic
  linux-signed-image-4.4.0-38-generic
The following packages will be upgraded:
  linux-generic linux-headers-generic linux-image-generic linux-libc-dev
  linux-signed-generic linux-signed-image-generic
6 to upgrade, 5 to newly install, 0 to remove and 0 not to upgrade.
Need to get 69.3 MB of archives.
After this operation, 296 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 linux-image-4.4.0-38-generic amd64 4.4.0-38.57 [18.7 MB]
Get:2 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 linux-image-extra-4.4.0-38-generic amd64 4.4.0-38.57 [39.0 MB]
Get:3 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 linux-generic amd64 4.4.0.38.40 [1,790 B]
Get:4 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 linux-image-generic amd64 4.4.0.38.40 [2,300 B]
Get:5 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 linux-signed-image-4.4.0-38-generic amd64 4.4.0-38.57 [3,990 B]
Get:6 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 linux-signed-generic amd64 4.4.0.38.40 [1,820 B]
Get:7 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 linux-signed-image-generic amd64 4.4.0.38.40 [2,332 B]
Get:8 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 linux-headers-4.4.0-38 all 4.4.0-38.57 [9,948 kB]
Get:9 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 linux-headers-4.4.0-38-generic amd64 4.4.0-38.57 [785 kB]
Get:10 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 linux-headers-generic amd64 4.4.0.38.40 [2,274 B]
Get:11 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 linux-libc-dev amd64 4.4.0-38.57 [838 kB]
Fetched 69.3 MB in 1min 26s (806 kB/s)                                         
Selecting previously unselected package linux-image-4.4.0-38-generic.
(Reading database ... 248254 files and directories currently installed.)
Preparing to unpack .../linux-image-4.4.0-38-generic_4.4.0-38.57_amd64.deb ...
Done.
Unpacking linux-image-4.4.0-38-generic (4.4.0-38.57) ...
Selecting previously unselected package linux-image-extra-4.4.0-38-generic.
Preparing to unpack .../linux-image-extra-4.4.0-38-generic_4.4.0-38.57_amd64.deb ...
Unpacking linux-image-extra-4.4.0-38-generic (4.4.0-38.57) ...
Preparing to unpack .../linux-generic_4.4.0.38.40_amd64.deb ...
Unpacking linux-generic (4.4.0.38.40) over (4.4.0.36.38) ...
Preparing to unpack .../linux-image-generic_4.4.0.38.40_amd64.deb ...
Unpacking linux-image-generic (4.4.0.38.40) over (4.4.0.36.38) ...
Selecting previously unselected package linux-signed-image-4.4.0-38-generic.
Preparing to unpack .../linux-signed-image-4.4.0-38-generic_4.4.0-38.57_amd64.deb ...
Unpacking linux-signed-image-4.4.0-38-generic (4.4.0-38.57) ...
Preparing to unpack .../linux-signed-generic_4.4.0.38.40_amd64.deb ...
Unpacking linux-signed-generic (4.4.0.38.40) over (4.4.0.36.38) ...
Preparing to unpack .../linux-signed-image-generic_4.4.0.38.40_amd64.deb ...
Unpacking linux-signed-image-generic (4.4.0.38.40) over (4.4.0.36.38) ...
Selecting previously unselected package linux-headers-4.4.0-38.
Preparing to unpack .../linux-headers-4.4.0-38_4.4.0-38.57_all.deb ...
Unpacking linux-headers-4.4.0-38 (4.4.0-38.57) ...
Selecting previously unselected package linux-headers-4.4.0-38-generic.
Preparing to unpack .../linux-headers-4.4.0-38-generic_4.4.0-38.57_amd64.deb ...
Unpacking linux-headers-4.4.0-38-generic (4.4.0-38.57) ...
Preparing to unpack .../linux-headers-generic_4.4.0.38.40_amd64.deb ...
Unpacking linux-headers-generic (4.4.0.38.40) over (4.4.0.36.38) ...
Preparing to unpack .../linux-libc-dev_4.4.0-38.57_amd64.deb ...
Unpacking linux-libc-dev:amd64 (4.4.0-38.57) over (4.4.0-36.55) ...
Setting up linux-image-4.4.0-38-generic (4.4.0-38.57) ...
Running depmod.
update-initramfs: deferring update (hook will be called later)
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-38-generic /boot/vmlinuz-4.4.0-38-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-38-generic /boot/vmlinuz-4.4.0-38-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-38-generic /boot/vmlinuz-4.4.0-38-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-38-generic

gzip: stdout: No space left on device
E: mkinitramfs failure cpio 141 gzip 1
update-initramfs: failed for /boot/initrd.img-4.4.0-38-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
Failed to process /etc/kernel/postinst.d at /var/lib/dpkg/info/linux-image-4.4.0-38-generic.postinst line 1052.
dpkg: error processing package linux-image-4.4.0-38-generic (--configure):
 subprocess installed post-installation script returned error exit status 2
dpkg: dependency problems prevent configuration of linux-image-extra-4.4.0-38-generic:
 linux-image-extra-4.4.0-38-generic depends on linux-image-4.4.0-38-generic; however:
  Package linux-image-4.4.0-38-generic is not configured yet.

dpkg: error processing package linux-image-extra-4.4.0-38-generic (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-image-generic:
 linux-image-generic depends on linux-image-4.4.0-38-generic; however:
  Package linux-image-4.4.0-38-generic is not configured yet.
 linux-image-generic depends on linux-image-extra-4.4.0-38-generic; however:
  Package linux-image-extra-4.4.0-38-generic is not configured yet.

dpkg: error processing package linux-image-generic (--configure):
 dependency problems - leaving unconfigured
Setting up linux-headers-4.4.0-38 (No apport report written because the error message indicates it's a follow-up error from a previous failure.
                                                               No apport report written because the error message indicates it's a follow-up error from a previous failure.
           4.4.0-38.57) ...
Setting up linux-headers-4.4.0-38-generic (4.4.0-38.57) ...
Examining /etc/kernel/header_postinst.d.
run-parts: executing /etc/kernel/header_postinst.d/dkms 4.4.0-38-generic /boot/vmlinuz-4.4.0-38-generic
Setting up linux-headers-generic (4.4.0.38.40) ...
dpkg: dependency problems prevent configuration of linux-generic:
 linux-generic depends on linux-image-generic (= 4.4.0.38.40); however:
  Package linux-image-generic is not configured yet.

dpkg: error processing package linux-generic (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-signed-image-4.4.0-38-generic:
 linux-signed-image-4.4.0-38-generic depends on linux-image-4.4.0-38-generic (= 4.4.0-38.57); however:
  Package linux-image-4.4.0-38-generic is not configured yet.

No apport report written because MaxReports has already been reached
                                                                    No apport report written because MaxReports has already been reached
                                                        dpkg: error processing package linux-signed-image-4.4.0-38-generic (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-signed-image-generic:
 linux-signed-image-generic depends on linux-signed-image-4.4.0-38-generic; however:
  Package linux-signed-image-4.4.0-38-generic is not configured yet.
 linux-signed-image-generic depends on linux-image-extra-4.4.0-38-generic; however:
  Package linux-image-extra-4.4.0-38-generic is not configured yet.

dpkg: error processing package linux-signed-image-generic (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports has already been reached
                                                                    dpkg: dependency problems prevent configuration of linux-signed-generic:
 linux-signed-generic depends on linux-signed-image-generic (= 4.4.0.38.40); however:
  Package linux-signed-image-generic is not configured yet.

dpkg: error processing package linux-signed-generic (--configure):
 dependency problems - leaving unconfigured
Setting up linux-libc-dev:amd64 (4.4.0-38.57) ...
No apport report written because MaxReports has already been reached
                                                                    Errors were encountered while processing:
 linux-image-4.4.0-38-generic
 linux-image-extra-4.4.0-38-generic
 linux-image-generic
 linux-generic
 linux-signed-image-4.4.0-38-generic
 linux-signed-image-generic
 linux-signed-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

As you can see, I had lots of errors with update-initramfs. I am scared to restart now as the installation went so badly.

The issue led me to this bug report, but I'm still not exactly too sure what to do as this has never happened before. Why is this happening now and how exactly do I fix it? It talks about there not being enough space somewhere, why is this?

I am running Ubuntu GNOME 16.04.1 with GNOME 3.20.

Zanna
  • 70,465

4 Answers4

16

The reason might be that you are running out of free disk space (maybe because you created a too small /boot partition on your hard disk) and you are having too many old kernels installed.

The most proper way to clean up old kernels completely, is to remove them with this command :

sudo apt purge linux-headers-* linux-headers-*-generic linux-image-*-generic linux-image-extra-*-generic linux-signed-image-*-generic

To check which kernel versions currently are installed on the system ... execute this command :

sudo dpkg --get-selections | grep linux  

Replace * with the kernel versions (for instance : 4.4.0-36) from the output of the command.

Example - this is the command to completely remove all traces from kernel version 4.4.0-36 :

sudo apt purge linux-headers-4.4.0-36 linux-headers-4.4.0-36-generic linux-image-4.4.0-36-generic linux-image-extra-4.4.0-36-generic linux-signed-image-4.4.0-36-generic  

Alternatively you can use byobu from Dustin Kirkland (Canonical) to get rid of the older kernels :

sudo apt install byobu  
sudo purge-old-kernels  

This will remove all older kernels, but leaves the current (of course) and the one before installed.

cl-netbox
  • 31,163
  • 7
  • 94
  • 131
  • What has byobu to do with that? That's a text based window manager to let you run multiple applications and shells in one terminal, IIRC. – Byte Commander Sep 20 '16 at 14:00
  • @ByteCommander : Please read this -> http://blog.dustinkirkland.com/2016/06/purge-old-kernels.html ... ! :) By the way ... you can check it out on the Ubuntu 16.04 server edition ... byobu is installed by default there. :) – cl-netbox Sep 20 '16 at 14:10
  • 1
    Aha, okay. That's nice, although I'd say this tool should better be packaged separately. – Byte Commander Sep 20 '16 at 14:15
  • 1
    @ByteCommander System may be so full of kernels that purge-old-kernels and apt purge can not operate. Then my answer may help. I have made a full-featured script that is even more powerful. I will publish it, after my bounty goal is reached: https://www.bountysource.com/issues/38300038-feature-request-the-command-should-work-like-this – jarno Nov 05 '16 at 17:06
8

Your computer is out of disk space.

Free up some in /boot.

Then rerun the command.

Update: In chat we found that the /boot partition was full. This is where disk space should be freed.

Update 2: Doing ls /boot should show some vmlinuz-X.XX.XX files. Do apt-get purge linux-image-X.XX.XX-generic for each one. Just keep the latest one in case the one you install doesn't work. (Thanks to edwinksl for requesting information on how to do this).

IanC
  • 931
  • For the benefit of those don't know how to free some space in /boot, can you elaborate how one can do that? – edwinksl Sep 19 '16 at 21:04
  • @edwinksl sure. –  Sep 19 '16 at 22:15
  • You probably want to instruct people to use apt-get purge rather than remove them manually as configuration for them elsewhere will not go and you could cause corruption and confusion on your system if you remove them without telling it. –  Sep 20 '16 at 18:50
  • I'd also recommend that people kept at least one old kernel available in case the new one is somehow broken. – IanC Sep 20 '16 at 19:37
  • @IanC True. edited. –  Sep 20 '16 at 19:38
4

Hopefully this well help someone else.

I was trying to manually install a newer kernel version some months ago, with similar results to OP.
Even though /boot is only 30% full I was getting the same out of disk space error when running apt-get autoremove, it would try to build the initramfs for the new kernel every time and fail.

Based on this AskUbuntu question I moved the offending Kernel file from /var/lib/initramfs-tools and was able to get apt-get running again without errors.

Chris
  • 60
1

As for why it was happening in Ubuntu 16.04, I have a theory:

In 16.04 unneeded kernels are supposed to be removed automatically by unattended-upgrades ran automatically as a cron job or such by default so that /boot never gets full, but I suspect that Bug #1624644 occured. Can you confirm the bug in Launchpad?

jarno
  • 5,600