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

Questions about applications and software
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
User avatar
JoeFootball
Level 13
Level 13
Posts: 4674
Joined: Tue Nov 24, 2009 1:52 pm
Location: /home/usa/mn/minneapolis/joe

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

Post by JoeFootball »

One of the many concepts that continues to slip through my sieve of a brain is the difference between apt-get upgrade and apt-get dist-upgrade.

When I execute an apt-get upgrade, I see that there's a kernel upgrade "kept back"...

Code: Select all

$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages have been kept back:
  linux-generic linux-image-generic
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
...and when I do an apt-get dist-upgrade, it's available to upgrade...

Code: Select all

$ sudo apt-get dist-upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following NEW packages will be installed:
  linux-image-3.2.0-27-generic
The following packages will be upgraded:
  linux-generic linux-image-generic
2 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 38.5 MB of archives.
After this operation, 149 MB of additional disk space will be used.
The man page for apt-get didn't conclusively articulate why this may be, unless it's slipping by me once again. Any education would be greatly appreciated.

Thanks!

Joe
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
zerozero

Re: apt-get upgrade vs. apt-get dist-upgrade

Post by zerozero »

from man apt
upgrade
Used to install the newest versions of all packages currently installed on the system from the sources enumerated in /etc/apt/sources.list(5). Packages currently installed with new versions available are retrieved and upgraded; 1 under no circumstances are currently installed packages removed, nor are packages that are not already installed retrieved and installed. 2 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.
the highlight and numbering is mine
1 means upgrade doesn't install new pkgs/lib or remove installed ones (that's why in your example the new kernel is held back;
2 means that if if a pkg upgrade requires another pkg removal or installation to satisfy its new dependencies it will left at the current state (this usually happens with the multimedia stack)
dist-upgrade
In addition to performing the function of upgrade, this option 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 /etc/apt/sources.list(5) file contains a list of locations from
which to retrieve desired package files. See also apt_preferences(5) for a mechanism for over-riding the general settings for individual packages.
dist-upgrade performs the upgrade plus what is highlighted above
User avatar
JoeFootball
Level 13
Level 13
Posts: 4674
Joined: Tue Nov 24, 2009 1:52 pm
Location: /home/usa/mn/minneapolis/joe

Re: apt-get upgrade vs. apt-get dist-upgrade

Post by JoeFootball »

zerozero wrote:1 means upgrade doesn't install new pkgs/lib or remove installed ones (that's why in your example the new kernel is held back;
Thanks! That's what I initially thought when I read the man page, but if apt-get upgrade doesn't install new versions, such as the kernel in my example, how would anything ever get upgraded via this option?

Joe
zerozero

Re: apt-get upgrade vs. apt-get dist-upgrade

Post by zerozero »

Code: Select all

sudo apt-get upgrade
will never install new pkgs/lib, only update the ones your system already has;
but only if that doesn't imply point 2 in my previous post: meaning that if a installed pkg needs to be updated but in the process requires a removal or a new dependency, that upgrade won't happen.
upgrade is a conservative approach.

usually in the mint main editions (ubuntu-based) you won't see much difference between both (unless you are using LTS for some time or a lot of ppa's) because those ed. are for the most part pretty static (and the updates are not disruptive, rather conservative and mostly focused in security fixes)

where you get a real grip of these differences is if you use a rolling (or semi-rolling) distro (like debian testing or the original lmde): very quickly you see the amount of pkgs that are being held back (kernel, xorg stack, multimedia) and the system starts to fall apart (slowly of course)
User avatar
JoeFootball
Level 13
Level 13
Posts: 4674
Joined: Tue Nov 24, 2009 1:52 pm
Location: /home/usa/mn/minneapolis/joe

Re: apt-get upgrade vs. apt-get dist-upgrade

Post by JoeFootball »

zerozero wrote:usually in the mint main editions (ubuntu-based) you won't see much difference between both (unless you are using LTS for some time or a lot of ppa's) because those ed. are for the most part pretty static (and the updates are not disruptive, rather conservative and mostly focused in security fixes)

where you get a real grip of these differences is if you use a rolling (or semi-rolling) distro (like debian testing or the original lmde): very quickly you see the amount of pkgs that are being held back (kernel, xorg stack, multimedia) and the system starts to fall apart (slowly of course)
Excellent info, thank you! So, in your expert opinion, should someone on Linux Mint 13 KDE (e.g., me) be using apt-get upgrade, and someone on Linux Mint DE be using apt-get dist-upgrade?

Not that I have a pressing need to upgrade my kernel from 3.2.0-23 to 3.2.0-27, but is there an obvious detriment to using apt-get dist-upgrade if it "intelligently handles changing dependencies with new versions of packages" as the man page says?

Thanks again!

Joe
zerozero

Re: apt-get upgrade vs. apt-get dist-upgrade

Post by zerozero »

:D this is getting tougher as the posts go by :lol:
they are 2 completely distros and the upgrade approach has to be totally different as well:
- in lmde (or debian testing or sid) you should always use dist-upgrade: the system changes too much under the hood and you need a tool that provides you the cleaning material to keep it tidy; i don't see option here: you are better off holding updates for some time if you see something fishy in there (and that happens a lot believe me :mrgreen: ) than resort to upgrades and mess up the dependencies chain (i vaguely remember issues with libavformat-something that should be removed for the new version be installed and users that were holding this replacement at the time had troubles after)

- in the main edition, it's basically a user's choice together with hardware limitations: explaining >>
  • do you need the new kernel? are you having hardware issues, drivers issues? do you think that your setup will be better supported with the newest lib? it can happen: there's an issue with the new intel cards and the current kernel http://forums.linuxmint.com/viewtopic.p ... 05#p611705
  • do you value more stability?
  • do you have a lot of ppa's enabled? and what kind of ppa's? the stable ones or the bleeding edge ones? the ones that update daily and sometimes require new core components to function properly
  • the kernel upgrades are not the worst part :D that can happen specially because the old one remains in grub and if you have any issue with the new one simply use the old one, the main instability can come from mesa/xorg
as you see there's not one answer:
1- if you are in the short-term releases and don't have any fancy ppa's >> upgrade should be fine;
2- short-term releases but with bleeding edge ppa's >> maybe watch the dist-upgrade output once in awhile;
3- LTS without cutting edge ppa's >> for now i believe that upgrade should be fine but 5 years is a lifetime in linux (not that i believe that anyone will be using maya in 2017)
4- LTS with ppa's >> i would follow point 2.

feel free to hit me again :wink:
squeezy

Re: apt-get upgrade vs. apt-get dist-upgrade

Post by squeezy »

I live on the edge, it's always dist-upgrade for me 8)
cwsnyder

Re: apt-get upgrade vs. apt-get dist-upgrade

Post by cwsnyder »

One thing not mentioned about

Code: Select all

$ sudo apt-get dist-upgrade
is that on the main-line Mint distribution, if the new version of Mint is out, even if it isn't for your version of the desktop, you will be upgraded if you use dist-upgrade.
zerozero

Re: apt-get upgrade vs. apt-get dist-upgrade

Post by zerozero »

sorry but that is a myth and a wrong one :)
dist-upgrade never takes you from lisa to maya or from katya to lisa automatically just because you ran it. it doesn't do it in mint as it doesn't do it in ubuntu or in debian.
dist-upgrade does what the man pages says, that's all.

to go to a new release you have to, first, change the sources.list pointing them to the new release and them run the dist-upgrade command; or do like ubuntu that has a built-in procedure that does that for you (but it's independent from the dist-upgrade command)
http://www.ubuntu.com/download/desktop/upgrade
http://community.linuxmint.com/tutorial/view/2
User avatar
JoeFootball
Level 13
Level 13
Posts: 4674
Joined: Tue Nov 24, 2009 1:52 pm
Location: /home/usa/mn/minneapolis/joe

Re: apt-get upgrade vs. apt-get dist-upgrade

Post by JoeFootball »

ZeroZero, all excellent info. Sounds like I'll just stick with apt-get upgrade for Linux Mint 13 KDE for the most part, but may peek to see what apt-get dist-upgrade has to offer me from time to time. :wink:

Thanks again!

Joe
Locked

Return to “Software & Applications”