我正在运行 Ubuntu Server 16.04,升级到 linux-image-4.4.0-103-generic 失败,因为我的 /boot 几乎已满(200MB 中的 188MB)。
gzip: stdout: No space left on device
E: mkinitramfs failure cpio 141 gzip 1
update-initramfs: failed for /boot/initrd.img-4.4.0-103-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
Failed to process /etc/kernel/postinst.d at /var/lib/dpkg/info/linux-image-4.4.0-103-generic.postinst line 1052.
dpkg: error processing package linux-image-4.4.0-103-generic (--configure):
subprocess installed post-installation script returned error exit status 2
No apport report written because the error message indicates its a followup error from a previous failure.
dpkg: dependency problems prevent configuration of linux-image-extra-4.4.0-103-generic:
linux-image-extra-4.4.0-103-generic depends on linux-image-4.4.0-103-generic; however:
Package linux-image-4.4.0-103-generic is not configured yet.
dpkg 显示我只安装了 2 个最新内核(4.4.0-96-generic 和 4.4.0-97-generic)。
claude@shannon:~$ sudo dpkg --list 'linux-image*'
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trigpend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==============================================-============================- ============================-=================================================== ===============================================
un linux-image <none> <none> (no description available)
un linux-image-4.2.0-27-generic <none> <none> (no description available)
un linux-image-4.2.0-42-generic <none> <none> (no description available)
iF linux-image-4.4.0-103-generic 4.4.0-103.126 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
un linux-image-4.4.0-59-generic <none> <none> (no description available)
un linux-image-4.4.0-62-generic <none> <none> (no description available)
un linux-image-4.4.0-63-generic <none> <none> (no description available)
un linux-image-4.4.0-64-generic <none> <none> (no description available)
un linux-image-4.4.0-72-generic <none> <none> (no description available)
un linux-image-4.4.0-77-generic <none> <none> (no description available)
rc linux-image-4.4.0-81-generic 4.4.0-81.104 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-4.4.0-83-generic 4.4.0-83.106 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii linux-image-4.4.0-96-generic 4.4.0-96.119 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii linux-image-4.4.0-97-generic 4.4.0-97.120 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.2.0-27-generic 4.2.0-27.32~14.04.1 amd64 Linux kernel extra modules for version 4.2.0 on 64 bit x86 SMP
rc linux-image-extra-4.2.0-42-generic 4.2.0-42.49~14.04.1 amd64 Linux kernel extra modules for version 4.2.0 on 64 bit x86 SMP
iU linux-image-extra-4.4.0-103-generic 4.4.0-103.126 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc 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
rc 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
rc 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
rc 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
rc 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
rc 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
rc linux-image-extra-4.4.0-81-generic 4.4.0-81.104 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-83-generic 4.4.0-83.106 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii linux-image-extra-4.4.0-96-generic 4.4.0-96.119 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii linux-image-extra-4.4.0-97-generic 4.4.0-97.120 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
iU linux-image-generic 4.4.0.103.108 amd64 Generic Linux kernel image
我想过卸载其中一个以便为新内核腾出空间,但是 uname -r 显示 4.4.0.96-generic 作为当前内核,而不是 4.4.0-97-generic。我不确定为什么没有使用更新的内核,如果不需要,我也不想卸载其中任何一个。
claude@shannon:~$ uname -r
4.4.0-96-generic
sudo apt-get autoremove 失败,因为 /boot 太满
gzip: stdout: No space left on device
(and so on)
如何安装最新内核并删除旧内核软件包?
答案1
您可以尝试手动mount /dev/sdx /boot
(其中 x 是启动分区,假设使用SATA)并 rm 不需要的映像。
请记住,引导加载程序配置也必须更新。 (例如假设使用 grubgrub-mkconfig /boot/grub/grub.cfg
或手动编辑它)
答案2
好的,我能够修复它。事实证明,在之前更新到 4.4.0-97-generic 后服务器没有重新启动,因此它仍在运行 4.4.0-96-generic。我关闭了所有服务并重新启动,它使 4.4.0.97-generic 成为内核。然后,我跑了
sudo apt-get autoremove
sudo apt-get update
sudo apt-get dist-upgrade
并再次重新启动。现在4.4.0-103-generic是内核,4.4.0-97-generic是旧内核。