Tag Archives: Aptitude

Aptitude: actions upgrade and dist-upgrades are deprecated

Version 0.4.6.1-1ubuntu1 from the gutsy repositories (aptitude 0.4.6.1) has shown some changes. One of them is the replacement of upgrade with safe-upgrade and dist-upgrade with full-upgrade. From man aptitude:

safe-upgrade
           Upgrades installed packages to their most recent version. Installed
           packages will not be removed unless they are unused (see the
           section “Managing Automatically Installed Packages” in the aptitude
           reference manual); packages which are not currently installed will
           not be installed.

           It is sometimes necessary to remove or install one package in order
           to upgrade another; this command is not able to upgrade packages in
           such situations. Use the full-upgrade command to upgrade as many
           packages as possible.

full-upgrade
           Upgrades installed packages to their most recent version, removing
           or installing packages as necessary. This command is less
           conservative than safe-upgrade and thus more likely to perform
           unwanted actions. However, it is capable of upgrading packages that
           safe-upgrade cannot upgrade.

           Note
           This command was originally named dist-upgrade for historical
           reasons, and aptitude still recognizes dist-upgrade as a synonym
           for full-upgrade.

Please note that dist-upgrade will still work as usual, and that you will get this message when upgrading:

isabella@yeti:~ $ sudo aptitude upgrade
[sudo] password for isabella:
W: The "upgrade" command is deprecated; use "safe-upgrade" instead.

References

UF thread
Bug related to auto-completion in bash with new aptitude actions
Previous blog entry with a tutorial about aptitude

Aptitude [en]

aptitude is another package manager based on apt, as apt-get, apt-cache, synaptic and adept. One great advantage is the way aptitude handles dependencies (depend, recommend, conflict packages).
aptitude lists auto-installed packages in /var/lib/aptitude/pkgstates, automatically removes unused auto-installed packages (when they are not a dependency of any other package for example) and logs history in /var/log/aptitude.

Synaptic only logs history (> File > History) and apt-get does not log at all and relies on dpkg‘s.

Edit: apt-get has now an autoremove option.

This is why it is not recommended to alternatively use aptitude and apt-get, aptitude‘s log will not be complete and problems may be encountered when removing packages (many packages to remove for example). If aptitude suggests removing packages when you know they are needed, you should reinstall them with aptitude so that they make it to the log file.

This is how an upgrade looks like in the log file :

Log complete.
Aptitude 0.4.1: log report
Sun, Dec 17 2006 19:02:07 +0100

IMPORTANT: this log only lists intended actions; actions which fail due to
dpkg problems may not be completed.

Will install 5 packages, and remove 0 packages.
5337kB of disk space will be used
===========================================================
[UPGRADE] gdm 2.16.1-0ubuntu4 -> 2.16.1-0ubuntu4.1
[UPGRADE] language-pack-en 1:6.10+20061019 -> 1:6.10+20061130
[UPGRADE] language-pack-fr 1:6.10+20061019 -> 1:6.10+20061204
[UPGRADE] language-pack-gnome-en 1:6.10+20061019 -> 1:6.10+20061201
[UPGRADE] language-pack-gnome-fr 1:6.10+20061019 -> 1:6.10+20061205
===========================================================

Do not believe that using aptitude will allow you to mix Ubuntu repositories with non-Ubuntu ones in your sources.list ;-)

aptitude interface in a terminal

Run aptitude in a terminal, you’ll get to a two parts ncurses interface :

screenshot_aptitude_terminal.pngscreenshot_aptitude_terminal_2.pngscreenshot_aptitude_3.png

Clic on the top menu (or CTRL-t) to see the different possibilities and keyboard shortcuts. CTRL-t will get you back to the main screen. The bottom of the screen shows a short description of the menu. If you enter ?, you will get to a help screen.

aptitude will warn you for broken dependencies, will tell you why and suggest solutions.

When update-manager pops you up for an upgrade, you can run it from CLI (see below) or from a terminal. If you did not start aptitude in root mode, you can do it now from the action menu.
Hit “u” to mark upgradable packages, and “U” to run the upgrade :

screenshot-aptitude_4.pngscreenshot-aptitude_5.png

aptitude in CLI

Main options are : install, remove, purge, show, search, update, upgrade, dist-upgrade. See man aptitude.
If conflitcs are present when installing or removing packages, aptitude will warn you make some suggestions.

For example :

~ $ aptitude show aptitude
E: /home/isabella/.aptitude/config - Unable to open %s for writing (13 Permission denied)
Package: aptitude
State: installed
Automatically installed: no
Version: 0.4.1-1.1ubuntu7
Priority: important
Section: admin
Maintainer: Ubuntu Core Developers
Uncompressed Size: 7881k
Depends: libapt-pkg-libc6.4-6-3.51, libc6 (>= 2.4-1), libgcc1 (>= 1:4.1.1-12),
libncursesw5 (>= 5.4-5), libsigc++-2.0-0c2a (>= 2.0.2), libstdc++6 (>=
4.1.1-12)
Recommends: aptitude-doc-en | aptitude-doc
Suggests: libparse-debianchangelog-perl, tasksel, debtags
Description: terminal-based apt frontend
aptitude is a terminal-based apt frontend with a number of useful features,
including: a mutt-like syntax for matching packages in a flexible manner,
dselect-like persistence of user actions, the ability to retrieve and display
the Debian changelog of most packages, and a command-line mode similar to that
of apt-get.

aptitude is also Y2K-compliant, non-fattening, naturally cleansing, and
housebroken.

Tips and tricks

  • You did not start aptitude in sudo mode and you need to be root to do something ? When needed, aptitude will offer to gain root priviledges and will prompt you for your password (no more need to launch synaptic in root mode to look for informations on a package ^^)
  • The configuration file is ~/.aptitude/
  • You do not like the default color theme ? You can change it all in the configuration file
  • You can run a simulation with -s
  • Search and show options for packages informations
  • When an upgrade is difficult, aptitude will perform the least harmful action first. If it fails, or is not enough, running a second upgrade will end up with more aggressive actions (CTRL + U to cancel).

References

New aptitude actions
To install a complete manual in english : sudo aptitude install aptitude-doc-en and then read /usr/share/doc/aptitude/html/en/index.html.