Monday, May 6, 2024
 Popular · Latest · Hot · Upcoming
20
rated 0 times [  20] [ 0]  / answers: 1 / hits: 54178  / 2 Years ago, mon, may 23, 2022, 10:28:17

My question is simple -- I want to know more about dpkg -- what does it do?


More From » dpkg

 Answers
2

As has been said, dpkg is a low-level system tool to extract, analyse, unpack and install or remove .deb files. However, it is better to use Software Centre or Gdebi to install or remove .deb files that have been gained from other sources because these two programs have dependency resolution.



However, what has not been explained is the anatomy of an update using dpkg and apt-get. If, for example we call apt-get to install cheese, the dependency tree is analysed and the necessary files are fetched by apt-get, which then passes them to dpkg to extract, analyse and install to the correct locations and configure them according to the scripts inside them.



The scripts read by dpkg inside each .deb file are important as they give information to the program regarding the packages' installation, removal and configuration. Hence when you look in /var/log/dpkg.log there are a lot of verbose details about 'triggers' and packages going through varying stages of unpacking and configuration. In his blog, Raphael Hertzog (who is a key Debian developer and maintainer of the dpkg package) explains more about dpkg triggers and the way dpkg inspects and configures packages.



We are now getting to the heart of what dpkg does; it expertly handles Debian packages, rather than their dependencies. With dpkg-deb, for example, you can perform various actions in analysing and manually extracting files from the .deb archives; see man dpkg-deb for further information.



The status of each package is listed in /var/lib/dpkg/status, which can be used with grep to check on a particular package. Dpkg can also be called to reconfigure particular packages that have been configured (see man dpkg-reconfigure):



sudo dpkg-reconfigure <package>


Or to do a configuring of all unconfigured packages if there has been a problem with an update and some packages' configuration is still pending:



sudo dpkg --configure -a


For a great tutorial that focuses on dpkg and apt-get, see chapters 5 and 6 of the Debian Handbook, which is the best discussion available. Enter man dpkg in your terminal or view the Ubuntu manpages online to see all the many options available, such as using dpkg -l to list currently installed packages.


[#36295] Tuesday, May 24, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ersoggles

Total Points: 69
Total Questions: 111
Total Answers: 111

Location: Vanuatu
Member since Sun, Oct 2, 2022
2 Years ago
;