"Pin down" an automatically installed package so apt-get autoremove keeps it [duplicate]

Say I install package A, which depends on package B. Then I remove A.

Now apt-get autoremove wants to remove B, but I want to keep it. How do I "pin down" B so that the system acts as if I installed B myself?

I come from Gentoo, where the solution would be to add B to my world file. What's the Debian/Ubuntu equivalent?


Solution 1:

  • You can use

    sudo apt-mark manual some_package
    

    to mark some_package as manually installed so that it doesn't get autoremoved.

  • You can use

    sudo apt-mark auto some_package
    

    to mark some-package as automatically installed so that it gets autoremoved.