Alte Kernel können nicht gelöscht werden / sda voll

Alte Kernel können nicht gelöscht werden / sda voll

SDA1 ist voll und ich kann keine Upgrades ausführen

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

Es gibt eine Menge alter Kernel und ich möchte sie entfernen.

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

Was auch immer ich versuche, es funktioniert nicht:

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).

Nächster Versuch

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).

Nächster Versuch

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).

Letzte Idee

    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# 

BEARBEITEN: Nur das vorübergehende Verschieben alter Kerneldateien in einen temporären Ordner hat funktioniert, indem dadurch etwas Speicherplatz geschaffen und die Befehle wieder funktionieren konnten.

Antwort1

cd /boot

Suchen Sie den ältesten Kernel im /bootVerzeichnis:

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

Es gibt verschiedene Möglichkeiten, den obigen Befehl aus Nachhaltigkeitsgründen zu automatisieren. Ein cron jobBeispiel:

Antwort2

Bei mir hat es geklappt:

  1. Erstellen Sie einen temporären Ordner (zum Beispiel /home/user/temp)
  2. Führen Sie „uname -r“ aus, um herauszufinden, welcher Kernel ausgeführt wird, und ändern Sie dies nicht!
  3. Verschieben Sie die Kerneldateien eines bestimmten, nicht verwendeten Kernels in diesen temporären Ordner.

Sie erhalten etwas Platz und der Befehl sollte wieder funktionieren. Quelle:http://natesbox.com/blog/ubuntu-unable-to-installupdate-packages-full-boot-partition/

PS: Ich habe vergessen, Autoremove für diesen Server für automatische Updates einzurichten. Ich denke, das könnte das Problem verursacht haben.

verwandte Informationen