Linux Labs

Packages, services, and logs / Stage 3 of 13

Installing, upgrading and removing packages

Not running Starting usually ~20 s
Leave the lesson

Step 4 of 8 · theory · 5 min

Upgrades and your own settings edit

An upgrade installs a new version over the old one. A question comes up when both you and the package authors changed a setting.

A new version goes in with the same command: sudo dpkg -i with the new version's archive, or sudo apt upgrade from the repositories. dpkg unpacks the new files over the old ones and checks dependencies again. A requirement like (= 2.0-1) is met by the new version only if the package it depends on is upgraded along with it.

With a conffile dpkg acts like this. If you did not change the file, dpkg installs the new version silently. If the file did not change in the package, dpkg silently keeps yours. If both changed, dpkg stops and asks:

text
Configuration file '/etc/lab-pkg-report.conf'
 ==> Modified (by you or by a script) since installation.
 ==> Package distributor has shipped an updated version.
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : start a shell to examine the situation
 The default action is to keep your current version.

D shows the difference between the two versions. Answer N keeps yours, and dpkg puts the new one alongside, in lab-pkg-report.conf.dpkg-dist. Answer Y installs the new one, and yours is saved as .dpkg-old.

Check yourself 1 question

dpkg asked about /etc/lab-pkg-report.conf, and you answered N. Where does the setting from the new package version end up after the upgrade?

  • N means "keep mine": /etc/lab-pkg-report.conf keeps your edit. Answer Y installs the new version.

  • dpkg throws nothing away: it puts the rejected version alongside. ls /etc/lab-pkg-report.conf* shows the second file.

Answer N leaves your setting in place, and dpkg puts the package's version into .dpkg-dist. Compare them with diff /etc/lab-pkg-report.conf /etc/lab-pkg-report.conf.dpkg-dist.

Key points

  • An upgrade installs a new version over the old one, with the same dependency check.
  • dpkg asks about a conffile only when both your file and the package's file changed.
  • The rejected version of the setting stays alongside: .dpkg-dist or .dpkg-old.
Ubuntu 24.04
Loading…