Linux – No space left on device when upgrading Debian 7 to 8


I want to upgrade my Debian server from 7 to 8. It failed, and the error was :

dpkg: error processing archive /var/cache/apt/archives/linux-image-3.16.0-4-amd64_3.16.7-ckt11-1_amd64.deb (--unpack):
 cannot copy extracted data for './lib/modules/3.16.0-4-amd64/kernel/drivers/md/dm-cache-cleaner.ko' to '/lib/modules/3.16.0-4-amd64/kernel/drivers/md/dm-cache-cleaner.ko.dpkg-n
ew': failed to write (No space left on device)

I looked up with df -h my partitions :

Filesystem         Size  Used Avail Use% Mounted on
/dev/sda1          323M  203M  103M  67% /
udev                10M     0   10M   0% /dev
tmpfs              1.2G  232K  1.2G   1% /run
tmpfs              5.0M     0  5.0M   0% /run/lock
tmpfs              3.8G     0  3.8G   0% /run/shm
/dev/sda9           49G  180M   46G   1% /home
/dev/sda8          368M   11M  339M   3% /tmp
/dev/sda5          8.3G  778M  7.1G  10% /usr
/dev/sda6          2.8G  317M  2.4G  12% /var
/dev/cciss/c0d0p1  539G  4.9G  507G   1% /cache

So I saw my sda1 is kind of small, but I'm not sure. Could anyone tell me where is the problem and how can I make this upgrade?

Additional info:

The output of df -i

Filesystem          Inodes  IUsed    IFree IUse% Mounted on
/dev/sda1            85344   6598    78746    8% /
udev               1538700    403  1538297    1% /dev
tmpfs              1540254    333  1539921    1% /run
tmpfs              1540254      1  1540253    1% /run/lock
tmpfs              1540254      2  1540252    1% /run/shm
/dev/sda9          3235840     26  3235814    1% /home
/dev/sda8            97536     13    97523    1% /tmp
/dev/sda5           549440  29880   519560    6% /usr
/dev/sda6           183264   3328   179936    2% /var
/dev/cciss/c0d0p1 35840000 332679 35507321    1% /cache
none               1540254      2  1540252    1% /sys/fs/cgroup

I didn't reboot the server yet, and when I type cat /etc/issue I saw this machine is already in version 8, though it's not possible.

Thanks for Michael's help, this is what I got by apt-get upgrade:

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-amd64 : Depends: linux-image-3.16.0-4-amd64 but it is not installed
E: Unmet dependencies. Try using -f.

And when I ran apt-get -f install, it came back to the same error "No space left on device".

Best Answer

You need about 160MB free on /lib to install a new kernel including the modules; you only have about 100MB free. dpkg removes any partially-installed stuff while cleaning up in such cases.

Related Question