Tentando liberar espaço em disco no servidor de produção

1

Estou com dificuldades em me comprometer com algumas das soluções para criar espaço na minha partição de inicialização ... Eu li sobre, e entendi autoremove - eu li sobre e entendi apt-get -f install . Mas meu problema é um pouco diferente de todas as perguntas que têm respostas por aí. Todo mundo diz manualmente remover todos, mas os últimos 3 kernels. Aqui está minha reserva.

Quando eu emito o comando uname -r , recebo:

4.4.0-78-generic

Quando emito dpkg --list 'linux-image*' , obtenho:

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-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
ii  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
ii  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
ii  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
ii  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
ii  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
ii  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
ii  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
ii  linux-image-4.4.0-92-generic                  4.4.0-92.115                amd64                       Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  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
iF  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
iF  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
in  linux-image-4.4.0-98-generic                  <none>                      amd64                       (no description available)
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-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
ii  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
ii  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
ii  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
ii  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
ii  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
ii  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
ii  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
ii  linux-image-extra-4.4.0-92-generic            4.4.0-92.115                amd64                       Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
iF  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
iU  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
iU  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
iU  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
iU  linux-image-generic                           4.4.0.98.103                amd64                       Generic Linux kernel image

Eu tentei apt-get autoremove , mas recebi:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
 linux-image-extra-4.4.0-98-generic : Depends: linux-image-4.4.0-98-generic but it is not installed
 linux-image-generic : Depends: linux-image-4.4.0-98-generic but it is not installed
                       Recommends: thermald but it is not installed
E: Unmet dependencies. Try using -f.

Então, tento resolver as dependências por meio de sudo apt-get -f install e recebo:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  linux-headers-4.4.0-79 linux-headers-4.4.0-79-generic linux-headers-4.4.0-81 linux-headers-4.4.0-81-generic linux-headers-4.4.0-83 linux-headers-4.4.0-83-generic linux-headers-4.4.0-87
  linux-headers-4.4.0-87-generic linux-headers-4.4.0-89 linux-headers-4.4.0-89-generic linux-headers-4.4.0-91 linux-headers-4.4.0-91-generic linux-headers-4.4.0-92 linux-headers-4.4.0-92-generic
  linux-image-4.4.0-79-generic linux-image-4.4.0-81-generic linux-image-4.4.0-83-generic linux-image-4.4.0-87-generic linux-image-4.4.0-89-generic linux-image-4.4.0-91-generic linux-image-4.4.0-92-generic
  linux-image-extra-4.4.0-79-generic linux-image-extra-4.4.0-81-generic linux-image-extra-4.4.0-83-generic linux-image-extra-4.4.0-87-generic linux-image-extra-4.4.0-89-generic
  linux-image-extra-4.4.0-91-generic linux-image-extra-4.4.0-92-generic
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  linux-image-4.4.0-98-generic
Suggested packages:
  fdutils linux-doc-4.4.0 | linux-source-4.4.0 linux-tools
The following NEW packages will be installed:
  linux-image-4.4.0-98-generic
0 upgraded, 1 newly installed, 0 to remove and 99 not upgraded.
12 not fully installed or removed.
Need to get 0 B/21.9 MB of archives.
After this operation, 67.0 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 446621 files and directories currently installed.)
Preparing to unpack .../linux-image-4.4.0-98-generic_4.4.0-98.121_amd64.deb ...
Done.
Unpacking linux-image-4.4.0-98-generic (4.4.0-98.121) ...
dpkg: error processing archive /var/cache/apt/archives/linux-image-4.4.0-98-generic_4.4.0-98.121_amd64.deb (--unpack):
 cannot copy extracted data for './boot/vmlinuz-4.4.0-98-generic' to '/boot/vmlinuz-4.4.0-98-generic.dpkg-new': failed to write (No space left on device)
No apport report written because the error message indicates a disk full error
                                                                              dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.4.0-98-generic /boot/vmlinuz-4.4.0-98-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.4.0-98-generic /boot/vmlinuz-4.4.0-98-generic
Errors were encountered while processing:
 /var/cache/apt/archives/linux-image-4.4.0-98-generic_4.4.0-98.121_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Aqui é onde estou confuso. Estou usando a versão 4.4.0-78-generic de acordo com uname -r . No entanto, literalmente, todas as respostas que li até agora dizem para remover tudo, menos as últimas 3! Isso significaria remover o kernel que estou utilizando atualmente, certo?

Eu até tentei: sudo apt-get remove linux-image-4.4.0-31-generic , que é o mais antigo de acordo com dpkg --list 'linux-image*' e eu recebo:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package 'linux-image-4.4.0-31-generic' is not installed, so not removed
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 linux-image-extra-4.4.0-98-generic : Depends: linux-image-4.4.0-98-generic but it is not going to be installed
 linux-image-generic : Depends: linux-image-4.4.0-98-generic but it is not going to be installed
                       Recommends: thermald but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

Não está instalado ?! Estou completamente confuso. Depois de ver este desastre, qual é o meu próximo curso de ação? Alguém pode explicar por que existem versões do kernel MAIOR do que a que estou usando atualmente? E como faço para que isso seja resolvido e resolvido em um servidor de produção?

ESTE NÃO É UM DUPLICADO DE Minha partição / boot atingiu 100% e agora não posso atualizar. Não é possível remover kernels antigos para criar espaço Como:

1) Este OP não responde à questão dos kernels conflitantes. 2) não aborda a segurança de fazer isso em um ambiente de produção

    
por Zak 01.11.2017 / 21:47

1 resposta

3

Primeiro, instale o seguinte pacote:

sudo apt install byobu

Em seguida, você pode remover os kernels não utilizados com o seguinte comando:

sudo purge-old-kernels

Isso deve ajudar a liberar algum espaço.

Para mais informações, consulte este artigo .

    
por Michael 01.11.2017 / 22:10