0

I am getting out of space warnings when I try run and apt-get upgrade. I am running ubuntu server 14.04 in a virtual machine (virtual box) with a virtual hard drive of 10GB.

It is a very small machine only running bind9 on my local network so strange that it has already run out of space.

If I list the disk space it shows plenty of free space:

df -h
Filesystem                      Size  Used Avail Use% Mounted on
/dev/mapper/ubuntudns--vg-root  8.5G  4.0G  4.2G  49% /
none                            4.0K     0  4.0K   0% /sys/fs/cgroup
udev                            2.3G  4.0K  2.3G   1% /dev
tmpfs                           462M  456K  461M   1% /run
none                            5.0M     0  5.0M   0% /run/lock
none                            2.3G     0  2.3G   0% /run/shm
none                            100M     0  100M   0% /run/user
/dev/sda1                       236M  236M     0 100% /boot

My system uses LVM, which to be honest I don't 100% understand. This info may help:

sudo vgdisplay
--- Volume group ---
VG Name               ubuntudns-vg
System ID
Format                lvm2
Metadata Areas        1
Metadata Sequence No  3
VG Access             read/write
VG Status             resizable
MAX LV                0
Cur LV                2
Open LV               2
Max PV                0
Cur PV                1
Act PV                1
VG Size               9.76 GiB
PE Size               4.00 MiB
Total PE              2498
Alloc PE / Size       2498 / 9.76 GiB
Free  PE / Size       0 / 0
VG UUID               aax4CX-stxG-jcxV-s2fB-RQxf-43xe-u7Su89


sudo lvdisplay
--- Logical volume ---
LV Path                /dev/ubuntudns-vg/root
LV Name                root
VG Name                ubuntudns-vg
LV UUID                J5OD7h-CdmU-BQ4X-FOIv-0dqu-coeI-y8yvKq
LV Write Access        read/write
LV Creation host, time ubuntudns, 2015-09-17 18:20:27 +0200
LV Status              available
# open                 1
LV Size                8.76 GiB
Current LE             2242
Segments               1
Allocation             inherit
Read ahead sectors     auto
- currently set to     256
Block device           252:0

--- Logical volume ---
LV Path                /dev/ubuntudns-vg/swap_1
LV Name                swap_1
VG Name                ubuntudns-vg
LV UUID                ed2Wcu-u94R-RGYO-pNx7-Dqjt-3dgO-skT9AP
LV Write Access        read/write
LV Creation host, time ubuntudns, 2015-09-17 18:20:27 +0200
LV Status              available
# open                 2
LV Size                1.00 GiB
Current LE             256
Segments               1
Allocation             inherit
Read ahead sectors     auto
- currently set to     256
Block device           252:1

I have read a number of posts trying to figure this out but really not winning.

Any help would be greatly appreciated :)

1
  • 2
    Seems a duplicate of askubuntu.com/questions/89710/… --- check for example my answer there to get space in a very safe way way (anyway, you have a very small /boot partition there).
    – Rmano
    Commented Dec 24, 2015 at 12:50

4 Answers 4

3

Your /boot is full, look

/dev/sda1  236M  236M     0 100% /boot

That is tiny, you might want to expand this later, but to clear some space now, you can run

sudo apt-get autoremove

This should remove any old kernels and any useless packages (thanks @dan in comments for suggesting autoremove) on use

You could also build a purge command for this, but I don't know what kernels you have, so some thing like

sudo apt-get purge linux-image-2.6.32-22-generic

Replacing linux-image-2.6.32-22-generic with the kernel to remove, see all installed kernels with

dpkg --list | grep linux-image

or you can open nautilus as root

gksu nautilus

Browse to /boot and remove any old kernels in here, DO NOT remove the one you are using, to find the current kernel you are using run

uname -a
5
  • Is it safe to just delete the files there? Usually when running apt-get autoremove to remove old kernels, apt does quite some stuff in order to remove them. There are even more configurations that used to happen during the uninstall, when I had the proprietary nvidia drivers installed.
    – Dan
    Commented Dec 24, 2015 at 10:02
  • Should be fine for old kernels but autoremove is a solid point, mind if I add that in?
    – Mark Kirby
    Commented Dec 24, 2015 at 10:04
  • 1
    Of course, go ahead
    – Dan
    Commented Dec 24, 2015 at 10:05
  • @Dan I gave you some upvotes for this info, just in case you wondered where they suddenly came from :)
    – Mark Kirby
    Commented Dec 24, 2015 at 10:11
  • Thanks for your quick response! I will clean out the /boot partition and expand it to something more sensible :) Commented Dec 26, 2015 at 9:11
3

The important part is the /boot partition. As you can see, it's completely full:

/dev/sda1                       236M  236M     0 100% /boot

To free up space from /boot folder please delete older kernels that are still installed.

To find out about the kernels installed in your system, use the command:

cd /boot && ls | grep generic

OR

dpkg --list | grep linux-image | awk '/ii/ {print $2}'

And to find your current active kernel version, type:

uname -r

After you have found out about your active and older kernel versions, you can remove the older ones by typing:

sudo apt-get remove --purge linux-image-yourolderkernelversion* && sudo apt-get autoremove && sudo apt-get autoclean && sudo apt-get clean

For example:

sudo apt-get remove --purge linux-image-3.19.0-32* && sudo apt-get autoremove && sudo apt-get autoclean && sudo apt-get clean

After everything's done please reboot your system.

1

Sometimes it helps to clean apt's cache of previously downloaded files. Run

sudo apt-get clean

from command line. After that, try

sudo apt-get update
sudo apt-get upgrade

again.

0
1

When you launch sudo apt-get upgrade new kernel images and headers shall be downloaded and installed but your /boot partition is full:

/dev/sda1                       236M  236M     0 100% /boot

You need to remove your old kernel images and headers to free it up but sudo apt-get autoremove might not work in this case.

This command is to show all kernels and headers that can be removed, excluding the current running kernel:

dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve "$(uname -r | sed -r 's/-[a-z]+//')"

You can safely remove them all by the command:

sudo apt-get purge $(dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve "$(uname -r | sed -r 's/-[a-z]+//')")

Finally, you may need to reboot your system.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .