aptitude can't find a solution where apt-get can (no complicated packages)

Asked by Allo on 2012-05-31

The problem is, aptitude does not find a solution, where apt-get finds an easy one:

$ aptitude upgrade
Resolving dependencies...
Unable to resolve dependencies for the upgrade: no solution found.

$ apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages have been kept back:
  ins-config-development-environment
The following packages will be upgraded:
  akregator apport apport-gtk apport-kde ark cups-filters dolphin dragonplayer gir1.2-gtk-3.0 gir1.2-ubuntuoneui-3.0 gwenview kaddressbook kamera kate kate-data kate
  [...]
174 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
Need to get 126 MB of archives.
After this operation, 642 kB of additional disk space will be used.

with full-upgrade, it would work:
$ aptitude full-upgrade
The following NEW packages will be installed:
  tetgen{a}
The following packages will be upgraded:
  akregator apport apport-gtk apport-kde ark cups-filters dolphin dragonplayer gir1.2-gtk-3.0 gir1.2-ubuntuoneui-3.0 gwenview
  [...]
The following packages are RECOMMENDED but will NOT be installed:
  firefox-locale-en
175 packages upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 126 MB of archives. After unpacking 1,383 kB will be used.

but we do not want to use full-upgrade, because on the computers is cron-apt installed with a safe commandline:
dist-upgrade --safe-resolver -y -o APT:Get:Show-Upgraded=true

we even tried to use:
dist-upgrade --safe-resolver --allow-new-installs --allow-new-upgrades -y -o APT:Get:Show-Upgraded=true

but even then aptitude not only refuses to install the new dependency, but even rejects the safe-upgrades, which would work with apt-get:

$ aptitude dist-upgrade --safe-resolver --allow-new-installs --allow-new-upgrades -y -o APT:Get:Show-Upgraded=true
Resolving dependencies...
Unable to resolve dependencies for the upgrade: no solution found.
Unable to safely resolve dependencies, try running with --full-resolver.

Why is aptitude rejecting to install the packages, which do not even need newly installed packages as a dependency? What can we try to solve this, except from using full-upgrade (which might happen to uninstall important packages, which is why we use safe-upgrade instead).

Question information

Allo (allo) said : #1

The Problem happens only, when there are packages which need to be kept back, when there are only upgrades, aptitude suggests the same solution as apt-get and it works.

Allo (allo) said : #2

this a a regression from lucid, where

$ cat /etc/cron-apt/action.d/5-install
autoclean -y
dist-upgrade --safe-resolver -y -o APT:Get:Show-Upgraded=true

worked even for installing new packages via our own meta-packages.

Jeet (gour-jitendrasingh) said : #3

did 'sudo apt-get update && sudo apt-get upgrade' worked ?

Allo (allo) said : #4

apt-get upgrade works, but we want to use aptitude with safe-resolver.

just using apt-get would mean, if some dependencies are broken, apt-get might remove important packages, so we need to fix it manually. so we want to use aptitude with safe-resolver (see the config wre're using with lucid in my post above) to avoid stuff like "sshd gets uninstalled, because the meta-package which kept it installed was broken".

so the commandline cron-apt should use, should be something like
aptitude dist-upgrade --safe-resolver -y -o APT:Get:Show-Upgraded=true

or maybe
aptitude -o Acquire::http::Dl-Limit=2000 dist-upgrade --safe-resolver --allow-new-installs --allow-new-upgrades -y -o APT:Get:Show-Upgraded=true

But nothing using only apt-get.

can you give the output of:

lsb_release -a; uname -a; file `which dist-upgrade`

Thanks

Allo (allo) said : #6

i think you meant "file $(which aptitude)", so i modified your commandline accordingly, as there is no dist-upgrade binary, dist-upgrade is a command for the aptitude binary.

$ lsb_release -a; uname -a; file `which aptitude`
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 12.04 LTS
Release: 12.04
Codename: precise
Linux dipl-013 3.2.0-24-generic #39-Ubuntu SMP Mon May 21 16:52:17 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
/usr/bin/aptitude: symbolic link to `/etc/alternatives/aptitude'

and to answer the next questions:
$ file /etc/alternatives/aptitude
/etc/alternatives/aptitude: symbolic link to `/usr/bin/aptitude-curses'

$ apt-cache policy aptitude
aptitude:
  Installed: 0.6.6-1ubuntu1
  Candidate: 0.6.6-1ubuntu1
  Version table:
 *** 0.6.6-1ubuntu1 0
        500 http://archive.ubuntu.com/ubuntu/ precise/main amd64 Packages
        100 /var/lib/dpkg/status

Daniel Hartwig (wigs) said : #7

> just using apt-get would mean, if some dependencies are broken, apt-get might remove
> important packages, so we need to fix it manually. so we want to use aptitude with safe-
> resolver (see the config wre're using with lucid in my post above) to avoid stuff like "sshd gets
> uninstalled, because the meta-package which kept it installed was broken".

Are you saying that before you run dist-upgrade some packages have broken dependencies?

The man page for apt-get says that upgrade (as opposed to dist-upgrade) will never remove a currently installed package.

Also, if you are running 'aptitude dist-upgrade --safe-resolver' this is very similar to 'aptitude safe-upgrade', which tries to be just like 'apt-get upgrade'.

Allo (allo) said : #8

We're using own meta-packages and cron-apt to distribute configurations and new packages to our workstations.
The worst case is, some meta-package has broken dependencies (possible only on some of the workstations) and does bad things like uninstalling itself, which leads to stuff like that dependencies pulled by this meta-packages will be removed on the next run of cron-apt

Worst-Case: In the first night the package depending on sshd is uninstalled because of a conflict and in the next night sshd is uninstalled by the autoremove command.

with lucid, we use "aptitude dist-upgrade --safe-upgrade", which allows aptitude to install new packages needed as dependency, but stops with an error in case the package itself is broken (and does not remove the package itself).

- "apt-get upgrade" will not install new dependencies (which is against the point of having a meta-package)
- "apt-get dist-upgrade" will remove broken packages, maybe leading to a system where the configuration packages are not installed any longer, preventing us from distributing a fixed package.

desired behaviour:
- install updates like "upgrade"
- install new dependencies like "dist-upgrade"
- in case of error, do nothing, stop with an errorcode (cron-apt will mail the error)

of course, normally a package SHOULD NOT break, but in case it breaks anyway, the behaviour of the cron-apt commandline should be safe in a way, we can put a fixed .deb on the mirror and it will be installed on the next run. This is not provided, when the package is uninstalled in case of errors.

Allo (allo) said : #9

so to emphasise on this point:
The difference between "aptitude upgrade" and "aptitude dist-upgrade --safe-resolver" is, that new dependencies will get installed, when needed. Thats why we're using "dist-upgrade --safe-resolver" instead of "upgrade" for doing a safe-upgrade.

Daniel Hartwig (wigs) said : #10

Firstly, note that the problem resolver in aptitude has many issues. It is rather complex and there are no active developers experienced with working on it.

You can run aptitude with "--log-file=resolver.log --log-resolver" to capture debugging output. This may help you understand why it has not found, or rejected, a solution that you prefer. A third party is likely to also need the output of aptitude-create-state-bundle. Investigate these logs only in consultation with the user's manual.

Since you are using metapackages to handle your upgrades, a simpler solution could be something like:

apt-get install -y $metapackages && apt-get upgrade -y

where determining the set of metapackages installed on or relevant to each machine is an exercise I leave up to you.

Can you help with this problem?

Provide an answer of your own, or ask Allo for more information if necessary.

To post a message you must log in.