Sunday, November 17, 2013

Ubuntu Update Error - Disk Is Full ?

My last Software Update didn't go well and something got broken. Afterwards I had a nice little red mark on the top bar on my Desktop saying that the Update was unsuccessful. No matter how many times I tried to re-run the upgrade it didn't work.

sudo apt-get update

Returned that there are is a broken package and I should run apt-get -f install to repair broken packages.

Trying the command as per suggested in the terminal window gave the following result:

nargren@T808:~$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
  linux-headers-3.2.0-56
The following NEW packages will be installed
  linux-headers-3.2.0-56
0 upgraded, 1 newly installed, 0 to remove and 14 not upgraded.
3 not fully installed or removed.
Need to get 0 B/11.7 MB of archives.
After this operation, 56.3 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
(Reading database ... 803914 files and directories currently installed.)
Unpacking linux-headers-3.2.0-56 (from .../linux-headers-3.2.0-56_3.2.0-56.86_all.deb) ...
dpkg: error processing /var/cache/apt/archives/linux-headers-3.2.0-56_3.2.0-56.86_all.deb (--unpack):
 unable to create `/usr/src/linux-headers-3.2.0-56/arch/parisc/include/asm/superio.h.dpkg-new' (while processing `./usr/src/linux-headers-3.2.0-56/arch/parisc/include/asm/superio.h'): 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)
Errors were encountered while processing:
 /var/cache/apt/archives/linux-headers-3.2.0-56_3.2.0-56.86_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Saying that there is no space left on the device made me check my disk partitions.

nargren@T808:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda2        14G   11G  2.3G  84% /
udev            489M  4.0K  489M   1% /dev
tmpfs           199M  980K  198M   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            497M  224K  496M   1% /run/shm
/dev/sda3        58G   30G   25G  55% /home

It showed that there is plenty of space. Looking for further advice on my issue I stumbled upon this post on superb.com. Although the issue was not much related to my problem, I could use the techniques described there.

Using the command

for i in /*; do echo $i; find $i | wc -l; done

What this does is it counts the number of files in the root (/*) directory. Once it finishes (can take some time) run it again on the directory that had most f the files in it. To do so simply change the "/*" part of the code. So for example if your /usr directory contained the most of the files, then it would be 

for i in /usr/*; do echo $i; find $i | wc -l; done

(Please not that this command can take a while to run, be patient)

I found that for me the /usr directory was overcrowded with files, 786000 to be exact. Most of this was occupied by the /usr/src sub-directory. After some more searching and research, turns out this holds the different kernel header files.

Since it is not advised to manually remove these files, I checked quickly what kernel I'm using, just to know what to leave intact.

nargren@T808:~$ uname -a
Linux T808 3.2.0-56-generic-pae #86-Ubuntu SMP Wed Oct 23 17:51:27 UTC 2013 i686 i686 i386 GNU/Linux

Afterwards I opened synaptic manager and marked all kernel files up until 3.2.0-49 for removal (left the last few, just to be on the safe side).

You can open the synaptic manager either from the Dash (Windows button) or with
sudo synaptic






After this, the error message was gone, my kernel wasn't damaged and had been updated successfully.

No comments:

Post a Comment