Não é possível apagar kernels antigos / sda full [duplicado]

0

O SDA1 está cheio e não consigo executar atualizações

root@ubuntu-nextcloud:/home/nextcloud# df -h
Filesystem                              Size  Used Avail Use% Mounted on
udev                                    6.9G     0  6.9G   0% /dev
tmpfs                                   1.4G  9.0M  1.3G   1% /run
/dev/mapper/ubuntu--nextcloud--vg-root  585G  273G  282G  50% /
tmpfs                                   4.0G     0  4.0G   0% /dev/shm
tmpfs                                   5.0M     0  5.0M   0% /run/lock
tmpfs                                   4.0G     0  4.0G   0% /sys/fs/cgroup
/dev/loop0                              179M  179M     0 100% /snap/nextcloud/1474
/dev/loop1                               80M   80M     0 100% /snap/core/1689
/dev/loop3                              161M  161M     0 100% /snap/nextcloud/1337
/dev/loop2                               79M   79M     0 100% /snap/core/1441
/dev/loop5                              179M  179M     0 100% /snap/nextcloud/1540
/dev/loop4                               79M   79M     0 100% /snap/core/1577
/dev/sda1                               472M  461M     0 100% /boot
tmpfs                                   829M     0  829M   0% /run/user/1000

Há um monte de kernels antigos e eu gostaria de removê-los.

root@ubuntu-nextcloud:/home/nextcloud# dpkg --list | grep linux-image
ii  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
ii  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
ii  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
ii  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
ii  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
ii  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
ii  linux-image-4.4.0-67-generic       4.4.0-67.88                                amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  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
ii  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
iF  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
iF  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-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
ii  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
ii  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
ii  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
ii  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
ii  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
ii  linux-image-extra-4.4.0-67-generic 4.4.0-67.88                                amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  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
iF  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
iU  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
iU  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
iU  linux-image-extra-4.4.0-77-generic 4.4.0-77.98                                amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
iU  linux-image-generic                4.4.0.77.83                                amd64        Generic Linux kernel image

Não importa o que eu tente, não funciona:

root@ubuntu-nextcloud:/home/nextcloud# sudo apt-get purge linux-image-4.4.0-31-generic
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-31-generic : Depends: linux-image-4.4.0-31-generic but it is not going to be installed
 linux-image-extra-4.4.0-77-generic : Depends: linux-image-4.4.0-77-generic but it is not going to be installed
 linux-image-generic : Depends: linux-image-4.4.0-77-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).

Próxima tentativa

root@ubuntu-nextcloud:/home/nextcloud# purge-old-kernels --keep 3
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-31-generic : Depends: linux-image-4.4.0-31-generic but it is not going to be installed
 linux-image-extra-4.4.0-59-generic : Depends: linux-image-4.4.0-59-generic but it is not going to be installed
 linux-image-extra-4.4.0-62-generic : Depends: linux-image-4.4.0-62-generic but it is not going to be installed
 linux-image-extra-4.4.0-63-generic : Depends: linux-image-4.4.0-63-generic but it is not going to be installed
 linux-image-extra-4.4.0-64-generic : Depends: linux-image-4.4.0-64-generic but it is not going to be installed
 linux-image-extra-4.4.0-66-generic : Depends: linux-image-4.4.0-66-generic but it is not going to be installed
 linux-image-extra-4.4.0-67-generic : Depends: linux-image-4.4.0-67-generic but it is not going to be installed
 linux-image-extra-4.4.0-70-generic : Depends: linux-image-4.4.0-70-generic but it is not going to be installed
 linux-image-extra-4.4.0-77-generic : Depends: linux-image-4.4.0-77-generic but it is not going to be installed
 linux-image-generic : Depends: linux-image-4.4.0-77-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).

Próxima tentativa

root@ubuntu-nextcloud:/home/nextcloud# dpkg -l linux-* | awk '/^ii/{ print $2}' | grep -v -e 'uname -r | cut -f1,2 -d"-"' | grep -e [0-9] | grep -E "(image|headers)" | xargs sudo apt-get -y purge
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-77-generic : Depends: linux-image-4.4.0-77-generic but it is not going to be installed
 linux-image-generic : Depends: linux-image-4.4.0-77-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).

Última ideia

    root@ubuntu-nextcloud:/home/nextcloud# apt-get autoremove -f
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
  linux-image-4.4.0-77-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-77-generic
0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
12 not fully installed or removed.
Need to get 0 B/21.9 MB of archives.
After this operation, 66.8 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 414438 files and directories currently installed.)
Preparing to unpack .../linux-image-4.4.0-77-generic_4.4.0-77.98_amd64.deb ...
Done.
Unpacking linux-image-4.4.0-77-generic (4.4.0-77.98) ...
dpkg: error processing archive /var/cache/apt/archives/linux-image-4.4.0-77-generic_4.4.0-77.98_amd64.deb (--unpack):
 cannot copy extracted data for './boot/abi-4.4.0-77-generic' to '/boot/abi-4.4.0-77-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-77-generic /boot/vmlinuz-4.4.0-77-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.4.0-77-generic /boot/vmlinuz-4.4.0-77-generic
Errors were encountered while processing:
 /var/cache/apt/archives/linux-image-4.4.0-77-generic_4.4.0-77.98_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@ubuntu-nextcloud:/home/nextcloud# 

EDIT: Apenas mover temporariamente os arquivos do kernel antigo para uma pasta temporária, criando uma pequena quantidade de espaço e permitindo que os comandos funcionem novamente.

    
por Binary 04.06.2017 / 02:22

2 respostas

0

cd /boot

Localize o kernel mais antigo no diretório /boot :

sudo dpkg --force-all -P Full_name_of_oldest_kernel
sudo apt autoremove --purge

Existem várias maneiras de automatizar o comando acima para a sustentabilidade. Um cron job , por exemplo.

    
por jones0610 04.06.2017 / 03:31
-1

Eu trabalhei:

  1. Crie uma pasta temporária (por exemplo, / home / user / temp)
  2. Execute uname -r para descobrir qual kernel está rodando e não toque nisso!
  3. Mova os arquivos de kernel de um kernel não usado específico para essa pasta temporária.

Você obterá algum espaço e o comando deverá funcionar novamente. Fonte: link

PS: Esqueci de definir autoremove para este servidor para atualizações automáticas. Acho que isso pode ter causado o problema.

    
por Binary 04.06.2017 / 03:13