如何在 /etc/initramfs-tools 中设置选项 COMPRESS

Jab*_*er1 19 upgrade partitioning boot

我正在尝试将 Ubuntu 升级到最新版本,但收到此错误:

Not enough free disk space

The upgrade has aborted. The upgrade needs a total of 430 M free space on disk '/boot'. Please free at least an additional 37.8 M of disk space on '/boot'. You can remove old kernels using 'sudo apt autoremove' and you could also set COMPRESS=xz in /etc/initramfs-tools/initramfs.conf to reduce the size of your initramfs.
Run Code Online (Sandbox Code Playgroud)

从 gparted 中我得知我的/boot分区大小为 732 MB,其中 425 MB 空闲。我很乐意分配更多空间来/boot避免这个问题,但考虑到我现在所处的位置,这就是我所做的:

  • 我跑了sudo apt autoremove——这没有什么区别。
  • 我正在尝试添加压缩,但说明只是说set COMPRESS=xz .... 据推测,这意味着更改以下行/etc/initramfs-tools/initramfs.conf

COMPRESS=lz4

对此:

COMPRESS=gz

...但是然后呢?我应该保存该文件然后重新启动吗?我应该注销并重新登录吗?我应该使用某种命令在某处重新初始化某些东西吗?这里的更多澄清会非常有帮助。“设置”该值是什么意思COMPRESS?编辑上述文件后我需要做什么才能使更改生效?

小智 29

在终端中输入:

sudo nano /etc/initramfs-tools/initramfs.conf
Run Code Online (Sandbox Code Playgroud)

它将在编辑器中打开文件。
改成COMPRESS=zstdCOMPRESS=xz

查看截图

然后使用重建图像

sudo update-initramfs -u -k all
Run Code Online (Sandbox Code Playgroud)

  • > " 然后使用 sudo update-initramfs -u -k all 重建映像" <-- 这是关键的缺失信息。谢谢你! (3认同)