"gzip: stdout: No space left on device" while upgrading the kernel

I see the following error while trying run the command shown below. I read somewhere that my /boot partition is low on disk space. How can I increase the size of the /boot partition so I can install more software? I have a 500GB hard disk, so there is enough space to play with.

sudo apt-get install libdvdread4

gzip: stdout: No space left on device                                                                                                                                                                              
   E: mkinitramfs failure cpio 141 gzip 1                                                                                                                                                                             
   update-initramfs: failed for /boot/initrd.img-3.2.0-33-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-3.2.0-33-generic.postinst line 1010.                                                                                                    
   dpkg: error processing linux-image-3.2.0-33-generic (--configure):                                                                                                                                                 
    subprocess installed post-installation script returned error exit status 2                                                                                                                                        
   dpkg: dependency problems prevent configuration of linux-image-server:                                                                                                                                             
   linux-image-server depends on linux-image-3.2.0-33-generic; however:                                                                                                                                              
     Package linux-image-3.2.0-33-generic is not configured yet.
   dpkg: error processing linux-image-server (--configure):
    dependency problems - leaving unconfigured
   dpkg: dependency problems prevent configuration of linux-server:
    linux-server depends on linux-image-server (= 3.2.0.33.36); however:
     Package linux-image-server is not configured yet.
   dpkg: error processing linux-server (--configure):
    dependency problems - leaving unconfigured
   No apport report written because the error message indicates its a followup error from a   previous failure.
                                                                                                          No apport report written because the error message indicates its a followup error from a previous failure.
 Errors were encountered while processing:
 linux-image-3.2.0-33-generic
 linux-image-server
 linux-server
N: Ignoring file 'michael-gruz-canon-precise.list.1' in directory '/etc/apt/sources.list.d/' as it has an invalid filename extension
N: Ignoring file 'michael-gruz-canon-precise.list.1' in directory '/etc/apt/sources.list.d/' as it has an invalid filename extension

Listed below is the output of du

Filesystem              1K-blocks      Used Available Use% Mounted on
/dev/mapper/ubuntu-root 712660664 104095912 572363692  16% /
udev                      3964792         4   3964788   1% /dev
tmpfs                     1591012      1064   1589948   1% /run
none                         5120         0      5120   0% /run/lock
none                      3977528       684   3976844   1% /run/shm
/dev/sda1                  233191    219821       929 100% /boot

Here is Solutions:

We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.

Solution 1

You have a separate partition for /boot that is only around 227MB in size. This partition is full.

The reason Ubuntu has given you a separate parition for /boot seems to be that you are using LVM and/or "full" disk encryption on the rest of the drive.

The /boot directory contains all of your kernel images, so the likely cause of this issue is that you have too many previous kernels installed. Ubuntu issues kernel updates which bump the version number in the package name fairly frequently even for long term stable versions, so over time if you keep the system up to date, the /boot directory will grow.

You should be able to list your installed kernels with

aptitude search ~ilinux-image

(Note that this will probably return packages that aren’t kernels, too).

There is usually no need for more than two kernels to be installed – the one currently in use and the previous known working kernel (as a fallback). So you can start removing the older ones, one by one, like this:

sudo apt-get autoremove linux-image-3.2.0-23-generic

Make sure you substitute "3.2.0-23-generic" with the actual kernel version you want to remove! Also, don’t remove packages such as linux-image-generic. You have to be really careful not to remove the currently running kernel or you won’t be able to boot (Ubuntu may or may not warn you about doing this).

You can find your currently running kernel with:

uname -r

Here’s an illustrated guide to doing what I’ve just explained. This article uses slightly different tools but basically the same approach.

Solution 2

I actually wanted to comment to neon_overload,
but the askubuntu prevents me from doing it..

I followed the process but now the package: linux-image-generic does not appear after I run:
aptitude search ~ilinux-image

and now I don’t know how to continue – I’m running on 3.14 kenel:

$ uname -a
Linux ***** 3.13.1-031301-generic #201401291035 SMP Wed Jan 29 15:37:43 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

Now I do not know if I need to install the linux-image-generic that I can find in synaptic package manager – 3.2 or install look for the linux-image-generic with the 3.13 version

I have solved the problem by –

  1. installing using synaptic package manager: linux-image-generic and linux-image
  2. followed the regular procedure to install a new kernel – used dpkg -i on the 3 files:

    ubuntu-pc:~/Downloads/kernel_3.13.1$ ls
    linux-headers-3.13.1-031301_3.13.1-031301.201401291035_all.deb
    linux-headers-3.13.1-031301-generic_3.13.1-031301.201401291035_amd64.deb
    linux-image-3.13.1-031301-generic_3.13.1-031301.201401291035_amd64.deb

Now I have the linux-image-generic and linux-image in my output of: aptitude search ~ilinux-image.

Now let’s try to boot with fingers crossed.

Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply