为什么 apt-get 直接标记我不想要的软件包?

为什么 apt-get 直接标记我不想要的软件包?

如果我尝试安装元包apt-get install lubuntu-desktop,然后查看输出,apt-mark showmanual | grep lubuntu我看到的不仅仅是lubuntu-desktop

lubuntu-artwork
lubuntu-core
lubuntu-deskto

因此,apt-get install lubuntu-desktop不仅将软件包标记为手动安装lubuntu-desktop,还将它的依赖项或其他内容标记为手动安装。但我并不直接需要这些软件包,这种行为很奇怪,而且出乎意料。

有没有什么方法可以配置apt为仅将我手动安装的那些软件包标记为手动安装,而不是它们的依赖项或类似的东西?

答案1

通过 apt 源快速搜索我得到了 (1)。据我所知,在 部分列出的软件包在APT::Never-MarkAuto-Sections安装时会将其标记为即时依赖项为手动。这样,安装需要浏览器等元包,然后删除元包,浏览器仍然会保留在安装状态。这似乎是有意为之的行为。应该可以通过清除默认值来更改APT::Never-MarkAuto-Sections

(1)http://sources.debian.net/src/apt/1.1.9/apt-pkg/depcache.cc/?hl=849#L843

答案2

Ubuntu

软件包依赖项

程序通常会使用一些相同的文件。与其将这些文件放入每个包中,不如安装一个单独的包来为所有需要它们的程序提供这些文件。因此,要安装需要其中一个文件的程序,还必须安装包含这些文件的包。当一个包以这种方式依赖于另一个包时,这被称为包依赖关系。通过指定依赖关系,可以使包更小更简单,并且大多数文件和程序的重复项都会被删除。

当您安装程序时,必须同时安装其依赖项。通常,大多数必需的依赖项都已安装,但可能还需要一些额外的依赖项。因此,当您安装软件包时,如果还安装了其他几个软件包,请不要感到惊讶 - 这些只是您选择的软件包正常运行所需的依赖项。

根据你的问题,

lubuntu-desktop取决于以下内容:

lubuntu-artwork lubuntu-core lubuntu-desktop ...

因此,命令sudo apt-get install lubuntu-desktop也会安装它们。这是不可避免的。

编辑: 从Ubuntu

apt-mark

       apt-mark will change whether a package has been marked as being
       automatically installed.
       When you request that a package is installed, and as a result other
       packages are installed to satisfy its dependencies, the dependencies
       are marked as being automatically installed. Once these automatically
       installed packages are no longer depended on by any manually installed
       packages, they will be removed by e.g.  apt-get or aptitude.

展会汽车

       showauto is used to print a list of automatically installed
       packages with each package on a new line. All automatically
       installed packages will be listed if no package is given. If
       packages are given only those which are automatically installed will be shown.

展示手册

       showmanual can be used in the same way as showauto except that it
       will print a list of manually installed packages instead.

手册页中已经说过,它还将包括其依赖项。

相关内容