Linux online course

Using dselect to Manage Debian Packages

Learn how Debian's legacy dselect text interface works with dpkg and APT through its Access, Update, Select, Install, Config, and Remove workflow.

dselect is an interactive, text-mode package selection interface for Debian and Debian-based systems. It works with dpkg, Debian's low-level package database and package installation system, while using an access method to locate package metadata and package archives.

This lesson explains dselect's complete workflow: configuring package sources, choosing an access method, updating package indexes, selecting package states, installing packages, completing configuration, and removing unwanted software.

Prerequisites and terminology

You should be comfortable using a terminal, becoming root with sudo, identifying Debian packages, and editing system configuration carefully. Package operations can change services, libraries, and system dependencies, so read proposed actions before confirming them.

  • Package: An installable collection of files and metadata, normally distributed as a Debian package archive.
  • Dependency: A package requirement needed by another package to install or function correctly.
  • Conflict: A declared incompatibility that prevents particular packages or versions from being installed together.
  • Selection state: The requested state of a package, such as install, hold, remove, or purge.
  • Unpacked: Package files have been extracted, but setup has not completed.
  • Configured: The package's setup scripts have completed successfully.
  • Remove: Uninstall the package's program files while normally retaining package-managed configuration files.
  • Purge: Remove the package and its package-managed configuration files.

How dselect relates to dpkg and APT

dpkg: the local package system

dpkg is the low-level Debian package management system. It maintains the local package database, unpacks Debian package archives, runs package maintainer scripts, and records whether packages are installed, unpacked, configured, removed, or purged.

dpkg does not, by itself, provide the normal repository search and dependency-resolution workflow. It primarily operates on local package archives and the local package database.

dselect: a selection-oriented interface

dselect presents package information and lets you declare desired package states. For example, you can mark a package for installation or removal, review dependency changes, and then ask dselect to process the pending selections.

The selection step does not install a package immediately. It records a requested state. The later Install stage processes that state and invokes the configured access method to obtain packages when necessary.

APT: repositories and retrieval

APT, the Advanced Package Tool ecosystem, supplies repository metadata, retrieves package archives, and helps resolve dependencies. dselect can use an apt access method, which relies on APT's configured software sources.

APT sources may point to network mirrors or local repositories. A separate cdrom access method reads package information and archives from registered installation media. CD-ROM access is not the same as network mirror access: it requires the expected disc to be inserted or mounted when requested.

Preparing package sources

Configure package sources before selecting the apt access method. Without valid sources, dselect cannot obtain current package indexes or download packages from repositories.

The primary APT source file is /etc/apt/sources.list. Additional source-list fragments may be stored under /etc/apt/sources.list.d/. Inspect both locations before using dselect:

cat /etc/apt/sources.list
ls /etc/apt/sources.list.d/

A repository entry must match the installed Debian release, use valid components, and identify a reachable mirror or local repository. For example:

deb http://deb.debian.org/debian stable main

When using a CD-ROM source, register the media as an APT source and ensure that the expected disc is available. dselect may pause and ask for a particular disc. Insert or mount that disc before continuing, or select the apt access method instead if a network repository is appropriate.

Starting and navigating dselect

Launch dselect from a terminal with administrative privileges:

sudo dselect

Availability and exact screen details vary by Debian release and installation. The interface is menu-driven and keyboard-oriented. Use the on-screen help, read status messages, and pay attention to confirmation prompts before accepting package changes.

The main workflow normally contains these stages:

  1. Access: Choose how package information and archives will be obtained.
  2. Update: Refresh the available-package information.
  3. Select: Mark desired package states and review dependencies.
  4. Install: Retrieve and install or upgrade packages selected for processing.
  5. Config: Configure packages that remain unpacked or otherwise pending.
  6. Remove: Process packages marked as unwanted.

Complete these stages in sequence rather than jumping over prerequisites. For example, selecting a package before refreshing metadata can leave dselect with an outdated view of available versions. Installing before reviewing selections can apply changes you did not intend.

dselect workflow stages

StagePrimary purposeInputs or prerequisitesTypical resultCommon failure symptom
AccessChoose the mechanism used to find and retrieve package data and archives.Valid APT sources or registered installation media.dselect knows whether to use apt, cdrom, or another available method.The chosen source cannot be reached or the expected media is unavailable.
UpdateRead or download repository package indexes.A working access method and valid source definitions.The available-package view contains current metadata.Index downloads fail, use an incorrect release, or request missing media.
SelectChoose requested package states and review dependency changes.Preferably current package indexes.Pending install, upgrade, hold, removal, or purge selections are recorded.Conflicts, unexpected dependency changes, or an outdated package view appear.
InstallRetrieve archives and process pending installation or upgrade selections.Selections, package archives, and sufficient disk space.Packages are unpacked and usually configured in dependency order.Downloads, maintainer scripts, dependencies, or permissions fail.
ConfigComplete setup for packages left unpacked or unconfigured.Required dependencies and system prerequisites.Pending packages become configured.A maintainer script, service, prompt, or dependency still fails.
RemoveProcess packages marked as unwanted.Removal selections and a reviewed dependency plan.Selected program files are removed, or packages are purged where supported.Shared dependencies or metapackages cause a surprisingly large removal plan.

Access: choose the package source mechanism

The Access stage chooses the mechanism dselect uses to locate package metadata and obtain package archives. The selected method affects later Update and Install operations.

  • apt: The usual choice for systems using network mirrors or local APT repositories. It uses the source definitions managed by APT.
  • cdrom: Used for registered Debian installation media. The required disc must be present when dselect requests it.

Choose apt for a network-connected system with working repository definitions. Choose cdrom when the package set is intentionally supplied by installation media or another registered optical-disc source. If the method cannot find the source, later stages cannot retrieve the required data.

Update: refresh package indexes

The Update stage reads or downloads package index metadata and builds the available-package view used by dselect. Debian repositories publish index files commonly named Packages, often in compressed forms such as Packages.gz or Packages.xz. These indexes describe available package names, versions, dependencies, descriptions, and related metadata.

Run Update after changing source definitions, switching mirrors, changing registered media, or when repository metadata may have changed. Updating metadata is not the same as upgrading installed packages: Update refreshes information; it does not by itself install newer software.

If Update fails, do not assume that the package list is current. Inspect the error, correct the source or connectivity problem, and repeat the stage.

Select: declare desired package states

Select is dselect's central package-browsing and decision-making stage. It displays installed and available packages, their versions and descriptions, and their current or requested states. Use the on-screen help to learn the key used by the particular release.

Depending on the interface and package state support, you can mark packages for:

  • Installation: Request that a package be installed.
  • Upgrade: Request a newer available version when one is applicable.
  • Hold or retention: Keep the installed version and avoid changing it through the requested operation.
  • Removal: Request that the package's installed program files be uninstalled.
  • Purge: Request removal of the package and its package-managed configuration data.

When you select a package, dselect evaluates declared dependencies and conflicts. Selecting one package may automatically select additional libraries or utilities. Conversely, selecting a package for removal may propose removing packages that depend on it. A conflict may cause dselect to request a different version, remove an incompatible package, or reject the proposed combination.

Review these changes carefully. Do not accept a plan that removes a desktop environment, network service, administrative tool, or other important package unless that is intentional. A package selection is only a request; no archive is normally installed until you leave Select and run Install.

Package state actions

Requested actionEffect on installed filesEffect on configuration filesWhen to useDependency considerations
InstallInstalls the package files, or reinstalls the requested version.Creates or updates package-managed configuration as needed.When the package is needed.Required dependencies may also be selected.
UpgradeReplaces an installed version with a newer compatible version.Maintainer scripts may update configuration and migrate data.When a newer repository version should be applied.Versioned dependencies and conflicts must remain satisfiable.
HoldLeaves the installed package files at their current version.Normally leaves its current configuration in place.When a package must remain unchanged temporarily.Holding a package can prevent another package's dependency plan from succeeding.
RemoveRemoves the package's program files.Normally retains package-managed configuration files.When software is no longer needed but settings may be useful later.Reverse dependencies may also be affected.
PurgeRemoves the package's program files.Removes package-managed configuration files as well.When the software and its managed settings should be deleted.Dependencies still need review; locally modified or unrelated files may remain.

Install: process pending selections

The Install stage processes packages marked for installation or upgrade. It retrieves required archives through the selected access method, resolves the necessary dependency order at a conceptual level, unpacks packages, and runs their configuration steps when possible.

Installation can invoke maintainer scripts. These scripts may create users, update caches, enable services, migrate data, or ask configuration questions through debconf. You may also be asked about restarting services or replacing a configuration file.

Before confirming, review the complete planned action. During the operation, use a stable power and network connection, avoid closing the terminal, and do not run another package manager. Afterward, read the final status and error messages. A return to the menu does not by itself prove that every package completed successfully.

Config: finish deferred package setup

The Config stage processes packages that were unpacked but not configured. This is conceptually similar to asking dpkg to configure all pending packages.

Configuration may be pending because an operation was interrupted, dependencies had to be configured first, a maintainer script failed, or setup was intentionally deferred. Configuration can display debconf questions and service-related prompts, so answer them carefully.

If dselect cannot complete Config, the equivalent low-level recovery command is:

sudo dpkg --configure -a

Read the first meaningful error rather than repeatedly retrying without correction. A failed service start, missing dependency, full filesystem, invalid configuration, or broken maintainer script usually needs to be fixed before configuration can succeed.

Remove: uninstall unwanted software

The Remove stage acts on packages marked as unwanted. Review the proposed changes before confirming, especially when the target is a shared library, a dependency of another application, or a metapackage.

Removing an application normally deletes its installed program files but retains package-managed configuration. Purging also deletes those configuration files. Neither action necessarily removes every user-created file, data file, log, cache, or manually edited file associated with the application.

After removal, check whether the associated command, service, library, and configuration have the expected state. If a service was enabled independently or has remaining data outside the package's ownership, it may require separate cleanup.

Practical example: install a package from an APT repository

  1. Confirm that an appropriate repository entry exists in /etc/apt/sources.list or a file under /etc/apt/sources.list.d/.
  2. Start dselect with sudo dselect.
  3. Choose the apt access method.
  4. Run Update to obtain current package metadata.
  5. Enter Select, locate the desired package, and mark it for installation.
  6. Read and accept required dependency selections only after reviewing them.
  7. Run Install and monitor downloads, prompts, and errors.
  8. Run Config if any packages remain unpacked or unconfigured.

Practical example: install software from installation media

  1. Register or configure the installation medium as a package source.
  2. Choose the cdrom access method.
  3. Run Update so dselect reads the package data from the medium.
  4. Use Select to mark the desired package.
  5. Run Install and insert or mount the requested disc when prompted.
  6. Run Config afterward if package setup remains incomplete.

Practical example: remove an application

  1. In Select, locate the installed package.
  2. Mark it for removal rather than installation.
  3. Review reverse-dependency effects and any additional packages proposed for removal.
  4. Run Remove and read the result.
  5. Verify that the program and related service are no longer active.
  6. Choose purge instead when package-managed settings should also be deleted.

If the removal plan includes many important packages, cancel it and investigate. The target may be a shared dependency or a metapackage that represents a larger software group.

Practical example: recover after an interrupted package operation

  1. Look for a package state indicating that files are unpacked but configuration is pending.
  2. Run dselect's Config stage.
  3. If needed, leave dselect and run sudo dpkg --configure -a.
  4. Read the displayed error and correct the underlying dependency, service, filesystem, or configuration problem.
  5. Only rerun Update or pending installation when repository access is actually required.

To inspect a particular package's recorded state, use:

dpkg -l package-name

Safe operating procedure

  1. Verify sources: Check release names, components, mirrors, connectivity, and media registration.
  2. Choose Access: Select apt for configured repositories or cdrom for registered installation media.
  3. Update metadata: Refresh package indexes before making decisions based on availability or versions.
  4. Review selections: Mark packages and inspect dependency and conflict changes.
  5. Install: Process pending installation and upgrade requests without interruption.
  6. Configure: Complete deferred setup and respond to configuration prompts.
  7. Remove carefully: Review reverse dependencies and distinguish removal from purge.
  8. Verify: Inspect package states, services, commands, logs, and important configuration after the operation.
  • Take a backup or snapshot before making large changes on an important system.
  • Use stable network access and adequate free disk space.
  • Do not power off or terminate dselect, dpkg, or an active APT operation during package changes.
  • Do not start apt, apt-get, aptitude, dpkg, or another dselect process concurrently.

Troubleshooting dselect

Update cannot retrieve package lists

Likely causes include an incorrect or obsolete repository entry, a network, DNS, proxy, or mirror failure, an unavailable repository suite, or missing CD-ROM media.

  • Inspect /etc/apt/sources.list and files under /etc/apt/sources.list.d/.
  • Confirm that the suite matches the installed Debian release and that the components exist.
  • Check network reachability and name resolution.
  • Use a supported mirror or correct the distribution suite.
  • For media access, insert and mount the requested disc, or switch to apt when a network source is intended.

Dependencies conflict during Select or Install

Incompatible versions, third-party repositories, held packages, packages marked for removal, or mixed distribution suites can make a selection impossible.

  • Read the dependency and conflict information shown by Select.
  • Avoid mixing repositories from incompatible Debian releases.
  • Adjust selections only after reviewing the packages that will be installed or removed.
  • Use APT diagnostic output or aptitude to investigate alternative dependency solutions.

Packages remain unconfigured

An interrupted operation, failed maintainer script, incomplete dependency configuration, unanswered prompt, or service-start failure can leave packages pending.

  • Run the Config stage.
  • Use sudo dpkg --configure -a if dselect cannot complete the task.
  • Read the displayed error and relevant package or system logs.
  • Correct the underlying problem before retrying.

The package database is locked

Another apt, apt-get, aptitude, dpkg, or dselect process may be running. An automated update process may also be active.

  • Identify the process holding the lock and allow it to finish when possible.
  • Do not delete lock files merely to bypass an active package manager.
  • After confirming that no package process is active, repair incomplete configuration before continuing.

Removal proposes many packages

The target may be a shared dependency or a metapackage. Other installed packages may depend on it.

  • Review the complete removal plan before confirming.
  • Cancel if important packages are included and inspect reverse dependencies.
  • Select a narrower package or retain the dependency when broad removal is unacceptable.

Modern alternatives and migration guidance

Modern Debian systems generally use APT commands for scripted or direct package operations. apt is convenient for interactive terminal use, apt-get is commonly used in scripts and precise administrative procedures, and aptitude offers an interactive dependency-oriented interface that is closer in spirit to dselect.

Taskdselect stage or actionModern command-line equivalentNotes
Refresh repository metadataAccess, then Updatesudo apt-get updateRefreshes package indexes; it does not upgrade installed packages.
Install a packageSelect, mark install, then Installsudo apt-get install package-nameAPT calculates and presents dependency changes.
Upgrade packagesSelect upgrades, then Installsudo apt-get upgradeReview the proposed changes; larger changes may require a different upgrade operation.
Remove a packageSelect removal, then Removesudo apt-get remove package-nameNormally retains package-managed configuration files.
Purge a packageSelect purge where supported, then Removesudo apt-get purge package-nameRemoves package-managed configuration as well.
Finish pending configurationConfigsudo dpkg --configure -aConfigures packages left unpacked or otherwise pending.

When investigating unmet dependencies, an APT equivalent sometimes used after identifying the cause is:

sudo apt-get -f install

Do not run that command concurrently with dselect, and review its proposed changes. All these tools share the system's dpkg database. A lock or unfinished dpkg state must be resolved before switching tools.

For shell fundamentals that help when inspecting package systems, see Linux and Bourne Again Shell Bash. The guide on showing the full path of shell commands is also useful when verifying which executable a package installed.

Key exam and maintenance notes

  • dselect is a text-mode package selection interface; dpkg remains the low-level package database and installation system.
  • The apt access method depends on APT source configuration, while cdrom uses registered installation media.
  • Update refreshes package indexes. It does not upgrade installed packages.
  • Select records desired package states; Install performs the pending package changes.
  • Dependencies can add packages to a plan, and conflicts can cause packages to be removed or selections to be rejected.
  • Config handles packages that are unpacked but not configured and corresponds conceptually to dpkg --configure -a.
  • Remove normally retains package configuration; purge removes package-managed configuration too.
  • Always review large removal plans, dependency changes, prompts, and final errors.
  • Never delete package-manager lock files merely to bypass an active process.