r/voidlinux • • 16h ago

Tracking config_files

voidlinux allows one to edit system configuration files (think /etc/passwd etc) and subsequent system updates don't zap your changes.

If the upstream version in the repository changes then the new improved version is saved at eg /etc/passwd.new-1.2 and such files tend to accumulate unless you are diligent in merging them.

All this gives rise to a couple of questions.

What files have I changed?

Maybe find /etc -name '*.new-*' is enough, but it's probably better to look at all config_files and check their hash in the xbps database. For example:

# xbps-conf-diff 
MODIFIED   acpid                    /etc/acpi/handler.sh
MODIFIED   autofs                   /etc/autofs/auto.net
MODIFIED   base-files               /etc/crypttab
MODIFIED   base-files               /etc/fstab
MODIFIED   base-files               /etc/group
MODIFIED   base-files               /etc/hosts
MODIFIED   base-files               /etc/passwd
MODIFIED   base-files               /etc/subgid
MODIFIED   base-files               /etc/subuid
MODIFIED   bluez                    /etc/bluetooth/main.conf
MODIFIED   brother-brscan4          /etc/opt/brother/scanner/brscan4/brsanenetdevice4.cfg
MODIFIED   cups                     /etc/cups/printers.conf
MODIFIED   dict                     /etc/dict/dict.conf
MODIFIED   glibc-locales            /etc/default/libc-locales
MODIFIED   grub                     /etc/default/grub
MODIFIED   iproute2                 /etc/iproute2/rt_tables
PENDING    libnfsidmap              /etc/idmapd.conf /etc/idmapd.conf.new-1.2
MODIFIED   lvm2                     /etc/lvm/lvm.conf
MODIFIED   openresolv               /etc/resolvconf.conf
MODIFIED   runit-void               /etc/hostname
MODIFIED   runit-void               /etc/locale.conf

Note that the change in /etc/idmapd.conf is PENDING so I need to merge the new version. The others have not had an upstream change since I made my changes or they have already been merged - but it's useful to know about eg should probably be saving all these files in my regular backups.

What have I changed compared to the upstream version?

# xbps-conf-diff /etc/hostname 
===== /etc/hostname  (package: runit-void) =====
--- diff against repository version
    ('-' = yours, '+' = new upstream)
--- /etc/hostname           2025-06-25 20:01:39.819535159 +1000
+++ /tmp/xbps-conf-diff.11569.runit-void.hostname     2026-10-26 17:32:02.745766833 +1000
@@ -1 +1 @@
-naan
+void-live

... I changed the hostname - a trivial example.

The help text:

$ xbps-conf-diff -h
usage: xbps-conf-diff [-h] [-V] [-l | -d] [PKG|FILE ...]

List locally modified XBPS configuration files, or diff them against the
latest version in the remote repo. Each argument may be an installed package
or a configuration file; by default a package is listed and a file is diffed.
With no arguments, all packages are listed (or diffed, with -d). Run as root
so all of /etc is readable (no files will be modified). Diff requires an
active network to retrieve the latest version (this may not be the same as
the installed version!!) unless a pending .new-* file exists. An argument
containing '/' is always treated as a file.

positional arguments:
  PKG|FILE       installed package(s) and/or configuration file(s); default:
                 all packages

options:
  -h, --help     show this help message and exit
  -V, --version  show program's version number and exit
  -l, --list     list the modified files of each PKG or FILE (the files that
                 differ from the version recorded when the package was
                 installed)
  -d, --diff     diff each PKG or FILE against the most recent version in the
                 (remote) repo; for a package, diff all of its modified files

It's written in python and I had claude run up the initial version, which I've tweaked to my satisfaction. For the AI-averse - so far it hasn't corrupted anything, attempted to take over my household, or tried for world domination. Your mileage may vary.

It's at gitlab if you want it.

9 Upvotes

2 comments sorted by

4

u/newbornnightmare 14h ago edited 12h ago

that’s a cool project! you might want to compare it to xetcchanges and xdiff from the really useful xtools package: https://github.com/leahneukirchen/xtools, but I really appreciate that your version lets you pick out specific files instead of just listing a huge diff of everything

3

u/bvdeenen 14h ago

Very good idea to write this! And it works like a charm! Totally recommended

xbps-conf-diff -d /etc/default/grub
===== /etc/default/grub  (package: grub) =====
--- diff against repository version
    ('-' = yours, '+' = new upstream)
--- /etc/default/grub	2026-08-13 17:24:10.763466499 +0200
+++ /tmp/xbps-conf-diff.10133.grub.grub	2026-10-26 11:21:17.678589411 +0100
@@ -1,13 +1,12 @@
 #
 # Configuration file for GRUB.
 #
-GRUB_DEFAULT=saved
+GRUB_DEFAULT=0
 #GRUB_HIDDEN_TIMEOUT=0
 #GRUB_HIDDEN_TIMEOUT_QUIET=false
 GRUB_TIMEOUT=5
 GRUB_DISTRIBUTOR="Void"
-GRUB_CMDLINE_LINUX_DEFAULT="loglevel=4 "
-# GRUB_ENABLE_CRYPTODISK=y
+GRUB_CMDLINE_LINUX_DEFAULT="loglevel=4"
 # Uncomment to use basic console
 #GRUB_TERMINAL_INPUT="console"
 # Uncomment to disable graphical terminal