Dpkg

1 Article purpose

This article aims to give information required to start with the LINUX tool : dpkg[1]

2 Introduction

dpkg is the basic tool to deal with this package manager. A package manager is helpful for installing, removing and updating package in rootfs.

A package is an archive with .deb extension that contains a set of files but also a set of installing/removing scripts.

Any package provides two kind of artifacts:

  • metadata: collection of scripts and configs need to correctly install data of package
  • data : applications, libraries, and any files to copy to rootfs


3 Getting Started

dpkg could be very helpful to know which file of the rootfs belong which package.

Keep in mind the OpenSTLinux distribution has been generated with OpenEmbedded. There is a direct parity between 'recipes' and 'packages'.

Indeed an OpenEmbedded recipe describes how to get sources code, how to compile it, where to install build artifacts on filesystem and also which the 'dpkg' packages to create and which files to put in.

That's why it could be very interesting to list the files belong a package or reverse.

Here a short list of useful commands with 'dpkg':

  • How to list currently installed packages
$> dpkg -l
  • How to install a package:
$> dpkg -i <packageName>.deb
  • How to remove/uninstalling a package
$> dpkg -r <packageName>
  • How to list files of a pakage
$> dpkg -L <packageName>
  • How to find package belong a file
$> dpkg -S </absolute/path/to/a/file/of/target>

4 References