I really like that in the new Ubuntu 20.04LTS the repositories are always updated to the latest. When a new version of a software comes, I dont have to do it manually.

But, this at times is problematic, because, sometimes, until I'm finished with a project, I'd not like to upgrade version of a software. How can I stop automatic upgrade for a specific app or atleast downgrade it to a previous version after the upgrade?

  • No, the repositories are not always updated to the latest. With a few exceptions, versions are frozen in each release. If you install Ubuntu 16.04, you will get five-year-old software...plus patches for security vulnerabilities and critical bugfixes. – user535733 Nov 28 '20 at 3:36
  • see: askubuntu.com/questions/151283/… – Nmath Nov 28 '20 at 3:37
  • 1
    Best practice for folks who want a specific environment for development or troubleshooting (keeping libs and other dependencies at a specific version) is to spin up a VM or Container for it instead of customizing the base system. – user535733 Nov 28 '20 at 3:40
  • you can put a hold on packages (apt-mark hold), but I'd avoid that unless you have to use it. I don't see how it relates, as only security updates occur; it's extremely rare where it's less work to provide a later version of software than just backport the security patches to the existing version (web browsers are probably the primary exception to that rule) – guiverc Nov 28 '20 at 3:44

You will avoid a lot of problems if you let your Ubuntu system's built-in tools keep your Ubuntu system up to date.

For cases like yours, where that simply isn't possible, best practice is to keep your custom/project environment in a Virtual Machine or a Container. That way, your customizations don't cause conflicts and other problems on your base system.

To stop normal upgrades:

  • Disable Unattended Upgrades in /etc/apt/apt.conf.d/20auto-upgrades. Warning: Your system will no longer receive security patches.
  • To keep a few packages unchanged for a limited time, you can apt-mark hold <packagename>. Over time, your system may diverge from standard Ubuntu, so try to keep that delta small.
  • [Optional] Disable Software Updater by uninstalling update-manager. Warning: This will also remove several desktop metapackages. Under some conditions, this may make your entire desktop stack eligible for accidental autoremoval.

Downgrades are sometimes possible using apt (specify the version that you want), but not recommended. A Debian-based system can have only one version of a package installed at any time, so if you try to downgrade a package that other parts of your system also depend upon, you may get unexpected or painful results. Also, Debian archives usually have only one version (the latest), so you will need to locate the older version yourself.

  • do you think you can mention something about apt-mark hold command and how that may help/screw the current problem? – juztcode Nov 28 '20 at 4:18
  • @juztcode edited – user535733 Nov 28 '20 at 4:29
  • could you explain a bit on what delta is and what you mean by diverge? – juztcode Nov 28 '20 at 4:44
  • @juztcode: AskUbuntu has multiple questions every day from folks who broke their systems by making small (in their view) changes in package versions...that had vast unintended consequences. If you are not an expert in apt management, avoid doing that. The purpose of this answer is to recommend doing such experimentation in a way that doesn't need to be repaired, maintained, or puzzled over later. – user535733 Nov 28 '20 at 4:55

Not the answer you're looking for? Browse other questions tagged or ask your own question.