How to tell the difference between apt-get upgrade, apt-get dist-upgrade, and do-release-upgrade - TechRepublic

How to tell the difference between apt-get upgrade, apt-get dist-upgrade, and do-release-upgrade

Don’t confuse the three commands used for upgrading a Debian- or Ubuntu-based machine. Instead, learn what each can do.

Verfasst von
Jack Wallen
Jack Wallen
May 6, 2019
We may earn from vendors via affiliate links or sponsorships. This might affect product placement on our site, but not the content of our reviews. See our Terms of Use for details.

How to upgrade a Debian-based Linux distribution–let me count the ways. There’s an apt-get upgrade, apt-get dist-upgrade, and do-release-upgrade. Say what? Why are there three different paths to upgrading an operating system? Truth be told, each of those commands does different things. Confused?

Open source: Must-read coverage

Let me explain.

SEE: Choosing your Windows 7 exit strategy: Four options (Tech Pro Research)

apt-get upgrade vs. apt-get dist-upgrade

Let’s first look at the difference between apt-get upgrade and apt-get dist-upgrade (as that is where much of the confusion lies). When you run apt-get upgrade, it only upgrades that which has a new release available to the platform, as defined in /etc/apt/sources.list or in /etc/apt/sources.list.d/.

However, when you run apt-get dist-upgrade, it will intelligently install or remove packages as needed, in order to complete the upgrade. Apt-get dist-upgrade has a smart conflict resolution system, so it will attempt to upgrade the most important packages, at the expense of those deemed less important.

Apt-get upgrade does not remove packages, it only upgrades. Can you use sudo apt-get dist-upgrade as your regular upgrade tool? Certainly. Just remember, it will delete software–if it is required to complete the process.

Advertisement

do-release-upgrade

The do-release-upgrade command, on the other hand, is responsible for upgrading from one release to another. So if you want to upgrade from Ubuntu 18.10 to 19.04, you use do-release-upgrade.

However, in order to use this command, the system must first be fully upgraded. To do that, you should first run sudo apt-get upgrade, followed by sudo apt-get dist-upgrade. When those two complete, you can then run sudo do-release-upgrade and wait for the magic to complete.

The difference between these commands is important. In fact, you might want to read up on the apt-get and do-release-upgrade man pages to find out more. To do that, issue the commands man apt-get and man do-release-upgrade. Enjoy the read.

Jack Wallen

Jack Wallen is an award-winning writer for TechRepublic, The New Stack, and Linux New Media. He's covered a variety of topics for over twenty years and is an avid promoter of open source. For more news about Jack Wallen, visit his website jackwallen.com.