What should I do with /etc/**/*-opkg files?

Today, while tinkering with my Omnia, I’ve found out there is lot of *-opkg files:

# find /etc -name "*-opkg"
/etc/config/dhcp-opkg
/etc/config/updater-opkg
/etc/config/user_notify-opkg
/etc/config/resolver-opkg
/etc/config/foris-opkg
/etc/config/system-opkg
/etc/config/ucollect-opkg
/etc/updater/auto.lua-opkg
/etc/passwd-opkg
/etc/shadow-opkg
/etc/inittab-opkg
/etc/shells-opkg
/etc/group-opkg

For what those files are? When they are created and what I am supposed to do with them? Are those files something similar to *.pacnew/*.pacsave files from Arch Linux’s pacman?

In Arch Linux there exist pacdiff or yaourt -C which help resolving config “conflicts”, is there something similar?

Thanks a lot

I think those are created, when opkg has restricted to just overwrite changed config files during updates. Me personally, just review changes, apply to my configs If I find it usefull, and delete opkg ones.

I end up going through the opkg files to make sure my current configs aren’t missing something critical or sometimes there are new options that aren’t in the old config files that i would like to use.

I like the side by side comparison, so usually something like:

diff -y foris foris-opkg

It is kind of a pain in the neck, but sometimes it’s worthwhile.

I would dearly love an authoritative answer to this, better than “I think …” as I have the same issue, and my own ignorance bothers me here.

Nice. So wrote this quickly to make life easier:

#!/bin/bash
BAR=$(printf '=%.0s' {1..40})
cd /etc/config
for f in *-opkg
do
  echo $BAR ${f%-opkg} $BAR
  diff -y ${f%-opkg} $f
done

Will print a nice summary.

But as I said, still super keen to read a definitive answer on this!

I wouldn’t bother with them unless you’re having problems. They are created when upgrading packages, to debug problems - most Linux systems ask if you want to overwrite, discard, diff or merge configuration files when upgrading packages etc, but since Turris/openwrt runs on a router and upgrades will, in most cases, be completely unattended there’s no good way to ask what the user wants to do with the new config file - so it extracts it to -opkg in case you are having problems and want to merge your changes in to the new one.
Of course, auto-merging the new config with the old one would be ideal, but as far as I know there’s no way to do this currently (unless the install script inside the package does the migration manually).

1 Like

Fair call. I’d really appreciate seeing some documentation as to who creates them when and why is all, I guess. They are mildly concerning when confronting a veil of ignorance like mine ;-). My assumption so far is, the -opkg ones are not used by anyone anytime, just there for reference, created sometime somewhen by some app with the Turris updater implicated, and opkg implicated, but a dearth of actual documented facts at hand?

As has been said, they are created by opkg (the package manager built-in to most OpenWrt routers) whenrading a package. I’m not sure there’s any proper documentation on this particular function, but you can find the source code for it here:
https://git.lede-project.org/?p=project/opkg-lede.git;a=tree;f=libopkg;hb=HEAD

I think you will want to look at:
https://git.lede-project.org/?p=project/opkg-lede.git;a=blob;f=libopkg/conffile.c;h=d541509e8459c069e86259c4da46be617d430ea7;hb=HEAD#l38
and
https://git.lede-project.org/?p=project/opkg-lede.git;a=blob;f=libopkg/opkg_install.c;h=e6f8a1b6276ede518a5c59b2f9347f1de8e5dd7a;hb=HEAD#l691

Hope this helps :slight_smile:

Just for completeness. Updater-ng is conforming to opkg behavior so it does the same thing. So for updater-ng side of things you can look here: https://gitlab.labs.nic.cz/turris/updater/blob/master/src/lib/autoload/a_06_backend.lua#L839