2

I would like to obtain the chronological list of package upgrades. Something like:

Jan 08 10:45:33 CET 2016  xorg 1:7.7+6      upgrade to 1:7.7+7
Jan 10 13:16:33 CET 2016  gcc 1.132         upgrade to 1.133
Jan 12 07:05:33 CET 2016  pulseaudio 5.0-12 upgrade to 5.0-13

I'm interrested in the upgrade list on my machine but also on the debian sources.

2 Answers2

2

This can be found in the file /var/log/dpkg.log.

Use this command to generate a list:

awk '$3=="upgrade"' /var/log/dpkg.log*

Example output:

2015-12-30 15:33:15 upgrade firefox 38.0+build3-0ubuntu0.12.04.1 43.0+build1-0ubuntu0.12.04.1
chaos
  • 48,171
  • The log files are not correctly concatenated. The * will order log files from most recent to older and inside a file the lines are ordred from older to most recent. – Ortomala Lokni Jan 12 '16 at 12:58
  • 1
    The fix for that is to either sort the files (e.g. $(ls -rt1 /var/log/dpkg.log*) instead of the glob, or (more reliable) to sort the output (ISO-8601 dates sort well naively). A bigger issue is that your logrotate rules may (like mine) gzip the older files... – Toby Speight Jan 12 '16 at 14:18
  • For the compression problem see: http://unix.stackexchange.com/questions/77296/is-there-a-tool-that-combines-zcat-and-cat-transparently – Ortomala Lokni Jan 12 '16 at 15:43
0

I adress two issues in chaos answer:

1) The generated log file is not ordered because * will log files alphabeticaly (dpkg.log, dpkg.log.1, dpkg.log.2, ...) which is equivalent to from most recent to older, and inside a log file, lines are ordred from older to most recent. One solution is (thanks Toby) to use ls -rt

awk '$3=="upgrade"' $(ls -rt /var/log/dpkg.log*)

2) The files in /var/log could be gzipped by logrotate. For this the following answer is useful : Is there a tool that combines zcat and cat transparently?. The solution is

 zcat -f -- $(ls -rt /var/log/dpkg.log*) | awk '$3=="upgrade"'