According to https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3101, glib now searches for the session bus socket in runstatedir. The dbus service must thus have its socket in /run/dbus. For interoperability with the dbus standard, /run/dbus is also symlinked to /var/run/dbus. * gnu/services/dbus.scm (dbus-activation): Symlink /run/dbus to /var/run/dbus. (%dbus-accounts): Run dbus in /run/dbus. (dbus-root-service-type): Save the pid file in /run/dbus. --- Le jeudi 05 octobre 2023 à 06:41 +0200, Liliana Marie Prikler a écrit : > > I’m still concerned about doing a symlink in the activation function. > > What if we activate a new system from an existing one? Won’t the symlink > > fail? I think we should preemptively delete /var/run/dbus and make a new > > symlink every time. But I could be wrong, maybe this is not needed. > > > > What do you think? > If we go this route, I think we should first check whether /var/run/dbus is > indeed a symlink to /run/dbus and move the existing files if not before > deleting the directory and creating the symlink. But before that, we should > try to symlink, which will fail with EEXIST if the file already exists, > regardless of whether it's a symlink – thereafter you can check the cause of > this failure through lstat. I changed my mind! I now think it is OK for the system reconfigure to fail if a different symlink already exists. Best regards, Vivien gnu/services/dbus.scm | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/gnu/services/dbus.scm b/gnu/services/dbus.scm index 5a0c634393..206a7bb491 100644 --- a/gnu/services/dbus.scm +++ b/gnu/services/dbus.scm @@ -163,7 +163,7 @@ (define %dbus-accounts (group "messagebus") (system? #t) (comment "D-Bus system bus user") - (home-directory "/var/run/dbus") + (home-directory "/run/dbus") (shell (file-append shadow "/sbin/nologin"))))) (define dbus-setuid-programs @@ -186,7 +186,24 @@ (define (dbus-activation config) (let ((user (getpwnam "messagebus"))) ;; This directory contains the daemon's socket so it must be ;; world-readable. - (mkdir-p/perms "/var/run/dbus" user #o755)) + (mkdir-p/perms "/run/dbus" user #o755)) + + (catch 'system-error + (lambda () + (symlink "/run/dbus" "/var/run/dbus")) + (lambda args + (let ((errno (system-error-errno args))) + (cond + ((= errno EEXIST) + (let ((existing-name + (readlink "/run/dbus"))) + (unless (equal? existing-name "/var/run/dbus") + (error "the symlink /run/dbus exists and does not point to /var/run/dbus")))) + (else + (format (current-error-port) + "Failed to symlink /run/dbus to /var/run/dbus: ~s~%" + (strerror errno)) + (error "cannot create /var/run/dbus")))))) (unless (file-exists? "/etc/machine-id") (format #t "creating /etc/machine-id...~%") @@ -210,7 +227,7 @@ (define dbus-shepherd-service '(#:environment-variables '("DBUS_VERBOSE=1") #:log-file "/var/log/dbus-daemon.log") '()) - #:pid-file "/var/run/dbus/pid")) + #:pid-file "/run/dbus/pid")) (stop #~(make-kill-destructor))))))) (define dbus-root-service-type base-commit: b18b2d13488f2a92331ccad2dc8cbb54ee15582f -- 2.41.0