Tell me more ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Possible Duplicate:
Free up more space on /boot

I logged onto my server today to find the message:

=> /boot is using 98.9% of 91MB

When I look at /boot I see that it is indeed very low on space, and has old-kernel files in it:

phrogz@planar:~$ df -h /boot
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1              92M   54M   33M  63% /boot

phrogz@planar:~$ la /boot
total 81880
drwxr-xr-x  4 root root    3072 2011-12-02 06:26 ./
drwxr-xr-x 22 root root    4096 2011-09-29 06:37 ../
-rw-r--r--  1 root root  646419 2011-03-01 19:02 abi-2.6.32-30-server
-rw-r--r--  1 root root  646419 2011-04-08 17:07 abi-2.6.32-31-server
-rw-r--r--  1 root root  646454 2011-04-20 16:53 abi-2.6.32-32-server
-rw-r--r--  1 root root  646454 2011-07-29 16:07 abi-2.6.32-33-server
-rw-r--r--  1 root root  646710 2011-09-13 18:00 abi-2.6.32-34-server
-rw-r--r--  1 root root  646820 2011-10-11 11:10 abi-2.6.32-35-server
-rw-r--r--  1 root root  110687 2011-03-01 19:02 config-2.6.32-30-server
-rw-r--r--  1 root root  110676 2011-04-08 17:07 config-2.6.32-31-server
-rw-r--r--  1 root root  110687 2011-04-20 16:53 config-2.6.32-32-server
-rw-r--r--  1 root root  110687 2011-07-29 16:07 config-2.6.32-33-server
-rw-r--r--  1 root root  110687 2011-09-13 18:00 config-2.6.32-34-server
-rw-r--r--  1 root root  110687 2011-10-11 11:10 config-2.6.32-35-server
drwxr-xr-x  3 root root    6144 2011-12-02 06:26 grub/
-rw-r--r--  1 root root 8258196 2011-05-18 11:58 initrd.img-2.6.32-30-server
-rw-r--r--  1 root root 8259568 2011-05-23 20:24 initrd.img-2.6.32-31-server
-rw-r--r--  1 root root 8257374 2011-05-30 07:47 initrd.img-2.6.32-32-server
-rw-r--r--  1 root root 8287489 2011-08-10 06:37 initrd.img-2.6.32-33-server
-rw-r--r--  1 root root 8288075 2011-09-29 06:37 initrd.img-2.6.32-34-server
drwx------  2 root root   12288 2011-05-18 11:46 lost+found/
-rw-r--r--  1 root root  160280 2010-03-23 03:40 memtest86+.bin
-rw-r--r--  1 root root 2179117 2011-03-01 19:02 System.map-2.6.32-30-server
-rw-r--r--  1 root root 2179628 2011-04-08 17:07 System.map-2.6.32-31-server
-rw-r--r--  1 root root 2178240 2011-04-20 16:53 System.map-2.6.32-32-server
-rw-r--r--  1 root root 2178382 2011-07-29 16:07 System.map-2.6.32-33-server
-rw-r--r--  1 root root 2178952 2011-09-13 18:00 System.map-2.6.32-34-server
-rw-r--r--  1 root root 2179333 2011-10-11 11:10 System.map-2.6.32-35-server
-rw-r--r--  1 root root    1336 2011-03-01 19:08 vmcoreinfo-2.6.32-30-server
-rw-r--r--  1 root root    1336 2011-04-08 17:13 vmcoreinfo-2.6.32-31-server
-rw-r--r--  1 root root    1336 2011-04-20 16:54 vmcoreinfo-2.6.32-32-server
-rw-r--r--  1 root root    1336 2011-07-29 16:08 vmcoreinfo-2.6.32-33-server
-rw-r--r--  1 root root    1336 2011-09-13 18:03 vmcoreinfo-2.6.32-34-server
-rw-r--r--  1 root root    1336 2011-10-11 11:11 vmcoreinfo-2.6.32-35-server
-rw-r--r--  1 root root 4111552 2011-03-01 19:02 vmlinuz-2.6.32-30-server
-rw-r--r--  1 root root 4113344 2011-04-08 17:07 vmlinuz-2.6.32-31-server
-rw-r--r--  1 root root 4106528 2011-04-20 16:53 vmlinuz-2.6.32-32-server
-rw-r--r--  1 root root 4107648 2011-07-29 16:07 vmlinuz-2.6.32-33-server
-rw-r--r--  1 root root 4108960 2011-09-13 18:00 vmlinuz-2.6.32-34-server
-rw-r--r--  1 root root 4111040 2011-10-11 11:10 vmlinuz-2.6.32-35-server

I was able to find the old kernel packages like so:

phrogz@planar:/boot$ dpkg -l | grep linux-image
ii  linux-image-2.6.32-30-server  2.6.32-30.59  Linux kernel image for version 2.6.32 on x86
ii  linux-image-2.6.32-31-server  2.6.32-31.61  Linux kernel image for version 2.6.32 on x86
ii  linux-image-2.6.32-32-server  2.6.32-32.62  Linux kernel image for version 2.6.32 on x86
ii  linux-image-2.6.32-33-server  2.6.32-33.72  Linux kernel image for version 2.6.32 on x86
ii  linux-image-2.6.32-34-server  2.6.32-34.77  Linux kernel image for version 2.6.32 on x86
iF  linux-image-2.6.32-35-server  2.6.32-35.78  Linux kernel image for version 2.6.32 on x86
iU  linux-image-server            2.6.32.36.42  Linux kernel image on Server Equipment.

…and I can see that many of them are older than my current image:

phrogz@planar:/boot$ uname -a
Linux planar 2.6.32-34-server #77-Ubuntu SMP Tue Sep 13 20:54:38 UTC 2011 x86_64 GNU/Linux

However, I can't actually remove them due to an unmet dependency:

phrogz@planar:/boot$ sudo apt-get --purge remove linux-image-2.6.32-30-server
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-2.6.32-36-server but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

But I can't fix the dependency (presumably due to low disk space):

phrogz@planar:/boot$ 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:
  liblcms1 linux-headers-2.6.32-32-server libnspr4-0d linux-headers-2.6.32-33-server linux-headers-2.6.32-32
  linux-headers-2.6.32-33 linux-headers-2.6.32-34 libcups2 tzdata-java libjpeg62 linux-headers-2.6.32-34-server libavahi-client3
  ca-certificates-java libnss3-1d
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  linux-image-2.6.32-36-server
Suggested packages:
  fdutils linux-doc-2.6.32 linux-source-2.6.32 linux-tools
The following NEW packages will be installed:
  linux-image-2.6.32-36-server
0 upgraded, 1 newly installed, 0 to remove and 8 not upgraded.
3 not fully installed or removed.
Need to get 0B/31.8MB of archives.
After this operation, 128MB of additional disk space will be used.
Do you want to continue [Y/n]? 
(Reading database ... 145200 files and directories currently installed.)
Unpacking linux-image-2.6.32-36-server (from .../linux-image-2.6.32-36-server_2.6.32-36.79_amd64.deb) ...
Done.
dpkg: error processing /var/cache/apt/archives/linux-image-2.6.32-36-server_2.6.32-36.79_amd64.deb (--unpack):
 failed in buffer_write(fd) (10, ret=-1): backend dpkg-deb during `./boot/vmlinuz-2.6.32-36-server': No space left on device
dpkg-deb: subprocess paste killed by signal (Broken pipe)
Running postrm hook script /usr/sbin/update-grub.
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.32-35-server
Found linux image: /boot/vmlinuz-2.6.32-34-server
Found initrd image: /boot/initrd.img-2.6.32-34-server
Found linux image: /boot/vmlinuz-2.6.32-33-server
Found initrd image: /boot/initrd.img-2.6.32-33-server
Found linux image: /boot/vmlinuz-2.6.32-32-server
Found initrd image: /boot/initrd.img-2.6.32-32-server
Found linux image: /boot/vmlinuz-2.6.32-31-server
Found initrd image: /boot/initrd.img-2.6.32-31-server
Found linux image: /boot/vmlinuz-2.6.32-30-server
Found initrd image: /boot/initrd.img-2.6.32-30-server
Found memtest86+ image: /memtest86+.bin
done
Errors were encountered while processing:
 /var/cache/apt/archives/linux-image-2.6.32-36-server_2.6.32-36.79_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

How do I free up space on /boot so that I can fix my dependencies? Should I just delete the files manually?

And then, should I resize my /boot to be larger, so this doesn't happen again? If so, how? If not, what maintenance should I be running regularly to prevent the accumulation of this cruft?

share|improve this question

marked as duplicate by jrg Jun 1 '12 at 13:22

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.

3 Answers

Thank you for your detailed post of your problem, this got me going in the right direction. Although it is useful to keep previous kernel files you can remove all of them in one go, check this post:
How to Remove All Unused Linux Kernel Headers, Images and Modules

Done via command line. If you are doing this via remote use something like WINSCP to open a terminal session and just paste it in, works very well.

Here it is copied from article link, I suggest you read the full article:

dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge
share|improve this answer

I was able to fix the problem by using dpkg to remove the packages directly. Although the packages are still listed in dpkg -l, the files are removed from /boot, freeing up space.

phrogz@planar:/boot$ sudo dpkg --remove linux-image-2.6.32-30-server
(Reading database ... 145199 files and directories currently installed.)
Removing linux-image-2.6.32-30-server ...
Running postrm hook script /usr/sbin/update-grub.
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.32-35-server
Found linux image: /boot/vmlinuz-2.6.32-34-server
Found initrd image: /boot/initrd.img-2.6.32-34-server
Found linux image: /boot/vmlinuz-2.6.32-33-server
Found initrd image: /boot/initrd.img-2.6.32-33-server
Found linux image: /boot/vmlinuz-2.6.32-32-server
Found initrd image: /boot/initrd.img-2.6.32-32-server
Found linux image: /boot/vmlinuz-2.6.32-31-server
Found initrd image: /boot/initrd.img-2.6.32-31-server
Found memtest86+ image: /memtest86+.bin
done

# Repeat for kernels -31 and -32 and -33, up to (but not including)
# the version listed by `uname -a`

After this, apt-get -f install fixed my dependency problems, and all was well with the world.

I'll not be accepting this answer of mine, however, as I still need to know if I should be increasing my /boot size or doing something else.

share|improve this answer
You should either not have a separate /boot partition in the first place, or you should increase its size as 100mb is too small. – psusi Dec 4 '11 at 4:07

I suggest to

  • move some of the huge files in /boot relative to older kernel to some other partition,

  • fix the problem,

  • put back the files in their place,

  • remove old and unused kernel (keeping the newer two is enough)

I do not suggest to increase /boot, but check regularly the space on it and remove old kernel when not needed.

share|improve this answer
1  
You suggest to: fix the problem ? Well he asks how to ... – WitchCraft Aug 4 '12 at 13:03

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