Chapter 3. Package Management

Table of Contents

What is a "package"?
An introduction to APK
Installing and uninstalling packages
Ensuring package integrity
Package repositories

In this chapter, we will discuss package management in the Adélie Linux operating environment, including the APK package manager.

We'll start off by learning what a package is, and about the package manager used by Adélie Linux.

All software in Adélie Linux is provided to you in the form of packages. A "software package" is a single distribution of computer software that fulfils a purpose. For example, AbiWord, a word processor, is provided in the "abiword" package. When you want to install or uninstall software from your computer, you add (to install) or delete (to uninstall) packages.

Some packages have what are termed subpackages, which can provide related files such as translations of the software, documentation, or accessories.

There are also metapackages, which provide no software themselves, but refer to a collective, related group of software. For instance, the kde-games metapackage allows you to quickly install or uninstall the entire set of KDE Games.

Adélie Linux uses the APK package manager. The APK package manager is very fast, and performs well even on computers with limited resources. APK allows you to add and remove packages, ensure the integrity of installed packages, and perform system updates.

APK refers the entire set of packages you have chosen to install on your computer as a "world". When you install a package, you are adding it to the "world". When you uninstall a package, you are removing it from the "world". The world file exists at /etc/apk/world and is a text file with each package you have chosen to install on a single line.

When you want to install a package on your Adélie Linux system, you may use the command apk add PACKAGE, where PACKAGE is the name of the package you want to install. You may install multiple packages at the same time by separating them with spaces. For example, apk add firefox thunderbird will install the Firefox web browser and Thunderbird email client.

To uninstall a package on your Adélie Linux system, you may use the command apk del PACKAGE, where PACKAGE is the name of the package you want to uninstall. As with package installation, you may uninstall multiple packages at the same time by separating them with spaces.

When you install a package, APK will determine what additional libraries are required for your desired package(s) to run, and install those dependencies as well. These dependencies are not added to your "world" file, because you did not explicitly install them. They are kept only as long as the software that requires them is installed. Attempting to uninstall a dependency that is currently required by another package will result in a message similar to the following:

workstation01 ~ # apk del fts
World updated, but the following packages are not removed due to:
  fts: dracut

This indicates that the fts package was removed from your "world" file (if it was listed there), but it is still required by the dracut package that is currently installed on your computer.

The APK package manager can help you ensure continuing system integrity, and can also help you correct some issues as they arise. Every file installed on your computer by APK has a cryptographic signature and checksum. You may use the command apk audit to audit your entire system for integrity, or apk audit PATH to audit a specific file or directory on your system. Note that PATH must be an absolute path; it must be the entire path beginning with a /. For example, the command apk audit /usr/bin/vim is valid; the command apk audit vim, even if it is run from inside the /usr/bin directory, is not.

The typical output of an apk audit run will look something like the following:

gwyn ~ # apk audit
A etc/init.d/net.eth1
A etc/conf.d/net
A etc/machine-id
A etc/fstab
U etc/shadow
U etc/group
A etc/hostname
A etc/resolv.conf
A etc/localtime
D etc/lvm/cache
U etc/passwd

Files marked with an 'A' are files added by a process other than APK. In this example, the /etc/resolv.conf was created when networking was configured on this computer. Files marked with a 'U' are files updated by a process other than APK. In this example, the /etc/passwd file was updated by changing the root password. Files marked with a 'D' are files deleted by a process other than APK. In this example, the /etc/lvm/cache directory was removed by a LVM process.

If you do find a file has been corrupted, incorrectly manipulated, or otherwise damaged, you may determine what package owns it by using the apk info -W FILE command, where FILE is the absolute path to the file that is damaged. For example, if the file /etc/os-release was corrupted, you may run apk info -W /etc/os-release to determine which package owns it. You may then run apk fix PACKAGE to reinstall the package, where PACKAGE is the name of the owning package.

There are a few additional options you may pass to apk fix, including:

  • -d, which will additionally reinstall all dependencies of the package;

  • -x, which will repair extended attributes (or xattrs); and

  • --directory-permissions, which will repair all directory permissions.

A package repository is a collection of packages that you may install on your computer. The Adélie Linux project runs two official package repositories: system, which contains essential packages that are necessary for the operation of computers running the Adélie Linux system, and user, which contains packages that can be installed and uninstalled by users and administrators.

You may run your own package repository using the information contained in our Developer's Handbook. There are also external package repositories on the Internet. Some of these may contain experimental software ports or software that could not be included in the Adélie Linux system. They may also contain malware, software that can harm your computer or cause security issues. Please always ensure that repositories that you add to your system are authored by people or organisations you trust.

Management of package repositories is accomplished via the /etc/apk/repositories configuration file. Refer to the section called “/etc/apk/repositories: Package repository configuration” for more information on the /etc/apk/repositories configuration file.