软件包 “被标记为手动安装”？这是什么意思？
软件包
![](/data/attachment/album/202206/05/154517uqnqdfi79yqidi79.jpg)


如果你使用 `apt` 命令在终端中安装软件包，你将看到各种输出。


如果你注意并查看输出，有时你会注意到一条消息：



```
package_name set to manually installed

```

你有没有想过这条消息是什么意思，为什么你没有在所有包上看到它？让我在本篇中分享一些细节。


### 理解 “软件包被标记为手动安装”


当你尝试安装已安装的库或开发包时，你会看到此消息。此依赖包是与另一个包一起自动安装的。如果删除了主包，则使用 `apt autoremove` 命令删除依赖包。


但是由于你试图显式安装依赖包，你的 Ubuntu 系统认为你需要这个包独立于主包。因此，该软件包被标记为手动安装，因此不会自动删除。


不是很清楚，对吧？以 [在 Ubuntu 上安装 VLC](https://itsfoss.com/install-latest-vlc/) 为例。


由于主 VLC 包依赖于许多其他包，因此这些包会自动安装。


![installing vlc with apt ubuntu](/data/attachment/album/202206/05/154519drr0ufpauzfzmhdr.png)


如果你检查名称中包含 `vlc` 的 [已安装软件包列表](https://itsfoss.com/list-installed-packages-ubuntu/)，你会看到除了 VLC，其余都标记为“自动”。这表明这些软件包是（跟着 vlc）自动安装的，当 VLC 被卸载时，它们将使用 `apt autoremove` 命令自动删除。


![list installed packages vlc ubuntu](/data/attachment/album/202206/05/154520fihw24233hgnr8pr.png)


现在假设你出于某种原因考虑安装 `vlc-plugin-base`。如果你在其上运行 `apt install` 命令，系统会告诉你该软件包已安装。同时，它将标记从自动更改为手动，因为系统认为在尝试手动安装表明你明确需要此 `vlc-plugin-base`。


![package set manually](/data/attachment/album/202206/05/154520np0a3bz0ynjn5jha.png)


可以看到它的状态已经从 `[installed,automatic]` 变成了 `[installed]`。


![listing installed packages with vlc](/data/attachment/album/202206/05/154520r16zzrc9kcryihyk.png)


现在，让我删除 VLC 并运行 `autoremove` 命令。你可以看到 `vlc-plugin-base` 不在要删除的软件包列表中。


![autoremove vlc ubuntu](/data/attachment/album/202206/05/154520b6qupdgwvw0xcir6.png)


再次检查已安装软件包的列表。`vlc-plugin-base` 仍然安装在系统上。


![listing installed packages after removing vlc](/data/attachment/album/202206/05/154521af9i0iooonnilid8.png)


你可以在这里看到另外两个与 VLC 相关的包。这些是 `vlc-plugin-base` 包的依赖项，这就是为什么它们也存在于系统上但标记为 `automatic` 的原因。


我相信现在有了这些例子，事情就更清楚了。让我给你一个额外的技巧。


### 将包重置为自动


如果包的状态从自动更改为手动，你可以通过以下方式将其设置回自动：



```
sudo apt-mark auto package_name

```

![set package to automatic](/data/attachment/album/202206/05/154521vkjj4rszj1z1kqjj.png)


### 结论


这不是一个重大错误，也不会阻止你在系统中进行工作。但是，了解这些小事会增加你的知识。


**好奇心可能会害死猫，但它会让企鹅变得更聪明**。这是为这篇原本枯燥的文章增添幽默感的原始引述 : )


如果你想阅读更多这样的文章，这些文章可能看起来微不足道，但可以帮助你更好地了解您的 Linux 系统，请告诉我。




---


via: <https://itsfoss.com/package-set-manually-installed/>


作者：[Abhishek Prakash](https://itsfoss.com/author/abhishek/) 选题：[lkxed](https://github.com/lkxed) 译者：[geekpi](https://github.com/geekpi) 校对：[wxy](https://github.com/wxy)


本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译，[Linux中国](https://linux.cn/) 荣誉推出


OK
![Warp Terminal](/assets/images/warp-terminal.webp)


![Warp Terminal](/assets/images/warp-terminal.webp)

If you use the apt command to install packages in the terminal, you’ll see all kinds of output.

If you pay attention and read the output, sometimes you’ll notice a message that reads:

*package_name set to manually installed*

Have you ever wondered what this message means and why you don’t see it for all packages? Let me share some details in this explainer.

## Understanding “Package set to manually installed”

You’ll see this message when you try installing an already installed library or development package. This dependency package was installed automatically with another package. The dependency package gets removed with the apt autoremove command if the main package is removed.

But since you tried to install the dependency package explicitly, your Ubuntu system thinks that you need this package independent of the main package. And hence the package is marked as manually installed so that it is not removed automatically.

Not very clear, right? Take the example of [installing VLC on on Ubuntu](https://itsfoss.com/install-latest-vlc/).

Since the main vlc package depends on a number of other packages, those packages are automatically installed with it.

![installing vlc with apt ubuntu](https://itsfoss.com/content/images/wordpress/2022/05/installing-vlc-with-apt-ubuntu-800x489.png)

If you check the [list of installed packages](https://itsfoss.com/list-installed-packages-ubuntu/) that have vlc in their name, you’ll see that except vlc, the rest are marked ‘automatic’. This indicates that these packages were installed automatically (with vlc) and they will be removed automatically with apt autoremove command (when vlc is uninstalled).

![list installed packages vlc ubuntu](https://itsfoss.com/content/images/wordpress/2022/05/list-installed-packages-vlc-ubuntu-800x477.png)

Now suppose you thought to install “vlc-plugin-base” for some reason. If you run the apt install command on it, the system tells you that the package is already installed. At the same time, it changes the mark from automatic to manual because the system thinks that you need this vlc-plugin-base explicitly as you tried to manually install it.

![package set manually](https://itsfoss.com/content/images/wordpress/2022/05/package-set-manually.png)

You can see that its status has been changed to [installed] from [installed,automatic].

![listing installed packages with vlc](https://itsfoss.com/content/images/wordpress/2022/05/listing-installed-packages-with-vlc.png)

Now, let me remove VLC and run the auoremove command. You can see that “vlc-plugin-base” is not in the list of packages to be removed.

![autoremove vlc ubuntu](https://itsfoss.com/content/images/wordpress/2022/05/autoremove-vlc-ubuntu.png)

Check the list of installed packages again. vlc-plugin-base is still installed on the system.

![listing installed packages after removing vlc](https://itsfoss.com/content/images/wordpress/2022/05/listing-installed-packages-after-removing-vlc.png)

You can see two more vlc-related packages here. These are the dependencies for the vlc-plugin-base package and this is why they are also present on the system but marked ‘automatic’.

I believe things are more clear now with the examples. Let me add a bonus tip for you.

## Reset package to automatic

If the state of the package got changed to manual from automatic, you can set it back to automatic in the following manner:

`sudo apt-mark auto package_name`


![set package to automatic](https://itsfoss.com/content/images/wordpress/2022/05/set-package-to-automatic.png)

## Conclusion

This is not a major error and doesn’t stop you from doing your work in your system. However, knowing these little things increase your knowledge a little.

*Curiosity may have killed the cat, but it makes a penguin smarter*. That’s an original quote to add humor to this otherwise dull article :)

Since you are curious about the small details of the apt packages, here are a few more such articles for you.

[apt remove vs apt purge: What’s the Difference?To uninstall an application in the Ubuntu terminal, you can use: sudo apt remove package_name But in various forums, you may come across the suggestion to use the apt purge command for removing applications completely. This leaves you confused because using apt purge is quite similar…](https://itsfoss.com/apt-remove-purge/)![](https://itsfoss.com/content/images/wordpress/2022/11/apt-remove-vs-apt-purge.png)


![](https://itsfoss.com/content/images/wordpress/2022/11/apt-remove-vs-apt-purge.png)

[Understanding sources.list](https://itsfoss.com/sources-list-ubuntu/) also helps improve your apt package manager knowledge.

[What is the Use of sources.list File in Ubuntu Linux?Understanding the concept of sources.list in Ubuntu will help you understand and fix common update errors in Ubuntu.](https://itsfoss.com/sources-list-ubuntu/)![](https://itsfoss.com/content/images/2022/12/sources-lits-file-ubuntu.png)


![](https://itsfoss.com/content/images/2022/12/sources-lits-file-ubuntu.png)

Let me know if you would like to read more such articles that may seem insignificant but help you understand your Linux system a tiny bit better.