Updating packages: whether to update the config file
October 13, 2021
Consider a situation when the package manager of your Linux distribution (Debian, Linux Mint, Ubuntu, Kali Linux) asks about updating the configuration file – what to do and how to get the latest version of the configuration file? Let’s figure it out.
With some updates of some packages, the structure of the configuration file changes. As a rule, the new file contains directives and settings that are necessary for the new version of the program, without which it cannot work.
Setting up a services is almost always changing configuration files. The end file can be the result of lengthy configuration work and many tests. This can take hours or even days.
Therefore, if it is necessary to update the configuration, a dilemma arises:
- do not update the config, as a result of which the new version of a package will not work normally
- update config and erase service configuration results
It is for this reason that the system asks you every time what needs to be done if the configuration file is updated with the program update?
An example of a message in which the package manager asks what to do with the new config file:
Configuration file '/etc/squid/squid.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. *** squid.conf (Y/I/N/O/D/Z) [default=N] ?
The options are:
- Y or I – install a new config file
- N or O – save the currently used config file
- D – show differences between versions
- Z – open the shell to examine the situation
The default option is to save the current config file (N).
If in reality you have not used this program, or the settings made are of no value to you, then always agree to update the configuration file. If the settings made are important to you, then:
- refuse to update the config file
- make a backup copy of your config, update the config file to the new version, and then make the necessary settings in it
For some packages, like Tor, the config file is just a set of comments with no setting active – for such files (if you haven't changed them), the update is more of a formality.
How to view the new config file
Typically, system administrators and users save the current configuration file. But how do you view the new file? After all, it is quite possible that there are important changes in it.
One way to do this is to download the latest version of a package and see the configuration file for the latest version in that package.
Download the package with a command like:
apt download PACKAGE
For example, to download the squid package
apt download squid
Unpack the downloaded installation file with a command like:
ar x FILE.deb
ar x squid_5.1-2_amd64.deb
Now we need to unpack a file called data.tar.gz or data.tar.xz.
Look at the contents of the folder to find out the name of the file:
If the file has a .tar.gz extension, then the command is as follows:
tar xzf data.tar.gz
If the file has the extension .tar.xz, then the command is as follows:
tar xf data.tar.xz
Let's check the contents of the current directory again in search of unpacked folders and files:
Configuration files on the system are usually placed in the /etc/ directory, when you unpack the package, you will find this folder under the path ./etc/ (that is, in the current folder).
For example, the command to view the configuration file of the latest version of the squid package I am interested in:
- Warning: apt-key is deprecated (SOLVED) (100%)
- How to simulate package installation on Linux (How to create and install a dummy package) (100%)
- Is it safe to remove configuration files left over from removed packages? (SOLVED) (83%)
- Do services need to be restarted when updating packages (73.8%)
- How to change the login shell in Linux. chsh instruction (67%)
- How to run small Python code in Bash (RANDOM - 50%)