What is it with the "dist-upgrade" option of apt-get? - gHacks Tech News

What is it with the "dist-upgrade" option of apt-get?

There has always been a bit of confusion when people learn they can do a full upgrade of their distribution from the command line. Most people don't brave such a feat. Some because they don't use the command line, and others because they are afraid an attempt to upgrade from the command line will wind up fubaring their system.  And new users aren't quite sure what the difference between apt-get upgrade and apt-get dist-upgrade is.

In this Ghacks Linux entry, I am going t dispel the myths and fear of the dist-upgrade command. Of course, as with everything PC-related, you know their are always risks when you do a major upgrade. With that warning out in the open, let's set out to curb a little fear.


First I want to compare the two apt-get options: upgrade and dist-upgrade. The difference between these two is very simple. The upgrade option is used only to install all of the newest versions of the packages already installed on your machine. This is what happens when you see the upgrade upgrade packages through the Update Manager (You know, when you are made aware of notification in your panel and then Update Manager opens to show you which  updates are available for your system.)

The dist-upgrade option is quite different from upgrade. But just what does dist-upgrade do? Simple. The dist-upgrade option not only will upgrade all of the currently installed packages on your system it will also handle the dependency changes with new versions of packages. In other words, dist-upgrade will remove obsolete packages from your system, whereas upgrade will not. This function is out of necessity for upgrading from one distribution release to another.

But doesn't it upgrade my distro?

Not necessarily. Although, by itself, dist-upgrade, will prepare your system for a distribution upgrade, the only way it will actually perform the upgrade to a new release is if you have changed your /etc/apt/sources.listfile to reflect the change. In other words, you have to add the repositories for the new distribution in the sources.list file before this can happen.

Well that sounds simple. Yes it is. But it is not the recommended plan of attack for upgrading to a new distribution. Although it will work, there is a better way...by command. The command do-release-upgrade was created specifically for upgrading the operating system to the latest release via the command line. Of course, before you issue this command you will want to check to see if an upgrade is available with the command sudo do-release-upgrade -d. When you do this you you be informed if a new release is available. If there is a new release available issue the command sudo do-release-upgrade and the upgrade process will begin. Of course this is a rather lengthy process and there are risks involved.You could lose packages you have manually installed (that are not supported by the new release) or (worst case scenario) your system could become unstable.

Distribution upgrades are always tricky. I have had them go exceedingly well and I have had them go very awry. It's a gamble. But now you know exactly how to manage the task from the command line. You are now, officially, dangerous. ;-)

  • We need your help

    Advertising revenue is falling fast across the Internet, and independently-run sites like Ghacks are hit hardest by it. The advertising model in its current form is coming to an end, and we have to find other ways to continue operating this site.

    We are committed to keeping our content free and independent, which means no paywalls, no sponsored posts, no annoying ad formats (video ads) or subscription fees.

    If you like our content, and would like to help, please consider making a contribution:


    1. awesome said on March 11, 2010 at 3:45 pm

      thanks. very informative

    2. HNicolai said on March 11, 2010 at 5:30 pm

      Nice! I didn’t know about the whole “do-release-upgrade”-command, but now I know! Thanks :)

    3. Bart said on March 11, 2010 at 11:08 pm

      From the official Ubuntu documentation of do-release-upgrade:

      “It is also possible to use do-release-upgrade to upgrade to a development version of Ubuntu. To accomplish this use the -d switch: ”

      From what I can tell that command will not just check to see if a new version is available, but will perform an upgrade to the current alpha/beta.

    4. kubrick said on March 13, 2010 at 2:37 pm

      Thanks for the info.

      Best regards.

    5. gus said on January 26, 2011 at 10:52 pm

      man I setup this old p4 in my closet for projects during a college course a year and a half ago- I originally put a desktop distro of ubuntu on it and was managing it via remote desktop if you can believe it. Being new to linux in general much less bash, you a learn a bit more and a bit more at a time, the shell being clearly easier, quicker, and sans the obtuse extra overhead of desktop software totally in-germane to server use. Finally though, I feel like I’m “dangerous” thanks Mr. Ghacks!

    6. Alexander Fieroch said on February 3, 2011 at 5:30 pm

      You have to run “do-release-upgrade -c” for only checking if there is a new release available. The parameter -d is for upgrading to the latest devel release (alpha, beta or rc).

    7. Kars said on June 26, 2011 at 10:09 am

      Thanks for clarifying. I had a problem with broken packages and couldn’t update to the latest version of firefox. So I went on the mint IRC channel to ask for help and someone mentioned dist-upgrade. This fixed the broken package and completed the update! I also was told to execute apt-get install -f, does anyone know what that does?

    8. Lokesh Walase said on August 25, 2011 at 10:45 am

      Thanks for the article, it did upgrade my knowledge @ apt-get upgrade !! ;))

    9. german ochoa said on September 27, 2011 at 7:34 pm

      Thanks, really useful information. Also it works for Trisquel (https://trisquel.info/en).

    10. nubby said on July 30, 2013 at 1:03 am

      “Of course, before you issue this command you will want to check to see if an upgrade is available with the command sudo do-release-upgrade -d.”

      I’m pretty sure you meant to say “sudo do-release-upgrade -c” here, -d (= Devel Release) actually starts the upgrade process.

    Leave a Reply