我正在使用 Linux Ubuntu mate-desktop 4.4.0-24-generic #43-Ubuntu SMP Wed Jun 8 19:27:37 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux。
最近,我在更新时遇到了问题,特别是较旧的内核 4.4.0-22(linux-image-extra-4.4.0-22-generic)。它被标记为删除,但并没有被删除。我绝不是 Linux 专家!我需要帮助才能完全删除这个旧内核。这是我从终端复制的内容。
root@xxxxxxxxxx-desktop:/home/xxxxxxxxxx# apt-get autoremove -f
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
linux-image-extra-4.4.0-22-generic
0 upgraded, 0 newly installed, 1 to remove and 2 not upgraded.
6 not fully installed or removed.
After this operation, 162 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 272391 files and directories currently installed.)
Removing linux-image-extra-4.4.0-22-generic (4.4.0-22.40) ...
depmod: FATAL: could not load /boot/System.map-4.4.0-22-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-22-.generic /boot/vmlinuz-4.4.0-22-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-22-generic
./boot/vmlinuz-4.4.0-22-generic
Error! Your kernel headers for kernel 4.4.0-22-generic cannot be found.
Please install the linux-headers-4.4.0-22-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-22-generic /boot/vmlinuz-4.4.0-22-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-22-generic
WARNING: missing /lib/modules/4.4.0-22-generic
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/4.4.0-22-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_U8szG6/lib/modules/4.4.0-22-generic/modules.order: No such file or directorydepmod: WARNING: .
could not open /var/tmp/mkinitramfs_U8szG6/lib/modules/4.4.0-22-generic/modules.builtin: No such file or directory
/usr/sbin/update-initramfs: 206: /usr/sbin/update-initramfs: cannot create /var/lib/initramfs-tools/4.4.0-22-generic: Directory nonexistent
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 2
dpkg: error processing package linux-image-extra-4.4.0-22-generic (--remove):
subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
linux-image-extra-4.4.0-22-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@xxxxxxxxxx-desktop:/home/xxxxxxxxxx#
希望这些信息足以帮助您开始。
答案1
该linux-image-extra-4.4.0-22-generic
软件包取决于linux-image-4.4.0-22-generic
哪个也是缺失的根源/boot/System.map-4.4.0-22-generic
(这可以视为一个错误)。因此,尽管听起来很奇怪,但您需要安装后者,然后才能删除两者:
sudo apt-get install linux-image-4.4.0-22-generic
sudo apt-get remove linux-image-4.4.0-22-generic linux-image-extra-4.4.0-22-generic
它们应该在第一次时就被(自动)一起移除,但我不知道为什么没有发生这种情况。
答案2
删除未使用的内核的最简单和最推荐的方法是更新管理器。 来自看法菜单(更新管理器的主窗口)选择Linux 内核在出现的窗口中,选择要卸载的内核。然后一切都由更新管理器。