Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

This question already has an answer here:

I'm trying to remove old kernel versions so I can upgrade. The method I'm using is below.

sudo apt-get purge linux-image-x.y.z-server

Every time I run it I get the following error:

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

Ok, so what I get is this is telling me i'm out of space which I know. I also get a message from time to time about running the below to resolve my errors at which point I get the now space message again.

sudo apt-get install -f

Everything I try give me the now space error. Frustrating..... Thanks for the help folks.

Here is the output requested, sorry

    /dev/mapper/wikisrvr-root
                       48G  6.4G   40G  14% /
udev                  996M  4.0K  996M   1% /dev
tmpfs                 402M  952K  401M   1% /run
none                  5.0M     0  5.0M   0% /run/lock
none                 1005M  188K 1004M   1% /run/shm
/dev/sda1             228M  227M     0 100% /boot

This is the error I get when trying to purge as per the posted link. BTW that was the orgions post I tried to follow.

build@wikisrvr:~$ sudo apt-get purge linux-image-3.0.0-12-server
[sudo] password for build: 
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.0.0-32-server but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

resultz from sudo apt-get -f install

build@wikisrvr:~$ 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.0.0-26-generic linux-headers-3.0.0-20-server
  linux-headers-3.0.0-24-server linux-headers-3.0.0-19-server ubufox
  linux-headers-3.0.0-12 linux-headers-3.0.0-20 linux-headers-3.0.0-21
  linux-headers-3.0.0-16 linux-headers-3.0.0-22 linux-headers-3.0.0-17
  linux-headers-3.0.0-24 linux-headers-3.0.0-19 linux-headers-3.0.0-30
  linux-headers-3.0.0-25 linux-headers-3.0.0-26 linux-headers-3.0.0-21-generic
  linux-headers-3.0.0-16-generic linux-headers-3.0.0-12-server
  linux-headers-3.0.0-24-generic linux-headers-3.0.0-19-generic
  linux-headers-3.0.0-21-server linux-headers-3.0.0-30-server
  linux-headers-3.0.0-25-server linux-headers-3.0.0-22-generic
  linux-headers-3.0.0-17-generic linux-headers-3.0.0-22-server
  linux-headers-3.0.0-17-server linux-headers-3.0.0-30-generic
  linux-headers-3.0.0-25-generic linux-headers-3.0.0-26-server
  linux-headers-3.0.0-20-generic
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  linux-image-3.0.0-32-server
Suggested packages:
  fdutils linux-doc-3.0.0 linux-source-3.0.0 linux-tools
The following NEW packages will be installed:
  linux-image-3.0.0-32-server
0 upgraded, 1 newly installed, 0 to remove and 127 not upgraded.
12 not fully installed or removed.
Need to get 0 B/37.3 MB of archives.
After this operation, 150 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
(Reading database ... 516009 files and directories currently installed.)
Unpacking linux-image-3.0.0-32-server (from .../linux-image-3.0.0-32-server_3.0.0-32.51_amd64.deb) ...
Done.
dpkg: error processing /var/cache/apt/archives/linux-image-3.0.0-32-server_3.0.0-32.51_amd64.deb (--unpack):
 failed in write on buffer copy for backend dpkg-deb during `./boot/System.map-3.0.0-32-server': 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.0.0-32-server /boot/vmlinuz-3.0.0-32-server
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.0.0-32-server /boot/vmlinuz-3.0.0-32-server
Errors were encountered while processing:
 /var/cache/apt/archives/linux-image-3.0.0-32-server_3.0.0-32.51_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Results from sugo apt-get autoremove

build@wikisrvr:~$ 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-server : Depends: linux-image-3.0.0-32-server but it is not installed
E: Unmet dependencies. Try using -f.

Results from sudo apt-get autoremove -f

build@wikisrvr:~$ sudo apt-get autoremove -f
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
  linux-image-3.0.0-32-server
Suggested packages:
  fdutils linux-doc-3.0.0 linux-source-3.0.0 linux-tools
The following packages will be REMOVED:
  linux-headers-3.0.0-12 linux-headers-3.0.0-12-server linux-headers-3.0.0-16
  linux-headers-3.0.0-16-generic linux-headers-3.0.0-17
  linux-headers-3.0.0-17-generic linux-headers-3.0.0-17-server
  linux-headers-3.0.0-19 linux-headers-3.0.0-19-generic
  linux-headers-3.0.0-19-server linux-headers-3.0.0-20
  linux-headers-3.0.0-20-generic linux-headers-3.0.0-20-server
  linux-headers-3.0.0-21 linux-headers-3.0.0-21-generic
  linux-headers-3.0.0-21-server linux-headers-3.0.0-22
  linux-headers-3.0.0-22-generic linux-headers-3.0.0-22-server
  linux-headers-3.0.0-24 linux-headers-3.0.0-24-generic
  linux-headers-3.0.0-24-server linux-headers-3.0.0-25
  linux-headers-3.0.0-25-generic linux-headers-3.0.0-25-server
  linux-headers-3.0.0-26 linux-headers-3.0.0-26-generic
  linux-headers-3.0.0-26-server linux-headers-3.0.0-30
  linux-headers-3.0.0-30-generic linux-headers-3.0.0-30-server ubufox
The following NEW packages will be installed:
  linux-image-3.0.0-32-server
0 upgraded, 1 newly installed, 32 to remove and 127 not upgraded.
12 not fully installed or removed.
Need to get 0 B/37.3 MB of archives.
After this operation, 1,029 MB disk space will be freed.
Do you want to continue [Y/n]? y
(Reading database ... 516009 files and directories currently installed.)
Unpacking linux-image-3.0.0-32-server (from .../linux-image-3.0.0-32-server_3.0.0-32.51_amd64.deb) ...
Done.
dpkg: error processing /var/cache/apt/archives/linux-image-3.0.0-32-server_3.0.0-32.51_amd64.deb (--unpack):
 failed in write on buffer copy for backend dpkg-deb during `./boot/System.map-3.0.0-32-server': 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.0.0-32-server /boot/vmlinuz-3.0.0-32-server
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.0.0-32-server /boot/vmlinuz-3.0.0-32-server
Errors were encountered while processing:
 /var/cache/apt/archives/linux-image-3.0.0-32-server_3.0.0-32.51_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
share|improve this question

marked as duplicate by minerz029, BuZZ-dEE, mikewhatever, belacqua, qbi Feb 14 at 22:49

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.

    
What is the size of your / or /boot partition? Please add the output of df -h –  Wilf Feb 10 at 19:52
2  
Try freeing space in your boot/ and then try again. –  Parto Feb 10 at 20:20
    
Run sudo apt-get autoremove first then try deleting the old kernels again. –  Parto Feb 10 at 20:39
    
just added the results from autoremove and autoremove -f –  user2993692 Feb 10 at 20:45
    
Is your boot/ folder in your home folder? If so, try creating some space by moving large files in your home folder to other partitions then try sudo apt-get -f install. This is to take care of the 'No space left on device' error. –  Parto Feb 10 at 20:50

2 Answers 2

To prevent future 'no space in boot/' errors, install ubuntu-tweak and use it's janitor to do frequent cleanups of your cached programs, old kernels, unneeded programs, etc.

After installing, go to "janitor" and check the "system" checkbox in the left sidebar and then press "clean" at the bottom. Check image below.

Ubuntu tweak showing janitor

share|improve this answer
    
This. This right here! Goodbye manual cleaning! Wish I had seen this earlier in life... –  kanov-baekonfat Apr 28 at 2:27

This command source:

dpkg -l linux-* | awk '/^ii/{ print $2}' | grep -v -e `uname -r | cut -f1,2 -d"-"` | grep -e [0-9] | grep -E "(image|headers)" | xargs sudo apt-get -y purge

that I ran just freed 723 MB of my disk space. This will check for the current kernel release that you are using and removes the rest.

share|improve this answer

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