User Tools

Site Tools


foss:ubuntu:aptclean

Cleaning the repositories after an upgrade

Introduction

This guide aimed to be a reference about cleaning residual configuration or obsolete packages that can occur after an upgrade of distribution.

Intended readership

This document is intended to end user who wants to restore a clean state after having upgrade its distribution (like upgrading from Ubuntu 8.10 to Ubuntu 9.04). The user is assumed to have basic knowledge of the Ubuntu user interface.

Applicability statement

This document applies to Ubuntu Desktop Edition (verified on version 7.04, 8.04 LTS, 8.10, 9.04 and 9.10 Alpha 2). Other versions of this software or other linux distribution could apply, but have not been validated. The user must have access to administrative rights to perform the described actions.

In addition, the following requirements apply to this guide:

  • Package management system compatible with Debian or Ubuntu system (using dpkg and apt-get)

Concept

Using Synaptic, the package manager, it is possible to clean-up the installed packages and remove residual files. Therefore, it is based on the standard Ubuntu package management system and uses mainly program from the Ubuntu main repository. Optionally, a program from the universe repository could be used.

Guide

Synaptic after having upgrade from Ubuntu 6.10 to 7.04 Synaptic is the Ubuntu package manager. It is available via the Gnome menu “System” → “Administration” → “Synaptic package manager”, your password might be requested when activating it, this process is necessary to verify your rights to modify installed application.

For further reading on Synaptic, you could refer to the official community documentation:

In the lower left corner, Synaptic offers different views that help the user reviewing what data are installed or not, or in need of actions. Each views has its advantages and this guide will mainly used the Status and optionally the Custom filters views. When using the Status view and after a fresh install of Ubuntu, only 3 categories are shown in the left corner of Synaptic: All, Installed and Not installed. However, after upgrading of distribution you might have more like displayed on the picture. The category Installed (auto removable) filter the packages that are not needed any more by the system in the current configuration. Installed (local or obsolete) lists the packages that have been installed using a manually downloaded package file (like a .deb) or that have been made obsolete (are not longer in any of the currently selected Ubuntu repositories). New in repository are packages newly added to the repositories. And finally Not installed (residual config) are residual configuration files of previously removed packages.

Let's start with the residual configuration files.

Removing residual configuration

Category: Not installed (residual config)

Residual configuration are data or configuration files left by formerly installed packages. Removing them will not affect your system negatively, on the contrary it will free an interesting amount of data (a few 100MB after an upgrade).

To remove them, one should select them all and in the Package menu of Synaptic the “Mark for complete removal” should be selected. This item is also accessible via a context menu when right clicking on the selected list of packages. You can click on the Apply button to confirm your modification.

Removing unneeded packages

Category: Installed (auto removable)

Auto removable are packages that are no longer needed on the system because some other packages have been recently removed. As this packages have no more dependencies (they are no longer used by the system or applications), they can be safely removed.

To remove them, one should select them all and in the Package menu of Synaptic the “Mark for complete removal” should be selected. This item is also accessible via a context menu when right clicking on the selected list of packages. You can click on the Apply button to confirm your modification.

Local or obsolete packages

Category: Installed (local or obsolete)

This category includes packages that have been locally installed by the user, like .deb packages downloaded from a web site. It also figures packages that are no longer parts of the currently selected repositories. It means that either the support for this package was dropped, that it has change of name or has been made obsolete.

Finally, version conflict ends up also in this category. Version conflict means that a package was in a version “higher” in the previous release than in the new one. This can happen when re-branding application or changing version scheme, in those case the newer version might be lower than the older one. Those package are identifiable in this list because their “installed version” is different than the “latest version” (see the package corresponding columns).

What should be clean are the obsolete and version conflict packages. The locally installed packages might require an update. One should try to execute the programs, if it is working nothing needs to be done. Else, a new version needs to be installed or it should be removed.

The obsolete one can simply be removed. To remove them, one should select them all and in the Package menu of Synaptic the “Mark for complete removal” should be selected. This item is also accessible via a context menu when right clicking on the selected list of packages.

The conflicting package should be selected one by one. For each of them, the item “Force version…” in the Package menu should be selected. A small window will appear with a list of available versions for this package. Mark the version that depends on your current distribution. So if you have just installed Ubuntu 7.04 (a.k.a. Feisty Fawn), the correct version should be indicated with “(feisty)”.

You can click on the Apply button to confirm your modifications.

Orphan (optional)

Category: Custom filters

By default, Ubuntu does not check for orphan packages: packages that were probably installed by others for dependency but that are no longer required. To make Ubuntu checks for orphan, you need to install a package from the Universe repository: deborphan. You can use Synpatic to install this package.

Creating a new filter for orphaned packages Once deborphan is installed, in the lower left part of Synaptic, check for “Custom filters”. Then, in the Settings menu select “Filters. A dialog box appears to create or modify filters. Click on the button “New filter”, modify the name of the filter to something like “Orphaned pkg”, and click on the button “Deselect all”. Then, select the “Orphaned” filter in the list of checkbox (see the figure). You can now close the Filters window by pressing “OK”.

In the list of custom filters, you can now see the one you have just created. Click on it. Orphan are packages that are no longer needed on the system because their dependency is no longer required. Thus, they can be safely removed.

To remove them, one should select them all and in the Package menu of Synaptic the “Mark for complete removal” should be selected. This item is also accessible via a context menu when right clicking on the selected list of packages. You can click on the Apply button to confirm your modification.

foss/ubuntu/aptclean.txt · Last modified: 2015/05/01 23:32 (external edit)