Opkg conffile overwrite conditions


When I install my package I've got a base configuration file which is listed in Package/conffile section. When the software runs some data are being added to this file like rotating passwords and keys for different accesses, etc. When I upgrade this package using opkg upgrade, obviously this base package is not being overwritten - it is being written in the location as pac.conf-opkg. Now, I've got a few occurences when the config file has been overwritten indeed and since I do not have any logs of opkg, I'm trying to investigate what could have happened. So my question is - is there any situation when conffile can be overwritten by opkg unless I do not add --force option?



Correct option to replace existing conf files is --force-maintainer

1 Like

So, if I invoke opkg upgrade without any switches, there is no posibility that existing conffile would ever be overwritten by package manager?

1 Like

One can add backward-incompatible format upgrade via uci-defaults

1 Like

It wont be overwritten as the new config file is placed as a copy renamed as ...-opkg like you say.

BUT like brada4 mentions, it is possible that the installed package contains an uci-defaults script for modifying settings e.g. in a version upgrade that requires changing an existing parameter.

Those uci-defaults scripts are run when the package is installed by opkg, so it could modify individual settings in the old config file. (or even delete it wholly. the script is a full shell script.)
Example: uhttpd uci-defaults script that makes sure that ubus_prefix is set and the socket dir is correct.