Não é possível remover o kernel antigo mostrando o código de erro 1

1

Eu tentei remover meus kernels antigos para fazer atualizações de espaço livre suficientes.

Eu tentei

sudo apt-get purge 4.4.0-81-generic

e retorna

gzip: stdout: No space left on device E: mkinitramfs failure cpio 141
gzip 1 update-initramfs: failed for /boot/initrd.img-4.4.0-83-generic with 1. 
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1 
Failed to process /etc/kernel/postinst.d at /var/lib/dpkg/info/linux-image-4.4.0-83-generic.postinst line 1052.
dpkg: error processing package linux-image-4.4.0-83-generic  (--configure):  subprocess installed post-installation script returned error exit status 2
dpkg: dependency problems prevent configuration of linux-image-extra-4.4.0-83-generic: 
 linux-image-extra-4.4.0-83-generic depends on
 linux-image-4.4.0-83-generic; however: 
 Package linux-image-4.4.0-83-generic is not configured yet.
dpkg: error processing package linux-image-extra-4.4.0-83-generic  (--configure):  dependency problems - leaving unconfigured 
Processing triggers for initramfs-tools (0.122ubuntu8.8) ... 
No apport report written because the error message indicates its a followup error from a previous failure.

update-initramfs: Generating /boot/initrd.img-4.4.0-81-generic 
depmod: WARNING: could not open /var/tmp/mkinitramfs_6MkWbI/lib/modules/4.4.0-81-generic/modules.order: No such file or directory 
depmod: WARNING: could not open /var/tmp/mkinitramfs_6MkWbI/lib/modules/4.4.0-81-generic/modules.builtin: No such file or directory
gzip: stdout: No space left on device 
E: mkinitramfs failure cpio 141
gzip 1 update-initramfs: failed for /boot/initrd.img-4.4.0-81-generic with 1. 
dpkg: error processing package initramfs-tools (--configure): 
 subprocess installed post-installation script returned error exit status 1 
Errors were encountered while processing: 
 linux-image-4.4.0-83-generic  linux-image-extra-4.4.0-83-generic 
 initramfs-tools 
E: Sub-process /usr/bin/dpkg returned an error code (1)

Como posso resolver isso?

Estou usando o Ubuntu 16.04 de 64 bits.

$ ls -l /boot
total 310275
-rw-r--r-- 1 prafulla root  1241623 Jul 28  2016 abi-4.4.0-34-generic
-rw-r--r-- 1 prafulla root  1242701 Oct  8  2016 abi-4.4.0-42-generic
-rw-r--r-- 1 prafulla root  1242701 Oct 19  2016 abi-4.4.0-45-generic
-rw-r--r-- 1 prafulla root  1243800 Dec 10  2016 abi-4.4.0-57-generic
-rw-r--r-- 1 prafulla root  1244118 Jan  7 06:14 abi-4.4.0-59-generic
-rw-r--r-- 1 prafulla root  1244118 Jan 18 21:29 abi-4.4.0-62-generic
-rw-r--r-- 1 prafulla root  1245512 Feb 20 19:10 abi-4.4.0-64-generic
-rw-r--r-- 1 prafulla root  1246511 Jun 27 01:15 abi-4.4.0-83-generic
-rw-r--r-- 1 prafulla root   189676 Jul 28  2016 config-4.4.0-34-generic
-rw-r--r-- 1 prafulla root   189760 Oct  8  2016 config-4.4.0-42-generic
-rw-r--r-- 1 prafulla root   189760 Oct 19  2016 config-4.4.0-45-generic
-rw-r--r-- 1 prafulla root   189991 Dec 10  2016 config-4.4.0-57-generic
-rw-r--r-- 1 prafulla root   190047 Jan  7 06:14 config-4.4.0-59-generic
-rw-r--r-- 1 prafulla root   190047 Jan 18 21:29 config-4.4.0-62-generic
-rw-r--r-- 1 prafulla root   190247 Feb 20 19:10 config-4.4.0-64-generic
-rw-r--r-- 1 prafulla root   190356 Jun 27 01:15 config-4.4.0-83-generic
drwx------ 3 root     root     4096 Jan  1  1970 efi
drwxr-xr-x 5 prafulla root     1024 Jul  5 17:14 grub
-rw-r--r-- 1 prafulla root 39251639 Jul  5 11:53 initrd.img-4.4.0-57-generic
-rw-r--r-- 1 prafulla root 39246014 Jul  5 11:53 initrd.img-4.4.0-59-generic
-rw-r--r-- 1 prafulla root 39245795 Jul  5 11:53 initrd.img-4.4.0-62-generic
-rw-r--r-- 1 prafulla root 39230522 Jul  5 11:52 initrd.img-4.4.0-64-generic
-rw-r--r-- 1 prafulla root 10396186 Jul  5 11:52 initrd.img-4.4.0-75-generic
drwx------ 2 prafulla root    12288 May 11  2016 lost+found
-rw-r--r-- 1 prafulla root   182704 Jan 28  2016 memtest86+.bin
-rw-r--r-- 1 prafulla root   184380 Jan 28  2016 memtest86+.elf
-rw-r--r-- 1 prafulla root   184840 Jan 28  2016 memtest86+_multiboot.bin
-rw------- 1 prafulla root  3866644 Jul 28  2016 System.map-4.4.0-34-generic
-rw------- 1 prafulla root  3869895 Oct  8  2016 System.map-4.4.0-42-generic
-rw------- 1 prafulla root  3869895 Oct 19  2016 System.map-4.4.0-45-generic
-rw------- 1 prafulla root  3875329 Dec 10  2016 System.map-4.4.0-57-generic
-rw------- 1 prafulla root  3875594 Jan  7 06:14 System.map-4.4.0-59-generic
-rw------- 1 prafulla root  3875553 Jan 18 21:29 System.map-4.4.0-62-generic
-rw------- 1 prafulla root  3883990 Feb 20 19:10 System.map-4.4.0-64-generic
-rw------- 1 prafulla root  3883887 Jun 27 01:15 System.map-4.4.0-83-generic
-rw------- 1 prafulla root  7046160 Jul 28  2016 vmlinuz-4.4.0-34-generic
-rw------- 1 prafulla root  7048088 Aug 19  2016 vmlinuz-4.4.0-34-generic.efi.signed
-rw------- 1 prafulla root  7053472 Oct  8  2016 vmlinuz-4.4.0-42-generic
-rw------- 1 prafulla root  7055384 Oct 13  2016 vmlinuz-4.4.0-42-generic.efi.signed
-rw------- 1 prafulla root  7054208 Oct 19  2016 vmlinuz-4.4.0-45-generic
-rw------- 1 prafulla root  7056120 Nov  8  2016 vmlinuz-4.4.0-45-generic.efi.signed
-rw------- 1 prafulla root  7067152 Dec 10  2016 vmlinuz-4.4.0-57-generic
-rw------- 1 prafulla root  7069080 Dec 27  2016 vmlinuz-4.4.0-57-generic.efi.signed
-rw------- 1 prafulla root  7069136 Jan  7 06:14 vmlinuz-4.4.0-59-generic
-rw------- 1 prafulla root  7071064 Jan 11 12:51 vmlinuz-4.4.0-59-generic.efi.signed
-rw------- 1 prafulla root  7070992 Jan 18 21:29 vmlinuz-4.4.0-62-generic
-rw------- 1 prafulla root  7072920 Feb  7 11:48 vmlinuz-4.4.0-62-generic.efi.signed
-rw------- 1 prafulla root  7087152 Feb 20 19:10 vmlinuz-4.4.0-64-generic
-rw------- 1 prafulla root  7089080 Feb 24 11:07 vmlinuz-4.4.0-64-generic.efi.signed
-rw------- 1 prafulla root  7092720 Jun 27 01:15 vmlinuz-4.4.0-83-generic

$ sudo rm config-4.4.0-[3,4,5][4,2,5,7,9]-generic abi-4.4.0-[3,4,5][4,2,5,7,9]-generic initrd.img-4.4.0-[3,4,5][4,2,5,7,9]-generic System.map4.4.0-[3,4,5][4,2,5,7,9]-generic
rm: cannot remove 'config-4.4.0-[3,4,5][4,2,5,7,9]-generic': No such file or directory
rm: cannot remove 'abi-4.4.0-[3,4,5][4,2,5,7,9]-generic': No such file or directory
rm: cannot remove 'initrd.img-4.4.0-[3,4,5][4,2,5,7,9]-generic': No such file or directory
rm: cannot remove 'System.map4.4.0-[3,4,5][4,2,5,7,9]-generic': No such file or directory
    
por Prafulla Kumar Sahu 05.07.2017 / 13:22

2 respostas

4

Exclua-o manualmente para criar espaço e execute os comandos posteriormente.

Isto irá listar todos os kernels instalados sem o atualmente em uso

dpkg -l | tail -n +6 | grep -E 'linux-image-[0-9]+' | grep -Fv $(uname -r)

Uma vez que você sabe o nome dos pacotes, você pode limpá-los com o dpkg, por exemplo,

sudo dpkg --purge linux-image-4.4.0-21-generic

Depois de remover todos os seus kernels antigos, você pode querer reparar suas dependências quebradas executando:

sudo apt -f install

Se nada funcionar, clique no seu /boot e exclua-os manualmente com o comando rm. Cuidado com isso, embora você não queira excluir o usado atualmente ...

sudo rm config-4.4.0-[3,4,5][4,2,5,7,9]-generic abi-4.4.0-[3,4,5][4,2,5,7,9]-generic initrd.img-4.4.0-[3,4,5][4,2,5,7,9]-generic System.map-4.4.0-[3,4,5][4,2,5,7,9]-generic vmlinuz-4.4.0-[3,4,5][4,2,5,7,9]-generic*
    
por Ziazis 05.07.2017 / 13:45
0

Eu fiz isso com o Install byobu :

sudo apt install byobu

depois, remova os kernels antigos:

sudo purge-old-kernels

concluído

    
por ChaosPredictor 19.05.2018 / 18:54