Announcement

Collapse
No announcement yet.

Using zgrep to look at dpkg logs

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    Originally posted by chimak111 View Post
    I modified the code further to
    • exit the script if the user presses Enter without providing a search string
    • allow for the use of an exact match or part of the package name. For example, entering snapd will provide only snapd results whereas entering .*snapd.* will provide results for libsnapd-glib1 as well
    I'd still think a cleaner approach would be to take the package name as an argument (optionally falling back to querying it if no arguments are given), and use an option like "-e" for exact matching (or, if defaulting to exact match, use "-w" for widcard matching). These would result to less typing/less enter presses (you could even take multiple arguments for searching two [or more] matching strings in the logs simultaneously). [Optionally you could also add other options, for example only showing "installed" (-i) or "not-installed" (-n) etc. You can use getopt or getopts for parsing the options...I know, it''ll turn into a serious hobby soon enough.].

    Originally posted by chimak111 View Post
    However, a notable failure of using zgrep on dkpg logs appears to relate to the very first (oldest) dpkg.log, the one recording the initial install.
    For example, the code doesn't show status not-installed for packages such as casper, ubiquity-slideshow-kde, and many more that were automatically purged from the system during the installation process.
    I've noted this on Kubuntu 18.04. I'll check in some *buntu 20.04 VMs as well.
    Okay, it's the same in a VM of Kubuntu 20.04.It's as if dpkg is unaware of what is recorded in the corresponding /var/log/apt/history.log in the section beginning with
    Code:
    Start-Date: 2020-01-23  16:01:05
    Requested-By: kubuntu (999)
    Purge: ...
    These aren't logged to the dpkg.logs, so it isn't really a failure of the zgrep. Don't know why, though, maybe cause the purge is run by the installer in the live environment.
    Last edited by kubicle; May 18, 2020, 08:06 AM.

    Comment


      #17
      Originally posted by kubicle View Post
      ...
      These aren't logged to the dpkg.logs, so it isn't really a failure of the zgrep. Don't know why, though, maybe cause the purge is run by the installer in the live environment.
      Maybe I should have worded it better. The same situation exists with Ubuntu (also using ubiquity). But Lubuntu's calamares does a better job!

      Code:
      dkb@dkb-lubu-ff:~$ zgrep -E "status (not-)?installed calamares:" /var/log/dpkg.log* | sed 's/:/: /' | sort -k2,3 -r | column -t
      /var/log/dpkg.log.1:  2020-04-24  17:45:22  status  not-installed  calamares:amd64  <none>
      /var/log/dpkg.log.1:  2020-04-24  17:45:20  status  installed      calamares:amd64  3.2.20-0ubuntu1
      /var/log/dpkg.log.1:  2020-04-23  07:38:17  status  installed      calamares:amd64  3.2.20-0ubuntu1
      dkb@dkb-lubu-ff:~$
      Kubuntu 20.04

      Comment

      Working...
      X