2

I am using Ubuntu 12.04 LTS and whenever I use:

sudo apt-get remove
sudo apt-get install

it replies:

cp: failed to extend `/boot/initrd.img-3.5.0-47-generic.dpkg-bak': No space left on device
dpkg: error processing initramfs-tools (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 initramfs-tools
E: Sub-process /usr/bin/dpkg returned an error code (1)

Is this right?

Is it installing/removing?

The reply for:

sudo apt-get install -f 

is:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up initramfs-tools (0.99ubuntu13.4) ...
update-initramfs: deferring update (trigger activated)
Processing triggers for initramfs-tools ...
ln: failed to create hard link `/boot/initrd.img-3.5.0-47-generic.dpkg-bak' => `/boot/initrd.img-3.5.0-47-generic': Operation not permitted
cp: writing `/boot/initrd.img-3.5.0-47-generic.dpkg-bak': No space left on device
cp: failed to extend `/boot/initrd.img-3.5.0-47-generic.dpkg-bak': No space left on device
dpkg: error processing initramfs-tools (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 initramfs-tools
E: Sub-process /usr/bin/dpkg returned an error code (1)
techraf
  • 3,316
Jatttt
  • 2,327
  • 12
  • 32
  • 43

2 Answers2

3

Your errors said:

No space left on device

Open System Monitor from Dash and select the Filesystems tab.

enter image description here

And if the problem is only related to /boot partition try this:

sudo apt-get autoremove

If it didn't work then It seems you have no space in /boot

You've a lot unused kernels. Remove all but the last kernels with:

sudo apt-get purge $(dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve "$(uname -r | sed -r 's/-[a-z]+//')")
kamil
  • 7,355
  • 7
  • 40
  • 61
1
cp: failed to extend `/boot/initrd.img-3.5.0-47-generic.dpkg-bak': No space left on device

You have to free up the /boot partition.Remove all the old unused kernals.

See How do I free up more space in /boot?

Avinash Raj
  • 78,556