An installed package won't continue to automatically get upgrades if you disable the software source that the package was installed from (for example by commenting out the software source's line in your software sources by preceding it with a #
character), however you can still manually upgrade that package by re-enabling its software source and reinstalling the package, and then disabling its software source again.
When you reinstall a package with sudo apt reinstall package-name
, apt will try to locate that package in your software sources and install the latest available version of that package. When a package is upgraded by sudo apt upgrade
it also upgrades it to the latest available version of that package.
Dependencies cross repositories only if you are also adding suggested packages with the --install-suggests
option when running a sudo apt install
command. Ubuntu installs only the package itself and its recommended packages by default. You will get an error message if you try to install a suggested package that is not available from your system's software sources.
Even if a package has been installed by apt there are commands that tell apt to treat that package like a manually installed package, so that it cannot be either automatically removed or automatically upgraded without toggling an option first. sudo apt-mark manual package-name
is used to mark a package as being manually installed, which will prevent the package from being automatically removed if no other packages depend on it. sudo apt mark hold package-name
hold is used to mark a package as held back, which will prevent the package from being automatically installed, upgraded or removed. unhold
is used to cancel a previously set hold on a package to allow all actions again. apt reinstall --simulate package-name
simulates the re-installation of a package the results of which will show whether reinstalling that package will also install any new packages or dependencies which may include non-free packages that aren't currently installed. Use sudo apt-mark hold
to prevent these unwanted new packages from being installed.