How does sudo apt-get remove package_name handle dependencies?

I installed smartmontools and it installed alot of stuff with it like a Postfix mail server/system.

I was wondering how Ubuntu handles uninstalls of the side tools and side packages when removing the main package?

Would it take everything away that was installed with the main package?

If yes, would it leave all dependencies on the machine that are needed by other packages? How and does it make sure that removing dependencies doesn't harm other packages?

1 Answer

No, it does not, that command will remove only that package leaving dependencies and configuration in the system.

You need to run it explicitly:

  • To remove configuration file too:

    apt-get purge <pacakge-name>
  • After removing the package, run auto remove to uninstall all auto installed dependencies.

    # Check the list package with simulation
    apt-get -s autoremove
    # Run for real and check list again
    apt-get autoremove

    As kreemoweet mentioned below in the comment, it could be unsafe and remove essential packages (rare case).

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like