无法安装 Ubuntu 更新,甚至无法从 /boot 中删除旧软件包
许多答案都提出了好的解决方案,但我还是无法从 /boot 中删除较旧的软件包。
无法更新 ubuntu 应用程序,因为 /boot 上没有足够的空间
我陷入了循环,我的 /boot 大小是 256M
df -h
输出:
Filesystem Size Used Avail Use% Mounted on
tmpfs 1.6G 2.2M 1.6G 1% /run
/dev/nvme0n1p5 82G 39G 39G 50% /
tmpfs 7.8G 0 7.8G 0% /dev/shm
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
/dev/nvme0n1p6 256M 186M 50M 79% /boot
/dev/nvme0n1p1 96M 31M 66M 32% /boot/efi
tmpfs 1.6G 120K 1.6G 1% /run/user/1000
/dev/sda2 67G 32K 64G 1% /media/nmt/3bf914c7-c1b2-47f0-9820-42dd7eb06059
dpkg -l | grep linux-image
输出:
rc linux-image-5.19.0-21-generic 5.19.0-21.21 amd64 Signed kernel image generic
rc linux-image-5.19.0-23-generic 5.19.0-23.24 amd64 Signed kernel image generic
rc linux-image-5.19.0-26-generic 5.19.0-26.27 amd64 Signed kernel image generic
rc linux-image-5.19.0-28-generic 5.19.0-28.29 amd64 Signed kernel image generic
rc linux-image-5.19.0-29-generic 5.19.0-29.30 amd64 Signed kernel image generic
rc linux-image-5.19.0-31-generic 5.19.0-31.32 amd64 Signed kernel image generic
rc linux-image-5.19.0-35-generic 5.19.0-35.36 amd64 Signed kernel image generic
rc linux-image-5.19.0-38-generic 5.19.0-38.39 amd64 Signed kernel image generic
rc linux-image-5.19.0-40-generic 5.19.0-40.41 amd64 Signed kernel image generic
ii linux-image-5.19.0-41-generic 5.19.0-41.42 amd64 Signed kernel image generic
iF linux-image-5.19.0-42-generic 5.19.0-42.43 amd64 Signed kernel image generic
ii linux-image-generic-hwe-22.04 5.19.0.42.38 amd64 Generic Linux kernel image
uname -r
输出:
5.19.0-42-generic
sudo apt-get remove --purge linux-image-5.19.0-21-generic
输出:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package 'linux-image-5.19.0-21-generic' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 165 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up linux-image-5.19.0-42-generic (5.19.0-42.43) ...
Processing triggers for linux-image-5.19.0-42-generic (5.19.0-42.43) ...
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-5.19.0-42-generic
zstd: error 25 : Write error : No space left on device (cannot write compressed block)
E: mkinitramfs failure zstd -q -1 -T0 25
update-initramfs: failed for /boot/initrd.img-5.19.0-42-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-5.19.0-42-generic (--configure):
installed linux-image-5.19.0-42-generic package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
linux-image-5.19.0-42-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
更新:
ls -lah /boot
输出:
total 178M
drwxr-xr-x 5 root root 4.0K Jun 3 11:37 .
drwxr-xr-x 20 root root 4.0K Nov 15 2022 ..
-rw------- 1 root root 6.2M Mar 23 23:36 System.map-5.19.0-40-generic
-rw------- 1 root root 6.2M Apr 17 17:56 System.map-5.19.0-41-generic
-rw------- 1 root root 6.2M Apr 18 20:50 System.map-5.19.0-42-generic
-rw-r--r-- 1 root root 264K Mar 23 23:36 config-5.19.0-40-generic
-rw-r--r-- 1 root root 264K Apr 17 17:56 config-5.19.0-41-generic
-rw-r--r-- 1 root root 264K Apr 18 20:50 config-5.19.0-42-generic
drwx------ 4 root root 1.0K Jan 1 1970 efi
drwxr-xr-x 5 root root 4.0K May 18 06:58 grub
lrwxrwxrwx 1 root root 28 May 18 06:57 initrd.img -> initrd.img-5.19.0-42-generic
-rw-r--r-- 1 root root 68M May 5 06:47 initrd.img-5.19.0-41-generic
-rw-r--r-- 1 root root 68M May 18 06:58 initrd.img-5.19.0-42-generic
lrwxrwxrwx 1 root root 28 May 17 08:04 initrd.img.old -> initrd.img-5.19.0-41-generic
drwx------ 2 root root 16K Nov 15 2022 lost+found
-rw-r--r-- 1 root root 179K Feb 6 2022 memtest86+.bin
-rw-r--r-- 1 root root 181K Feb 6 2022 memtest86+.elf
-rw-r--r-- 1 root root 181K Feb 6 2022 memtest86+_multiboot.bin
lrwxrwxrwx 1 root root 25 May 17 08:04 vmlinuz -> vmlinuz-5.19.0-42-generic
-rw------- 1 root root 12M Apr 17 20:55 vmlinuz-5.19.0-41-generic
-rw------- 1 root root 12M Apr 18 20:55 vmlinuz-5.19.0-42-generic
lrwxrwxrwx 1 root root 25 May 17 08:04 vmlinuz.old -> vmlinuz-5.19.0-41-generic