Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've followed most instructions an clearing boot found on the interwebs, I'm a bit n00bish on linux inwards I use it mostly for web dev testing, but am pretty good at following command instructions ;)

Unfortunately my box seems to be stuck with the /boot full and I can't get my head around the correct steps to get clear it.

I believe I can't clean the boot because kernel 39 is pending install, but I can remove it from pending install because the boot is full?

This is the sequence of steps I attemped:

pedro@lamp01:~$ sudo apt-get autoremove
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-generic-lts-quantal : Depends: linux-image-3.5.0-39-generic but it is not installed
E: Unmet dependencies. Try using -f.

pedro@lamp01:~$ sudo apt-get purge $(dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve "$(uname -r | sed -r 's/-[a-z]+//')")
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-headers-generic-lts-quantal : Depends: linux-headers-3.5.0-39-generic but it is not going to be installed
 linux-image-generic-lts-quantal : Depends: linux-image-3.5.0-39-generic but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

pedro@lamp01:~$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  linux-headers-3.5.0-32-generic linux-headers-3.5.0-27-generic
  linux-headers-3.5.0-30-generic linux-headers-3.5.0-28-generic
  linux-headers-3.5.0-30 linux-headers-3.5.0-31 linux-headers-3.5.0-26
  linux-headers-3.5.0-32 linux-headers-3.5.0-27 linux-headers-3.5.0-28
  linux-headers-3.5.0-31-generic linux-headers-3.5.0-26-generic
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
Suggested packages:
  fdutils linux-lts-quantal-doc-3.5.0 linux-lts-quantal-source-3.5.0
The following NEW packages will be installed
0 upgraded, 1 newly installed, 0 to remove and 27 not upgraded.
3 not fully installed or removed.
Need to get 0 B/40.7 MB of archives.
After this operation, 157 MB of additional disk space will be used.
Do you want to continue [Y/n]? Y
(Reading database ... 269199 files and directories currently installed.)
Unpacking linux-image-3.5.0-39-generic (from .../linux-image-3.5.0-39-generic_3.5.0-39.60~precise1_amd64.deb) ...
dpkg: error processing /var/cache/apt/archives/linux-image-3.5.0-39-generic_3.5.0-39.60~precise1_amd64.deb (--unpack):
 failed in write on buffer copy for backend dpkg-deb during `./boot/vmlinuz-3.5.0-39-generic': 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 3.5.0-39-generic /boot/vmlinuz-3.5.0-39-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.5.0-39-generic /boot/vmlinuz-3.5.0-39-generic
Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)

It's a bit odd the autoremove appears to be forcing the install, the current kernel is 37:

pedro@lamp01:~$ uname -a
Linux lamp01 3.5.0-37-generic #58~precise1-Ubuntu SMP Wed Jul 10 17:48:11 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

Can anyone help?

Many thanks, P.

share|improve this question

marked as duplicate by jokerdino Sep 24 '13 at 13:23

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

So you can't do sudo apt-get autoremove? Is your /boot in a different partition than the root filesystem? – Salem Sep 2 '13 at 20:32
Nope, always comes up with the error above. – Pedro Costa Sep 3 '13 at 9:40
Please add what is the error with autoremove. – Braiam Sep 3 '13 at 12:27
See above, in OP, it's the first command executed! – Pedro Costa Sep 5 '13 at 9:02

As I don't a similar setup of yours, I can't say how well any of those work, so before trying anything make a backup! Having said that, you can try the following:

  1. Using dpkg to remove older kernels and install the new one after. For example:

    $ sudo dpkg -r linux-headers-3.5.0-28-generic
  2. If it still does not work, you can try to move temporarily some older kernel files to a different location (root partition, some pen drive, etc...), install the new kernel and then remove older kernels, while moving the kernel files to their default location;

  3. You can try to "move" your /boot mount point temporarily (supposing you have sufficient space on /). This will take the following steps:

    • Unmount your /boot mount point: sudo umount /boot;
    • Mount it anywhere else: sudo mount /dev/**your boot partition** /mnt;
    • Move your files from /mnt to /boot: you can use gksu nautilus or sudo mv to do that
    • Perform the changes you want (installing the new kernel, removing the old ones);
    • Copy the files from /mnt back to /boot;

Also note that if you are using LVM, resizing a partition is a lot easier (you dont even need to stop anything/reboot/use live cd's). So if this is the case just use lvextend to increase the space on /boot partition.

share|improve this answer
I think /boot is not on LVM, but it is a regular partition. – jarno Feb 2 at 15:40

I'm sure that if you do a df -h you will notice your /boot partition full.

braiam@bt:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda7        14G  9.8G  3.3G  76% /
/dev/sda5       922M   40M  819M   5% /boot

This happens because you made it too small, or you smashed there several kernels that you don't need, or you just filled it with unicorns background for the Grub... either way, it has 2 simple solutions:

  1. Uninstall obsolete kernels.

    sudo apt-get -y autoremove
    sudo apt-get -f install
  2. Make your /boot partition bigger.

    This requires that you boot into a Live OS then resize the partition.

share|improve this answer
thanks, sudo apt-get -y autoremove does not work, same error has above, am going to try making the /boot partition bigger next, this is a hyper-v install of ubuntu, I must have gave it the default size/setup, can't remember customizing it. – Pedro Costa Sep 3 '13 at 9:41

Not the answer you're looking for? Browse other questions tagged or ask your own question.