E: 子进程 /usr/bin/dpkg 返回错误代码 (1) dpkg 错误

E: 子进程 /usr/bin/dpkg 返回错误代码 (1) dpkg 错误

运行时出现此错误sudo apt upgrade

Error 24 : Write error : cannot write compressed block
E: mkinitramfs failure cpio 141 lz4 -9 -l 24
update-initramfs: failed for /boot/initrd.img-5.4.0-7634-generic with 1.
dpkg: error processing package linux-firmware (--configure):
installed linux-firmware package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
linux-firmware
E: Sub-process /usr/bin/dpkg returned an error code (1)

我尝试了以下操作:

sudo apt-get clean
sudo apt upgrade
sudo apt install -f
sudo apt-get dist-upgrade

我也试过flatpak update

$ df -h
Filesystem             Size  Used Avail Use% Mounted on
udev                   1.9G     0  1.9G   0% /dev
tmpfs                  390M  1.9M  388M   1% /run
/dev/mapper/data-root  106G   89G   12G  89% /
tmpfs                  2.0G   53M  1.9G   3% /dev/shm
tmpfs                  5.0M     0  5.0M   0% /run/lock
tmpfs                  2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/loop2              56M   56M     0 100% /snap/core18/1885
/dev/loop1              97M   97M     0 100% /snap/core/9665
/dev/loop3             161M  161M     0 100% /snap/gnome-3-28-1804/116
/dev/loop4             162M  162M     0 100% /snap/gnome-3-28-1804/128
/dev/loop5             128K  128K     0 100% /snap/hello-world/29
/dev/loop0              97M   97M     0 100% /snap/core/9804
/dev/loop6              44M   44M     0 100% /snap/snap-store/415
/dev/loop7             227M  227M     0 100% /snap/wine-platform-runtime/145
/dev/loop8              55M   55M     0 100% /snap/core18/1880
/dev/loop9              63M   63M     0 100% /snap/gtk-common-themes/1506
/dev/loop10            227M  227M     0 100% /snap/wine-platform-runtime/136
/dev/sdb1              467M  427M  5.4M  99% /boot
tmpfs                  390M   20K  390M   1% /run/user/120
tmpfs                  390M   60K  390M   1% /run/user/1000
/dev/sdc1              467M  131M  301M  31% /media/pappkozos/34c06214-5cb6-42b6-b033-9c53b228a584
/dev/sr0               7.5G  7.5G     0 100% /media/pappkozos/empire_disc1
/dev/sdc2              928G   46G  882G   5% /media/pappkozos/Merevlemez
$ df -ih
Filesystem             Size  Used Avail Use% Mounted on
udev                   1.9G     0  1.9G   0% /dev
tmpfs                  390M  1.9M  388M   1% /run
/dev/mapper/data-root  106G   89G   12G  89% /
tmpfs                  2.0G   53M  1.9G   3% /dev/shm
tmpfs                  5.0M     0  5.0M   0% /run/lock
tmpfs                  2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/loop2              56M   56M     0 100% /snap/core18/1885
/dev/loop1              97M   97M     0 100% /snap/core/9665
/dev/loop3             161M  161M     0 100% /snap/gnome-3-28-1804/116
/dev/loop4             162M  162M     0 100% /snap/gnome-3-28-1804/128
/dev/loop5             128K  128K     0 100% /snap/hello-world/29
/dev/loop0              97M   97M     0 100% /snap/core/9804
/dev/loop6              44M   44M     0 100% /snap/snap-store/415
/dev/loop7             227M  227M     0 100% /snap/wine-platform-runtime/145
/dev/loop8              55M   55M     0 100% /snap/core18/1880
/dev/loop9              63M   63M     0 100% /snap/gtk-common-themes/1506
/dev/loop10            227M  227M     0 100% /snap/wine-platform-runtime/136
/dev/sdb1              467M  427M  5.4M  99% /boot
tmpfs                  390M   20K  390M   1% /run/user/120
tmpfs                  390M   60K  390M   1% /run/user/1000
/dev/sdc1              467M  131M  301M  31% /media/pappkozos/34c06214-5cb6-42b6-b033-9c53b228a584
/dev/sr0               7.5G  7.5G     0 100% /media/pappkozos/empire_disc1
/dev/sdc2              928G   46G  882G   5% /media/pappkozos/Merevlemez
pappkozos@terminator:~$ df -ih
Filesystem            Inodes IUsed IFree IUse% Mounted on
udev                    476K   607  476K    1% /dev
tmpfs                   487K  1.2K  486K    1% /run
/dev/mapper/data-root   6.8M  632K  6.1M   10% /
tmpfs                   487K    75  487K    1% /dev/shm
tmpfs                   487K     3  487K    1% /run/lock
tmpfs                   487K    18  487K    1% /sys/fs/cgroup
/dev/loop2               11K   11K     0  100% /snap/core18/1885
/dev/loop1               13K   13K     0  100% /snap/core/9665
/dev/loop3               28K   28K     0  100% /snap/gnome-3-28-1804/116
/dev/loop4               28K   28K     0  100% /snap/gnome-3-28-1804/128
/dev/loop5                10    10     0  100% /snap/hello-world/29
/dev/loop0               13K   13K     0  100% /snap/core/9804
/dev/loop6               15K   15K     0  100% /snap/snap-store/415
/dev/loop7               28K   28K     0  100% /snap/wine-platform-runtime/145
/dev/loop8               11K   11K     0  100% /snap/core18/1880
/dev/loop9               61K   61K     0  100% /snap/gtk-common-themes/1506
/dev/loop10              28K   28K     0  100% /snap/wine-platform-runtime/136
/dev/sdb1               125K   324  125K    1% /boot
tmpfs                   487K    69  487K    1% /run/user/120
tmpfs                   487K   103  487K    1% /run/user/1000
/dev/sdc1               125K    20  125K    1% /media/pappkozos/34c06214-5cb6-42b6-b033-9c53b228a584
/dev/sr0                   0     0     0     - /media/pappkozos/empire_disc1
/dev/sdc2               882M   26K  882M    1% /media/pappkozos/Merevlemez

我的内核:5.4.0-7634-generic

我安装的内核:

dpkg --list | egrep -i 'linux-image|linux-headers'
ii  linux-headers-5.3.0-7648                         5.3.0-7648.41~1586789791~19.10~9593806               all          Header files related to Linux kernel version 5.3.0
ii  linux-headers-5.3.0-7648-generic                 5.3.0-7648.41~1586789791~19.10~9593806               amd64        Linux kernel headers for version 5.3.0 on 64 bit x86 SMP
ii  linux-headers-5.4.0-7626                         5.4.0-7626.30~1588169883~20.04~bbe668a               all          Header files related to Linux kernel version 5.4.0
ii  linux-headers-5.4.0-7626-generic                 5.4.0-7626.30~1588169883~20.04~bbe668a               amd64        Linux kernel headers for version 5.4.0 on 64 bit x86 SMP
ii  linux-headers-5.4.0-7629                         5.4.0-7629.33~1589834512~20.04~ff6e79e               all          Header files related to Linux kernel version 5.4.0
ii  linux-headers-5.4.0-7629-generic                 5.4.0-7629.33~1589834512~20.04~ff6e79e               amd64        Linux kernel headers for version 5.4.0 on 64 bit x86 SMP
ii  linux-headers-5.4.0-7634                         5.4.0-7634.38~1592497129~20.04~9a1ea2e               all          Header files related to Linux kernel version 5.4.0
ii  linux-headers-5.4.0-7634-generic                 5.4.0-7634.38~1592497129~20.04~9a1ea2e               amd64        Linux kernel headers for version 5.4.0 on 64 bit x86 SMP
ii  linux-headers-generic                            5.4.0.7634.38~1592497129~20.04~9a1ea2e               amd64        Generic Linux kernel headers
ii  linux-image-5.3.0-7648-generic                   5.3.0-7648.41~1586789791~19.10~9593806               amd64        Linux kernel image for version 5.3.0 on 64 bit x86 SMP
ii  linux-image-5.4.0-7626-generic                   5.4.0-7626.30~1588169883~20.04~bbe668a               amd64        Linux kernel image for version 5.4.0 on 64 bit x86 SMP
ii  linux-image-5.4.0-7629-generic                   5.4.0-7629.33~1589834512~20.04~ff6e79e               amd64        Linux kernel image for version 5.4.0 on 64 bit x86 SMP
it  linux-image-5.4.0-7634-generic                   5.4.0-7634.38~1592497129~20.04~9a1ea2e               amd64        Linux kernel image for version 5.4.0 on 64 bit x86 SMP
ii  linux-image-generic                              5.4.0.7634.38~1592497129~20.04~9a1ea2e               amd64        Generic Linux kernel image
$ ls -alh /boot
total 226M
drwxr-xr-x  3 root root 4.0K Sep  6 18:18 .
drwxr-xr-x 18 root root 4.0K Sep  6 18:16 ..
-rw-r--r--  1 root root 231K Apr 13 16:56 config-5.3.0-7648-generic
-rw-r--r--  1 root root 233K Aug 28 17:31 config-5.4.0-7642-generic
drwxr-xr-x  4 root root 4.0K Sep  6 18:14 grub
lrwxrwxrwx  1 root root   29 Sep  6 17:44 initrd.img -> initrd.img-5.4.0-7642-generic
-rw-r--r--  1 root root  21M Apr 16 00:08 initrd.img-5.3.0-7642-generic
-rw-r--r--  1 root root  94M Sep  6 18:18 initrd.img-5.3.0-7648-generic
-rw-r--r--  1 root root  81M Sep  6 18:18 initrd.img-5.4.0-7642-generic
lrwxrwxrwx  1 root root   29 Apr 15 23:48 initrd.img.old -> initrd.img-5.3.0-7648-generic
-rw-------  1 root root 4.5M Apr 13 16:56 System.map-5.3.0-7648-generic
-rw-------  1 root root 4.6M Aug 28 17:31 System.map-5.4.0-7642-generic
lrwxrwxrwx  1 root root   26 Sep  6 17:44 vmlinuz -> vmlinuz-5.4.0-7642-generic
-rw-------  1 root root  11M Apr 13 16:56 vmlinuz-5.3.0-7648-generic
-rw-------  1 root root  12M Aug 28 17:31 vmlinuz-5.4.0-7642-generic
lrwxrwxrwx  1 root root   26 Apr 15 23:48 vmlinuz.old -> vmlinuz-5.3.0-7648-generic

答案1

我认为第一个是:

  • 启动分区中有足够的空间吗?您可以粘贴以下输出吗:
df -h

还:

df -ih

您可以通过以下命令删除旧内核:

sudo apt --purge autoremove

您使用的是哪个版本的 Ubuntu?

编辑:看到你的 df -h 后,我可以看到 /boot 已满 99%:

/dev/sdb1              467M  427M  5.4M  99% /boot

您仅有 5.4 MB 可用空间。

您可以手动删除 /boot 中未使用或非常旧的内核,但必须非常小心地执行此操作,否则您可能会失去启动能力。还可以移动一些文件并创建符号链接,并将文件保存在具有足够空间的挂载点中,然后运行

sudo apt --purge autoremove

如果您提供以下输出,我可以提供帮助:

ls -alh /boot

编辑2020-08-25:首先看看你的内核是什么:

uname -r

您可以使用以下命令查看系统中安装的内核:

dpkg --list | egrep -i 'linux-image|linux-headers'

较旧的内核,尤其是非常旧的内核,是首先要删除的。我建议您卸载其中的几个,仅两三个,直到您可以更新系统并运行自动清除。

sudo apt --purge autoremove

您可以使用以下命令删除一个特定内核:

apt-get --purge remove fullkernelname

通常情况下,你必须两人一组地做这件事。例如:

apt-get --purge remove linux-headers-4.15.0-111
apt-get --purge remove linux-image-4.15.0-111-generic

编辑 2020-09-01:由于您正在使用内核 34,因此我们将移动两个您不使用的内核:

输入以下命令:

sudo mkdir /root/old_kernels
sudo mv /boot/linux-headers-5.4.0-7626* /root/old_kernels/
sudo mv /boot/linux-headers-5.4.0-7629* /root/old_kernels/
sudo ln -s /root/old_kernels/* /boot/

此后,/boot 中将有一些可用空间,其中的内核文件未被删除,但通过符号链接链接。这很重要,因为 dkpg 可以找到它们以执行自动删除。现在执行:

sudo apt update

成功运行后:

sudo apt --purge autoremove

干杯

相关内容