18

Is there a way to use dpkg to view a changelog between different versions of a package?

If I wanted to know e.g., why 'passwd' was being upgraded in a recent update is there a way to use dpkg to see what changed?

$ dpkg -l passwd
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version      Architecture Description
+++-==============-============-============-=================================
ii  passwd         1:4.2-3.1    amd64        change and administer password an

It's being upgraded to 1:4.2-3.3...

I know with Debian I can look at the package notes and from there at the linked Debian changelog.

But this doesn't apply to all deb based distros, and it's awkward for a quick look at what's new.

4 Answers 4

23

dpkg does not provide any facility to read the changelog of a package. you should extract the package and read the changelog

dpkg -X <package.deb> <folder>

then you can read the changelog using the dpkg-parsechangelog utility

dpkg-parsechangelog -l <folder>/usr/share/doc/<package>/changelog.Debian.gz

Since that's a real pain , if your distro is using apt-get you can use

apt-get changelog <packagename>

or

apt changelog <packagename>
1
  • Note that at least in Ubuntu apt-get changelog is not the same as reading the local changelog in the package under <folder>/usr/share/doc/<package>/changelog.Debian.gz. apt-get fetches the changelog from Canonical's server. For some some packages the changelogs in the package are truncated at their tail and there is indeed a comment to use apt-get changelog to read further.
    – Uwe Geuder
    Nov 30, 2018 at 9:55
10

If the package is installed, you just go to /usr/share/doc/<package_name>/ and there you will find the upstream ChangeLog and the Debian (package) changelog.

Possibly the files are gzipped, in such case, you can use zless to view them.

3

If I wanted to know e.g., why 'passwd' was being upgraded in a recent update is there a way to use dpkg to see what changed?

apt-listchanges covers this particular use case. You can view the changelog entries corresponding to an upgrade.

If you want to look at changelogs for packages that are not installed, probably the simplest thing is to look online. E.g. Go to https://packages.qa.debian.org, enter the desired source package (say dpkg), and you'll see the changelog on the right under 'links'. In this case, you'll end up at http://metadata.ftp-master.debian.org/changelogs/main/d/dpkg/unstable_changelog.

This particular site can only be used for Debian, of course.

1

Hey i know it's very old but I ended up landing here and the question is very interesting for who is learning Linux. So please forgive me.

COMMANDS AVAILABLE

If the package is installed, you have some ways to read without extracting:

1. zless: if you type man zless you will read:

zless - file perusal filter for crt viewing of compressed text.

2. zcat: from man zcat:

zcat is identical to gunzip -c. (On some systems, zcat may be installed as gzcat to preserve the original link to compress.) zcat uncompresses either a list of files on the command line or its standard input and writes the uncompressed data on standard output. zcat will uncompress files that have the correct magic number whether they have a .gz suffix or not.

3. gunzip -c <path/file> | less: from zcat above we learn that zcat is just an alias to "gunzip -c". So you can use gunzip plus "less".

SEARCH

Find your changelog. It's name traditionally is:

  • changelog.gz (program itself)
  • changelog.Debian.gz (fix package issues)
  • NEWS.gz (same as changelog.gz)
  • NEWS.Debian.gz (same as changelog.Debian.gz)

Changelogs are always installed in /usr/share/doc, so you can list that folder to discover the name of the changelog. let's use package passwd as example.

$ ls -l /usr/share/doc/passwd
total 24
-rw-r--r-- 1 root root 2279 nov 24 09:05 changelog.Debian.gz
-rw-r--r-- 1 root root 5153 nov 11  2021 copyright
drwxr-xr-x 1 root root   36 dez 17 12:13 examples
-rw-r--r-- 1 root root  801 nov 11  2021 NEWS.Debian.gz
-rw-r--r-- 1 root root 2075 nov 11  2021 README.Debian
-rw-r--r-- 1 root root 1020 nov 11  2021 TODO.Debian

Now read one by one (zcat or zless):

$ zcat /usr/share/doc/passwd/changelog.Debian.gz
$ zcat /usr/share/doc/passwd/NEWS.Debian.gz

Alternatively, you don't know that changelogs goes in /usr/share/doc, so search for it, then list, and finally read:

$ find / -type d -name passwd 2>/dev/null
/usr/share/doc/passwd

The 2>/dev/null is to avoid all those anoying Permission denied messages.

1
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Feb 13, 2023 at 17:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .