0

sudo apt-get purge linux-image-x.x.x-x-generic does not work

Unable to install anything as in synaptics, because there is no space on boot.

I get a message that boot has 0 bytes available.

After reading certain posts about this, I tried removing some of the old kernels, but each time I try, I get an error message saying that I should run apt-get -f install

When I try to run that, it says, I don't have enough space to run that command:

userone@userone:~$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED
  linux-image-extra-4.4.0-98-generic
0 to upgrade, 0 to newly install, 1 to remove and 28 not to upgrade.
3 not fully installed or removed.
After this operation, 153 MB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 476523 files and directories currently installed.)
Removing linux-image-extra-4.4.0-98-generic (4.4.0-98.121) ...
depmod: FATAL: could not load /boot/System.map-4.4.0-98-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-98-generic /boot/vmlinuz-4.4.0-98-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-98-generic /boot/vmlinuz-4.4.0-98-generic
Error! Your kernel headers for kernel 4.4.0-98-generic cannot be found.
Please install the linux-headers-4.4.0-98-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
Error! Your kernel headers for kernel 4.4.0-98-generic cannot be found.
Please install the linux-headers-4.4.0-98-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
Error! Your kernel headers for kernel 4.4.0-98-generic cannot be found.
Please install the linux-headers-4.4.0-98-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-98-generic /boot/vmlinuz-4.4.0-98-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-98-generic
WARNING: missing /lib/modules/4.4.0-98-generic
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/4.4.0-98-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_sLktUc/lib/modules/4.4.0-98-generic/modules.order: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_sLktUc/lib/modules/4.4.0-98-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-4.4.0-98-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-extra-4.4.0-98-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
 linux-image-extra-4.4.0-98-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
userone@userone:~$ ×

Any idea how to fix this issue?

oshirowanen
  • 3,977
  • I have tried those solutions, they do not work as there is no space. – oshirowanen Nov 05 '17 at 18:21
  • Really, the root of your problem is that you made /boot too small. IMO this is a common problem and with the sheer size of modern hard drives is silly. SO, IMHO, the fix is to boot a live usb and make /boot larger. You will have to manually delete file in /boot, but you are probably best to boot to recovery mode, move some kernels to /root, remove old ones, and restore from /root and then remove the rest. – Panther Nov 05 '17 at 18:25
  • You also have broken packages as they are partially removed. You are going to have to follow - http://blog.bodhizazen.com/linux/apt-get-how-to-fix-very-broken-packages/ – Panther Nov 05 '17 at 18:29
  • Please provide the output from these commands: ‘df -h’ and ‘ls /boot’. You have to free some space before ‘apt-get -f install’. – Evgeniy Yanuk Nov 05 '17 at 18:49

0 Answers0