2

I am a new Ubuntu user, so please have patience.

It all started when my /root partition became full. It was obviously too small and I will have to resize. I tried to remove kernels using Synaptic and various commands in the Terminal without success. This is latest output:

$ dpkg --list | grep linux-image
ii  linux-image-3.16.0-30-generic                               3.16.0-30.40~14.04.1                                amd64        Linux kernel image for version 3.16.0 on 64 bit x86 SMP
ii  linux-image-3.16.0-36-generic                               3.16.0-36.48~14.04.1                                amd64        Linux kernel image for version 3.16.0 on 64 bit x86 SMP
ii  linux-image-3.16.0-37-generic                               3.16.0-37.51~14.04.1                                amd64        Linux kernel image for version 3.16.0 on 64 bit x86 SMP
ii  linux-image-3.16.0-38-generic                               3.16.0-38.52~14.04.1                                amd64        Linux kernel image for version 3.16.0 on 64 bit x86 SMP
ii  linux-image-3.16.0-40-generic                               3.16.0-40.54~14.04.1                                amd64        Linux kernel image for version 3.16.0 on 64 bit x86 SMP
ii  linux-image-extra-3.16.0-30-generic                         3.16.0-30.40~14.04.1                                amd64        Linux kernel extra modules for version 3.16.0 on 64 bit x86 SMP
ii  linux-image-extra-3.16.0-36-generic                         3.16.0-36.48~14.04.1                                amd64        Linux kernel extra modules for version 3.16.0 on 64 bit x86 SMP
ii  linux-image-extra-3.16.0-37-generic                         3.16.0-37.51~14.04.1                                amd64        Linux kernel extra modules for version 3.16.0 on 64 bit x86 SMP
ii  linux-image-extra-3.16.0-38-generic                         3.16.0-38.52~14.04.1                                amd64        Linux kernel extra modules for version 3.16.0 on 64 bit x86 SMP
iF  linux-image-extra-3.16.0-40-generic                         3.16.0-40.54~14.04.1                                amd64        Linux kernel extra modules for version 3.16.0 on 64 bit x86 SMP
rH  linux-image-extra-3.16.0-41-generic                         3.16.0-41.55~14.04.1                                amd64        Linux kernel extra modules for version 3.16.0 on 64 bit x86 SMP

$ sudo apt-get purge linux-image-extra-3.16.0.30-generic
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'linux-image-extra-3.16.0-30-generic' for regex 'linux-image-extra-3.16.0.30-generic'
The following packages were automatically installed and are no longer required:
  account-plugin-windows-live cabextract kde-l10n-engb libllvm3.4 libupstart1
  linux-headers-generic-lts-utopic smplayer-translations
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
  linux-image-extra-3.16.0-30-generic* linux-image-extra-3.16.0-41-generic
  linux-signed-image-3.16.0-30-generic*
0 upgraded, 0 newly installed, 3 to remove and 44 not upgraded.
3 not fully installed or removed.
After this operation, 313 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 371721 files and directories currently installed.)
Removing linux-image-extra-3.16.0-41-generic (3.16.0-41.55~14.04.1) ...
depmod: FATAL: could not load /boot/System.map-3.16.0-41-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 3.16.0-41-generic /boot/vmlinuz-3.16.0-41-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.16.0-41-generic /boot/vmlinuz-3.16.0-41-generic
update-initramfs: Generating /boot/initrd.img-3.16.0-41-generic
grep: /boot/config-3.16.0-41-generic: No such file or directory
depmod: WARNING: could not open /tmp/mkinitramfs_n4g54n/lib/modules/3.16.0-41-generic/modules.order: No such file or directory
depmod: WARNING: could not open /tmp/mkinitramfs_n4g54n/lib/modules/3.16.0-41-generic/modules.builtin: No such file or directory

gzip: stdout: No space left on device
E: mkinitramfs failure cpio 141 gzip 1
update-initramfs: failed for /boot/initrd.img-3.16.0-41-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-extra-3.16.0-41-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
 linux-image-extra-3.16.0-41-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

The kernel currently in use is 3.16.0.40.

Help will be appreciated!

The results of df -h is:

$ df -h
Filesystem                   Size  Used Avail Use% Mounted on
/dev/mapper/ubuntu--vg-root  454G   53G  378G  13% /
none                         4,0K     0  4,0K   0% /sys/fs/cgroup
udev                         1,9G  4,0K  1,9G   1% /dev
tmpfs                        385M  1,2M  384M   1% /run
none                         5,0M     0  5,0M   0% /run/lock
none                         1,9G  268K  1,9G   1% /run/shm
none                         100M   36K  100M   1% /run/user
/dev/sda2                    237M  231M     0 100% /boot
/dev/sda1                    511M  3,4M  508M   1% /boot/efi
/home/danie/.Private         454G   53G  378G  13% /home/danie
muru
  • 197,895
  • 55
  • 485
  • 740
Danie
  • 21
  • 4
  • Add the output of df -h, please. – muru Jun 22 '15 at 03:03
  • Filesystem Size Used Avail Use% Mounted on /dev/mapper/ubuntu--vg-root 454G 53G 378G 13% / none 4,0K 0 4,0K 0% /sys/fs/cgroup udev 1,9G 4,0K 1,9G 1% /dev tmpfs 385M 1,2M 384M 1% /run none 5,0M 0 5,0M 0% /run/lock none 1,9G 268K 1,9G 1% /run/shm none 100M 36K 100M 1% /run/user /dev/sda2 237M 231M 0 100% /boot /dev/sda1 511M 3,4M 508M 1% /boot/efi /home/danie/.Private 454G 53G 378G 13% /home/danie – Danie Jun 22 '15 at 03:15
  • Please [edit] your post to add more information. – muru Jun 22 '15 at 03:16
  • @muru I have done the edit.. – Danie Jun 22 '15 at 03:27
  • http://askubuntu.com/questions/401581/bash-one-liner-to-delete-only-old-kernels – aldwinaldwin Jun 22 '15 at 08:08

1 Answers1

2

As part of the removal process apt-get tries to unzip a file to find out which exactly files it should remove. However because you don't have any space on the device apt-get can't do that and can't free up more space.

I suggest you move a few big files from your root filesystem to another filesystem (or to a USB stick or whatever), try sudo apt-get autoremove --purge and then move these big files back.

sмurf
  • 4,680