我喜欢自己管理内核,但我不知道如何阻止apt-get autoremove删除旧的内核。
apt-get autoremove
会删除已自动安装但不再需要的文件。如果你不希望autoremove删除其中一些文件,可以将它们标记为手动安装。在你的情况下:sudo apt-mark manual
package_name。
如果你安装了一个主线内核,你需要标记3个软件包:
linux-headers-version
linux-headers-version-generic
linux-image-version-generic
如果你使用的是官方内核,你还需要标记一个软件包:
linux-image-extra-version-generic。
你唯一需要做的就是找到正确的版本并替换软件包名称中的单词。当然,所有三个或四个版本必须相同。
sudo apt-mark showmanual
或showauto来检查文件标志。apt-mark将为您提供相应的已安装文件列表。 - Stormlordhttps://help.ubuntu.com/community/RemoveOldKernels#GUI_Way 解释了如何将内核标记为自动安装。你也可以做相反的操作。这里有一个示例命令:
首先,我以非超级用户权限运行该命令:
apt-mark manual '^linux-.*-5\.0\.0-38(-generic)?$'
linux-image-unsigned-5.0.0-38-generic can not be marked as it is not installed.
linux-image-5.0.0-38-generic set to manually installed.
linux-headers-5.0.0-38-generic can not be marked as it is not installed.
linux-modules-extra-5.0.0-38-generic set to manually installed.
linux-modules-5.0.0-38-generic set to manually installed.
E: Could not create temporary file for /var/lib/apt/extended_states - mkstemp (13: Permission denied)
E: Failed to write temporary StateFile /var/lib/apt/extended_states
sudo
运行命令。'^linux-.*-5\.0\.0-38(-generic)?$'
是什么,请访问https://regex101.com/r/Oi9ixx/1。