Your message dated Fri, 24 Jul 2026 12:22:19 +0200
with message-id <[email protected]>
and subject line Re: Bug#1142701: Acknowledgement (knot postinst fails if 
/etc/knot/knot.conf (and others) are symlinks)
has caused the Debian Bug report #1142701,
regarding knot postinst fails if /etc/knot/knot.conf (and others) are symlinks
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
1142701: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1142701
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: knot
Severity: wishlist
Tags: patch

Hi,

knot fails to update or install if the items where statoverrides are processed for in knot.postinst are not files, i.e. symlinks.

at least for /etc/knot/knot.conf as well as /var/lib/knot (containing the zones by default), it's quite common to have these symlinked from other paths (e.g. /srv).

Currently, upgrading knot when using symlinks will break and take the daemon out until manually removed the symlink, dpkg --configure, and re-instating the symlink.

I suggest to only do the statoverride if the files are not symlinks, I've attached three patches (not knowing which one you prefer):

  * check-for-symlinks.patch

    - only run dpkg-statoverride if the item is not a symlink.

  * check-for-file-or-directory.patch

    - since the actual default permissions used suggest a specific type
      (knot.conf being a file, the other two a directory), you could
      also just be explicitly strict about it and check for the correct
      type (file or directory).

  * ignore-errors.patch

    - or you might want to just ignore the errors (note that you'll need
      to divert the output to /dev/null, otherwise one sees a red error
      message on any install/upgrade/reconfigure when using symlinks).

Regards,
Daniel
diff --git a/debian/knot.postinst b/debian/knot.postinst
index 9ed7222..03fc993 100644
--- a/debian/knot.postinst
+++ b/debian/knot.postinst
@@ -6,9 +6,9 @@ set -e
 #DEBHELPER#
 
 if [ "$1" = "configure" ]; then
-    dpkg-statoverride --list /var/lib/knot >/dev/null 2>&1 || dpkg-statoverride --update --add root knot 0770 /var/lib/knot
-    dpkg-statoverride --list /etc/knot/knot.conf >/dev/null 2>&1 || dpkg-statoverride --update --add root knot 0640 /etc/knot/knot.conf
-    dpkg-statoverride --list /etc/knot >/dev/null 2>&1 || dpkg-statoverride --update --add root knot 0750 /etc/knot
+    dpkg-statoverride --list /var/lib/knot >/dev/null 2>&1 || dpkg-statoverride --update --add root knot 0770 /var/lib/knot > /dev/null 2>&1 || true
+    dpkg-statoverride --list /etc/knot/knot.conf >/dev/null 2>&1 || dpkg-statoverride --update --add root knot 0640 /etc/knot/knot.conf > /dev/null 2>&1 || true
+    dpkg-statoverride --list /etc/knot >/dev/null 2>&1 || dpkg-statoverride --update --add root knot 0750 /etc/knot > /dev/null 2>&1 || true
 fi
 
 exit 0
diff --git a/debian/knot.postinst b/debian/knot.postinst
index 9ed7222..56a064a 100644
--- a/debian/knot.postinst
+++ b/debian/knot.postinst
@@ -6,9 +6,17 @@ set -e
 #DEBHELPER#
 
 if [ "$1" = "configure" ]; then
-    dpkg-statoverride --list /var/lib/knot >/dev/null 2>&1 || dpkg-statoverride --update --add root knot 0770 /var/lib/knot
-    dpkg-statoverride --list /etc/knot/knot.conf >/dev/null 2>&1 || dpkg-statoverride --update --add root knot 0640 /etc/knot/knot.conf
-    dpkg-statoverride --list /etc/knot >/dev/null 2>&1 || dpkg-statoverride --update --add root knot 0750 /etc/knot
+    if [ ! -L /var/lib/knot ]; then
+        dpkg-statoverride --list /var/lib/knot >/dev/null 2>&1 || dpkg-statoverride --update --add root knot 0770 /var/lib/knot
+    fi
+
+    if [ ! -L /etc/knot/knot.conf ]; then
+        dpkg-statoverride --list /etc/knot/knot.conf >/dev/null 2>&1 || dpkg-statoverride --update --add root knot 0640 /etc/knot/knot.conf
+    fi
+
+    if [ ! -L /etc/knot ]; then
+        dpkg-statoverride --list /etc/knot >/dev/null 2>&1 || dpkg-statoverride --update --add root knot 0750 /etc/knot
+    fi
 fi
 
 exit 0
diff --git a/debian/knot.postinst b/debian/knot.postinst
index 9ed7222..ef466ec 100644
--- a/debian/knot.postinst
+++ b/debian/knot.postinst
@@ -6,9 +6,17 @@ set -e
 #DEBHELPER#
 
 if [ "$1" = "configure" ]; then
-    dpkg-statoverride --list /var/lib/knot >/dev/null 2>&1 || dpkg-statoverride --update --add root knot 0770 /var/lib/knot
-    dpkg-statoverride --list /etc/knot/knot.conf >/dev/null 2>&1 || dpkg-statoverride --update --add root knot 0640 /etc/knot/knot.conf
-    dpkg-statoverride --list /etc/knot >/dev/null 2>&1 || dpkg-statoverride --update --add root knot 0750 /etc/knot
+    if [ -d /var/lib/knot ]; then
+        dpkg-statoverride --list /var/lib/knot >/dev/null 2>&1 || dpkg-statoverride --update --add root knot 0770 /var/lib/knot
+    fi
+
+    if [ -f /etc/knot/knot.conf ]; then
+        dpkg-statoverride --list /etc/knot/knot.conf >/dev/null 2>&1 || dpkg-statoverride --update --add root knot 0640 /etc/knot/knot.conf
+    fi
+
+    if [ -d /etc/knot ]; then
+        dpkg-statoverride --list /etc/knot >/dev/null 2>&1 || dpkg-statoverride --update --add root knot 0750 /etc/knot
+    fi
 fi
 
 exit 0

--- End Message ---
--- Begin Message ---
Hi,

please ignore the previous patches - the reason is actually

  "systemd-tmpfiles --create knot.conf"

so, this one needs to be guarded.. which doesn't seem possible in the declarative way it's ment to be used via knot.tmpfiles.

I'll fill a bug against systemd instead.

Regards,
Daniel

--- End Message ---

Reply via email to