Now that you can move about the list of packages, it's time to start using aptitude to install and remove packages. In this section you will learn how to flag packages for installation, deletion, and upgrade.
![]() | Tip |
---|---|
You can only change your system's setup as the root user. If you want to experiment with aptitude, you can safely run it as any user other than root without damaging your system in any way. aptitude will tell you when you try to do something that only root can do, and if you want to continue, you must type root's password. |
All changes to a package are performed by first highlighting it in the package list, then pressing a key corresponding to the action which should be performed. The basic action keys [2] are + to install or upgrade a package, - to remove a package, and = to prevent a package from being automatically upgraded (this is known as holding the package). These actions are not performed immediately; aptitude will simply update the package list to show the change that has been requested.
For instance, in the screen shot below, the kaffeine package was selected and + was pushed. The package is now highlighted in green and the letter “i” has appeared to the left of its name, to indicate that it will be installed; in addition, an estimate of the amount of space that the package will use is displayed.
![]() | Tip |
---|---|
At any time, you can use Control+u) to “undo” any change to one or more packages. This is very useful if an action has unforseen consequences and you want to “take it back”. -> ( |
In addition to actions that affect individual packages, another important action is available: typing U will attempt to upgrade any packages that can be upgraded. You should use this command on a regular basis to keep your system up-to-date.
Sometimes, changing a package's state will cause dependency relationships to become unfulfilled; packages with unfulfilled dependencies are said to be broken. aptitude will warn you when this happens, and explain why it occured. For instance, here is what happens if you attempt to remove libpopt0:
As you can see, aptitude displays two indicators that something has gone wrong: first, the number of broken packages is displayed in the upper blue area; second, the lower half of the display changes to describe broken packages that are related to the currently highlighted package. To quickly find broken packages in the package list, you can search for ~b.
![]() | Tip |
---|---|
When there is more information in the lower half of the display than fits into the available space, the a and z keys can be used to scroll through it. |
If you do not resolve the situation on your own, aptitude will try to fix things for you when you commit your selections. However, it is hard to automatically solve dependency problems, and you may not be happy with the results, so it is generally better to solve problems such as this before committing your selections.
[2] You can also change packages using the menu; see the section called “The Package Menu” for details.