Too many old kernels and /boot partition full - Dependencies pbs with old kernel image preventing clean up

Questions about applications and software
Forum rules
Before you post please read how to get help
Bildo
Level 1
Level 1
Posts: 8
Joined: Wed Aug 15, 2018 4:14 am

Too many old kernels and /boot partition full - Dependencies pbs with old kernel image preventing clean up

Post by Bildo » Wed Aug 15, 2018 4:33 am

I've got too much old kernels images on my system and my /Boot partition is now full.
I would like to make some free space there, but there seems to be a pb with an old linux image which prevents any action or any removal of old kernel.
Every time i get the same error code code 1

This is what i got when trying to uninstall linux kernel 4.8.0-53 from the update manager.

Code: Select all

(Lecture de la base de données... 447119 fichiers et répertoires déjà installés.)
Suppression de linux-image-extra-4.10.0-40-generic (4.10.0-40.44~16.04.1) ...
depmod: FATAL: could not load /boot/System.map-4.10.0-40-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.10.0-40-generic /boot/vmlinuz-4.10.0-40-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.10.0-40-generic /boot/vmlinuz-4.10.0-40-generic
Error! echo
Your kernel headers for kernel 4.10.0-40-generic cannot be found at
/lib/modules/4.10.0-40-generic/build or /lib/modules/4.10.0-40-generic/source.
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.10.0-40-generic /boot/vmlinuz-4.10.0-40-generic
update-initramfs: Generating /boot/initrd.img-4.10.0-40-generic
WARNING: missing /lib/modules/4.10.0-40-generic
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/4.10.0-40-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
Warning: No support for locale: fr_FR.utf8
depmod: WARNING: could not open /tmp/user/0/mkinitramfs_fceEnT/lib/modules/4.10.0-40-generic/modules.order: No such file or directory
depmod: WARNING: could not open /tmp/user/0/mkinitramfs_fceEnT/lib/modules/4.10.0-40-generic/modules.builtin: No such file or directory

gzip: stdout: No space left on device
E: mkinitramfs failure cpio 141 gzip 1
update-initramfs: failed for /boot/initrd.img-4.10.0-40-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: erreur de traitement du paquet linux-image-extra-4.10.0-40-generic (--remove) :
 le sous-processus script post-removal installé a retourné une erreur de sortie d'état 1
Suppression de linux-image-extra-4.10.0-42-generic (4.10.0-42.46~16.04.1) ...
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.10.0-42-generic /boot/vmlinuz-4.10.0-42-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.10.0-42-generic /boot/vmlinuz-4.10.0-42-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.10.0-42-generic /boot/vmlinuz-4.10.0-42-generic
update-initramfs: Generating /boot/initrd.img-4.10.0-42-generic
Warning: No support for locale: fr_FR.utf8

gzip: stdout: No space left on device
E: mkinitramfs failure cpio 141 gzip 1
update-initramfs: failed for /boot/initrd.img-4.10.0-42-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: erreur de traitement du paquet linux-image-extra-4.10.0-42-generic (--remove) :
 le sous-processus script post-removal installé a retourné une erreur de sortie d'état 1
Des erreurs ont été rencontrées pendant l'exécution :
 linux-image-extra-4.10.0-40-generic
 linux-image-extra-4.10.0-42-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
Échec de l'installation d'un paquet. Tentative de récupération :


And this is what i got when trying to install byobu, as i read this can be used to remove old kernels in another thread.

Code: Select all

sudo apt-get install byobu
Lecture des listes de paquets... Fait
Construction de l'arbre des dépendances       
Lecture des informations d'état... Fait
Les paquets suivants ont été installés automatiquement et ne sont plus nécessaires :
  linux-headers-4.13.0-37 linux-headers-4.13.0-37-generic
  linux-image-4.13.0-37-generic linux-image-extra-4.13.0-37-generic
Veuillez utiliser « sudo apt autoremove » pour les supprimer.
Les paquets supplémentaires suivants seront installés :
  python3-newt tmux
Paquets suggérés :
  apport ccze update-notifier-common
Paquets recommandés :
  pastebinit screen run-one
Les paquets suivants seront ENLEVÉS :
  linux-image-extra-4.10.0-40-generic linux-image-extra-4.10.0-42-generic
Les NOUVEAUX paquets suivants seront installés :
  byobu python3-newt tmux
0 mis à jour, 3 nouvellement installés, 2 à enlever et 10 non mis à jour.
2 partiellement installés ou enlevés.
Il est nécessaire de prendre 0 o/347 ko dans les archives.
Après cette opération, 310 Mo d'espace disque seront libérés.
Souhaitez-vous continuer ? [O/n] O
Préconfiguration des paquets...
(Lecture de la base de données... 447119 fichiers et répertoires déjà installés.)
Suppression de linux-image-extra-4.10.0-40-generic (4.10.0-40.44~16.04.1) ...
depmod: FATAL: could not load /boot/System.map-4.10.0-40-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.10.0-40-generic /boot/vmlinuz-4.10.0-40-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.10.0-40-generic /boot/vmlinuz-4.10.0-40-generic
Error! echo
Your kernel headers for kernel 4.10.0-40-generic cannot be found at
/lib/modules/4.10.0-40-generic/build or /lib/modules/4.10.0-40-generic/source.
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.10.0-40-generic /boot/vmlinuz-4.10.0-40-generic
update-initramfs: Generating /boot/initrd.img-4.10.0-40-generic
WARNING: missing /lib/modules/4.10.0-40-generic
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/4.10.0-40-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
Warning: No support for locale: fr_FR.utf8
depmod: WARNING: could not open /tmp/user/0/mkinitramfs_ogDahD/lib/modules/4.10.0-40-generic/modules.order: No such file or directory
depmod: WARNING: could not open /tmp/user/0/mkinitramfs_ogDahD/lib/modules/4.10.0-40-generic/modules.builtin: No such file or directory

gzip: stdout: No space left on device
E: mkinitramfs failure cpio 141 gzip 1
update-initramfs: failed for /boot/initrd.img-4.10.0-40-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: erreur de traitement du paquet linux-image-extra-4.10.0-40-generic (--remove) :
 le sous-processus script post-removal installé a retourné une erreur de sortie d'état 1
Suppression de linux-image-extra-4.10.0-42-generic (4.10.0-42.46~16.04.1) ...
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.10.0-42-generic /boot/vmlinuz-4.10.0-42-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.10.0-42-generic /boot/vmlinuz-4.10.0-42-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.10.0-42-generic /boot/vmlinuz-4.10.0-42-generic
update-initramfs: Generating /boot/initrd.img-4.10.0-42-generic
Warning: No support for locale: fr_FR.utf8

gzip: stdout: No space left on device
E: mkinitramfs failure cpio 141 gzip 1
update-initramfs: failed for /boot/initrd.img-4.10.0-42-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: erreur de traitement du paquet linux-image-extra-4.10.0-42-generic (--remove) :
 le sous-processus script post-removal installé a retourné une erreur de sortie d'état 1
Des erreurs ont été rencontrées pendant l'exécution :
 linux-image-extra-4.10.0-40-generic
 linux-image-extra-4.10.0-42-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
How can i solve this pls ?

Laurent85
Level 15
Level 15
Posts: 5559
Joined: Tue May 26, 2015 10:11 am

Re: Too many old kernels and /boot partition full - Dependencies pbs with old kernel image preventing clean up

Post by Laurent85 » Wed Aug 15, 2018 5:15 am

Post below command output:

Code: Select all

uname -a
apt search ~ilinux-
ls /boot
df -h /boot /
Image

Bildo
Level 1
Level 1
Posts: 8
Joined: Wed Aug 15, 2018 4:14 am

Re: Too many old kernels and /boot partition full - Dependencies pbs with old kernel image preventing clean up

Post by Bildo » Wed Aug 15, 2018 5:52 am

Here are command outputs :

Code: Select all

 uname -a
Linux dm 4.15.0-29-generic #31~16.04.1-Ubuntu SMP Wed Jul 18 08:54:04 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

Code: Select all

 $ apt search ~ilinux-
i   linux-base                      - Linux image base package                  
i   linux-firmware                  - Firmware for Linux kernel drivers         
i   linux-headers-4.10.0-42         - Header files related to Linux kernel versi
i   linux-headers-4.10.0-42-generic - Linux kernel headers for version 4.10.0 on
i   linux-headers-4.13.0-32         - Header files related to Linux kernel versi
i   linux-headers-4.13.0-32-generic - Linux kernel headers for version 4.13.0 on
i   linux-headers-4.13.0-36         - Header files related to Linux kernel versi
i   linux-headers-4.13.0-36-generic - Linux kernel headers for version 4.13.0 on
i A linux-headers-4.13.0-37         - Header files related to Linux kernel versi
i A linux-headers-4.13.0-37-generic - Linux kernel headers for version 4.13.0 on
i A linux-headers-4.13.0-45         - Header files related to Linux kernel versi
i A linux-headers-4.13.0-45-generic - Linux kernel headers for version 4.13.0 on
i A linux-headers-4.15.0-29         - Header files related to Linux kernel versi
i A linux-headers-4.15.0-29-generic - Linux kernel headers for version 4.15.0 on
i   linux-headers-4.8.0-53          - Header files related to Linux kernel versi
i   linux-headers-4.8.0-53-generic  - Linux kernel headers for version 4.8.0 on 
i   linux-image-4.10.0-42-generic   - Linux kernel image for version 4.10.0 on 6
i   linux-image-4.13.0-32-generic   - Linux kernel image for version 4.13.0 on 6
i   linux-image-4.13.0-36-generic   - Linux kernel image for version 4.13.0 on 6
i A linux-image-4.13.0-37-generic   - Linux kernel image for version 4.13.0 on 6
i A linux-image-4.13.0-45-generic   - Linux kernel image for version 4.13.0 on 6
i A linux-image-4.15.0-29-generic   - Signed kernel image generic               
i   linux-image-4.8.0-53-generic    - Linux kernel image for version 4.8.0 on 64
BB  linux-image-extra-4.10.0-40-gen - Linux kernel extra modules for version 4.1
H   linux-image-extra-4.10.0-42-gen - Linux kernel extra modules for version 4.1
i   linux-image-extra-4.13.0-32-gen - Linux kernel extra modules for version 4.1
i   linux-image-extra-4.13.0-36-gen - Linux kernel extra modules for version 4.1
i A linux-image-extra-4.13.0-37-gen - Linux kernel extra modules for version 4.1
i A linux-image-extra-4.13.0-45-gen - Linux kernel extra modules for version 4.1
i   linux-image-extra-4.8.0-53-gene - Linux kernel extra modules for version 4.8
i   linux-libc-dev                  - Linux Kernel Headers for development      
i A linux-modules-4.15.0-29-generic - Linux kernel extra modules for version 4.1
i A linux-modules-extra-4.15.0-29-g - Linux kernel extra modules for version 4.1
i   linux-sound-base                - base package for ALSA and OSS sound system
i   syslinux-common                 - collection of bootloaders (common)        
i   syslinux-legacy                 - Bootloader for Linux/i386 using MS-DOS flo
i   syslinux-utils                  - collection of bootloaders (utilities)     

Code: Select all

 $ ls /boot
abi-4.10.0-42-generic     initrd.img-4.10.0-42-generic  System.map-4.10.0-42-generic
abi-4.13.0-32-generic     initrd.img-4.13.0-32-generic  System.map-4.13.0-32-generic
abi-4.13.0-36-generic     initrd.img-4.13.0-36-generic  System.map-4.13.0-36-generic
abi-4.13.0-37-generic     initrd.img-4.13.0-37-generic  System.map-4.13.0-37-generic
abi-4.13.0-45-generic     initrd.img-4.13.0-45-generic  System.map-4.13.0-45-generic
abi-4.15.0-29-generic     initrd.img-4.15.0-29-generic  System.map-4.15.0-29-generic
abi-4.8.0-53-generic      initrd.img-4.8.0-53-generic   System.map-4.8.0-53-generic
config-4.10.0-42-generic  lost+found                    vmlinuz-4.10.0-42-generic
config-4.13.0-32-generic  memtest86+.bin                vmlinuz-4.13.0-32-generic
config-4.13.0-36-generic  memtest86+.elf                vmlinuz-4.13.0-36-generic
config-4.13.0-37-generic  memtest86+_multiboot.bin      vmlinuz-4.13.0-37-generic
config-4.13.0-45-generic  retpoline-4.13.0-36-generic   vmlinuz-4.13.0-45-generic
config-4.15.0-29-generic  retpoline-4.13.0-37-generic   vmlinuz-4.15.0-29-generic
config-4.8.0-53-generic   retpoline-4.13.0-45-generic   vmlinuz-4.8.0-53-generic
grub                      retpoline-4.15.0-29-generic

Code: Select all

 $ df -h /boot /
Sys. de fichiers      Taille Utilisé Dispo Uti% Monté sur
/dev/sda3               454M    445M     0 100% /boot
/dev/mapper/mint-root   106G     44G   58G  43% /

gm10
Level 9
Level 9
Posts: 2641
Joined: Thu Jun 21, 2018 5:11 pm

Re: Too many old kernels and /boot partition full - Dependencies pbs with old kernel image preventing clean up

Post by gm10 » Wed Aug 15, 2018 6:14 am

Too clean out all old kernels except the current one, you can run this (copy & paste into a terminal as is):

Code: Select all

dpkg-query -W -f '${Version}\n' linux-image-*;dpkg-query -W -f '${Version}\n' linux-image-*|uniq -u|sed -e 's/\~[^~]*$//' -e 's/\.[^.]*$//' -e "/`uname -r|sed s/-generic//`/Q"  -e 's/.*/ls \/boot\/*-&-*/'|source /dev/stdin
sudo apt-get install -f -y
sudo apt-get autoremove -y
sudo update-grub

User avatar
Pjotr
Level 20
Level 20
Posts: 10775
Joined: Mon Mar 07, 2011 10:18 am
Location: The Netherlands (Holland)
Contact:

Re: Too many old kernels and /boot partition full - Dependencies pbs with old kernel image preventing clean up

Post by Pjotr » Wed Aug 15, 2018 6:18 am

To clean out all old kernels except the current one and the latest old one (always handy to have a spare kernel):
https://sites.google.com/site/easylinux ... one-stroke
(item 9.1, right column)

My personal favourite. :mrgreen:
Tip: 10 things to do after installing Linux Mint 19 Tara
Keep your Linux Mint healthy: Avoid these 10 fatal mistakes
Twitter: twitter.com/easylinuxtips
All in all, horse sense simply makes sense.

User avatar
Pierre
Level 17
Level 17
Posts: 7280
Joined: Fri Sep 05, 2008 5:33 am
Location: Perth, AU.

Re: Too many old kernels and /boot partition full - Dependencies pbs with old kernel image preventing clean up

Post by Pierre » Wed Aug 15, 2018 6:27 am

if you have just had another update of another kernel,,
& you then get that Disk Full Error:
then you need to run one of the above suggestions - Before You Reboot Your Machine !.
as you may get even more issues, after you have done that reboot .. ..

--> this especially applies if you are using LM19 series on your machine.
ie: there are lots of kernel updates, with this version, when compared to the previous LM version.
:o
Image
Please edit your original post title to include [SOLVED] - when your problem is solved!
and DO LOOK at those Unanswered Topics - - you may be able to answer some!.

gm10
Level 9
Level 9
Posts: 2641
Joined: Thu Jun 21, 2018 5:11 pm

Re: Too many old kernels and /boot partition full - Dependencies pbs with old kernel image preventing clean up

Post by gm10 » Wed Aug 15, 2018 6:30 am

Pjotr wrote:
Wed Aug 15, 2018 6:18 am
To clean out all old kernels except the current one and the latest old one (always handy to have a spare kernel):
https://sites.google.com/site/easylinux ... one-stroke
(item 9.1, right column)

My personal favourite. :mrgreen:
Just about certain that will fail with a full /boot partition though. Also I'll send you a PM about a further issue.

Bildo
Level 1
Level 1
Posts: 8
Joined: Wed Aug 15, 2018 4:14 am

Re: Too many old kernels and /boot partition full - Dependencies pbs with old kernel image preventing clean up

Post by Bildo » Wed Aug 15, 2018 6:33 am

gm10 wrote:
Wed Aug 15, 2018 6:14 am
Too clean out all old kernels except the current one, you can run this (copy & paste into a terminal as is):

Code: Select all

dpkg-query -W -f '${Version}\n' linux-image-*;dpkg-query -W -f '${Version}\n' linux-image-*|uniq -u|sed -e 's/\~[^~]*$//' -e 's/\.[^.]*$//' -e "/`uname -r|sed s/-generic//`/Q"  -e 's/.*/ls \/boot\/*-&-*/'|source /dev/stdin
sudo apt-get install -f -y
sudo apt-get autoremove -y
sudo update-grub
Hello,
i just run your script, here is what i get

Code: Select all

~ $ dpkg-query -W -f '${Version}\n' linux-image-*;dpkg-query -W -f '${Version}\n' linux-image-*|uniq -u|sed -e 's/\~[^~]*$//' -e 's/\.[^.]*$//' -e "/`uname -r|sed s/-generic//`/Q"  -e 's/.*/ls \/boot\/*-&-*/'|source /dev/stdin

4.10.0-42.46~16.04.1
4.13.0-32.35~16.04.1
4.13.0-36.40~16.04.1
4.13.0-37.42~16.04.1
4.13.0-45.50~16.04.1
4.15.0-29.31~16.04.1
4.8.0-53.56~16.04.1
4.10.0-40.44~16.04.1
4.10.0-42.46~16.04.1
4.13.0-32.35~16.04.1
4.13.0-36.40~16.04.1
4.13.0-37.42~16.04.1
4.13.0-45.50~16.04.1
4.8.0-53.56~16.04.1

ls: impossible d'accéder à '/boot/*--*': Aucun fichier ou dossier de ce type
/boot/abi-4.10.0-42-generic         /boot/System.map-4.10.0-42-generic
/boot/config-4.10.0-42-generic      /boot/vmlinuz-4.10.0-42-generic
/boot/initrd.img-4.10.0-42-generic
/boot/abi-4.13.0-32-generic         /boot/System.map-4.13.0-32-generic
/boot/config-4.13.0-32-generic      /boot/vmlinuz-4.13.0-32-generic
/boot/initrd.img-4.13.0-32-generic
/boot/abi-4.13.0-36-generic         /boot/retpoline-4.13.0-36-generic
/boot/config-4.13.0-36-generic      /boot/System.map-4.13.0-36-generic
/boot/initrd.img-4.13.0-36-generic  /boot/vmlinuz-4.13.0-36-generic
/boot/abi-4.13.0-37-generic         /boot/retpoline-4.13.0-37-generic
/boot/config-4.13.0-37-generic      /boot/System.map-4.13.0-37-generic
/boot/initrd.img-4.13.0-37-generic  /boot/vmlinuz-4.13.0-37-generic
/boot/abi-4.13.0-45-generic         /boot/retpoline-4.13.0-45-generic
/boot/config-4.13.0-45-generic      /boot/System.map-4.13.0-45-generic
/boot/initrd.img-4.13.0-45-generic  /boot/vmlinuz-4.13.0-45-generic
eric@dm ~ $ sudo apt-get install -f -y
[sudo] Mot de passe de eric : 
Désolé, essayez de nouveau.
[sudo] Mot de passe de eric : 
Lecture des listes de paquets... Fait
Construction de l'arbre des dépendances       
Lecture des informations d'état... Fait
Les paquets suivants ont été installés automatiquement et ne sont plus nécessaires :
  linux-headers-4.13.0-37 linux-headers-4.13.0-37-generic linux-image-4.13.0-37-generic
  linux-image-extra-4.13.0-37-generic
Veuillez utiliser « sudo apt autoremove » pour les supprimer.
Les paquets suivants seront ENLEVÉS :
  linux-image-extra-4.10.0-40-generic linux-image-extra-4.10.0-42-generic
0 mis à jour, 0 nouvellement installés, 2 à enlever et 10 non mis à jour.
2 partiellement installés ou enlevés.
Après cette opération, 312 Mo d'espace disque seront libérés.
(Lecture de la base de données... 447119 fichiers et répertoires déjà installés.)
Suppression de linux-image-extra-4.10.0-40-generic (4.10.0-40.44~16.04.1) ...
depmod: FATAL: could not load /boot/System.map-4.10.0-40-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.10.0-40-generic /boot/vmlinuz-4.10.0-40-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.10.0-40-generic /boot/vmlinuz-4.10.0-40-generic
Error! echo
Your kernel headers for kernel 4.10.0-40-generic cannot be found at
/lib/modules/4.10.0-40-generic/build or /lib/modules/4.10.0-40-generic/source.
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.10.0-40-generic /boot/vmlinuz-4.10.0-40-generic
update-initramfs: Generating /boot/initrd.img-4.10.0-40-generic
WARNING: missing /lib/modules/4.10.0-40-generic
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/4.10.0-40-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
Warning: No support for locale: fr_FR.utf8
depmod: WARNING: could not open /tmp/user/0/mkinitramfs_HTHVHl/lib/modules/4.10.0-40-generic/modules.order: No such file or directory
depmod: WARNING: could not open /tmp/user/0/mkinitramfs_HTHVHl/lib/modules/4.10.0-40-generic/modules.builtin: No such file or directory

gzip: stdout: No space left on device
E: mkinitramfs failure cpio 141 gzip 1
update-initramfs: failed for /boot/initrd.img-4.10.0-40-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: erreur de traitement du paquet linux-image-extra-4.10.0-40-generic (--remove) :
 le sous-processus script post-removal installé a retourné une erreur de sortie d'état 1
Suppression de linux-image-extra-4.10.0-42-generic (4.10.0-42.46~16.04.1) ...
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.10.0-42-generic /boot/vmlinuz-4.10.0-42-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.10.0-42-generic /boot/vmlinuz-4.10.0-42-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.10.0-42-generic /boot/vmlinuz-4.10.0-42-generic
update-initramfs: Generating /boot/initrd.img-4.10.0-42-generic
Warning: No support for locale: fr_FR.utf8

gzip: stdout: No space left on device
E: mkinitramfs failure cpio 141 gzip 1
update-initramfs: failed for /boot/initrd.img-4.10.0-42-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: erreur de traitement du paquet linux-image-extra-4.10.0-42-generic (--remove) :
 le sous-processus script post-removal installé a retourné une erreur de sortie d'état 1
Des erreurs ont été rencontrées pendant l'exécution :
 linux-image-extra-4.10.0-40-generic
 linux-image-extra-4.10.0-42-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
i still have that error code 1, which is linked to images 4.10.0-40 and 4.10.0-42

Bildo
Level 1
Level 1
Posts: 8
Joined: Wed Aug 15, 2018 4:14 am

Re: Too many old kernels and /boot partition full - Dependencies pbs with old kernel image preventing clean up

Post by Bildo » Wed Aug 15, 2018 6:38 am

I did not mention i still have Linux Mint 18.2 Cinnamon 64 bits.

gm10
Level 9
Level 9
Posts: 2641
Joined: Thu Jun 21, 2018 5:11 pm

Re: Too many old kernels and /boot partition full - Dependencies pbs with old kernel image preventing clean up

Post by gm10 » Wed Aug 15, 2018 6:44 am

I'm sorry, I'm an idiot, I had made a change to the first line the other day for testing and forgotten to change it back. Here's the correct version, please run again:

Code: Select all

dpkg-query -W -f '${Version}\n' linux-image-*|uniq -u|sed -e 's/\~[^~]*$//' -e 's/\.[^.]*$//' -e "/`uname -r|sed s/-generic//`/Q" -e 's/.*/sudo rm -rf \/boot\/*-&-*/'|source /dev/stdin
sudo apt-get install -f -y
sudo apt-get autoremove -y
sudo update-grub

Bildo
Level 1
Level 1
Posts: 8
Joined: Wed Aug 15, 2018 4:14 am

Re: Too many old kernels and /boot partition full - Dependencies pbs with old kernel image preventing clean up

Post by Bildo » Wed Aug 15, 2018 6:49 am

That seems much better, here is the output :

Code: Select all

$ dpkg-query -W -f '${Version}\n' linux-image-*;dpkg-query -W -f '${Version}\n' linux-image-*|uniq -u|sed -e 's/\~[^~]*$//' -e 's/\.[^.]*$//' -e "/`uname -r|sed s/-generic//`/Q"  -e 's/.*/sudo rm -rf \/boot\/*-&-*/'|source /dev/stdin

4.10.0-42.46~16.04.1
4.13.0-32.35~16.04.1
4.13.0-36.40~16.04.1
4.13.0-37.42~16.04.1
4.13.0-45.50~16.04.1
4.15.0-29.31~16.04.1
4.8.0-53.56~16.04.1
4.10.0-40.44~16.04.1
4.10.0-42.46~16.04.1
4.13.0-32.35~16.04.1
4.13.0-36.40~16.04.1
4.13.0-37.42~16.04.1
4.13.0-45.50~16.04.1
4.8.0-53.56~16.04.1

eric@dm ~ $ sudo apt-get install -f -y
Lecture des listes de paquets... Fait
Construction de l'arbre des dépendances       
Lecture des informations d'état... Fait
Les paquets suivants ont été installés automatiquement et ne sont plus nécessaires :
  linux-headers-4.13.0-37 linux-headers-4.13.0-37-generic linux-image-4.13.0-37-generic linux-image-extra-4.13.0-37-generic
Veuillez utiliser « sudo apt autoremove » pour les supprimer.
Les paquets suivants seront ENLEVÉS :
  linux-image-extra-4.10.0-40-generic linux-image-extra-4.10.0-42-generic
0 mis à jour, 0 nouvellement installés, 2 à enlever et 10 non mis à jour.
2 partiellement installés ou enlevés.
Après cette opération, 312 Mo d'espace disque seront libérés.
(Lecture de la base de données... 447119 fichiers et répertoires déjà installés.)
Suppression de linux-image-extra-4.10.0-40-generic (4.10.0-40.44~16.04.1) ...
depmod: FATAL: could not load /boot/System.map-4.10.0-40-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.10.0-40-generic /boot/vmlinuz-4.10.0-40-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.10.0-40-generic /boot/vmlinuz-4.10.0-40-generic
Error! echo
Your kernel headers for kernel 4.10.0-40-generic cannot be found at
/lib/modules/4.10.0-40-generic/build or /lib/modules/4.10.0-40-generic/source.
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.10.0-40-generic /boot/vmlinuz-4.10.0-40-generic
update-initramfs: Generating /boot/initrd.img-4.10.0-40-generic
WARNING: missing /lib/modules/4.10.0-40-generic
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/4.10.0-40-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
Warning: No support for locale: fr_FR.utf8
depmod: WARNING: could not open /tmp/user/0/mkinitramfs_1oK3uz/lib/modules/4.10.0-40-generic/modules.order: No such file or directory
depmod: WARNING: could not open /tmp/user/0/mkinitramfs_1oK3uz/lib/modules/4.10.0-40-generic/modules.builtin: No such file or directory
run-parts: executing /etc/kernel/postinst.d/pm-utils 4.10.0-40-generic /boot/vmlinuz-4.10.0-40-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.10.0-40-generic /boot/vmlinuz-4.10.0-40-generic
Création du fichier de configuration GRUB…
Image Linux trouvée : /boot/vmlinuz-4.15.0-29-generic
Image mémoire initiale trouvée : /boot/initrd.img-4.15.0-29-generic
Image Linux trouvée : /boot/vmlinuz-4.8.0-53-generic
Image mémoire initiale trouvée : /boot/initrd.img-4.8.0-53-generic
Found memtest86+ image: /memtest86+.elf
Found memtest86+ image: /memtest86+.bin
Windows 10 (loader) trouvé sur /dev/sda1
Windows Recovery Environment (loader) trouvé sur /dev/sda2
fait
Suppression de linux-image-extra-4.10.0-42-generic (4.10.0-42.46~16.04.1) ...
depmod: FATAL: could not load /boot/System.map-4.10.0-42-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.10.0-42-generic /boot/vmlinuz-4.10.0-42-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.10.0-42-generic /boot/vmlinuz-4.10.0-42-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.10.0-42-generic /boot/vmlinuz-4.10.0-42-generic
update-initramfs: Generating /boot/initrd.img-4.10.0-42-generic
Warning: No support for locale: fr_FR.utf8
run-parts: executing /etc/kernel/postinst.d/pm-utils 4.10.0-42-generic /boot/vmlinuz-4.10.0-42-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.10.0-42-generic /boot/vmlinuz-4.10.0-42-generic
Création du fichier de configuration GRUB…
Image Linux trouvée : /boot/vmlinuz-4.15.0-29-generic
Image mémoire initiale trouvée : /boot/initrd.img-4.15.0-29-generic
Image Linux trouvée : /boot/vmlinuz-4.8.0-53-generic
Image mémoire initiale trouvée : /boot/initrd.img-4.8.0-53-generic
Found memtest86+ image: /memtest86+.elf
Found memtest86+ image: /memtest86+.bin
Windows 10 (loader) trouvé sur /dev/sda1
Windows Recovery Environment (loader) trouvé sur /dev/sda2
fait
when i type ls /boot, here is the output now

Code: Select all

~ $ ls /boot
abi-4.15.0-29-generic     initrd.img-4.10.0-40-generic  memtest86+.bin                System.map-4.8.0-53-generic
abi-4.8.0-53-generic      initrd.img-4.10.0-42-generic  memtest86+.elf                vmlinuz-4.15.0-29-generic
config-4.15.0-29-generic  initrd.img-4.15.0-29-generic  memtest86+_multiboot.bin      vmlinuz-4.8.0-53-generic
config-4.8.0-53-generic   initrd.img-4.8.0-53-generic   retpoline-4.15.0-29-generic
grub                      lost+found                    System.map-4.15.0-29-generic

Bildo
Level 1
Level 1
Posts: 8
Joined: Wed Aug 15, 2018 4:14 am

Re: Too many old kernels and /boot partition full - Dependencies pbs with old kernel image preventing clean up

Post by Bildo » Wed Aug 15, 2018 6:58 am

What is maybe strange is that kernels are still tagged as Installed in the Update Manager.
But what is good now is that i can remove them from the Update Manager, which was not possible before.
Thanks a lot, your script made a good job on my machine - i dont know what but now seems good, so thanks.

Code: Select all

~ $ df -h /boot /
Sys. de fichiers      Taille Utilisé Dispo Uti% Monté sur
/dev/sda3               454M     92M  335M  22% /boot
/dev/mapper/mint-root   106G     43G   59G  43% /
My /boot partition is now much better.

gm10
Level 9
Level 9
Posts: 2641
Joined: Thu Jun 21, 2018 5:11 pm

Re: Too many old kernels and /boot partition full - Dependencies pbs with old kernel image preventing clean up

Post by gm10 » Wed Aug 15, 2018 7:06 am

Damn, how are you so fast, lol, I hadn't fully fixed the command when I first posted the fixed version and edited to properly fix that not even 30 seconds later, but seems you managed to grab it in between. I need to be more careful posting.

No harm done though, you don't need to do it again.

Now to the remaining errors:

Code: Select all

sudo dpkg --remove --force-remove-reinstreq linux-image-extra-4.10.0-40-generic linux-image-extra-4.10.0-42-generic
apt install -f
apt check
If you can successfully remove the remaining old kernels via Update Manager, then do that, but maybe post outputs of these once you're done so we can make sure:

Code: Select all

ls /boot 
apt list --installed linux-*

DAMIEN1307
Level 5
Level 5
Posts: 965
Joined: Tue Feb 21, 2017 8:13 pm
Location: Alamogordo, New Mexico

Re: Too many old kernels and /boot partition full - Dependencies pbs with old kernel image preventing clean up

Post by DAMIEN1307 » Wed Aug 15, 2018 10:25 am

these terminal commands will clean up residual crud that is usually left over after so many kernel deletions...DAMIEN

Kernel and other Cleanups after Deletion

do these one at a time, dont worry if the first dpkg -l says error etc...just means nothing is there is all...

sudo apt autoremove

dpkg -l | grep '^rc' | awk '{print $2}' | sudo xargs dpkg --purge

dpkg -l | grep '^rc' | awk '{print $2}' | xargs sudo apt-get purge

dpkg --get-selections | grep linux-headers && dpkg --get-selections | grep linux-image

then reboot
ORDO AB CHAO

gm10
Level 9
Level 9
Posts: 2641
Joined: Thu Jun 21, 2018 5:11 pm

Re: Too many old kernels and /boot partition full - Dependencies pbs with old kernel image preventing clean up

Post by gm10 » Wed Aug 15, 2018 10:50 am

DAMIEN1307 wrote:
Wed Aug 15, 2018 10:25 am
these terminal commands will clean up residual crud that is usually left over after so many kernel deletions...DAMIEN

Kernel and other Cleanups after Deletion

do these one at a time, dont worry if the first dpkg -l says error etc...just means nothing is there is all...

sudo apt autoremove

dpkg -l | grep '^rc' | awk '{print $2}' | sudo xargs dpkg --purge

dpkg -l | grep '^rc' | awk '{print $2}' | xargs sudo apt-get purge

dpkg --get-selections | grep linux-headers && dpkg --get-selections | grep linux-image

then reboot
OP, before you run that blindly:

The first line removes automatically installed packages that no other package depends on anymore. This is generally safe to run, in fact you already ran it because it was part of the commands I gave you above.

The two following lines both do the same thing, they try to remove residual configuration files, i.e. configuration files that were originally installed by packages which have been removed in the meantime. You may not want to remove these - I keep a few around for packages I do not currently have installed but which I may want to re-install again in the future. If that's not the case for you, then by all means clean them up.

The last line does nothing.

Reboot is not required.

DAMIEN1307
Level 5
Level 5
Posts: 965
Joined: Tue Feb 21, 2017 8:13 pm
Location: Alamogordo, New Mexico

Re: Too many old kernels and /boot partition full - Dependencies pbs with old kernel image preventing clean up

Post by DAMIEN1307 » Wed Aug 15, 2018 10:57 am

gm10 said... "The last line does nothing" ...the last line DOES do something...it gives you a read out of what kernels are left "installed" in your system...my readout from my system listed below...DAMIEN

damien@damien ~ $ dpkg --get-selections | grep linux-headers && dpkg --get-selections | grep linux-image
linux-headers-4.15.0-30 install
linux-headers-4.15.0-30-generic install
linux-headers-4.15.0-32 install
linux-headers-4.15.0-32-generic install
linux-headers-generic install
linux-image-4.15.0-30-generic install
linux-image-4.15.0-32-generic install
linux-image-generic install
damien@damien ~ $
ORDO AB CHAO

gm10
Level 9
Level 9
Posts: 2641
Joined: Thu Jun 21, 2018 5:11 pm

Re: Too many old kernels and /boot partition full - Dependencies pbs with old kernel image preventing clean up

Post by gm10 » Wed Aug 15, 2018 11:09 am

DAMIEN1307 wrote:
Wed Aug 15, 2018 10:57 am
gm10 said... "The last line does nothing" ...the last line DOES do something....it gives you a read out of what kernels are left "installed" in your system..
I meant nothing in the sense of it doesn't make any changes. As such it's safe to run. I should have been more specific.

By the way, it does not just list old kernels but also your current one. Plus kernel headers and associated meta-packages.

w7fzy
Level 1
Level 1
Posts: 23
Joined: Mon Oct 10, 2016 12:00 am

Re: Too many old kernels and /boot partition full - Dependencies pbs with old kernel image preventing clean up

Post by w7fzy » Thu Aug 16, 2018 11:48 am

Amazing timing. I'm having the same problem, I think.
Running 18.2 linux mint on 64 bit machine that is dual booted so I limited my root partition. Keep getting Low Disk Space on "Filesystem root" warning message.

Reading through your info above. I'm not sure which batch of commands I should run so would you please post the corrected one? Thanks..

Here are my /ls boot results
ls /boot
abi-4.10.0-38-generic memtest86+.bin
abi-4.15.0-29-generic memtest86+.elf
abi-4.15.0-30-generic memtest86+_multiboot.bin
abi-4.15.0-32-generic retpoline-4.15.0-29-generic
abi-4.4.0-130-generic retpoline-4.15.0-30-generic
abi-4.4.0-131-generic retpoline-4.15.0-32-generic
abi-4.4.0-21-generic retpoline-4.4.0-130-generic
config-4.10.0-38-generic retpoline-4.4.0-131-generic
config-4.15.0-29-generic System.map-4.10.0-38-generic
config-4.15.0-30-generic System.map-4.15.0-29-generic
config-4.15.0-32-generic System.map-4.15.0-30-generic
config-4.4.0-130-generic System.map-4.15.0-32-generic
config-4.4.0-131-generic System.map-4.4.0-130-generic
config-4.4.0-21-generic System.map-4.4.0-131-generic
efi System.map-4.4.0-21-generic
grub vmlinuz-4.10.0-38-generic
initrd.img-4.10.0-38-generic vmlinuz-4.15.0-29-generic
initrd.img-4.15.0-29-generic vmlinuz-4.15.0-30-generic
initrd.img-4.15.0-30-generic vmlinuz-4.15.0-32-generic
initrd.img-4.15.0-32-generic vmlinuz-4.4.0-130-generic
initrd.img-4.4.0-130-generic vmlinuz-4.4.0-131-generic
initrd.img-4.4.0-131-generic vmlinuz-4.4.0-21-generic
initrd.img-4.4.0-21-generic

Something seems wrong with the $apt search -ilinux command below. Do I need a space?
{I looked at the original post and noticed that I needed a tilde, not a hyphen in front of ilinux. Redid and edited below}

uname -a
Linux Gimli 4.15.0-32-generic #35~16.04.1-Ubuntu SMP Fri Aug 10 21:54:34 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
XXXXX@Gimli ~ $ apt search ~ilinux-
i linux-base - Linux image base package
i linux-firmware - Firmware for Linux kernel drivers
i A linux-headers-4.10.0-38 - Header files related to Linux kernel versi
i A linux-headers-4.10.0-38-generic - Linux kernel headers for version 4.10.0 on
i linux-headers-4.15.0-29 - Header files related to Linux kernel versi
i linux-headers-4.15.0-29-generic - Linux kernel headers for version 4.15.0 on
i linux-headers-4.15.0-30 - Header files related to Linux kernel versi
i linux-headers-4.15.0-30-generic - Linux kernel headers for version 4.15.0 on
i linux-headers-4.15.0-32 - Header files related to Linux kernel versi
i linux-headers-4.15.0-32-generic - Linux kernel headers for version 4.15.0 on
i linux-headers-4.4.0-130 - Header files related to Linux kernel versi
i linux-headers-4.4.0-130-generic - Linux kernel headers for version 4.4.0 on
i linux-headers-4.4.0-131 - Header files related to Linux kernel versi
i linux-headers-4.4.0-131-generic - Linux kernel headers for version 4.4.0 on
i linux-headers-4.4.0-21 - Header files related to Linux kernel versi
i linux-headers-4.4.0-21-generic - Linux kernel headers for version 4.4.0 on
i A linux-image-4.10.0-38-generic - Linux kernel image for version 4.10.0 on 6
i linux-image-4.15.0-29-generic - Signed kernel image generic
i linux-image-4.15.0-30-generic - Signed kernel image generic
i linux-image-4.15.0-32-generic - Signed kernel image generic
i linux-image-4.4.0-130-generic - Linux kernel image for version 4.4.0 on 64
i linux-image-4.4.0-131-generic - Linux kernel image for version 4.4.0 on 64
i linux-image-4.4.0-21-generic - Linux kernel image for version 4.4.0 on 64
i A linux-image-extra-4.10.0-38-gen - Linux kernel extra modules for version 4.1
i linux-image-extra-4.4.0-130-gen - Linux kernel extra modules for version 4.4
i linux-image-extra-4.4.0-131-gen - Linux kernel extra modules for version 4.4
i linux-image-extra-4.4.0-21-gene - Linux kernel extra modules for version 4.4
i linux-kernel-generic - The Linux kernel.
i linux-libc-dev - Linux Kernel Headers for development
i A linux-modules-4.15.0-29-generic - Linux kernel extra modules for version 4.1
i A linux-modules-4.15.0-30-generic - Linux kernel extra modules for version 4.1
i A linux-modules-4.15.0-32-generic - Linux kernel extra modules for version 4.1
i linux-modules-extra-4.15.0-29-g - Linux kernel extra modules for version 4.1
i linux-modules-extra-4.15.0-30-g - Linux kernel extra modules for version 4.1
i linux-modules-extra-4.15.0-32-g - Linux kernel extra modules for version 4.1
i linux-sound-base - base package for ALSA and OSS sound system
i syslinux-common - collection of bootloaders (common)
i syslinux-legacy - Bootloader for Linux/i386 using MS-DOS flo
i syslinux-utils - collection of bootloaders (utilities)

df -h boot /
df: boot: No such file or directory
Filesystem Size Used Avail Use% Mounted on
/dev/sda6 23G 22G 331M 99% /


Thanks for the repost.
Time flies like an arrow.
Fruit flies like a banana.

gm10
Level 9
Level 9
Posts: 2641
Joined: Thu Jun 21, 2018 5:11 pm

Re: Too many old kernels and /boot partition full - Dependencies pbs with old kernel image preventing clean up

Post by gm10 » Thu Aug 16, 2018 12:02 pm

w7fzy wrote:
Thu Aug 16, 2018 11:48 am
Amazing timing. I'm having the same problem, I think.
Please don't hijack other user's support threads. Your problem isn't even the same. See forum rules linked in the red banner at the top. Make your own thread and someone will be happy to help.

w7fzy
Level 1
Level 1
Posts: 23
Joined: Mon Oct 10, 2016 12:00 am

Re: Too many old kernels and /boot partition full - Dependencies pbs with old kernel image preventing clean up

Post by w7fzy » Thu Aug 16, 2018 3:20 pm

Hijacked?
Interesting.
Usually, when you start a new post on forums you are flamed for not doing a search for the same problem.
RE: Rules ->
RULE NUMBER ONE. Search Before Posting

Search the Linux Mint forums and Google for questions before posting.
You can also search the Linux Mint forums with Google, Yahoo, DuckDuckGo or your favourite search engine by entering site:forums.linuxmint.com with your search query....


I didn't do anything to my computer and since I'm not experienced, I figured I WAS following the forum rules of doing a search first. I've never been reprimanded for doing a search and finding what I think is the correct post and asking a question. Until now.
Time flies like an arrow.
Fruit flies like a banana.

Post Reply

Return to “Software & Applications”