写入错误:无法写入压缩块

写入错误:无法写入压缩块

我按照OpenZFS项目。

我想知道是否有人可以帮助我解决这个问题:

root@ubuntuzfs:~# apt autoremove
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 33 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up initramfs-tools (0.136ubuntu6.3) ...
update-initramfs: deferring update (trigger activated)
Processing triggers for initramfs-tools (0.136ubuntu6.3) ...
update-initramfs: Generating /boot/initrd.img-5.4.0-48-generic
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-48-generic with 1.
dpkg: error processing package initramfs-tools (--configure):
 installed initramfs-tools package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 initramfs-tools
E: Sub-process /usr/bin/dpkg returned an error code (1)

据我了解,这个问题是由于我的根分区空间不足造成的。

以下是一些可能相关的信息。

root@ubuntuzfs:~# zfs list -o space -r bpool
NAME               AVAIL   USED  USEDSNAP  USEDDS  USEDREFRESERV  USEDCHILD
bpool              48.6M   319M        0B     96K             0B       319M
bpool/BOOT         48.6M   317M        0B     96K             0B       317M
bpool/BOOT/ubuntu  48.6M   317M      160K    317M             0B         0B

root@ubuntuzfs:/boot# du -bsh *
233K    config-5.4.0-45-generic
233K    config-5.4.0-47-generic
233K    config-5.4.0-48-generic
7.8M    efi
7.6M    grub
27  initrd.img
93M initrd.img-5.4.0-45-generic
93M initrd.img-5.4.0-47-generic
93M initrd.img-5.4.0-48-generic
27  initrd.img.old
179K    memtest86+.bin
181K    memtest86+.elf
181K    memtest86+_multiboot.bin
4.6M    System.map-5.4.0-45-generic
4.6M    System.map-5.4.0-47-generic
4.6M    System.map-5.4.0-48-generic
24  vmlinuz
12M vmlinuz-5.4.0-45-generic
12M vmlinuz-5.4.0-47-generic
12M vmlinuz-5.4.0-48-generic
24  vmlinuz.old

有人能建议我删除此列表中的文件以腾出一些空间吗?

答案1

我在尝试update-initramfs手动运行时遇到了这个问题,但是如果您尝试更新软件包并且更新程序update-initramfs由于内核升级而调用,那么您将遇到与上述 OP 类似的问题。如果/boot分区上不再有空间并且您有一个专用分区,该分区与根分区 ( ) 和/或分区/boot不同,则会出现相同的错误。例如,如果您有一个 LUKS 加密的根、主分区和交换分区,并且在单独的非加密启动分区上空间不足。//home

您可以通过删除一些旧的内核条目或删除分区initrd.img-<VERSION>-generic中的旧文件\boot并运行来修复它update-grub。然后您应该能够正确更新内核。

答案2

经过进一步研究,我发现在启动过程中内核必须挂载根分区。实现此功能所需的模块未编译到内核中,而是位于根分区上的“/lib/modules/”目录中。如果不先挂载根分区,内核就无法访问挂载根分区所需的模块,这些模块位于根分区上,因此这是一个难题。initrd 映像的存在就是为了解决这个问题。initrd 映像包含挂载根分区所需的模块。initrd 映像与内核映像位于同一分区上。在启动过程中,内核将 initrd 映像加载到内存中,然后能够访问挂载根分区所需的模块。

从我的磁盘使用情况可以看出,启动分区上超过一半的空间被三个 initrd 映像占用。只需要一个,所以我可以通过删除两个较旧的 initrd 映像来创建大量额外空间。我也可以删除所有 initrd 映像,然后使用以下命令创建一个新映像

sudo update-initramfs -c -k $(uname -r)

相关内容