1

The manifest for the Desktop image of Ubuntu 20.04 is available here. Some of the packages listed in the manifest are removed during the installation process. For example, ubiquity, ubiquity-casper, ubiquity-frontend-gtk, and ubiquity-slideshow-ubuntu are all removed (to mention just a few). This can be seen by looking in the very first history.log, probably archived by now, in /var/log/apt/ for the section beginning with something like:

Start-Date: ...
Requested-By: ubuntu (999)
Purge: ...

Running something like apt policy ubiquity ubiquity-casper ubiquity-frontend-gtk ubiquity-slideshow-ubuntu will confirm their absence.

However, the removal of these packages by this automatic "Purge:", is not recorded in the very first dpkg.log (covering the installation process).

If a user runs

zgrep "status installed ubiquity" /var/log/dpkg.log*

the result is this (assuming the relevant archived log is still available) giving the impression that the packages are still installed:

$ zgrep "status installed ubiquity" /var/log/dpkg.log*
/var/log/dpkg.log.1:2020-04-23 07:40:38 status installed ubiquity-ubuntu-artwork:all 20.04.15
/var/log/dpkg.log.1:2020-04-23 07:40:43 status installed ubiquity-casper:all 1.445
/var/log/dpkg.log.1:2020-04-23 07:40:43 status installed ubiquity-slideshow-ubuntu:all 160
/var/log/dpkg.log.1:2020-04-23 07:42:15 status installed ubiquity-frontend-gtk:amd64 20.04.15
/var/log/dpkg.log.1:2020-04-23 07:42:18 status installed ubiquity:amd64 20.04.15
$ 

Is it that the installation of software is handled by dpkg, but this Purge step is not handled by dpkg? Or what is the reason for not the dpkg log not showing that these various packages were removed (as correctly shown in apt's history.log)?




I'm asking the same question but in a different way.

This is an annotated extract (with long lines truncated) of my /var/log/history.log from the date I installed Ubuntu 20.04.
2:, 3:, etc are line numbers included for ease of reference:

2: Start-Date: 2020-04-23  07:34:03
3: Commandline: apt-get --yes -oDebug::pkgDepCache::AutoInstall=yes install linux-generic-hwe-20.04 adduser apt apt-utils ...
4: Install: speech-dispatcher-espeak-ng:amd64 (0.9.1-4)Install: speech-dispatcher-espeak-ng:amd64 (0.9.1-4)
5: End-Date: 2020-04-23  07:39:30

7: Start-Date: 2020-04-23  07:39:39
8: Commandline: apt-get --yes -oDebug::pkgDepCache::AutoInstall=yes install lupin-casper ...
9: Install: hunspell-en-gb:amd64 (1:6.4.3-1), cryptsetup-bin:amd64 ...
10: End-Date: 2020-04-23  07:42:21

12: Start-Date: 2020-04-26  16:12:11
13: Requested-By: ubuntu (999)
14: End-Date: 2020-04-26  16:12:12

16: Start-Date: 2020-04-26  16:13:28
17: Requested-By: ubuntu (999)
18: End-Date: 2020-04-26  16:13:29

20: Start-Date: 2020-04-26  16:14:08
21: Requested-By: ubuntu (999)
22: Purge: hunspell-en-gb:amd64 ...
23: End-Date: 2020-04-26  16:19:54

25: Start-Date: 2020-04-26  16:19:57
26: Requested-By: ubuntu (999)
27: End-Date: 2020-04-26  16:19:58

29: Start-Date: 2020-04-26  16:20:00
30: Requested-By: ubuntu (999)
31: End-Date: 2020-04-26  16:20:00

33: Start-Date: 2020-04-26  16:24:48
34: Commandline: aptdaemon role='role-commit-packages' sender=':1.105'
35: Upgrade: netplan.io:amd64 (0.99-0ubuntu1, 0.99-0ubuntu2), distro-info-data:amd64 (0.43ubuntu1, 0.43ubuntu1.1), libnetplan0:amd64 (0.99-0ubuntu1, 0.99-0ubuntu2)
36: End-Date: 2020-04-26  16:25:01

So let's take the example of hunspell-en-gb which can be installed without any dependencies. (You may prefer to use some other language version which has been removed from your system in line #22.)

It has been installed according to line #9. Later, the same package is purged according to line 22.

The absence of this package on my system can be verified by running apt policy 2>/dev/null hunspell-en-gb which shows

hunspell-en-gb:
  Installed: (none)
  Candidate: 1:6.4.3-1

I would expect that querying /var/log/dpkg.log.1 (or the appropriate archived log) would reflect that.

$ zgrep hunspell-en-gb /var/log/dpkg*
dpkg.log.1:2020-04-23 07:39:54 install hunspell-en-gb:all <none> 1:6.4.3-1
dpkg.log.1:2020-04-23 07:39:54 status half-installed hunspell-en-gb:all 1:6.4.3-1
dpkg.log.1:2020-04-23 07:39:54 status unpacked hunspell-en-gb:all 1:6.4.3-1
dpkg.log.1:2020-04-23 07:40:43 configure hunspell-en-gb:all 1:6.4.3-1 <none>
dpkg.log.1:2020-04-23 07:40:43 status unpacked hunspell-en-gb:all 1:6.4.3-1
dpkg.log.1:2020-04-23 07:40:43 status half-configured hunspell-en-gb:all 1:6.4.3-1
dpkg.log.1:2020-04-23 07:40:43 status installed hunspell-en-gb:all 1:6.4.3-1
$ 

There is no line with "status not-installed" which is normally present if a package has been successfully removed using sudo apt purge .... You can check this for any package listed in line #22.

Normally,
- if a package is present on one system and was installed using sudo apt install, the dpkg logs in /var/log show that package with status:installed once for the initial install and then repeatedly for each update of that package - if that package is removed using sudo apt purge, the dkpg logs normally reflect that with status not-installed (each time that package is removed).

Just for confirmation, now run sudo apt install hunspell-en-gb followed by sudo apt purge hunspell-en-gb. Then, query the dpkg logs again:

$ zgrep -E "status (not-)?installed hunspell-en-gb:" /var/log/dpkg.log* | sed 's/:/: /' | sort -k2,3 -r | column -t /var/log/dpkg.log: 2020-05-20 15:36:09 status not-installed hunspell-en-gb:all /var/log/dpkg.log: 2020-05-20 15:36:08 status installed hunspell-en-gb:all 1:6.4.3-1 /var/log/dpkg.log: 2020-05-20 15:35:51 status installed hunspell-en-gb:all 1:6.4.3-1 /var/log/dpkg.log.1: 2020-04-23 07:40:43 status installed hunspell-en-gb:all 1:6.4.3-1 $

Notice the first line (because of the sorting) has status not-installed. And that is exactly what is missing from the dpkg logs for the packages removed during the installation. Why is that?

0

As for me - this is done for data safety and for getting some clues after installation if something went wrong.

Technically such purge or removal is done by package.prerm or package.postrm maintenance scripts located in /var/lib/dpkg/ (located here if the package is currently installed).

For example I have package sysstat installed on my system, its sysstat.postrm script contains the line for removing its logs from /var/log/sysstat on its purge.

Then lets analyze packages from your post:

So these package do not have post-removal directives for removing log-files.

2
  • I think I will edit my question to make it more clear. I will ping you then. – DK Bose May 20 '20 at 9:06
  • Please take a look whenever you can. I hope the issue is clearer now. – DK Bose May 20 '20 at 10:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.