Linux Labs

Packages, services, and logs / Stage 2 of 13

Installed packages and their files

Not running Starting usually ~20 s
Leave the lesson

Step 1 of 8 · on a machine · 4 min

The package is there, the program is not

What you will learn

  • Find the package that installed a file, and a package's file list.
  • Tell the package database record apart from the files on disk.
  • Restore a package file by reinstalling while keeping your own settings.

The server's disk was cleaned overnight, and in the morning the reporting program does not start. A colleague is sure someone removed the package. Before installing it again, check what the system knows about the package.

Exercise · look

What the system knows about the package

Run the reporting program and ask dpkg about its package, lab-pkg-report.

First, predict

The program does not start. What will dpkg -s lab-pkg-report show in the Status line?

Now start the exercise, run the command and compare your prediction with the output.

Sign in and start The machine is available after signing in
Check yourself 1 question

Why does dpkg consider the package installed although the program is not on disk?

  • The shell looked for the program in every program directory and did not find it. dpkg does not search the disk: it reads its record.

  • Services get switched on and off. A package has a different state, installed or not, and dpkg -s says installed.

  • apt update refreshes the repository indexes. The record of an installed package lives in the dpkg database on this machine, and apt update does not change it.

The record in the package database stayed the same: the file was deleted behind dpkg's back.

Ubuntu 24.04
Loading…