Package managers

Packages, repositories, dependencies and signatures; apt's subcommands, how it differs from dpkg, their dnf and rpm equivalents, and diagnosing the common errors.

  • 24 cards
  • 4 topics
  • Free

The outline, topic by topic

Each topic is weighted the way the exam weighs it.

  1. Concepts
  2. Questions
  3. Sort and link
  4. Scenarios

A few cards from the deck

  • Package manager: what is it?

    Show the answer

    A tool that installs, updates and removes a system's software from repositories, keeping the list of what is installed.

    It replaces manual downloads: it knows which files belong to which software, and therefore how to remove it cleanly.

  • Which command installs the latest available versions of all already installed packages, once the list has been refreshed?

    • sudo apt upgrade
    • sudo apt update
    • sudo apt install --all
    • sudo dpkg --upgrade
    Show the answer

    sudo apt upgrade

    update only rereads the repositories' index. apt install expects package names, and --all does not exist. dpkg has no --upgrade option: it does not talk to repositories.

  • apt's … subcommand refreshes the list of available packages; the … subcommand installs newer versions of the packages already present.

    Show the answer

    apt's update subcommand refreshes the list of available packages; the upgrade subcommand installs newer versions of the packages already present.

    Without update, apt does not know what is new in the repositories: this is the classic cause of an “Unable to locate package” on a fresh machine.

  • Package repository: what is it?

    Show the answer

    A server that publishes packages and the index describing them, whose addresses are listed in the manager's configuration.

    On Debian and Ubuntu, these addresses are in /etc/apt/sources.list and in the files of /etc/apt/sources.list.d/. A package absent from every configured repository cannot be installed.

  • On a freshly installed machine, sudo apt install htop answers “E: Unable to locate package htop”. What are the most likely cause and fix?

    • The package list was never downloaded; run sudo apt update then try again
    • htop does not exist for this architecture; go through dpkg
    • Rights are missing; rerun the command with su instead of sudo
    • The package is already installed; use apt upgrade htop
    Show the answer

    The package list was never downloaded; run sudo apt update then try again

    The message says the name is in no known index. On a fresh install the index is empty or old: apt update fills it. Missing rights would give another message (permission denied).