It seems like this should be true but I wanted to make sure. Thanks!
3 Answers
Short answer
No, they are not the same. apt-get upgrade
doesn't handle changing dependencies between versions, so if a package has changed dependencies, it wont be upgraded (it'll be "held back"). See the long answer for more details.
Using the Software Updater and using sudo apt-get update ; sudo apt-get dist-upgrade
(note the dist-
) would be almost equivalent, except that one's obviously a GUI and the other's a console application and also a few very minor informational differences.
Long asnwer
From man apt-get
,
apt-get upgrade
:upgrade upgrade is used to install the newest versions of all packages currently installed on the system from the sources enumerated in /etc/apt/sources.list. Packages currently installed with new versions available are retrieved and upgraded; under no circumstances are currently installed packages removed, or packages not already installed retrieved and installed. New versions of currently installed packages that cannot be upgraded without changing the install status of another package will be left at their current version. An update must be performed first so that apt-get knows that new versions of packages are available.
(emphasis by me)
This means that a newer version of a package which has a new dependency not required in the old version will not be upgraded with this method (unless the new dependency was already installed). These will be shown as "Held back".
apt-get dist-upgrade
:dist-upgrade dist-upgrade in addition to performing the function of upgrade, also intelligently handles changing dependencies with new versions of packages; apt-get has a "smart" conflict resolution system, and it will attempt to upgrade the most important packages at the expense of less important ones if necessary. The dist-upgrade command may therefore remove some packages. The /etc/apt/sources.list file contains a list of locations from which to retrieve desired package files. See also apt_preferences(5) for a mechanism for overriding the general settings for individual packages.
(emphasis by me)
This means that with this command instead of
upgrade
, packages with new (or removed) dependencies can by upgraded.
Example
A good example of the difference between the two is when a new Linux kernel is released. This is packaged into the linux-image-generic
package which always depends on the latest package of the Linux kernel. Because the dependencies of linux-image-generic
change with each kernel upgrade, upgrade
wont upgrade it.
-
1Can you explain why, when Software Updater no longer requires root password to update existing packages (i.e., when only
apt-get upgrade
is required),apt-get
can't do the same? It seems like there's something else fundamentally different between the two. Dec 2, 2015 at 7:47
It's nearly the same but not exactly. For example, when kernel updates are offered, sudo apt-get update && sudo apt-get dist-upgrade
is needed to get those updates.
sudo apt-get update && sudo apt-get upgrade
will tell you that some packages have been held back.
Using the Software Updater makes everything seamless and you won't see anything held back.
With apt
available, phased updates (mentioned by pabouk) are the most salient difference between updating with the Software Updater and the command line.
These days, the apt
utility--which didn't exist when this question was posted but would likely have been included in the question if it had--is an increasingly popular alternative to apt-get
for upgrading packages. They are similar: the same package (also called apt
) provides both, and everything apt
can do, the traditional apt-
utilities can too, though in some cases you would have to pass special configuration options. But apt
is closer than apt-get
to the Software Updater. Like the Software Updater, sudo apt upgrade
is capable of installing new packages when the new version of an existing package declares them as dependencies.
So these days, users who are concerned with this distinction can just run sudo apt upgrade
instead of sudo apt-get upgrade
if they want new dependencies to be installed automatically. Consequently, the Software Updater's feature of delaying some updates slightly, to determine if they are stable in the wild and limit damage if they are not, is now probably the main difference between using the Software Updater and updating on the command-line.
This behavior of the Software Updater is due to the phased updates policy. That policy--implemented in the Software Updater but not in apt-get
(or apt
)--has been one major difference between the two methods ever since the policy was introduced, and pabouk commented about it a couple years ago:
There is another difference:
apt-get
does not use PhasedUpdates so sometimes Software Updater shows less updates thanapt-get
. See Why Does Software Updater Say No updates Available, but apt-get upgrade Shows updates available?.
This may always have been the most significant difference, in that one could always run sudo apt-get dist-upgrade
when faced with the upgrade
action's unwillingness to install new packages or uninstall existing ones. However, when updating from the command-line, the relative importance of phased updates increases with apt
:
- Like
apt-get
, theapt
command will download and install updates even if they would be delayed due to the phased updates policy if the Software Updater had been used instead. - But unlike
apt-get
, theapt
command'supgrade
action will install new packages that were not previously installed but are required as dependencies for new package versions.
Aside from (a) preferring a graphical interface and (b) its desktop integration providing notifications when updates are available, the main current reason one might use the Software Updater that it is the easiest way to participate in phased updates.
apt-get
does not use PhasedUpdates so sometimes Software Updater shows less updates thanapt-get
. See Why Does Software Updater Say No updates Available, but apt-get upgrade Shows updates available?.