Linux Labs

Packages, services, and logs / Stage 3 of 13

Installing, upgrading and removing packages

Not running Starting usually ~20 s
Leave the lesson

Step 2 of 8 · theory · 6 min

Unpacking and configuring

dpkg installs a package in two stages. An error at the second leaves the files on disk and the package half-installed.

The first stage is unpacking: the files from the archive go into place. The second is configuring: dpkg checks dependencies, puts the package's settings files into /etc and runs its installation scripts. Only after configuring is the package considered installed.

dpkg checks dependencies before configuring. lab-pkg-data was not on the system, so lab-pkg-report stayed unpacked: dpkg -s says Status: install ok unpacked, and dpkg -l starts the line with iU. The program already sits in /usr/bin, but its settings are not there yet — that is where the errors you saw came from.

The fix: install the dependency, then finish configuring. sudo dpkg --configure lab-pkg-report configures one package, sudo dpkg --configure -a configures every package left unconfigured. You can also hand dpkg -i both archives in one command: it unpacks both and configures them in dependency order.

dpkg installs only the archives it is given and never goes online. apt install is what picks dependencies from repositories. There is no network here, and sudo apt install ./lab-pkg-report_1.0-1_all.deb prints lab-pkg-data (= 1.0-1) but it is not installable.

Check yourself 1 question

dpkg -s for a package shows Status: install ok unpacked, and you have already installed the dependency it needs. What do you do next?

  • Without configuration the package's settings file is missing from /etc, and dpkg -s says unpacked. Without it the program prints errors, as at the start of the lesson.

  • The archive is intact, and the files are already unpacked. What is missing is the configuration stage, which dpkg --configure performs.

  • apt update refreshes the repository indexes and configures nothing. The state in dpkg -s stays unpacked.

unpacked means the files are in place and the configuration stage was skipped. sudo dpkg --configure <package> runs it, after which dpkg -s says install ok installed.

Key points

  • dpkg installs a package in two stages: unpacking, then configuring.
  • Without its dependency a package stays unpacked: the files are on disk, the installation is unfinished.
  • Install the dependency and run dpkg --configure, and the configuration completes.
Ubuntu 24.04
Loading…