update-initramfs 缺少 /lib/modules/4.4.0-13-generic

update-initramfs 缺少 /lib/modules/4.4.0-13-generic

我刚刚升级了linux-firmware包,然后使用$ sudo update-initramfs -u -k all,但是出现了一些错误:

$ sudo update-initramfs -u -k all
[sudo] password for piotrek: 
update-initramfs: Generating /boot/initrd.img-4.4.0-34-generic
Warning: No support for locale: en_US.utf8
update-initramfs: Generating /boot/initrd.img-4.4.0-31-generic
Warning: No support for locale: en_US.utf8
update-initramfs: Generating /boot/initrd.img-4.4.0-13-generic
WARNING: missing /lib/modules/4.4.0-13-generic
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/4.4.0-13-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
Warning: No support for locale: en_US.utf8
depmod: WARNING: could not open /var/tmp/mkinitramfs_LJbkti/lib/modules/4.4.0-13-generic/modules.order: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_LJbkti/lib/modules/4.4.0-13-generic/modules.builtin: No such file or directory

我确定我没有内核 4.4.0-13。我可能以前有这个版本,但是我把它删掉了:

$ apt list --installed | grep linux-

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

linux-base/xenial,xenial,now 4.0ubuntu1 all [installed,automatic]
linux-firmware/now 1.159 all [installed,local]
linux-headers-4.4.0-31/xenial-updates,xenial-updates,xenial-security,xenial-security,now 4.4.0-31.50 all [installed]
linux-headers-4.4.0-31-generic/xenial-updates,xenial-security,now 4.4.0-31.50 amd64 [installed]
linux-headers-4.4.0-34/xenial-updates,xenial-updates,xenial-security,xenial-security,now 4.4.0-34.53 all [installed]
linux-headers-4.4.0-34-generic/xenial-updates,xenial-security,now 4.4.0-34.53 amd64 [installed]
linux-image-4.4.0-31-generic/xenial-updates,xenial-security,now 4.4.0-31.50 amd64 [installed]
linux-image-4.4.0-34-generic/xenial-updates,xenial-security,now 4.4.0-34.53 amd64 [installed]
linux-image-extra-4.4.0-31-generic/xenial-updates,xenial-security,now 4.4.0-31.50 amd64 [installed]
linux-image-extra-4.4.0-34-generic/xenial-updates,xenial-security,now 4.4.0-34.53 amd64 [installed]
linux-libc-dev/xenial-updates,xenial-security,now 4.4.0-34.53 amd64 [installed]
linux-sound-base/xenial,xenial,now 1.0.25+dfsg-0ubuntu5 all [installed]
syslinux-common/xenial,xenial,now 3:6.03+dfsg-11ubuntu1 all [installed]
syslinux-legacy/xenial,now 2:3.63+dfsg-2ubuntu8 amd64 [installed]

如何修复这些update-initramfs错误?

答案1

该实用程序update-initramfs会查找var/lib/initramfs-tools。您将在那里找到该旧内核的条目。删除它:

sudo rm /var/lib/initramfs-tools/4.4.0-13-generic

将消除该错误

(区域设置问题完全是另一回事……)

答案2

我也遇到了同样的问题。除了上述操作外,我还必须从 /boot 中删除与旧内核相关的所有文件

相关内容