Ubuntu – Prevent apt-get remove from uninstalling related packages

aptuninstall

I uninstalled some packages with apt-get remove. In addition to the selected packages the Okular document viewer was removed, which was running on my computer long before the other packages. Is there any way to prevent those "side effects", so that I don't have to reinstall programms again?

Best Answer

Okular depended on some or all of the packages your removed. That's why it was removed too. When you install a program, its dependencies must be installed at the same time, if you remove a dependency, the parent program is removed too.

Programs often use some of the same files as each other. Rather than putting these files into each package, a separate package can be installed to provide them for all of the programs that need them. So, to install a program which needs one of these files, the package containing those files must also be installed. When a package depends on another in this way, it is known as a package dependency. By specifying dependencies, packages can be made smaller and simpler, and duplicates of files and programs are mostly removed.

When you install a program, its dependencies must be installed at the same time. Usually, most of the required dependencies will already be installed, but a few extras may be needed, too. So, when you install a package, don't be surprised if several other packages are installed too - these are just dependencies which are needed for your chosen package to function properly.

Source: https://help.ubuntu.com/community/InstallingSoftware