Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

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

My first issue was when i tried to apt-get update/upgrade. On upgrade I get the following error:

You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
linux-image-server : Depends: linux-image-3.2.0-27-generic but it is not installed
E: Unmet dependencies. Try using -f.

I tried running apt-get install -f and this was the output(after saying yes on prompt)

(Reading database ... 186183 files and directories currently installed.)
Unpacking linux-image-3.2.0-27-generic (from .../linux-image-3.2.0-27-generic_3.2.0-27.43_amd64.deb) ...
dpkg: error processing /var/cache/apt/archives/linux-image-3.2.0-27-generic_3.2.0-27.43_amd64.deb (--unpack):
 failed in write on buffer copy for backend dpkg-deb during `./boot/': 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.2.0-27-generic   /boot/vmlinuz-3.2.0-27-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.2.0-27-generic /boot/vmlinuz-3.2.0-27-generic
Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)

I tried running apt-get autoremove and it gives me the same error as apt-get upgrade

When I run df, I get this for /boot:

/dev/sda1                    233191     230297         0 100% /boot

So, I read elsewhere that I should try to purge old kernals. I checked for what kernals I had with

dpkg -l linux-image-\* | grep ^ii

It returns

ii  linux-image-2.6.38-13-server         2.6.38-13.52                                 Linux kernel image for version 2.6.38                                                              on x86_64
ii  linux-image-3.0.0-13-server          3.0.0-13.22                              Linux kernel image for version 3.0.0                                                              on x86_64
ii  linux-image-3.0.0-14-server          3.0.0-14.23                              Linux kernel image for version 3.0.0                                                              on x86_64
ii  linux-image-3.0.0-15-server          3.0.0-15.26                              Linux kernel image for version 3.0.0                                                              on x86_64
ii  linux-image-3.0.0-16-server          3.0.0-16.29                              Linux kernel image for version 3.0.0                                                              on x86_64
ii  linux-image-3.0.0-17-server          3.0.0-17.30                              Linux kernel image for version 3.0.0                                                              on x86_64
ii  linux-image-3.2.0-24-generic         3.2.0-24.39                              Linux kernel image for version 3.2.0                                                              on 64 bit x86 SMP
ii  linux-image-3.2.0-25-generic         3.2.0-25.40                              Linux kernel image for version 3.2.0                                                              on 64 bit x86 SMP
ii  linux-image-3.2.0-26-generic         3.2.0-26.41                              Linux kernel image for version 3.2.0                                                              on 64 bit x86 SMP

So, when I try to remove the oldest with this:

sudo apt-get purge linux-image-2.6.38-13-server

I get the error:

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-server : Depends: linux-image-3.2.0-27-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'm out of ideas. How can I free up / extend boot without messing up my installation?

Thanks for the help.

share|improve this question
I think @mreiter's answer may be the best: it uses the package manager, and it worked when other package manager commands failed, at least for me: – Aaron Hall Mar 28 '15 at 13:16
up vote 69 down vote accepted

Freeing Up Space on the Root File System

To free up space on the root file system you can try to execute apt-get clean.

If that doesn't work you can go to /var/cache/apt/archives and manually remove a few files from the cache to get some space back, e.g.:

sudo rm linux-headers-*

It won't hurt to remove all of the .deb files here if you need to--that is what apt-get clean does. They will be automatically be re-downloaded by apt if they are again needed.

Freeing Up Space on the /boot File System

The Original Poster has a separate /boot partition, and that is what is full and preventing the apt system from working. It will be necessary for him to free up space there.

If there almost enough space, go to /boot and remove a config file or two:

sudo rm config-3.2.0-19-generic-pae

for example, but using the name of one of the kernel versions you intend to remove anyway. This will free up a little space (about 144K apiece).

If you need more space individually remove old vmlinuz initrd, abi and files until you have enough space (about 22 megs for one of my i386 kernel versions).

Whatever you do, don't remove them all. You should at least keep the latest two matching versions of each kind of file, for each kind of kernel you use.

Then proceed with your apt-get install commands. As mentioned above they may have to re-download some of the debs you deleted, but if so that will happen automatically. When you have apt working again, clean up by using apt-get to remove the packages corresponding to the files you removed--so everything matches.

The config file in /boot is the kernel config that was used by the kernel team to build the kernel of the same name. It should be harmless to remove unless you want it for reference or to aid you in building your own kernels.

Finally you are manually removing an old kernel package or two from the /boot partition to make even more room for the new one.

share|improve this answer
I tried removing almost all the configs. It still doesn't seem to have enough space. What other files in there would be safe to remove? My root file system isn't anywhere near full, so I'm not worried about it. – Strifey16 Aug 2 '12 at 16:28
I updated my answer with the further files to remove by hand. It seems to me that removing the and sets (five files to the set including the abi file) would suffice. – John S Gruber Aug 2 '12 at 19:42
Why not just remove all the files in /var/cache/apt/archives? (sudo apt-get clean will do this, or you can do it manually.) Please note that I am not suggesting to remove all files in /boot. – Eliah Kagan Aug 3 '12 at 0:27
@EliahKagan, I've edited the answer to suggest trying apt-get clean first, but I'm note sure whether it works in thies condition or not. It won't help the OP but might help others without separate /boot partitions. I tried to go from the least aggresive steps to the most aggressive. – John S Gruber Aug 3 '12 at 0:58
This fixed it. I realized it would probably come down to removing files by hand, but I'm always hesitant to do that with anything installed by apt, so I thought I'd ask here first. – Strifey16 Aug 4 '12 at 19:13

In my case, the apt commands and dpkg command could not finish, and could not remove. The autoupdate had failed on installing 2.6.32-56-server.

My first step, was to identify space to be used,

cd /boot
du -sk *|sort -n

I had about 30 kernels and supporting files.

I did a uname -a to get the running kernel, I identified that I was on Linux alternate 2.6.32-43-server and did a tar of 6 of the versions that were not running, and were old.

tar -cvf ~username/boot.tar *2.6.32-44-server *2.6.32-45-server *2.6.32-46-server *2.6.32-47-server *2.6.32-48-server *2.6.32-49-server

I then did a rm -rf of what I had backed up

rm -rf *2.6.32-44-server *2.6.32-45-server *2.6.32-46-server *2.6.32-47-server *2.6.32-48-server *2.6.32-49-server

I am showing these commands as examples, you will have to decide what you will work with for your situation.

Now that I had some space on /boot, I was able to run

apt-get -f install 

To clean up the failed install of 2.6.32-56-server.

I then did a

apt-get remove linux-headers-2.6.32-38 linux-headers-2.6.32-38-server linux-image-2.6.32-38-server
apt-get remove linux-headers-2.6.32-39 linux-headers-2.6.32-39-server linux-image-2.6.32-39-server

This gave me room to put back what I had backed up.

tar -xf ~username/boot.tar
rm  ~username/boot.tar    

To clean up, I then could run:

apt-get autoremove

I rebooted and am now down to using 4% of /boot.

share|improve this answer
This was the most helpful for me out of all of the suggestions. Thank you very much! – Joshua F. Rountree Mar 28 '15 at 1:53
removing files from /boot just horribly breaks apt and dpkg since thier install and removal scripts fail HARD when the files are missing. I don't see how you got this to work. – FizxMike Jun 11 at 22:54

You can use dpkg instead of apt-get to remove older kernels:

sudo dpkg -r linux-image-3.2.0-29-generic
share|improve this answer
That simple, thanks. – Laurent Jun 12 '14 at 3:04
Maybe there are plusses for using this, but @mreiter's suggestion worked for me when this one didn't (this one was suggested on ubuntu's IRC support channel.) – Aaron Hall Mar 28 '15 at 13:09

Thanks a lot for the indications!

When you say the following you don't give precise indications:

When you have apt working again, clean up by using apt-get to remove the packages corresponding to the files you removed--so everything matches.

I did it the following way:

I noticed there were still some files of the old versions in the boot directory ls /boot vmcoreinfo-2.6.31-17-server

And the package manager would list the old versions dpkg -l | grep linux-image

I therefore used this command (autoremove would also remove more recent images I don't want to remove) sudo apt-get purge linux-image-2.6.31-17-server

I had still some headers left dpkg -l | grep linux-headers

So I did this: sudo apt-get purge linux-headers-2.6.32-34

Finally there was one package left I couldn't remove with apt-get purge dpkg -l | grep linux-image rc linux-image-2.6.28-11-server

Thanks to the following thread I did it the following way: Remove a package marked as rc by dpkg

sudo dpkg --purge linux-image-2.6.28-11-server

share|improve this answer
Welcome to AskUbuntu! I'm afraid this is not an answer to the question. – NorTicUs Oct 26 '12 at 13:28
@NorTicUs This seems like an answer to me. It provides a procedure for solving the problem that was described in the question... – Eliah Kagan Oct 26 '12 at 14:48
Sorry, my bad, but that doesn't look like one. I'd like to see a result (That's worked) or instructions (Try this/ Do that). Maybe the content is right, but the look isn't. – NorTicUs Oct 26 '12 at 14:57
I too agree that this is a better answer than the accepted answer as it uses the package managers to perform the uninstallation of the old unused kernels. I had the same issue as the OP and this answer helped. – Chris Aug 14 '14 at 14:13
@Chris This worked for me too. Agree, best because it uses the package manager. – Aaron Hall Mar 28 '15 at 13:07

You cannot act upon packages, but you can act upon other files. First, go through your home folder and see whether there is anything you can delete. If not, try to move a good amount of files to another partition(or a flash drive) and then try sudo apt-get install -f to clean up the package dependency issues(most likely you installed a .deb file through dpkg), and then purge any kernels. Once you safely have at least 10 MB, try purging unneeded software or files.

share|improve this answer
The home folder is not in /boot – Thorbjørn Ravn Andersen May 17 '13 at 8:05

Use Synaptic Package Manager. Just pick the package you want removed and it will prompt you to also remove packages that depend on it. In my experience, kernel packages always come in groups of two (or more, depending on how you count) that are interdependant. You can usually find old ones quickly by using the "local/obsolete" filter.

share|improve this answer

I know this is an answer to an old question but it does not hurt to share my experience this is would it worked for me:

sudo apt-get autoremove linux-image-xxxx

Do that for all old kernels and only keep the last most recent two...

This would automatically remove the kernel and update grub see this: Ubuntu Documentation

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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