Qual versão do kernel excluir quando houver pouco espaço em disco em/boot?

Qual versão do kernel excluir quando houver pouco espaço em disco em/boot?

Executando no Ubuntu 20.04, surgiu uma mensagem de erro de pouco espaço em disco em /boot ao tentar atualizar.

The upgrade needs a total of 228 M free space on disk '/boot'. Please free at least an additional 24,8 M of disk space on '/boot'.

na minha pasta /boot tenho os seguintes arquivos:

/boot
total 460452
drwx------ 3 root root      4096 Jan  1  1970 efi
-rw-r--r-- 1 root root    184884 Aug 18  2020 memtest86+_multiboot.bin
-rw-r--r-- 1 root root    184380 Aug 18  2020 memtest86+.elf
-rw-r--r-- 1 root root    182704 Aug 18  2020 memtest86+.bin
drwx------ 2 root root     16384 Feb  2  2021 lost+found
-rw------- 1 root root   6219821 Jan  6 17:21 System.map-5.15.0-58-generic
-rw-r--r-- 1 root root    262181 Jan  6 17:21 config-5.15.0-58-generic
-rw------- 1 root root  11450528 Jan  6 17:21 vmlinuz-5.15.0-58-generic
-rw-r--r-- 1 root root 217500477 Jan 20 06:33 initrd.img-5.15.0-58-generic
-rw------- 1 root root   6221223 Jan 25 10:27 System.map-5.15.0-60-generic
-rw-r--r-- 1 root root    262215 Jan 25 10:27 config-5.15.0-60-generic
-rw------- 1 root root  11458344 Jan 25 10:29 vmlinuz-5.15.0-60-generic
lrwxrwxrwx 1 root root        25 Feb  9 06:53 vmlinuz.old -> vmlinuz-5.15.0-58-generic
lrwxrwxrwx 1 root root        25 Feb  9 06:53 vmlinuz -> vmlinuz-5.15.0-60-generic
lrwxrwxrwx 1 root root        28 Feb  9 06:53 initrd.img.old -> initrd.img-5.15.0-58-generic
lrwxrwxrwx 1 root root        28 Feb  9 06:53 initrd.img -> initrd.img-5.15.0-60-generic
-rw-r--r-- 1 root root 217514515 Feb  9 06:53 initrd.img-5.15.0-60-generic
drwxr-xr-x 4 root root      4096 Feb  9 06:54 grub

o comando "uname -a" retorna:

uname -a
Linux balazskocsis 5.15.0-60-generic #66~20.04.1-Ubuntu SMP Wed Jan 25 09:41:30 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

quando listo os pacotes dpkg, recebo:

dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d'
linux-generic-hwe-20.04
linux-headers-5.15.0-58-generic
linux-headers-5.8.0-63-generic
linux-headers-generic-hwe-20.04
linux-hwe-5.15-headers-5.15.0-58
linux-hwe-5.8-headers-5.8.0-63
linux-image-5.15.0-58-generic
linux-image-generic-hwe-20.04
linux-libc-dev:amd64
linux-modules-5.15.0-58-generic
linux-modules-extra-5.15.0-58-generic

Acredito que preciso limpar com o comando purge a versão 5-15.0-58 do kernel:

sudo apt-get -y purge linux-modules-5.15.0-58-generic

mas não tenho muita certeza.

Se eu interpretar isso corretamente:

lrwxrwxrwx 1 root root        25 Feb  9 06:53 vmlinuz.old -> vmlinuz-5.15.0-58-generic
lrwxrwxrwx 1 root root        25 Feb  9 06:53 vmlinuz -> vmlinuz-5.15.0-60-generic

a versão atual é a 5.15.0-60 e aquelas com 5.15.0-58 podem ser removidas.

Dada a saída da listagem da pasta /boot e o uname -a, seria seguro remover a versão 5.15.0-58?

Responder1

Se você tiver certeza de que a versão 5.15.0-60 do kernel está funcionando corretamente, sim, você pode remover a versão 5-15.0-58 do kernel.

No meu sistema, os seguintes arquivos são removidos automaticamente para kernels antigos:

linux-modules-extra-5.15.0-xx-generic
linux-modules-5.15.0-xx-generic
linux-image-5.15.0-xx-generic
linux-headers-5.15.0-xx-generic
linux-headers-5.15.0-xx

Então você poderia executar:

sudo apt remove --purge linux-modules-extra-5.15.0-58-generic linux-modules-5.15.0-58-generic linux-image-5.15.0-58-generic linux-headers-5.15.0-58-generic linux-headers-5.15.0-58

No entanto, esteja ciente de que, ao fazer isso, você estaráremovendo a rede de segurançade ter um kernel de backup instalado (o anterior), e só teráum kernel funcionalno sistema.

No longo prazo, seria muito mais aconselhável expandir sua /bootpartição, para que o Ubuntu possa rodar normalmente com 2 kernels funcionais instalados.

informação relacionada