Apt autoremove failed to fully uninstall old kernels, now they block apt-get
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgO9GURib1T8z7lCwjOGLQaGtrueEthgQ8LO42ZX8cOfTqDK4jvDDpKkLFwf2J49kYCMNW7d4ABih_XCb_2UXdq5fPJDkoyg7-8g_YfRUot-XnaXkNYycsNp7lA5_TW9td0FFpLQ2APzKcZ/s1600/1.jpg)
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYQ0N5W1qAOxLP7t7iOM6O6AzbZnkXUy16s7P_CWfOb5UbTQY_aDsc727chyphenhyphen5W4IppVNernMMQeaUFTB_rFzAd95_CDt-tnwN-nBx6JyUp2duGjPaL5-VgNO41AVsA_vu30EJcipdDG409/s400/Clash+Royale+CLAN+TAG%2523URR8PPP.png)
up vote
1
down vote
favorite
I was trying to remove some old linux-kernels by using sudo apt autoremove
as suggest by apt-get upgrade
. However the autoremoval was unsuccessful. Now, trying to remove an old kernel yields sudo apt remove linux-image-extra-4.4.0-112-generic
:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
linux-image-extra-4.4.0-112-generic linux-image-extra-4.4.0-116-generic
linux-image-extra-4.4.0-119-generic linux-image-extra-4.4.0-121-generic
linux-image-extra-4.4.0-122-generic
0 upgraded, 0 newly installed, 5 to remove and 29 not upgraded.
5 not fully installed or removed.
After this operation, 774 MB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 363205 files and directories currently installed.)
Removing linux-image-extra-4.4.0-112-generic (4.4.0-112.135) ...
depmod: FATAL: could not load /boot/System.map-4.4.0-112-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-112- generic /boot/vmlinuz-4.4.0-112-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-112-generic /boot/vmlinuz-4.4.0-112-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-112- generic /boot/vmlinuz-4.4.0-112-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-112-generic
mktemp: failed to create directory via template âÂÂ/var/tmp/mkinitramfs_XXXXXXâÂÂ: No such file or directory
update-initramfs: failed for /boot/initrd.img-4.4.0-112-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-112-generic (-- remove):
subprocess installed post-removal script returned error exit status 1
Removing linux-image-extra-4.4.0-116-generic (4.4.0-116.140) ...
depmod: FATAL: could not load /boot/System.map-4.4.0-116-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-116- generic /boot/vmlinuz-4.4.0-116-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-116-generic /boot/vmlinuz-4.4.0-116-generic
Error! Your kernel headers for kernel 4.4.0-116-generic cannot be found.
Please install the linux-headers-4.4.0-116-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
Error! Your kernel headers for kernel 4.4.0-116-generic cannot be found.
Please install the linux-headers-4.4.0-116-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-116- generic /boot/vmlinuz-4.4.0-116-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-116-generic
WARNING: missing /lib/modules/4.4.0-116-generic
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/4.4.0-116-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
mktemp: failed to create directory via template âÂÂ/var/tmp/mkinitramfs_XXXXXXâÂÂ: No such file or directory
update-initramfs: failed for /boot/initrd.img-4.4.0-116-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-116-generic (--remove):
subprocess installed post-removal script returned error exit status 1
Removing linux-image-extra-4.4.0-119-generic (4.4.0-119.143) ...
depmod: FATAL: could not load /boot/System.map-4.4.0-119-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-119- generic /boot/vmlinuz-4.4.0-119-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-119-generic /boot/vmlinuz-4.4.0-119-generic
Error! Your kernel headers for kernel 4.4.0-119-generic cannot be found.
Please install the linux-headers-4.4.0-119-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
Error! Your kernel headers for kernel 4.4.0-119-generic cannot be found.
Please install the linux-headers-4.4.0-119-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-119- generic /boot/vmlinuz-4.4.0-119-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-119-generic
WARNING: missing /lib/modules/4.4.0-119-generic
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/4.4.0-119-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
mktemp: failed to create directory via template âÂÂ/var/tmp/mkinitramfs_XXXXXXâÂÂ: No such file or directory
update-initramfs: failed for /boot/initrd.img-4.4.0-119-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-119-generic (-- remove):
subprocess installed post-removal script returned error exit status 1
Removing linux-image-extra-4.4.0-121-generic (4.4.0-121.145) ...
depmod: FATAL: could not load /boot/System.map-4.4.0-121-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-121- generic /boot/vmlinuz-4.4.0-121-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-121-generic /boot/vmlinuz-4.4.0-121-generic
Error! Your kernel headers for kernel 4.4.0-121-generic cannot be found.
Please install the linux-headers-4.4.0-121-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
Error! Your kernel headers for kernel 4.4.0-121-generic cannot be found.
Please install the linux-headers-4.4.0-121-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-121- generic /boot/vmlinuz-4.4.0-121-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-121-generic
WARNING: missing /lib/modules/4.4.0-121-generic
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/4.4.0-121-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
mktemp: failed to create directory via template âÂÂ/var/tmp/mkinitramfs_XXXXXXâÂÂ: No such file or directory
update-initramfs: failed for /boot/initrd.img-4.4.0-121-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-121-generic (-- remove):
subprocess installed post-removal script returned error exit status 1
No apport report written because MaxReports is reached already
Removing linux- image-extra-4.4.0-122-generic (4.4.0-122.146) ...
depmod: FATAL: could not load /boot/System.map-4.4.0-122-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-122-generic /boot/vmlinuz-4.4.0-122-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-122-generic /boot/vmlinuz-4.4.0-122-generic
Error! Your kernel headers for kernel 4.4.0-122-generic cannot be found.
Please install the linux-headers-4.4.0-122-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
Error! Your kernel headers for kernel 4.4.0-122-generic cannot be found.
Please install the linux-headers-4.4.0-122-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-122- generic /boot/vmlinuz-4.4.0-122-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-122-generic
WARNING: missing /lib/modules/4.4.0-122-generic
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/4.4.0-122-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
mktemp: failed to create directory via template âÂÂ/var/tmp/mkinitramfs_XXXXXXâÂÂ: No such file or directory
update-initramfs: failed for /boot/initrd.img-4.4.0-122-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-122-generic (--remove):
subprocess installed post-removal script returned error exit status 1
No apport report written because MaxReports is reached already
Errors were encountered while processing:
linux-image-extra-4.4.0-112-generic
linux-image-extra-4.4.0-116-generic
linux-image-extra-4.4.0-119-generic
linux-image-extra-4.4.0-121-generic
linux-image-extra-4.4.0-122-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
The fact that the first package does not print the error message "Please install the linux-headers-..." is because I installed the -112 headers manually via sudo dpkg -i linux-headers-4.4.0-112-generic_4.4.0-112.135_amd64.deb
as a test. Otherwise, the error message would be the same for all packages.
I would be very glad for any input on this situation.
P.S: There are related problems here and here, but there the removal was inhibited by dkms packages and lack of space, respectively, which do not seem to apply here.
EDIT 1: As requested, some more diagnosis. df
:
Filesystem 1K-blocks Used Available Use% Mounted on
udev 16403560 0 16403560 0% /dev
tmpfs 3285556 9988 3275568 1% /run
/dev/nvme0n1p6 20027260 15318552 3668324 81% /
tmpfs 16427776 31132 16396644 1% /dev/shm
tmpfs 5120 4 5116 1% /run/lock
tmpfs 16427776 0 16427776 0% /sys/fs/cgroup
/dev/nvme0n1p7 269994584 82741016 173515584 33% /home
/dev/nvme0n1p2 98304 28796 69508 30% /boot/efi
/dev/sda1 1953513540 166939096 1786574444 9% /windows
tmpfs 3285556 8 3285548 1% /run/user/108
tmpfs 3285556 48 3285508 1% /run/user/1000
/dev/nvme0n1p8 86410236 99712 86310524 1% /media/**/SSD Share
df -i
:
Filesystem Inodes IUsed IFree IUse% Mounted on
udev 4100890 652 4100238 1% /dev
tmpfs 4106944 958 4105986 1% /run
/dev/nvme0n1p6 1281120 412841 868279 33% /
tmpfs 4106944 211 4106733 1% /dev/shm
tmpfs 4106944 5 4106939 1% /run/lock
tmpfs 4106944 16 4106928 1% /sys/fs/cgroup
/dev/nvme0n1p7 17154048 1441660 15712388 9% /home
/dev/nvme0n1p2 0 0 0 - /boot/efi
/dev/sda1 1786771052 194329 1786576723 1% /windows
tmpfs 4106944 13 4106931 1% /run/user/108
tmpfs 4106944 29 4106915 1% /run/user/1000
/dev/nvme0n1p8 86376060 44 86376016 1% /media/**/SSD Share
dpkg -l | grep linux-image
:
rc linux-image-4.4.0-101-generic 4.4.0-101.124 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-103-generic 4.4.0-103.126 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-104-generic 4.4.0-104.127 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-108-generic 4.4.0-108.131 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-109-generic 4.4.0-109.132 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii linux-image-4.4.0-124-generic 4.4.0-124.148 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii linux-image-4.4.0-127-generic 4.4.0-127.153 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-31-generic 4.4.0-31.50 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-47-generic 4.4.0-47.68 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-51-generic 4.4.0-51.72 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-53-generic 4.4.0-53.74 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-57-generic 4.4.0-57.78 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-59-generic 4.4.0-59.80 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-62-generic 4.4.0-62.83 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-63-generic 4.4.0-63.84 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-64-generic 4.4.0-64.85 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-66-generic 4.4.0-66.87 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-70-generic 4.4.0-70.91 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-71-generic 4.4.0-71.92 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-72-generic 4.4.0-72.93 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-75-generic 4.4.0-75.96 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-78-generic 4.4.0-78.99 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-79-generic 4.4.0-79.100 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-81-generic 4.4.0-81.104 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-83-generic 4.4.0-83.106 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-87-generic 4.4.0-87.110 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-89-generic 4.4.0-89.112 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-91-generic 4.4.0-91.114 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-93-generic 4.4.0-93.116 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-96-generic 4.4.0-96.119 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-97-generic 4.4.0-97.120 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-98-generic 4.4.0-98.121 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-101-generic 4.4.0-101.124 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-103-generic 4.4.0-103.126 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-104-generic 4.4.0-104.127 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-108-generic 4.4.0-108.131 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-109-generic 4.4.0-109.132 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rH linux-image-extra-4.4.0-112-generic 4.4.0-112.135 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rH linux-image-extra-4.4.0-116-generic 4.4.0-116.140 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rH linux-image-extra-4.4.0-119-generic 4.4.0-119.143 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rH linux-image-extra-4.4.0-121-generic 4.4.0-121.145 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rH linux-image-extra-4.4.0-122-generic 4.4.0-122.146 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii linux-image-extra-4.4.0-124-generic 4.4.0-124.148 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii linux-image-extra-4.4.0-127-generic 4.4.0-127.153 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-31-generic 4.4.0-31.50 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-47-generic 4.4.0-47.68 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-51-generic 4.4.0-51.72 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-53-generic 4.4.0-53.74 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-57-generic 4.4.0-57.78 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-59-generic 4.4.0-59.80 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-62-generic 4.4.0-62.83 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-63-generic 4.4.0-63.84 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-64-generic 4.4.0-64.85 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-66-generic 4.4.0-66.87 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-70-generic 4.4.0-70.91 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-71-generic 4.4.0-71.92 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-72-generic 4.4.0-72.93 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-75-generic 4.4.0-75.96 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-78-generic 4.4.0-78.99 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-79-generic 4.4.0-79.100 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-81-generic 4.4.0-81.104 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-83-generic 4.4.0-83.106 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-87-generic 4.4.0-87.110 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-89-generic 4.4.0-89.112 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-91-generic 4.4.0-91.114 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-93-generic 4.4.0-93.116 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-96-generic 4.4.0-96.119 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-97-generic 4.4.0-97.120 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-98-generic 4.4.0-98.121 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii linux-image-generic 4.4.0.127.133 amd64 Generic Linux kernel image
ls /boot
:
abi-4.4.0-124-generic memtest86+_multiboot.bin
abi-4.4.0-127-generic retpoline-4.4.0-124-generic
config-4.4.0-124-generic retpoline-4.4.0-127-generic
config-4.4.0-127-generic System.map-4.4.0-124-generic
efi System.map-4.4.0-127-generic
grub vmlinuz-4.4.0-124-generic
initrd.img-4.4.0-124-generic vmlinuz-4.4.0-124-generic.efi.signed
initrd.img-4.4.0-127-generic vmlinuz-4.4.0-127-generic
memtest86+.bin vmlinuz-4.4.0-127-generic.efi.signed
memtest86+.elf
For reference, my current kernel is uname -r
4.4.0-127-generic
postinst.d/intramfs-tools file:
#!/bin/sh -e
version="$1"
bootopt=""
[ -x /usr/sbin/update-initramfs ] || exit 0
# passing the kernel version is required
if [ -z "$version" ]; then
echo >&2 "W: initramfs-tools: $DPKG_MAINTSCRIPT_PACKAGE:-kernel package did not pass a version number"
exit 2
fi
# exit if kernel does not need an initramfs
if [ "$INITRD" = 'No' ]; then
exit 0
fi
# absolute file name of kernel image may be passed as a second argument;
# create the initrd in the same directory
if [ -n "$2" ]; then
bootdir=$(dirname "$2")
bootopt="-b $bootdir"
fi
# avoid running multiple times
if [ -n "$DEB_MAINT_PARAMS" ]; then
eval set -- "$DEB_MAINT_PARAMS"
if [ -z "$1" ] || [ "$1" != "configure" ]; then
exit 0
fi
fi
# we're good - create initramfs. update runs do_bootloader
INITRAMFS_TOOLS_KERNEL_HOOK=1 update-initramfs -c -t -k "$version" $bootopt >&2
apt package-management kernel initramfs linux-headers
 |Â
show 9 more comments
up vote
1
down vote
favorite
I was trying to remove some old linux-kernels by using sudo apt autoremove
as suggest by apt-get upgrade
. However the autoremoval was unsuccessful. Now, trying to remove an old kernel yields sudo apt remove linux-image-extra-4.4.0-112-generic
:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
linux-image-extra-4.4.0-112-generic linux-image-extra-4.4.0-116-generic
linux-image-extra-4.4.0-119-generic linux-image-extra-4.4.0-121-generic
linux-image-extra-4.4.0-122-generic
0 upgraded, 0 newly installed, 5 to remove and 29 not upgraded.
5 not fully installed or removed.
After this operation, 774 MB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 363205 files and directories currently installed.)
Removing linux-image-extra-4.4.0-112-generic (4.4.0-112.135) ...
depmod: FATAL: could not load /boot/System.map-4.4.0-112-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-112- generic /boot/vmlinuz-4.4.0-112-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-112-generic /boot/vmlinuz-4.4.0-112-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-112- generic /boot/vmlinuz-4.4.0-112-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-112-generic
mktemp: failed to create directory via template âÂÂ/var/tmp/mkinitramfs_XXXXXXâÂÂ: No such file or directory
update-initramfs: failed for /boot/initrd.img-4.4.0-112-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-112-generic (-- remove):
subprocess installed post-removal script returned error exit status 1
Removing linux-image-extra-4.4.0-116-generic (4.4.0-116.140) ...
depmod: FATAL: could not load /boot/System.map-4.4.0-116-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-116- generic /boot/vmlinuz-4.4.0-116-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-116-generic /boot/vmlinuz-4.4.0-116-generic
Error! Your kernel headers for kernel 4.4.0-116-generic cannot be found.
Please install the linux-headers-4.4.0-116-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
Error! Your kernel headers for kernel 4.4.0-116-generic cannot be found.
Please install the linux-headers-4.4.0-116-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-116- generic /boot/vmlinuz-4.4.0-116-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-116-generic
WARNING: missing /lib/modules/4.4.0-116-generic
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/4.4.0-116-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
mktemp: failed to create directory via template âÂÂ/var/tmp/mkinitramfs_XXXXXXâÂÂ: No such file or directory
update-initramfs: failed for /boot/initrd.img-4.4.0-116-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-116-generic (--remove):
subprocess installed post-removal script returned error exit status 1
Removing linux-image-extra-4.4.0-119-generic (4.4.0-119.143) ...
depmod: FATAL: could not load /boot/System.map-4.4.0-119-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-119- generic /boot/vmlinuz-4.4.0-119-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-119-generic /boot/vmlinuz-4.4.0-119-generic
Error! Your kernel headers for kernel 4.4.0-119-generic cannot be found.
Please install the linux-headers-4.4.0-119-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
Error! Your kernel headers for kernel 4.4.0-119-generic cannot be found.
Please install the linux-headers-4.4.0-119-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-119- generic /boot/vmlinuz-4.4.0-119-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-119-generic
WARNING: missing /lib/modules/4.4.0-119-generic
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/4.4.0-119-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
mktemp: failed to create directory via template âÂÂ/var/tmp/mkinitramfs_XXXXXXâÂÂ: No such file or directory
update-initramfs: failed for /boot/initrd.img-4.4.0-119-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-119-generic (-- remove):
subprocess installed post-removal script returned error exit status 1
Removing linux-image-extra-4.4.0-121-generic (4.4.0-121.145) ...
depmod: FATAL: could not load /boot/System.map-4.4.0-121-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-121- generic /boot/vmlinuz-4.4.0-121-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-121-generic /boot/vmlinuz-4.4.0-121-generic
Error! Your kernel headers for kernel 4.4.0-121-generic cannot be found.
Please install the linux-headers-4.4.0-121-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
Error! Your kernel headers for kernel 4.4.0-121-generic cannot be found.
Please install the linux-headers-4.4.0-121-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-121- generic /boot/vmlinuz-4.4.0-121-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-121-generic
WARNING: missing /lib/modules/4.4.0-121-generic
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/4.4.0-121-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
mktemp: failed to create directory via template âÂÂ/var/tmp/mkinitramfs_XXXXXXâÂÂ: No such file or directory
update-initramfs: failed for /boot/initrd.img-4.4.0-121-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-121-generic (-- remove):
subprocess installed post-removal script returned error exit status 1
No apport report written because MaxReports is reached already
Removing linux- image-extra-4.4.0-122-generic (4.4.0-122.146) ...
depmod: FATAL: could not load /boot/System.map-4.4.0-122-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-122-generic /boot/vmlinuz-4.4.0-122-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-122-generic /boot/vmlinuz-4.4.0-122-generic
Error! Your kernel headers for kernel 4.4.0-122-generic cannot be found.
Please install the linux-headers-4.4.0-122-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
Error! Your kernel headers for kernel 4.4.0-122-generic cannot be found.
Please install the linux-headers-4.4.0-122-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-122- generic /boot/vmlinuz-4.4.0-122-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-122-generic
WARNING: missing /lib/modules/4.4.0-122-generic
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/4.4.0-122-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
mktemp: failed to create directory via template âÂÂ/var/tmp/mkinitramfs_XXXXXXâÂÂ: No such file or directory
update-initramfs: failed for /boot/initrd.img-4.4.0-122-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-122-generic (--remove):
subprocess installed post-removal script returned error exit status 1
No apport report written because MaxReports is reached already
Errors were encountered while processing:
linux-image-extra-4.4.0-112-generic
linux-image-extra-4.4.0-116-generic
linux-image-extra-4.4.0-119-generic
linux-image-extra-4.4.0-121-generic
linux-image-extra-4.4.0-122-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
The fact that the first package does not print the error message "Please install the linux-headers-..." is because I installed the -112 headers manually via sudo dpkg -i linux-headers-4.4.0-112-generic_4.4.0-112.135_amd64.deb
as a test. Otherwise, the error message would be the same for all packages.
I would be very glad for any input on this situation.
P.S: There are related problems here and here, but there the removal was inhibited by dkms packages and lack of space, respectively, which do not seem to apply here.
EDIT 1: As requested, some more diagnosis. df
:
Filesystem 1K-blocks Used Available Use% Mounted on
udev 16403560 0 16403560 0% /dev
tmpfs 3285556 9988 3275568 1% /run
/dev/nvme0n1p6 20027260 15318552 3668324 81% /
tmpfs 16427776 31132 16396644 1% /dev/shm
tmpfs 5120 4 5116 1% /run/lock
tmpfs 16427776 0 16427776 0% /sys/fs/cgroup
/dev/nvme0n1p7 269994584 82741016 173515584 33% /home
/dev/nvme0n1p2 98304 28796 69508 30% /boot/efi
/dev/sda1 1953513540 166939096 1786574444 9% /windows
tmpfs 3285556 8 3285548 1% /run/user/108
tmpfs 3285556 48 3285508 1% /run/user/1000
/dev/nvme0n1p8 86410236 99712 86310524 1% /media/**/SSD Share
df -i
:
Filesystem Inodes IUsed IFree IUse% Mounted on
udev 4100890 652 4100238 1% /dev
tmpfs 4106944 958 4105986 1% /run
/dev/nvme0n1p6 1281120 412841 868279 33% /
tmpfs 4106944 211 4106733 1% /dev/shm
tmpfs 4106944 5 4106939 1% /run/lock
tmpfs 4106944 16 4106928 1% /sys/fs/cgroup
/dev/nvme0n1p7 17154048 1441660 15712388 9% /home
/dev/nvme0n1p2 0 0 0 - /boot/efi
/dev/sda1 1786771052 194329 1786576723 1% /windows
tmpfs 4106944 13 4106931 1% /run/user/108
tmpfs 4106944 29 4106915 1% /run/user/1000
/dev/nvme0n1p8 86376060 44 86376016 1% /media/**/SSD Share
dpkg -l | grep linux-image
:
rc linux-image-4.4.0-101-generic 4.4.0-101.124 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-103-generic 4.4.0-103.126 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-104-generic 4.4.0-104.127 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-108-generic 4.4.0-108.131 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-109-generic 4.4.0-109.132 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii linux-image-4.4.0-124-generic 4.4.0-124.148 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii linux-image-4.4.0-127-generic 4.4.0-127.153 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-31-generic 4.4.0-31.50 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-47-generic 4.4.0-47.68 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-51-generic 4.4.0-51.72 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-53-generic 4.4.0-53.74 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-57-generic 4.4.0-57.78 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-59-generic 4.4.0-59.80 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-62-generic 4.4.0-62.83 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-63-generic 4.4.0-63.84 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-64-generic 4.4.0-64.85 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-66-generic 4.4.0-66.87 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-70-generic 4.4.0-70.91 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-71-generic 4.4.0-71.92 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-72-generic 4.4.0-72.93 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-75-generic 4.4.0-75.96 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-78-generic 4.4.0-78.99 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-79-generic 4.4.0-79.100 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-81-generic 4.4.0-81.104 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-83-generic 4.4.0-83.106 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-87-generic 4.4.0-87.110 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-89-generic 4.4.0-89.112 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-91-generic 4.4.0-91.114 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-93-generic 4.4.0-93.116 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-96-generic 4.4.0-96.119 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-97-generic 4.4.0-97.120 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-98-generic 4.4.0-98.121 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-101-generic 4.4.0-101.124 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-103-generic 4.4.0-103.126 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-104-generic 4.4.0-104.127 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-108-generic 4.4.0-108.131 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-109-generic 4.4.0-109.132 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rH linux-image-extra-4.4.0-112-generic 4.4.0-112.135 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rH linux-image-extra-4.4.0-116-generic 4.4.0-116.140 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rH linux-image-extra-4.4.0-119-generic 4.4.0-119.143 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rH linux-image-extra-4.4.0-121-generic 4.4.0-121.145 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rH linux-image-extra-4.4.0-122-generic 4.4.0-122.146 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii linux-image-extra-4.4.0-124-generic 4.4.0-124.148 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii linux-image-extra-4.4.0-127-generic 4.4.0-127.153 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-31-generic 4.4.0-31.50 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-47-generic 4.4.0-47.68 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-51-generic 4.4.0-51.72 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-53-generic 4.4.0-53.74 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-57-generic 4.4.0-57.78 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-59-generic 4.4.0-59.80 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-62-generic 4.4.0-62.83 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-63-generic 4.4.0-63.84 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-64-generic 4.4.0-64.85 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-66-generic 4.4.0-66.87 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-70-generic 4.4.0-70.91 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-71-generic 4.4.0-71.92 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-72-generic 4.4.0-72.93 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-75-generic 4.4.0-75.96 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-78-generic 4.4.0-78.99 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-79-generic 4.4.0-79.100 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-81-generic 4.4.0-81.104 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-83-generic 4.4.0-83.106 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-87-generic 4.4.0-87.110 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-89-generic 4.4.0-89.112 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-91-generic 4.4.0-91.114 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-93-generic 4.4.0-93.116 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-96-generic 4.4.0-96.119 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-97-generic 4.4.0-97.120 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-98-generic 4.4.0-98.121 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii linux-image-generic 4.4.0.127.133 amd64 Generic Linux kernel image
ls /boot
:
abi-4.4.0-124-generic memtest86+_multiboot.bin
abi-4.4.0-127-generic retpoline-4.4.0-124-generic
config-4.4.0-124-generic retpoline-4.4.0-127-generic
config-4.4.0-127-generic System.map-4.4.0-124-generic
efi System.map-4.4.0-127-generic
grub vmlinuz-4.4.0-124-generic
initrd.img-4.4.0-124-generic vmlinuz-4.4.0-124-generic.efi.signed
initrd.img-4.4.0-127-generic vmlinuz-4.4.0-127-generic
memtest86+.bin vmlinuz-4.4.0-127-generic.efi.signed
memtest86+.elf
For reference, my current kernel is uname -r
4.4.0-127-generic
postinst.d/intramfs-tools file:
#!/bin/sh -e
version="$1"
bootopt=""
[ -x /usr/sbin/update-initramfs ] || exit 0
# passing the kernel version is required
if [ -z "$version" ]; then
echo >&2 "W: initramfs-tools: $DPKG_MAINTSCRIPT_PACKAGE:-kernel package did not pass a version number"
exit 2
fi
# exit if kernel does not need an initramfs
if [ "$INITRD" = 'No' ]; then
exit 0
fi
# absolute file name of kernel image may be passed as a second argument;
# create the initrd in the same directory
if [ -n "$2" ]; then
bootdir=$(dirname "$2")
bootopt="-b $bootdir"
fi
# avoid running multiple times
if [ -n "$DEB_MAINT_PARAMS" ]; then
eval set -- "$DEB_MAINT_PARAMS"
if [ -z "$1" ] || [ "$1" != "configure" ]; then
exit 0
fi
fi
# we're good - create initramfs. update runs do_bootloader
INITRAMFS_TOOLS_KERNEL_HOOK=1 update-initramfs -c -t -k "$version" $bootopt >&2
apt package-management kernel initramfs linux-headers
These kinds of errors usually pop up after a user unwisely deletes package-manager-placed files usingrm
instead of using apt, turning an easy-to-fix disk-full error into a series of more-painful file-not-found errors. Could that be the case here?
â user535733
Jun 11 at 12:17
Please edit your question to include the complete output ofdf
anddf -i
anddpkg -l | grep linux-image
andls /boot
â user535733
Jun 11 at 12:18
So far I applied only apt-get and dpkg commands and tried the currently shown answer as well as the (now deleted) answer. This did not (atleast to my knowledge) worsen the problem, but I cannot be sure entirely.
â mirrormere
Jun 11 at 12:59
Now that I thought about it, earlier this morning I did delete the contents of the /tmp folder (unwise as that may have been without stopping all services). Could this have an influence here? I was not aware that anything to this issue would be stored there?
â mirrormere
Jun 11 at 15:28
Deleting items in /tmp are unlikely to have an effect. Please edit your question to include the complete output ofuname -r
. Your problem looks fairly typical - not difficult to fix, but perhaps a bit tedious.
â user535733
Jun 11 at 16:12
 |Â
show 9 more comments
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I was trying to remove some old linux-kernels by using sudo apt autoremove
as suggest by apt-get upgrade
. However the autoremoval was unsuccessful. Now, trying to remove an old kernel yields sudo apt remove linux-image-extra-4.4.0-112-generic
:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
linux-image-extra-4.4.0-112-generic linux-image-extra-4.4.0-116-generic
linux-image-extra-4.4.0-119-generic linux-image-extra-4.4.0-121-generic
linux-image-extra-4.4.0-122-generic
0 upgraded, 0 newly installed, 5 to remove and 29 not upgraded.
5 not fully installed or removed.
After this operation, 774 MB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 363205 files and directories currently installed.)
Removing linux-image-extra-4.4.0-112-generic (4.4.0-112.135) ...
depmod: FATAL: could not load /boot/System.map-4.4.0-112-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-112- generic /boot/vmlinuz-4.4.0-112-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-112-generic /boot/vmlinuz-4.4.0-112-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-112- generic /boot/vmlinuz-4.4.0-112-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-112-generic
mktemp: failed to create directory via template âÂÂ/var/tmp/mkinitramfs_XXXXXXâÂÂ: No such file or directory
update-initramfs: failed for /boot/initrd.img-4.4.0-112-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-112-generic (-- remove):
subprocess installed post-removal script returned error exit status 1
Removing linux-image-extra-4.4.0-116-generic (4.4.0-116.140) ...
depmod: FATAL: could not load /boot/System.map-4.4.0-116-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-116- generic /boot/vmlinuz-4.4.0-116-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-116-generic /boot/vmlinuz-4.4.0-116-generic
Error! Your kernel headers for kernel 4.4.0-116-generic cannot be found.
Please install the linux-headers-4.4.0-116-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
Error! Your kernel headers for kernel 4.4.0-116-generic cannot be found.
Please install the linux-headers-4.4.0-116-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-116- generic /boot/vmlinuz-4.4.0-116-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-116-generic
WARNING: missing /lib/modules/4.4.0-116-generic
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/4.4.0-116-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
mktemp: failed to create directory via template âÂÂ/var/tmp/mkinitramfs_XXXXXXâÂÂ: No such file or directory
update-initramfs: failed for /boot/initrd.img-4.4.0-116-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-116-generic (--remove):
subprocess installed post-removal script returned error exit status 1
Removing linux-image-extra-4.4.0-119-generic (4.4.0-119.143) ...
depmod: FATAL: could not load /boot/System.map-4.4.0-119-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-119- generic /boot/vmlinuz-4.4.0-119-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-119-generic /boot/vmlinuz-4.4.0-119-generic
Error! Your kernel headers for kernel 4.4.0-119-generic cannot be found.
Please install the linux-headers-4.4.0-119-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
Error! Your kernel headers for kernel 4.4.0-119-generic cannot be found.
Please install the linux-headers-4.4.0-119-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-119- generic /boot/vmlinuz-4.4.0-119-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-119-generic
WARNING: missing /lib/modules/4.4.0-119-generic
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/4.4.0-119-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
mktemp: failed to create directory via template âÂÂ/var/tmp/mkinitramfs_XXXXXXâÂÂ: No such file or directory
update-initramfs: failed for /boot/initrd.img-4.4.0-119-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-119-generic (-- remove):
subprocess installed post-removal script returned error exit status 1
Removing linux-image-extra-4.4.0-121-generic (4.4.0-121.145) ...
depmod: FATAL: could not load /boot/System.map-4.4.0-121-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-121- generic /boot/vmlinuz-4.4.0-121-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-121-generic /boot/vmlinuz-4.4.0-121-generic
Error! Your kernel headers for kernel 4.4.0-121-generic cannot be found.
Please install the linux-headers-4.4.0-121-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
Error! Your kernel headers for kernel 4.4.0-121-generic cannot be found.
Please install the linux-headers-4.4.0-121-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-121- generic /boot/vmlinuz-4.4.0-121-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-121-generic
WARNING: missing /lib/modules/4.4.0-121-generic
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/4.4.0-121-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
mktemp: failed to create directory via template âÂÂ/var/tmp/mkinitramfs_XXXXXXâÂÂ: No such file or directory
update-initramfs: failed for /boot/initrd.img-4.4.0-121-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-121-generic (-- remove):
subprocess installed post-removal script returned error exit status 1
No apport report written because MaxReports is reached already
Removing linux- image-extra-4.4.0-122-generic (4.4.0-122.146) ...
depmod: FATAL: could not load /boot/System.map-4.4.0-122-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-122-generic /boot/vmlinuz-4.4.0-122-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-122-generic /boot/vmlinuz-4.4.0-122-generic
Error! Your kernel headers for kernel 4.4.0-122-generic cannot be found.
Please install the linux-headers-4.4.0-122-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
Error! Your kernel headers for kernel 4.4.0-122-generic cannot be found.
Please install the linux-headers-4.4.0-122-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-122- generic /boot/vmlinuz-4.4.0-122-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-122-generic
WARNING: missing /lib/modules/4.4.0-122-generic
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/4.4.0-122-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
mktemp: failed to create directory via template âÂÂ/var/tmp/mkinitramfs_XXXXXXâÂÂ: No such file or directory
update-initramfs: failed for /boot/initrd.img-4.4.0-122-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-122-generic (--remove):
subprocess installed post-removal script returned error exit status 1
No apport report written because MaxReports is reached already
Errors were encountered while processing:
linux-image-extra-4.4.0-112-generic
linux-image-extra-4.4.0-116-generic
linux-image-extra-4.4.0-119-generic
linux-image-extra-4.4.0-121-generic
linux-image-extra-4.4.0-122-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
The fact that the first package does not print the error message "Please install the linux-headers-..." is because I installed the -112 headers manually via sudo dpkg -i linux-headers-4.4.0-112-generic_4.4.0-112.135_amd64.deb
as a test. Otherwise, the error message would be the same for all packages.
I would be very glad for any input on this situation.
P.S: There are related problems here and here, but there the removal was inhibited by dkms packages and lack of space, respectively, which do not seem to apply here.
EDIT 1: As requested, some more diagnosis. df
:
Filesystem 1K-blocks Used Available Use% Mounted on
udev 16403560 0 16403560 0% /dev
tmpfs 3285556 9988 3275568 1% /run
/dev/nvme0n1p6 20027260 15318552 3668324 81% /
tmpfs 16427776 31132 16396644 1% /dev/shm
tmpfs 5120 4 5116 1% /run/lock
tmpfs 16427776 0 16427776 0% /sys/fs/cgroup
/dev/nvme0n1p7 269994584 82741016 173515584 33% /home
/dev/nvme0n1p2 98304 28796 69508 30% /boot/efi
/dev/sda1 1953513540 166939096 1786574444 9% /windows
tmpfs 3285556 8 3285548 1% /run/user/108
tmpfs 3285556 48 3285508 1% /run/user/1000
/dev/nvme0n1p8 86410236 99712 86310524 1% /media/**/SSD Share
df -i
:
Filesystem Inodes IUsed IFree IUse% Mounted on
udev 4100890 652 4100238 1% /dev
tmpfs 4106944 958 4105986 1% /run
/dev/nvme0n1p6 1281120 412841 868279 33% /
tmpfs 4106944 211 4106733 1% /dev/shm
tmpfs 4106944 5 4106939 1% /run/lock
tmpfs 4106944 16 4106928 1% /sys/fs/cgroup
/dev/nvme0n1p7 17154048 1441660 15712388 9% /home
/dev/nvme0n1p2 0 0 0 - /boot/efi
/dev/sda1 1786771052 194329 1786576723 1% /windows
tmpfs 4106944 13 4106931 1% /run/user/108
tmpfs 4106944 29 4106915 1% /run/user/1000
/dev/nvme0n1p8 86376060 44 86376016 1% /media/**/SSD Share
dpkg -l | grep linux-image
:
rc linux-image-4.4.0-101-generic 4.4.0-101.124 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-103-generic 4.4.0-103.126 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-104-generic 4.4.0-104.127 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-108-generic 4.4.0-108.131 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-109-generic 4.4.0-109.132 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii linux-image-4.4.0-124-generic 4.4.0-124.148 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii linux-image-4.4.0-127-generic 4.4.0-127.153 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-31-generic 4.4.0-31.50 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-47-generic 4.4.0-47.68 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-51-generic 4.4.0-51.72 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-53-generic 4.4.0-53.74 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-57-generic 4.4.0-57.78 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-59-generic 4.4.0-59.80 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-62-generic 4.4.0-62.83 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-63-generic 4.4.0-63.84 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-64-generic 4.4.0-64.85 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-66-generic 4.4.0-66.87 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-70-generic 4.4.0-70.91 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-71-generic 4.4.0-71.92 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-72-generic 4.4.0-72.93 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-75-generic 4.4.0-75.96 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-78-generic 4.4.0-78.99 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-79-generic 4.4.0-79.100 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-81-generic 4.4.0-81.104 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-83-generic 4.4.0-83.106 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-87-generic 4.4.0-87.110 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-89-generic 4.4.0-89.112 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-91-generic 4.4.0-91.114 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-93-generic 4.4.0-93.116 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-96-generic 4.4.0-96.119 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-97-generic 4.4.0-97.120 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-98-generic 4.4.0-98.121 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-101-generic 4.4.0-101.124 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-103-generic 4.4.0-103.126 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-104-generic 4.4.0-104.127 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-108-generic 4.4.0-108.131 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-109-generic 4.4.0-109.132 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rH linux-image-extra-4.4.0-112-generic 4.4.0-112.135 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rH linux-image-extra-4.4.0-116-generic 4.4.0-116.140 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rH linux-image-extra-4.4.0-119-generic 4.4.0-119.143 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rH linux-image-extra-4.4.0-121-generic 4.4.0-121.145 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rH linux-image-extra-4.4.0-122-generic 4.4.0-122.146 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii linux-image-extra-4.4.0-124-generic 4.4.0-124.148 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii linux-image-extra-4.4.0-127-generic 4.4.0-127.153 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-31-generic 4.4.0-31.50 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-47-generic 4.4.0-47.68 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-51-generic 4.4.0-51.72 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-53-generic 4.4.0-53.74 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-57-generic 4.4.0-57.78 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-59-generic 4.4.0-59.80 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-62-generic 4.4.0-62.83 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-63-generic 4.4.0-63.84 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-64-generic 4.4.0-64.85 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-66-generic 4.4.0-66.87 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-70-generic 4.4.0-70.91 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-71-generic 4.4.0-71.92 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-72-generic 4.4.0-72.93 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-75-generic 4.4.0-75.96 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-78-generic 4.4.0-78.99 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-79-generic 4.4.0-79.100 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-81-generic 4.4.0-81.104 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-83-generic 4.4.0-83.106 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-87-generic 4.4.0-87.110 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-89-generic 4.4.0-89.112 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-91-generic 4.4.0-91.114 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-93-generic 4.4.0-93.116 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-96-generic 4.4.0-96.119 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-97-generic 4.4.0-97.120 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-98-generic 4.4.0-98.121 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii linux-image-generic 4.4.0.127.133 amd64 Generic Linux kernel image
ls /boot
:
abi-4.4.0-124-generic memtest86+_multiboot.bin
abi-4.4.0-127-generic retpoline-4.4.0-124-generic
config-4.4.0-124-generic retpoline-4.4.0-127-generic
config-4.4.0-127-generic System.map-4.4.0-124-generic
efi System.map-4.4.0-127-generic
grub vmlinuz-4.4.0-124-generic
initrd.img-4.4.0-124-generic vmlinuz-4.4.0-124-generic.efi.signed
initrd.img-4.4.0-127-generic vmlinuz-4.4.0-127-generic
memtest86+.bin vmlinuz-4.4.0-127-generic.efi.signed
memtest86+.elf
For reference, my current kernel is uname -r
4.4.0-127-generic
postinst.d/intramfs-tools file:
#!/bin/sh -e
version="$1"
bootopt=""
[ -x /usr/sbin/update-initramfs ] || exit 0
# passing the kernel version is required
if [ -z "$version" ]; then
echo >&2 "W: initramfs-tools: $DPKG_MAINTSCRIPT_PACKAGE:-kernel package did not pass a version number"
exit 2
fi
# exit if kernel does not need an initramfs
if [ "$INITRD" = 'No' ]; then
exit 0
fi
# absolute file name of kernel image may be passed as a second argument;
# create the initrd in the same directory
if [ -n "$2" ]; then
bootdir=$(dirname "$2")
bootopt="-b $bootdir"
fi
# avoid running multiple times
if [ -n "$DEB_MAINT_PARAMS" ]; then
eval set -- "$DEB_MAINT_PARAMS"
if [ -z "$1" ] || [ "$1" != "configure" ]; then
exit 0
fi
fi
# we're good - create initramfs. update runs do_bootloader
INITRAMFS_TOOLS_KERNEL_HOOK=1 update-initramfs -c -t -k "$version" $bootopt >&2
apt package-management kernel initramfs linux-headers
I was trying to remove some old linux-kernels by using sudo apt autoremove
as suggest by apt-get upgrade
. However the autoremoval was unsuccessful. Now, trying to remove an old kernel yields sudo apt remove linux-image-extra-4.4.0-112-generic
:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
linux-image-extra-4.4.0-112-generic linux-image-extra-4.4.0-116-generic
linux-image-extra-4.4.0-119-generic linux-image-extra-4.4.0-121-generic
linux-image-extra-4.4.0-122-generic
0 upgraded, 0 newly installed, 5 to remove and 29 not upgraded.
5 not fully installed or removed.
After this operation, 774 MB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 363205 files and directories currently installed.)
Removing linux-image-extra-4.4.0-112-generic (4.4.0-112.135) ...
depmod: FATAL: could not load /boot/System.map-4.4.0-112-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-112- generic /boot/vmlinuz-4.4.0-112-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-112-generic /boot/vmlinuz-4.4.0-112-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-112- generic /boot/vmlinuz-4.4.0-112-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-112-generic
mktemp: failed to create directory via template âÂÂ/var/tmp/mkinitramfs_XXXXXXâÂÂ: No such file or directory
update-initramfs: failed for /boot/initrd.img-4.4.0-112-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-112-generic (-- remove):
subprocess installed post-removal script returned error exit status 1
Removing linux-image-extra-4.4.0-116-generic (4.4.0-116.140) ...
depmod: FATAL: could not load /boot/System.map-4.4.0-116-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-116- generic /boot/vmlinuz-4.4.0-116-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-116-generic /boot/vmlinuz-4.4.0-116-generic
Error! Your kernel headers for kernel 4.4.0-116-generic cannot be found.
Please install the linux-headers-4.4.0-116-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
Error! Your kernel headers for kernel 4.4.0-116-generic cannot be found.
Please install the linux-headers-4.4.0-116-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-116- generic /boot/vmlinuz-4.4.0-116-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-116-generic
WARNING: missing /lib/modules/4.4.0-116-generic
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/4.4.0-116-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
mktemp: failed to create directory via template âÂÂ/var/tmp/mkinitramfs_XXXXXXâÂÂ: No such file or directory
update-initramfs: failed for /boot/initrd.img-4.4.0-116-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-116-generic (--remove):
subprocess installed post-removal script returned error exit status 1
Removing linux-image-extra-4.4.0-119-generic (4.4.0-119.143) ...
depmod: FATAL: could not load /boot/System.map-4.4.0-119-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-119- generic /boot/vmlinuz-4.4.0-119-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-119-generic /boot/vmlinuz-4.4.0-119-generic
Error! Your kernel headers for kernel 4.4.0-119-generic cannot be found.
Please install the linux-headers-4.4.0-119-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
Error! Your kernel headers for kernel 4.4.0-119-generic cannot be found.
Please install the linux-headers-4.4.0-119-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-119- generic /boot/vmlinuz-4.4.0-119-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-119-generic
WARNING: missing /lib/modules/4.4.0-119-generic
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/4.4.0-119-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
mktemp: failed to create directory via template âÂÂ/var/tmp/mkinitramfs_XXXXXXâÂÂ: No such file or directory
update-initramfs: failed for /boot/initrd.img-4.4.0-119-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-119-generic (-- remove):
subprocess installed post-removal script returned error exit status 1
Removing linux-image-extra-4.4.0-121-generic (4.4.0-121.145) ...
depmod: FATAL: could not load /boot/System.map-4.4.0-121-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-121- generic /boot/vmlinuz-4.4.0-121-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-121-generic /boot/vmlinuz-4.4.0-121-generic
Error! Your kernel headers for kernel 4.4.0-121-generic cannot be found.
Please install the linux-headers-4.4.0-121-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
Error! Your kernel headers for kernel 4.4.0-121-generic cannot be found.
Please install the linux-headers-4.4.0-121-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-121- generic /boot/vmlinuz-4.4.0-121-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-121-generic
WARNING: missing /lib/modules/4.4.0-121-generic
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/4.4.0-121-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
mktemp: failed to create directory via template âÂÂ/var/tmp/mkinitramfs_XXXXXXâÂÂ: No such file or directory
update-initramfs: failed for /boot/initrd.img-4.4.0-121-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-121-generic (-- remove):
subprocess installed post-removal script returned error exit status 1
No apport report written because MaxReports is reached already
Removing linux- image-extra-4.4.0-122-generic (4.4.0-122.146) ...
depmod: FATAL: could not load /boot/System.map-4.4.0-122-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-122-generic /boot/vmlinuz-4.4.0-122-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-122-generic /boot/vmlinuz-4.4.0-122-generic
Error! Your kernel headers for kernel 4.4.0-122-generic cannot be found.
Please install the linux-headers-4.4.0-122-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
Error! Your kernel headers for kernel 4.4.0-122-generic cannot be found.
Please install the linux-headers-4.4.0-122-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-122- generic /boot/vmlinuz-4.4.0-122-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-122-generic
WARNING: missing /lib/modules/4.4.0-122-generic
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/4.4.0-122-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
mktemp: failed to create directory via template âÂÂ/var/tmp/mkinitramfs_XXXXXXâÂÂ: No such file or directory
update-initramfs: failed for /boot/initrd.img-4.4.0-122-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-122-generic (--remove):
subprocess installed post-removal script returned error exit status 1
No apport report written because MaxReports is reached already
Errors were encountered while processing:
linux-image-extra-4.4.0-112-generic
linux-image-extra-4.4.0-116-generic
linux-image-extra-4.4.0-119-generic
linux-image-extra-4.4.0-121-generic
linux-image-extra-4.4.0-122-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
The fact that the first package does not print the error message "Please install the linux-headers-..." is because I installed the -112 headers manually via sudo dpkg -i linux-headers-4.4.0-112-generic_4.4.0-112.135_amd64.deb
as a test. Otherwise, the error message would be the same for all packages.
I would be very glad for any input on this situation.
P.S: There are related problems here and here, but there the removal was inhibited by dkms packages and lack of space, respectively, which do not seem to apply here.
EDIT 1: As requested, some more diagnosis. df
:
Filesystem 1K-blocks Used Available Use% Mounted on
udev 16403560 0 16403560 0% /dev
tmpfs 3285556 9988 3275568 1% /run
/dev/nvme0n1p6 20027260 15318552 3668324 81% /
tmpfs 16427776 31132 16396644 1% /dev/shm
tmpfs 5120 4 5116 1% /run/lock
tmpfs 16427776 0 16427776 0% /sys/fs/cgroup
/dev/nvme0n1p7 269994584 82741016 173515584 33% /home
/dev/nvme0n1p2 98304 28796 69508 30% /boot/efi
/dev/sda1 1953513540 166939096 1786574444 9% /windows
tmpfs 3285556 8 3285548 1% /run/user/108
tmpfs 3285556 48 3285508 1% /run/user/1000
/dev/nvme0n1p8 86410236 99712 86310524 1% /media/**/SSD Share
df -i
:
Filesystem Inodes IUsed IFree IUse% Mounted on
udev 4100890 652 4100238 1% /dev
tmpfs 4106944 958 4105986 1% /run
/dev/nvme0n1p6 1281120 412841 868279 33% /
tmpfs 4106944 211 4106733 1% /dev/shm
tmpfs 4106944 5 4106939 1% /run/lock
tmpfs 4106944 16 4106928 1% /sys/fs/cgroup
/dev/nvme0n1p7 17154048 1441660 15712388 9% /home
/dev/nvme0n1p2 0 0 0 - /boot/efi
/dev/sda1 1786771052 194329 1786576723 1% /windows
tmpfs 4106944 13 4106931 1% /run/user/108
tmpfs 4106944 29 4106915 1% /run/user/1000
/dev/nvme0n1p8 86376060 44 86376016 1% /media/**/SSD Share
dpkg -l | grep linux-image
:
rc linux-image-4.4.0-101-generic 4.4.0-101.124 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-103-generic 4.4.0-103.126 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-104-generic 4.4.0-104.127 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-108-generic 4.4.0-108.131 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-109-generic 4.4.0-109.132 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii linux-image-4.4.0-124-generic 4.4.0-124.148 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii linux-image-4.4.0-127-generic 4.4.0-127.153 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-31-generic 4.4.0-31.50 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-47-generic 4.4.0-47.68 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-51-generic 4.4.0-51.72 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-53-generic 4.4.0-53.74 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-57-generic 4.4.0-57.78 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-59-generic 4.4.0-59.80 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-62-generic 4.4.0-62.83 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-63-generic 4.4.0-63.84 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-64-generic 4.4.0-64.85 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-66-generic 4.4.0-66.87 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-70-generic 4.4.0-70.91 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-71-generic 4.4.0-71.92 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-72-generic 4.4.0-72.93 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-75-generic 4.4.0-75.96 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-78-generic 4.4.0-78.99 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-79-generic 4.4.0-79.100 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-81-generic 4.4.0-81.104 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-83-generic 4.4.0-83.106 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-87-generic 4.4.0-87.110 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-89-generic 4.4.0-89.112 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-91-generic 4.4.0-91.114 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-93-generic 4.4.0-93.116 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-96-generic 4.4.0-96.119 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-97-generic 4.4.0-97.120 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-98-generic 4.4.0-98.121 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-101-generic 4.4.0-101.124 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-103-generic 4.4.0-103.126 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-104-generic 4.4.0-104.127 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-108-generic 4.4.0-108.131 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-109-generic 4.4.0-109.132 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rH linux-image-extra-4.4.0-112-generic 4.4.0-112.135 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rH linux-image-extra-4.4.0-116-generic 4.4.0-116.140 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rH linux-image-extra-4.4.0-119-generic 4.4.0-119.143 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rH linux-image-extra-4.4.0-121-generic 4.4.0-121.145 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rH linux-image-extra-4.4.0-122-generic 4.4.0-122.146 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii linux-image-extra-4.4.0-124-generic 4.4.0-124.148 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii linux-image-extra-4.4.0-127-generic 4.4.0-127.153 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-31-generic 4.4.0-31.50 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-47-generic 4.4.0-47.68 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-51-generic 4.4.0-51.72 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-53-generic 4.4.0-53.74 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-57-generic 4.4.0-57.78 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-59-generic 4.4.0-59.80 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-62-generic 4.4.0-62.83 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-63-generic 4.4.0-63.84 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-64-generic 4.4.0-64.85 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-66-generic 4.4.0-66.87 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-70-generic 4.4.0-70.91 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-71-generic 4.4.0-71.92 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-72-generic 4.4.0-72.93 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-75-generic 4.4.0-75.96 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-78-generic 4.4.0-78.99 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-79-generic 4.4.0-79.100 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-81-generic 4.4.0-81.104 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-83-generic 4.4.0-83.106 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-87-generic 4.4.0-87.110 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-89-generic 4.4.0-89.112 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-91-generic 4.4.0-91.114 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-93-generic 4.4.0-93.116 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-96-generic 4.4.0-96.119 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-97-generic 4.4.0-97.120 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-98-generic 4.4.0-98.121 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii linux-image-generic 4.4.0.127.133 amd64 Generic Linux kernel image
ls /boot
:
abi-4.4.0-124-generic memtest86+_multiboot.bin
abi-4.4.0-127-generic retpoline-4.4.0-124-generic
config-4.4.0-124-generic retpoline-4.4.0-127-generic
config-4.4.0-127-generic System.map-4.4.0-124-generic
efi System.map-4.4.0-127-generic
grub vmlinuz-4.4.0-124-generic
initrd.img-4.4.0-124-generic vmlinuz-4.4.0-124-generic.efi.signed
initrd.img-4.4.0-127-generic vmlinuz-4.4.0-127-generic
memtest86+.bin vmlinuz-4.4.0-127-generic.efi.signed
memtest86+.elf
For reference, my current kernel is uname -r
4.4.0-127-generic
postinst.d/intramfs-tools file:
#!/bin/sh -e
version="$1"
bootopt=""
[ -x /usr/sbin/update-initramfs ] || exit 0
# passing the kernel version is required
if [ -z "$version" ]; then
echo >&2 "W: initramfs-tools: $DPKG_MAINTSCRIPT_PACKAGE:-kernel package did not pass a version number"
exit 2
fi
# exit if kernel does not need an initramfs
if [ "$INITRD" = 'No' ]; then
exit 0
fi
# absolute file name of kernel image may be passed as a second argument;
# create the initrd in the same directory
if [ -n "$2" ]; then
bootdir=$(dirname "$2")
bootopt="-b $bootdir"
fi
# avoid running multiple times
if [ -n "$DEB_MAINT_PARAMS" ]; then
eval set -- "$DEB_MAINT_PARAMS"
if [ -z "$1" ] || [ "$1" != "configure" ]; then
exit 0
fi
fi
# we're good - create initramfs. update runs do_bootloader
INITRAMFS_TOOLS_KERNEL_HOOK=1 update-initramfs -c -t -k "$version" $bootopt >&2
apt package-management kernel initramfs linux-headers
edited Jun 14 at 12:18
asked Jun 11 at 9:46
mirrormere
164
164
These kinds of errors usually pop up after a user unwisely deletes package-manager-placed files usingrm
instead of using apt, turning an easy-to-fix disk-full error into a series of more-painful file-not-found errors. Could that be the case here?
â user535733
Jun 11 at 12:17
Please edit your question to include the complete output ofdf
anddf -i
anddpkg -l | grep linux-image
andls /boot
â user535733
Jun 11 at 12:18
So far I applied only apt-get and dpkg commands and tried the currently shown answer as well as the (now deleted) answer. This did not (atleast to my knowledge) worsen the problem, but I cannot be sure entirely.
â mirrormere
Jun 11 at 12:59
Now that I thought about it, earlier this morning I did delete the contents of the /tmp folder (unwise as that may have been without stopping all services). Could this have an influence here? I was not aware that anything to this issue would be stored there?
â mirrormere
Jun 11 at 15:28
Deleting items in /tmp are unlikely to have an effect. Please edit your question to include the complete output ofuname -r
. Your problem looks fairly typical - not difficult to fix, but perhaps a bit tedious.
â user535733
Jun 11 at 16:12
 |Â
show 9 more comments
These kinds of errors usually pop up after a user unwisely deletes package-manager-placed files usingrm
instead of using apt, turning an easy-to-fix disk-full error into a series of more-painful file-not-found errors. Could that be the case here?
â user535733
Jun 11 at 12:17
Please edit your question to include the complete output ofdf
anddf -i
anddpkg -l | grep linux-image
andls /boot
â user535733
Jun 11 at 12:18
So far I applied only apt-get and dpkg commands and tried the currently shown answer as well as the (now deleted) answer. This did not (atleast to my knowledge) worsen the problem, but I cannot be sure entirely.
â mirrormere
Jun 11 at 12:59
Now that I thought about it, earlier this morning I did delete the contents of the /tmp folder (unwise as that may have been without stopping all services). Could this have an influence here? I was not aware that anything to this issue would be stored there?
â mirrormere
Jun 11 at 15:28
Deleting items in /tmp are unlikely to have an effect. Please edit your question to include the complete output ofuname -r
. Your problem looks fairly typical - not difficult to fix, but perhaps a bit tedious.
â user535733
Jun 11 at 16:12
These kinds of errors usually pop up after a user unwisely deletes package-manager-placed files using
rm
instead of using apt, turning an easy-to-fix disk-full error into a series of more-painful file-not-found errors. Could that be the case here?â user535733
Jun 11 at 12:17
These kinds of errors usually pop up after a user unwisely deletes package-manager-placed files using
rm
instead of using apt, turning an easy-to-fix disk-full error into a series of more-painful file-not-found errors. Could that be the case here?â user535733
Jun 11 at 12:17
Please edit your question to include the complete output of
df
and df -i
and dpkg -l | grep linux-image
and ls /boot
â user535733
Jun 11 at 12:18
Please edit your question to include the complete output of
df
and df -i
and dpkg -l | grep linux-image
and ls /boot
â user535733
Jun 11 at 12:18
So far I applied only apt-get and dpkg commands and tried the currently shown answer as well as the (now deleted) answer. This did not (atleast to my knowledge) worsen the problem, but I cannot be sure entirely.
â mirrormere
Jun 11 at 12:59
So far I applied only apt-get and dpkg commands and tried the currently shown answer as well as the (now deleted) answer. This did not (atleast to my knowledge) worsen the problem, but I cannot be sure entirely.
â mirrormere
Jun 11 at 12:59
Now that I thought about it, earlier this morning I did delete the contents of the /tmp folder (unwise as that may have been without stopping all services). Could this have an influence here? I was not aware that anything to this issue would be stored there?
â mirrormere
Jun 11 at 15:28
Now that I thought about it, earlier this morning I did delete the contents of the /tmp folder (unwise as that may have been without stopping all services). Could this have an influence here? I was not aware that anything to this issue would be stored there?
â mirrormere
Jun 11 at 15:28
Deleting items in /tmp are unlikely to have an effect. Please edit your question to include the complete output of
uname -r
. Your problem looks fairly typical - not difficult to fix, but perhaps a bit tedious.â user535733
Jun 11 at 16:12
Deleting items in /tmp are unlikely to have an effect. Please edit your question to include the complete output of
uname -r
. Your problem looks fairly typical - not difficult to fix, but perhaps a bit tedious.â user535733
Jun 11 at 16:12
 |Â
show 9 more comments
2 Answers
2
active
oldest
votes
up vote
1
down vote
accepted
I finally found a (very simple) answer to this problem.
It turns out that the answer to this particular problem can be found in the following line from the error log. All other errors and missing files are just symptoms of this problem:
mktemp: failed to create directory via template
âÂÂ/var/tmp/mkinitramfs_XXXXXXâÂÂ: No such file or directory
The mktemp command fails, because the script that calls it or mktemp itself do not create a missing directory.
And in fact on this system, the folder /var/tmp
was missing, due to a problem with the system between keyboard and chair :( . After restoring the folder, the removal process could continue and the issue was fixed.
Nice troubleshooting job! Congrats.
â Organic Marble
Jun 14 at 17:27
add a comment |Â
up vote
0
down vote
Try
ls /boot
View the vmilinuz-version files for their versions
Then, for the ones you want removed:
sudo dpkg --purge --force-depends linux-image-version
I do not use apt autoremove, because it frequently makes a mess of things.
This strategy sucessfully removes the problematic old kernels at first glance, but running an apt-get command afterwards again shows that apt-get still tries and fails to fully remove these kernels, as before.
â mirrormere
Jun 11 at 11:51
2
Over more than a decade, I've never found autoremove, used properly, to 'make a mess of things'. If you have discovered a flaw in apt's logic that causes, problems, please file a bug report so it can be fixed.
â user535733
Jun 11 at 12:12
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
I finally found a (very simple) answer to this problem.
It turns out that the answer to this particular problem can be found in the following line from the error log. All other errors and missing files are just symptoms of this problem:
mktemp: failed to create directory via template
âÂÂ/var/tmp/mkinitramfs_XXXXXXâÂÂ: No such file or directory
The mktemp command fails, because the script that calls it or mktemp itself do not create a missing directory.
And in fact on this system, the folder /var/tmp
was missing, due to a problem with the system between keyboard and chair :( . After restoring the folder, the removal process could continue and the issue was fixed.
Nice troubleshooting job! Congrats.
â Organic Marble
Jun 14 at 17:27
add a comment |Â
up vote
1
down vote
accepted
I finally found a (very simple) answer to this problem.
It turns out that the answer to this particular problem can be found in the following line from the error log. All other errors and missing files are just symptoms of this problem:
mktemp: failed to create directory via template
âÂÂ/var/tmp/mkinitramfs_XXXXXXâÂÂ: No such file or directory
The mktemp command fails, because the script that calls it or mktemp itself do not create a missing directory.
And in fact on this system, the folder /var/tmp
was missing, due to a problem with the system between keyboard and chair :( . After restoring the folder, the removal process could continue and the issue was fixed.
Nice troubleshooting job! Congrats.
â Organic Marble
Jun 14 at 17:27
add a comment |Â
up vote
1
down vote
accepted
up vote
1
down vote
accepted
I finally found a (very simple) answer to this problem.
It turns out that the answer to this particular problem can be found in the following line from the error log. All other errors and missing files are just symptoms of this problem:
mktemp: failed to create directory via template
âÂÂ/var/tmp/mkinitramfs_XXXXXXâÂÂ: No such file or directory
The mktemp command fails, because the script that calls it or mktemp itself do not create a missing directory.
And in fact on this system, the folder /var/tmp
was missing, due to a problem with the system between keyboard and chair :( . After restoring the folder, the removal process could continue and the issue was fixed.
I finally found a (very simple) answer to this problem.
It turns out that the answer to this particular problem can be found in the following line from the error log. All other errors and missing files are just symptoms of this problem:
mktemp: failed to create directory via template
âÂÂ/var/tmp/mkinitramfs_XXXXXXâÂÂ: No such file or directory
The mktemp command fails, because the script that calls it or mktemp itself do not create a missing directory.
And in fact on this system, the folder /var/tmp
was missing, due to a problem with the system between keyboard and chair :( . After restoring the folder, the removal process could continue and the issue was fixed.
answered Jun 14 at 15:12
mirrormere
164
164
Nice troubleshooting job! Congrats.
â Organic Marble
Jun 14 at 17:27
add a comment |Â
Nice troubleshooting job! Congrats.
â Organic Marble
Jun 14 at 17:27
Nice troubleshooting job! Congrats.
â Organic Marble
Jun 14 at 17:27
Nice troubleshooting job! Congrats.
â Organic Marble
Jun 14 at 17:27
add a comment |Â
up vote
0
down vote
Try
ls /boot
View the vmilinuz-version files for their versions
Then, for the ones you want removed:
sudo dpkg --purge --force-depends linux-image-version
I do not use apt autoremove, because it frequently makes a mess of things.
This strategy sucessfully removes the problematic old kernels at first glance, but running an apt-get command afterwards again shows that apt-get still tries and fails to fully remove these kernels, as before.
â mirrormere
Jun 11 at 11:51
2
Over more than a decade, I've never found autoremove, used properly, to 'make a mess of things'. If you have discovered a flaw in apt's logic that causes, problems, please file a bug report so it can be fixed.
â user535733
Jun 11 at 12:12
add a comment |Â
up vote
0
down vote
Try
ls /boot
View the vmilinuz-version files for their versions
Then, for the ones you want removed:
sudo dpkg --purge --force-depends linux-image-version
I do not use apt autoremove, because it frequently makes a mess of things.
This strategy sucessfully removes the problematic old kernels at first glance, but running an apt-get command afterwards again shows that apt-get still tries and fails to fully remove these kernels, as before.
â mirrormere
Jun 11 at 11:51
2
Over more than a decade, I've never found autoremove, used properly, to 'make a mess of things'. If you have discovered a flaw in apt's logic that causes, problems, please file a bug report so it can be fixed.
â user535733
Jun 11 at 12:12
add a comment |Â
up vote
0
down vote
up vote
0
down vote
Try
ls /boot
View the vmilinuz-version files for their versions
Then, for the ones you want removed:
sudo dpkg --purge --force-depends linux-image-version
I do not use apt autoremove, because it frequently makes a mess of things.
Try
ls /boot
View the vmilinuz-version files for their versions
Then, for the ones you want removed:
sudo dpkg --purge --force-depends linux-image-version
I do not use apt autoremove, because it frequently makes a mess of things.
answered Jun 11 at 10:09
Brian
1011
1011
This strategy sucessfully removes the problematic old kernels at first glance, but running an apt-get command afterwards again shows that apt-get still tries and fails to fully remove these kernels, as before.
â mirrormere
Jun 11 at 11:51
2
Over more than a decade, I've never found autoremove, used properly, to 'make a mess of things'. If you have discovered a flaw in apt's logic that causes, problems, please file a bug report so it can be fixed.
â user535733
Jun 11 at 12:12
add a comment |Â
This strategy sucessfully removes the problematic old kernels at first glance, but running an apt-get command afterwards again shows that apt-get still tries and fails to fully remove these kernels, as before.
â mirrormere
Jun 11 at 11:51
2
Over more than a decade, I've never found autoremove, used properly, to 'make a mess of things'. If you have discovered a flaw in apt's logic that causes, problems, please file a bug report so it can be fixed.
â user535733
Jun 11 at 12:12
This strategy sucessfully removes the problematic old kernels at first glance, but running an apt-get command afterwards again shows that apt-get still tries and fails to fully remove these kernels, as before.
â mirrormere
Jun 11 at 11:51
This strategy sucessfully removes the problematic old kernels at first glance, but running an apt-get command afterwards again shows that apt-get still tries and fails to fully remove these kernels, as before.
â mirrormere
Jun 11 at 11:51
2
2
Over more than a decade, I've never found autoremove, used properly, to 'make a mess of things'. If you have discovered a flaw in apt's logic that causes, problems, please file a bug report so it can be fixed.
â user535733
Jun 11 at 12:12
Over more than a decade, I've never found autoremove, used properly, to 'make a mess of things'. If you have discovered a flaw in apt's logic that causes, problems, please file a bug report so it can be fixed.
â user535733
Jun 11 at 12:12
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1045558%2fapt-autoremove-failed-to-fully-uninstall-old-kernels-now-they-block-apt-get%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
These kinds of errors usually pop up after a user unwisely deletes package-manager-placed files using
rm
instead of using apt, turning an easy-to-fix disk-full error into a series of more-painful file-not-found errors. Could that be the case here?â user535733
Jun 11 at 12:17
Please edit your question to include the complete output of
df
anddf -i
anddpkg -l | grep linux-image
andls /boot
â user535733
Jun 11 at 12:18
So far I applied only apt-get and dpkg commands and tried the currently shown answer as well as the (now deleted) answer. This did not (atleast to my knowledge) worsen the problem, but I cannot be sure entirely.
â mirrormere
Jun 11 at 12:59
Now that I thought about it, earlier this morning I did delete the contents of the /tmp folder (unwise as that may have been without stopping all services). Could this have an influence here? I was not aware that anything to this issue would be stored there?
â mirrormere
Jun 11 at 15:28
Deleting items in /tmp are unlikely to have an effect. Please edit your question to include the complete output of
uname -r
. Your problem looks fairly typical - not difficult to fix, but perhaps a bit tedious.â user535733
Jun 11 at 16:12