Difference between apt-get upgrade and apt-get dist-upgrade

Imagine you have installed packages A-1.deb and B-1.deb
A-1.deb depends on packages Adep1-1.deb and Adep2-1.deb while B-1.deb depends on package Bdep1-1.deb:

A-1.deb
|
`—– Adep1-1.deb
`—– Adep2-1.deb

B-1.deb
|
`—— Bdep1-1.deb

Now, there is a new package available for program A, namely A-2.deb. A-2.deb still depends on Adep1-1.deb but now it also depends on a new version of Adep2, namely Adep2-2.deb:

A-2.deb
|
`—– Adep1-1.deb
`—– Adep2-2.deb

There is also a new package for program B, namely B-2.deb, and there is also a new version of B-2′s dependency, namely Bdep1-2.deb. But contrary to the already installed version of B, B-1.deb, B-2.deb also depends on a new package: Bdep-new-1.deb

B-2.deb
|
`—— Bdep1-2.deb
`—— Bdep-new-1.deb

If you now execute an apt-get upgrade you would see something like this:

     # apt-get upgrade
     Reading Package Lists... Done
     Building Dependency Tree... Done
     The following packages have been kept back
       B 
     The following packages will be upgraded
       A Adep1 Adep2
     3 packages upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
     Need to get 5055B/5055kB of archives. After unpacking 1161kB will be used.
     Do you want to continue? [Y/n]

As you can see the package B is kept back. The reason is that in order to install the new version of B, B-2.deb, a new package must be installed, Bdep-new-1.deb, but apt-get upgrade doesn’t install new packages, it only upgrades already installed packages.

On the other hand, apt-get dist-upgrade will also install new packages in order to resolve dependencies. So with a dist-upgrade you would get something like this:

     # apt-get dist-upgrade
     Reading Package Lists... Done
     Building Dependency Tree... Done
     Calculating Upgrade... Done
    The following NEW packages will be installed:
       Bdep-new
     The following packages will be upgraded
       A Adep1 Adep2 B Bdep1
     5 packages upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
     Need to get 7055B/7055kB of archives. After unpacking 1161kB will be used.
     Do you want to continue? [Y/n]

In general, if you do an apt-get upgrade and a package is kept back:
“This means that there are new versions of these packages which will not be installed for some reason. Possible reasons are broken dependencies (a package on which it depends doesn’t have a version available for download) or [like in my example] new dependencies (the package has come to depend on new packages since the last version). ” [APT HOWTO
Chapter 3 - Managing packages, section 3.4 Upgrading packages
]

About these ads

4 Responses to Difference between apt-get upgrade and apt-get dist-upgrade

  1. Thank you for illustrating the dependency trees, this makes total sense. For whatever reason I, perhaps like others, thought that the “dist” in the distribution upgrade meant that there were specially flagged packages for ‘the next distribution’ of the operating system and that in turn might require dorking around with the sources.

    Nope, things are much simpler than I was making them out to be. My next mystery is why sometimes using sudo aptitude solves installation problems that apt-get doesn’t seem to. My bet: it’s specifying the dependencies I could be by hand.

  2. furicle says:

    I thought dist-upgrade will also *remove* things if required, where upgrade won’t. That’s the more important distinction to me.

  3. [...] viaDifference between apt-get upgrade and apt-get dist-upgrade « davitenio’s blag. Share this:TwitterFacebookLike this:Mi piaceBe the first to like this.   [...]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: