如何摆脱“run apt-get autoremove”消息?

如何摆脱“run apt-get autoremove”消息?

我安装了一个软件包,该软件包具有一些本身有用的依赖项。后来,我删除了原来的包,但我想保留它安装的依赖项。但是,当我尝试使用 执行操作时apt-get,它总是提醒我运行apt-get autoremove以删除我想要保留的依赖项。那么,apt数据库存储在哪里,以了解哪些软件包被安装为依赖项,以及如何编辑它,以便我可以保留旧的依赖项,而不必apt-get autoremove每次使用时都看到要运行的消息apt-get

答案1

最简单的可能就是按照斯蒂芬在另一个答案中建议的那样安装它们,但您也可以将它们标记为手动安装aptitude unmarkauto <packages>...

答案2

您应该能够执行sudo apt-get install ....并保留您想要保留的软件包。这将告诉系统软件包是“手动”安装的,因此将它们从自动删除范围中删除

例如,我们可以看到我的系统想要自动删除一些软件包:

# apt-get upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... The following packages were automatically installed and are no longer required:
  bluetooth bluez-cups libboost-filesystem1.55.0
  libboost-program-options1.55.0 libdumbnet1 libgssapi3-heimdal
  libheimntlm0-heimdal libkdc2-heimdal powertop zerofree
Use 'apt-get autoremove' to remove them.
Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

如果我手动安装蓝牙,我们现在看到它只是将其设置为“手动安装”,并且蓝牙(及其依赖项)不再被标记

# apt-get install bluetooth
Reading package lists... Done
Building dependency tree       
Reading state information... Done
bluetooth is already the newest version.
bluetooth set to manually installed.
The following packages were automatically installed and are no longer required:
  libboost-filesystem1.55.0 libboost-program-options1.55.0 libdumbnet1
  libgssapi3-heimdal libheimntlm0-heimdal libkdc2-heimdal powertop zerofree
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

答案3

我找到了该命令apt-mark(需要以 root 身份运行)。运行 将apt-mark manual <package name>软件包标记为手动安装,这样系统就不会在运行时将其删除apt-get autoremove

相关内容