Package management

Image:Ambox_notice.png
Some instructions here may cause serious problems. When unsure, see General precautions
Backing up your data is recommended. In case of trouble you might need to re-flash your device.


It is good to know how to manage packages, because uninstalled ones can leave configuration files behind and there are also many pre-installed packages which you might not need.


dpkg

Install package from a local .deb file:

dpkg -i

List all installed packages:

dpkg -l

List all packages that are not in "normal" (ii ) state:

dpkg -l | awk '$1 != "ii" {print $0}'

This also lists previously uninstalled packages which left config files behind (those will have "rc" state in the first column). You can purge (completely uninstall) them with:

dpkg -P package

If you are unsure, you can check which files were left by a certain package with the command:

dpkg -L package


Purging can give you the following errors (read the output!):


1. dpkg - warning: while removing package, directory `/path/dir' not empty so not removed.

It is ok if you manually delete those dirs/files if you know that they belong to the purged package (for example: don't delete /etc).


2. dpkg: error processing package (--purge):

An error occured while removing/purging the package, again resolve it manually.


apt-get

Install package from a repository:

apt-get install package

Remove a package:

apt-get remove

Purge a package:

apt-get purge

Update package lists (checks for updates, downloads new list of packages which are in the repository...):

apt-get update

Update packages:

apt-get upgrade

It will display which ones are to be updated and it asks you if you want to proceed so this is also the command to show available updates.

This will empty local cache containing downloaded installation packages:

apt-get clean

Remove unneeded dependencies (packages):

apt-get autoremove


Perform package maintenance

Do not just blindly follow these instructions if you do not know what you are doing. They are more like guidance...


  1. Refresh the repositories (apt-get update in command line).
  2. Update applications (apt-get upgrade in command line).
  3. Empty local cache with apt-get clean.
  4. Remove unneeded dependencies with apt-get autoremove.
  5. List all packages that are not in "normal" (ii ) state with dpkg (script is above).
  6. Purge them (dpkg -P package).
  7. Check if they were any errors from purging and resolve them.