Package management

m
 
(3 intermediate revisions not shown)
Line 1: Line 1:
 +
{{danger}}
 +
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.
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.
-
 
-
 
-
=Warning=
 
-
 
-
The usual warnings apply. You are performing administrating tasks on your device with root account and you can brick your device. If you don't know what are you typing into the terminal, then it is probably for the best if you don't do it at all!
 
Line 25: Line 22:
  dpkg -P package
  dpkg -P package
-
If you are unsure, you can check which files were left by a certain package with command:
+
If you are unsure, you can check which files were left by a certain package with the command:
  dpkg -L package
  dpkg -L package
Line 33: Line 30:
-
1. dpkg - warning: while removing ''package'', directory `''/path/dir''' not empty so not removed.
+
* ''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).
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):
+
* ''dpkg: error processing package (--purge):''
An error occured while removing/purging the package, again resolve it manually.
An error occured while removing/purging the package, again resolve it manually.
Line 74: Line 71:
  apt-get autoremove
  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...
 +
 +
 +
# Refresh the repositories (''apt-get update'' in command line).
 +
# Update applications (''apt-get upgrade'' in command line).
 +
# Empty local cache with ''apt-get clean''.
 +
# Remove unneeded dependencies with ''apt-get autoremove''.
 +
# List all packages that are not in "normal" (ii ) state with dpkg (script is above).
 +
# Purge them (''dpkg -P package'').
 +
# Check if they were any errors from purging and resolve them.
[[Category:Software]]
[[Category:Software]]
[[Category:Power users]]
[[Category:Power users]]

Latest revision as of 21:57, 14 April 2010

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.


[edit] 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!):


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


  • dpkg: error processing package (--purge):

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


[edit] 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


[edit] 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.