4

Just today, trying an update on Ubuntu 14.04:

$ sudo apt-get update # ...
$ sudo apt-get upgrade 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  phablet-tools ubuntu-sdk ubuntu-sdk-ide
The following packages will be upgraded:
  cgroup-lite curl libcurl3 libcurl3-gnutls python3-update-manager
  update-manager update-manager-core xserver-xorg-core-lts-xenial
8 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
Need to get 2,305 kB of archives.
After this operation, 13.3 kB of additional disk space will be used.
Do you want to continue? [Y/n] ^C

Ok, so from this I gather phablet-tools, ubuntu-sdk and ubuntu-sdk-ide packages had dependency changes in this update, and hence I'd have to call dist-upgrade; so I do:

$ sudo apt-get dist-upgrade 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages were automatically installed and are no longer required:
  at dctrl-tools devscripts distro-info-data dput intltool
  libcommon-sense-perl libdistro-info-perl libexporter-lite-perl
  libio-stringy-perl libjson-perl libjson-xs-perl libparse-debcontrol-perl
  unity-scope-tool
Use 'apt-get autoremove' to remove them.
The following NEW packages will be installed:
  autopilot-desktop gir1.2-gconf-2.0 gir1.2-upstart-app-launch-2
  libautopilot-gtk libautopilot-qt liblxc1 libseccomp2 libxpathselect1.4
  lxc-common lxcfs lxd lxd-client python-autopilot python-autopilot-trace
  python-autopilot-vis python-contextlib2 python-decorator python-evdev
  python-extras python-fixtures python-junitxml python-mimeparse python-psutil
  python-subunit python-testscenarios python-testtools squashfs-tools
  ubuntu-sdk-tools uidmap
The following packages have been kept back:
  ubuntu-sdk
The following packages will be upgraded:
  cgroup-lite curl libcurl3 libcurl3-gnutls python3-update-manager
  ubuntu-sdk-ide update-manager update-manager-core
  xserver-xorg-core-lts-xenial
9 upgraded, 29 newly installed, 0 to remove and 1 not upgraded.
Need to get 50.2 MB of archives.
After this operation, 66.9 MB of additional disk space will be used.
Do you want to continue? [Y/n] ^C

For one, ubuntu-sdk is still held back - but now I also get a ton of packages to be removed, as "no longer required", as well as a ton of packages to install. And this sort of irritates me, because I cannot tell which package (dependency), in particular, causes either installation of new - or removal due "no longer required" of old packages.

So my question is - is there some sort of verbose mode, or a switch, of apt-get, aptitude or similar programs, that would list what the dependency changes are from current to new version? I know I can do:

$ apt-cache depends ubuntu-sdk
ubuntu-sdk
  Depends: autopilot-desktop
  Depends: intltool
  Depends: phablet-tools
  Depends: ubuntu-device-flash
  Depends: ubuntu-sdk-ide

... but I read this as the state of the current version; what I'd like is something like (pseudocode)

$ apt-command --show-dependency-changes ubuntu-sdk
ubuntu-sdk:
  Installed: 1.126.2~0ubuntu1~trusty2 # as in 'apt-cache policy ubuntu-sdk'  
  Candidate: 1.266~0ubuntu1~0trusty
Depends: autopilot-desktop (installed v. XXX, candidate no longer required)
Depends: intltool (installed v. XXX, candidate v. YYY)
Depends: dctrl-tools (installed no dependency, candidate v. YYY)
...

... i.e. I'd like a verbose explanation of the reason why a particular package would be newly installed or removed.

Anything like this out there?

0

From the man-page of apt-get, an upgrade command do

... 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.

That means, apt-get upgrade won't install or remove a package while doing upgrade. Even when a package has higher version available. In that case, that particular package (and any associated packages that are required by this) will be held-back. This is for the safety of the system.

But, From man-page of apt-get, dist-upgrade is

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.

So, Here we see, dist-upgrade is more brutal than the upgrade. It will attempt to install newer version of important packages even if that requires removal of some packages and/or installation of newer packages. That's why dist-upgrade can trigger installation/removal of other packages like your situation in the question.

Also note that, a package can be held-back for some other cases too, like pinning. If you pin a package, that won't be upgraded.

held-back can also occur when newer version of the package can't be installed due to the lacking of one or more of it's dependency packages.

I'd like a verbose explanation of the reason why a particular package would be newly installed or removed.

A useful technique would be noting the package names that are going to be installed and manually checking their dependency changes between versions.

For your particular case, you can check the dependency change of ubuntu-sdk using apt-cache depends ubuntu-sdk=<version-installed> and apt-cache depends ubuntu-sdk=<version-candidate>. You'll see newer versions requiring extra packages.

You can also use aptitude safe-upgrade (for upgrade) or aptitude full-upgrade for (dist-upgrade) and while it's showing package lists to install and/or remove, press d to see the dependency information. Or while you're using full-upgrade, you can press o to see it's proposed dependency resolution solution. This will show you why a package is going to be installed or removed.

Check these links for more -

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.