* bug#66339: [WIP PATCH gnome-team] gnu: dbus-service: make the session available under /run/dbus [not found] <3121a39dc569ff872afe74a8871ef71456ea5451.camel@univ-reims.fr> @ 2023-10-04 10:47 ` Vivien Kraus via Bug reports for GNU Guix 2023-10-04 18:30 ` Liliana Marie Prikler 0 siblings, 1 reply; 14+ messages in thread From: Vivien Kraus via Bug reports for GNU Guix @ 2023-10-04 10:47 UTC (permalink / raw) To: 66339; +Cc: rg, liliana.prikler, maxim.cournoyer * gnu/services/dbus.scm (dbus-activation): Symlink /var/run/dbus to /run/dbus. --- gnu/services/dbus.scm | 1 + 1 file changed, 1 insertion(+) diff --git a/gnu/services/dbus.scm b/gnu/services/dbus.scm index 5a0c634393..80968ac1a4 100644 --- a/gnu/services/dbus.scm +++ b/gnu/services/dbus.scm @@ -187,6 +187,7 @@ (define (dbus-activation config) ;; This directory contains the daemon's socket so it must be ;; world-readable. (mkdir-p/perms "/var/run/dbus" user #o755)) + (symlink "/var/run/dbus" "/run/dbus") (unless (file-exists? "/etc/machine-id") (format #t "creating /etc/machine-id...~%") base-commit: b18b2d13488f2a92331ccad2dc8cbb54ee15582f -- 2.41.0 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* bug#66339: [WIP PATCH gnome-team] gnu: dbus-service: make the session available under /run/dbus 2023-10-04 10:47 ` bug#66339: [WIP PATCH gnome-team] gnu: dbus-service: make the session available under /run/dbus Vivien Kraus via Bug reports for GNU Guix @ 2023-10-04 18:30 ` Liliana Marie Prikler 2023-10-04 10:47 ` bug#66339: [PATCH gnome-team v2] " Vivien Kraus via Bug reports for GNU Guix 0 siblings, 1 reply; 14+ messages in thread From: Liliana Marie Prikler @ 2023-10-04 18:30 UTC (permalink / raw) To: Vivien Kraus, 66339; +Cc: rg, maxim.cournoyer Am Mittwoch, dem 04.10.2023 um 12:47 +0200 schrieb Vivien Kraus: > * gnu/services/dbus.scm (dbus-activation): Symlink /var/run/dbus to > /run/dbus. > --- > gnu/services/dbus.scm | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/gnu/services/dbus.scm b/gnu/services/dbus.scm > index 5a0c634393..80968ac1a4 100644 > --- a/gnu/services/dbus.scm > +++ b/gnu/services/dbus.scm > @@ -187,6 +187,7 @@ (define (dbus-activation config) > ;; This directory contains the daemon's socket so it must > be > ;; world-readable. > (mkdir-p/perms "/var/run/dbus" user #o755)) > + (symlink "/var/run/dbus" "/run/dbus") From [1]: > As documented in the NEWS file in > https://gitlab.freedesktop.org/dbus/dbus/-/merge_requests/209, it’s > only valid to use /run – rather than /var/run – for D-Bus if the two > paths are interoperable. i.e. /var/run should be a symlink to /run, > and the D-Bus daemon should be configured to put its socket there. Thus, the order of the two ought to be reversed. Alternatively, we could add '-Druntime_dir=/var/run' to glib. WDYT? [1]: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3101 ^ permalink raw reply [flat|nested] 14+ messages in thread
* bug#66339: [PATCH gnome-team v2] gnu: dbus-service: make the session available under /run/dbus 2023-10-04 18:30 ` Liliana Marie Prikler @ 2023-10-04 10:47 ` Vivien Kraus via Bug reports for GNU Guix 2023-10-05 4:41 ` Liliana Marie Prikler 0 siblings, 1 reply; 14+ messages in thread From: Vivien Kraus via Bug reports for GNU Guix @ 2023-10-04 10:47 UTC (permalink / raw) To: Liliana Marie Prikler, 66339; +Cc: rg, maxim.cournoyer [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain, Size: 3857 bytes --] 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 mercredi 04 octobre 2023 à 20:30 +0200, Liliana Marie Prikler a écrit : > Am Mittwoch, dem 04.10.2023 um 12:47 +0200 schrieb Vivien Kraus: > > * gnu/services/dbus.scm (dbus-activation): Symlink /var/run/dbus to > > /run/dbus. > > --- > > gnu/services/dbus.scm | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/gnu/services/dbus.scm b/gnu/services/dbus.scm > > index 5a0c634393..80968ac1a4 100644 > > --- a/gnu/services/dbus.scm > > +++ b/gnu/services/dbus.scm > > @@ -187,6 +187,7 @@ (define (dbus-activation config) > > ;; This directory contains the daemon's socket so it > > must > > be > > ;; world-readable. > > (mkdir-p/perms "/var/run/dbus" user #o755)) > > + (symlink "/var/run/dbus" "/run/dbus") > From [1]: > > As documented in the NEWS file in > > https://gitlab.freedesktop.org/dbus/dbus/-/merge_requests/209, it’s > > only valid to use /run – rather than /var/run – for D-Bus if the > > two > > paths are interoperable. i.e. /var/run should be a symlink to /run, > > and the D-Bus daemon should be configured to put its socket there. > > Thus, the order of the two ought to be reversed. Alternatively, we > could add '-Druntime_dir=/var/run' to glib. WDYT? > > [1]: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3101 Thank you for finding this information. I think we should follow glib, and have the socket in /run/dbus, with the symlink for standard interoperability. 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? Best regards, Vivien gnu/services/dbus.scm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/gnu/services/dbus.scm b/gnu/services/dbus.scm index 5a0c634393..53efa7adea 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,11 @@ (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)) + + (when (file-exists? "/var/run/dbus") + (delete-file "/var/run/dbus")) + (symlink "/run/dbus" "/var/run/dbus") (unless (file-exists? "/etc/machine-id") (format #t "creating /etc/machine-id...~%") @@ -210,7 +214,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 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* bug#66339: [PATCH gnome-team v2] gnu: dbus-service: make the session available under /run/dbus 2023-10-04 10:47 ` bug#66339: [PATCH gnome-team v2] " Vivien Kraus via Bug reports for GNU Guix @ 2023-10-05 4:41 ` Liliana Marie Prikler 2023-10-04 10:47 ` bug#66339: [PATCH gnome-team v3] " Vivien Kraus via Bug reports for GNU Guix 0 siblings, 1 reply; 14+ messages in thread From: Liliana Marie Prikler @ 2023-10-05 4:41 UTC (permalink / raw) To: Vivien Kraus, 66339; +Cc: rg, maxim.cournoyer Am Mittwoch, dem 04.10.2023 um 12:47 +0200 schrieb Vivien Kraus: > 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 mercredi 04 octobre 2023 à 20:30 +0200, Liliana Marie Prikler a > écrit : > > Am Mittwoch, dem 04.10.2023 um 12:47 +0200 schrieb Vivien Kraus: > > > * gnu/services/dbus.scm (dbus-activation): Symlink /var/run/dbus > > > to > > > /run/dbus. > > > --- > > > gnu/services/dbus.scm | 1 + > > > 1 file changed, 1 insertion(+) > > > > > > diff --git a/gnu/services/dbus.scm b/gnu/services/dbus.scm > > > index 5a0c634393..80968ac1a4 100644 > > > --- a/gnu/services/dbus.scm > > > +++ b/gnu/services/dbus.scm > > > @@ -187,6 +187,7 @@ (define (dbus-activation config) > > > ;; This directory contains the daemon's socket so it > > > must > > > be > > > ;; world-readable. > > > (mkdir-p/perms "/var/run/dbus" user #o755)) > > > + (symlink "/var/run/dbus" "/run/dbus") > > From [1]: > > > As documented in the NEWS file in > > > https://gitlab.freedesktop.org/dbus/dbus/-/merge_requests/209, > > > it’s only valid to use /run – rather than /var/run – for D-Bus if > > > the two paths are interoperable. i.e. /var/run should be a > > > symlink to /run, and the D-Bus daemon should be configured to put > > > its socket there. > > > > Thus, the order of the two ought to be reversed. Alternatively, we > > could add '-Druntime_dir=/var/run' to glib. WDYT? > > > > [1]: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3101 > > Thank you for finding this information. I think we should follow > glib, and have the socket in /run/dbus, with the symlink for standard > interoperability. > > 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. > Best regards, > > Vivien > > gnu/services/dbus.scm | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/gnu/services/dbus.scm b/gnu/services/dbus.scm > index 5a0c634393..53efa7adea 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,11 @@ (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)) > + > + (when (file-exists? "/var/run/dbus") > + (delete-file "/var/run/dbus")) This assumes "/var/run/dbus" to be a regular file or symlink, which it's not on reconfiguration IIUC. > + (symlink "/run/dbus" "/var/run/dbus") > > (unless (file-exists? "/etc/machine-id") > (format #t "creating /etc/machine-id...~%") > @@ -210,7 +214,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 Cheers ^ permalink raw reply [flat|nested] 14+ messages in thread
* bug#66339: [PATCH gnome-team v3] gnu: dbus-service: make the session available under /run/dbus 2023-10-05 4:41 ` Liliana Marie Prikler @ 2023-10-04 10:47 ` Vivien Kraus via Bug reports for GNU Guix 2023-10-06 18:50 ` Liliana Marie Prikler 0 siblings, 1 reply; 14+ messages in thread From: Vivien Kraus via Bug reports for GNU Guix @ 2023-10-04 10:47 UTC (permalink / raw) To: Liliana Marie Prikler, 66339; +Cc: rg, maxim.cournoyer [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain, Size: 3642 bytes --] 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 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* bug#66339: [PATCH gnome-team v3] gnu: dbus-service: make the session available under /run/dbus 2023-10-04 10:47 ` bug#66339: [PATCH gnome-team v3] " Vivien Kraus via Bug reports for GNU Guix @ 2023-10-06 18:50 ` Liliana Marie Prikler 2023-10-04 10:47 ` bug#66339: [PATCH gnome-team v4] " Vivien Kraus via Bug reports for GNU Guix 0 siblings, 1 reply; 14+ messages in thread From: Liliana Marie Prikler @ 2023-10-06 18:50 UTC (permalink / raw) To: Vivien Kraus, 66339; +Cc: rg, maxim.cournoyer Am Mittwoch, dem 04.10.2023 um 12:47 +0200 schrieb Vivien Kraus: > 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. Perhaps, but it's not okay to fail if it's a regular directory. We should move those! Cheers ^ permalink raw reply [flat|nested] 14+ messages in thread
* bug#66339: [PATCH gnome-team v4] gnu: dbus-service: make the session available under /run/dbus 2023-10-06 18:50 ` Liliana Marie Prikler @ 2023-10-04 10:47 ` Vivien Kraus via Bug reports for GNU Guix 2023-10-06 21:41 ` Liliana Marie Prikler 0 siblings, 1 reply; 14+ messages in thread From: Vivien Kraus via Bug reports for GNU Guix @ 2023-10-04 10:47 UTC (permalink / raw) To: Liliana Marie Prikler, 66339; +Cc: rg, maxim.cournoyer [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain, Size: 3976 bytes --] 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. --- > Perhaps, but it's not okay to fail if it's a regular directory. We should > move those! I’m not sure I understand. What comes to my mind is: 1. Try to make the symlink. If it fails with EEXIST: 2. Try to read /var/run/dbus as a symlink. If it points to /run/dbus already, stop. Otherwise: 3. Move everything in /var/run/dbus to /run/dbus. 4. Delete the now-empty /var/run/dbus. 5. Symlink /run/dbus to /var/run/dbus. Is it what you meant? Best regards, Vivien gnu/services/dbus.scm | 38 +++++++++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/gnu/services/dbus.scm b/gnu/services/dbus.scm index 5a0c634393..44bf0c910b 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,39 @@ (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 + (false-if-exception + (readlink "/var/run/dbus")))) + (unless (equal? existing-name "/run/dbus") + ;; Move the content of /var/run/dbus to /run/dbus, and + ;; retry. + (let ((dir (opendir "/var/run/dbus"))) + (let move-to-/run/dbus () + (let ((next (readdir dir))) + (unless (or (equal? next ".") + (equal? next "..") + (eof-object? next)) + (rename-file (string-append "/var/run/dbus/" next) + (string-append "/run/dbus/" next))) + (unless (eof-object? next) + (move-to-/run/dbus)))) + (closedir dir) + (rmdir "/var/run/dbus") + (symlink "/run/dbus" "/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 +242,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 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* bug#66339: [PATCH gnome-team v4] gnu: dbus-service: make the session available under /run/dbus 2023-10-04 10:47 ` bug#66339: [PATCH gnome-team v4] " Vivien Kraus via Bug reports for GNU Guix @ 2023-10-06 21:41 ` Liliana Marie Prikler 2023-10-04 10:47 ` bug#66339: [PATCH gnome-team v6] " Vivien Kraus via Bug reports for GNU Guix 2023-10-06 21:12 ` bug#66339: [PATCH gnome-team v5] gnu: glib: Set runstatedir Vivien Kraus via Bug reports for GNU Guix 0 siblings, 2 replies; 14+ messages in thread From: Liliana Marie Prikler @ 2023-10-06 21:41 UTC (permalink / raw) To: Vivien Kraus, 66339; +Cc: rg, maxim.cournoyer Am Mittwoch, dem 04.10.2023 um 12:47 +0200 schrieb Vivien Kraus: > 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. > --- > > > Perhaps, but it's not okay to fail if it's a regular directory. We > > should > > move those! > > I’m not sure I understand. What comes to my mind is: > > 1. Try to make the symlink. If it fails with EEXIST: > 2. Try to read /var/run/dbus as a symlink. If it points to /run/dbus > already, > stop. Otherwise: > 3. Move everything in /var/run/dbus to /run/dbus. > 4. Delete the now-empty /var/run/dbus. > 5. Symlink /run/dbus to /var/run/dbus. > > Is it what you meant? Yep, that's what I meant. > Best regards, > > Vivien > > gnu/services/dbus.scm | 38 +++++++++++++++++++++++++++++++++++--- > 1 file changed, 35 insertions(+), 3 deletions(-) > > diff --git a/gnu/services/dbus.scm b/gnu/services/dbus.scm > index 5a0c634393..44bf0c910b 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,39 @@ (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 > + (false-if-exception > + (readlink "/var/run/dbus")))) > + (unless (equal? existing-name "/run/dbus") > + ;; Move the content of /var/run/dbus to > /run/dbus, and > + ;; retry. > + (let ((dir (opendir "/var/run/dbus"))) > + (let move-to-/run/dbus () > + (let ((next (readdir dir))) > + (unless (or (equal? next ".") > + (equal? next "..") > + (eof-object? next)) > + (rename-file (string-append > "/var/run/dbus/" next) > + (string-append "/run/dbus/" > next))) > + (unless (eof-object? next) > + (move-to-/run/dbus)))) > + (closedir dir) > + (rmdir "/var/run/dbus") > + (symlink "/run/dbus" "/var/run/dbus"))))) You might want to express this in terms of a function similar to copy- recursively, or at the very least a let loop. (let loop ((next (readdir dir))) (cond ((eof-object? next) (closedir dir)) ((member next "." "..") (loop (readdir dir))) (else (rename-file …) (loop (readdir dir))))) > + (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 +242,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 Cheers ^ permalink raw reply [flat|nested] 14+ messages in thread
* bug#66339: [PATCH gnome-team v6] gnu: dbus-service: make the session available under /run/dbus 2023-10-06 21:41 ` Liliana Marie Prikler @ 2023-10-04 10:47 ` Vivien Kraus via Bug reports for GNU Guix 2023-10-08 14:53 ` Liliana Marie Prikler 2023-10-06 21:12 ` bug#66339: [PATCH gnome-team v5] gnu: glib: Set runstatedir Vivien Kraus via Bug reports for GNU Guix 1 sibling, 1 reply; 14+ messages in thread From: Vivien Kraus via Bug reports for GNU Guix @ 2023-10-04 10:47 UTC (permalink / raw) To: Liliana Marie Prikler, Maxim Cournoyer, 66339; +Cc: rg [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain, Size: 3966 bytes --] 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. --- Hello, I changed my mind back to a previous mind change, so: the socket should be installed in /run. I believe that the code moves the content of the existing /var/run/dbus to /run/dbus before trying the symlink again, if /var/run/dbus exists and is not a symlink to /run/dbus. I don’t really have a way to check the interesting case where existing files need to be moved. However, the gnome-team-configured VM works. Best regards, Vivien gnu/services/dbus.scm | 39 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/gnu/services/dbus.scm b/gnu/services/dbus.scm index 5a0c634393..aa9ce0720c 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,40 @@ (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 + (false-if-exception + (readlink "/var/run/dbus")))) + (unless (equal? existing-name "/run/dbus") + ;; Move the content of /var/run/dbus to /run/dbus, and + ;; retry. + (let ((dir (opendir "/var/run/dbus"))) + (let move-to-/run/dbus ((next (readdir dir))) + (cond + ((eof-object? next) + (closedir dir)) + ((member next '("." "..")) + (move-to-/run/dbus (readdir dir))) + (else + (begin + (rename-file (string-append "/var/run/dbus/" next) + (string-append "/run/dbus/" next)) + (move-to-/run/dbus (readdir dir)))))))) + (rmdir "/var/run/dbus") + (symlink "/run/dbus" "/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 +243,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 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* bug#66339: [PATCH gnome-team v6] gnu: dbus-service: make the session available under /run/dbus 2023-10-04 10:47 ` bug#66339: [PATCH gnome-team v6] " Vivien Kraus via Bug reports for GNU Guix @ 2023-10-08 14:53 ` Liliana Marie Prikler 2023-10-09 20:36 ` Liliana Marie Prikler 0 siblings, 1 reply; 14+ messages in thread From: Liliana Marie Prikler @ 2023-10-08 14:53 UTC (permalink / raw) To: Vivien Kraus, Maxim Cournoyer, 66339; +Cc: rg Am Mittwoch, dem 04.10.2023 um 12:47 +0200 schrieb Vivien Kraus: > 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. > --- > > Hello, > > I changed my mind back to a previous mind change, so: the socket > should be > installed in /run. I believe that the code moves the content of the > existing > /var/run/dbus to /run/dbus before trying the symlink again, if > /var/run/dbus > exists and is not a symlink to /run/dbus. I don’t really have a way > to check > the interesting case where existing files need to be moved. However, > the > gnome-team-configured VM works. > > Best regards, > > Vivien > > gnu/services/dbus.scm | 39 ++++++++++++++++++++++++++++++++++++--- > 1 file changed, 36 insertions(+), 3 deletions(-) > > diff --git a/gnu/services/dbus.scm b/gnu/services/dbus.scm > index 5a0c634393..aa9ce0720c 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,40 @@ (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 > + (false-if-exception > + (readlink "/var/run/dbus")))) > + (unless (equal? existing-name "/run/dbus") > + ;; Move the content of /var/run/dbus to > /run/dbus, and > + ;; retry. > + (let ((dir (opendir "/var/run/dbus"))) > + (let move-to-/run/dbus ((next (readdir dir))) > + (cond > + ((eof-object? next) > + (closedir dir)) > + ((member next '("." "..")) > + (move-to-/run/dbus (readdir dir))) > + (else > + (begin > + (rename-file (string-append > "/var/run/dbus/" next) > + (string-append "/run/dbus/" > next)) > + (move-to-/run/dbus (readdir dir)))))))) I'd rename "move-to-/run/dbus" to the boring but more idiomatic "loop". This saves us some horizontal real-estate that'd allow us to squash some lines. > + (rmdir "/var/run/dbus") > + (symlink "/run/dbus" "/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 +243,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 Otherwise LGTM. I'd commit it, but my machine is currently busy building half of core-updates for no reason. Cheers ^ permalink raw reply [flat|nested] 14+ messages in thread
* bug#66339: [PATCH gnome-team v6] gnu: dbus-service: make the session available under /run/dbus 2023-10-08 14:53 ` Liliana Marie Prikler @ 2023-10-09 20:36 ` Liliana Marie Prikler 0 siblings, 0 replies; 14+ messages in thread From: Liliana Marie Prikler @ 2023-10-09 20:36 UTC (permalink / raw) To: Vivien Kraus, Maxim Cournoyer, 66339-done; +Cc: rg Am Sonntag, dem 08.10.2023 um 16:53 +0200 schrieb Liliana Marie Prikler: > [...] > Otherwise LGTM. I'd commit it, but my machine is currently busy > building half of core-updates for no reason. No longer busy, time to commit. Thanks ^ permalink raw reply [flat|nested] 14+ messages in thread
* bug#66339: [PATCH gnome-team v5] gnu: glib: Set runstatedir. 2023-10-06 21:41 ` Liliana Marie Prikler 2023-10-04 10:47 ` bug#66339: [PATCH gnome-team v6] " Vivien Kraus via Bug reports for GNU Guix @ 2023-10-06 21:12 ` Vivien Kraus via Bug reports for GNU Guix 2023-10-07 14:39 ` bug#66339: Gnome-team dbus socket in /var/run/dbus, not /run/dbus Maxim Cournoyer 1 sibling, 1 reply; 14+ messages in thread From: Vivien Kraus via Bug reports for GNU Guix @ 2023-10-06 21:12 UTC (permalink / raw) To: Liliana Marie Prikler, 66339; +Cc: rg, maxim.cournoyer Glib has made /run the default runstatedir: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3101 However, in Guix, the default runstatedir is /var/run. * gnu/packages/glib.scm (glib): Set runtime_dir to /var/run. --- I changed my mind again! Following the IRC discussion, Guix has a separate /var/run and /run (and puts /run/current-system/ in /run). So, /var/run/dbus is actually the correct place to put the system session socket. gnu/packages/glib.scm | 1 + 1 file changed, 1 insertion(+) diff --git a/gnu/packages/glib.scm b/gnu/packages/glib.scm index 8af89d60e0..c4fcc20bb6 100644 --- a/gnu/packages/glib.scm +++ b/gnu/packages/glib.scm @@ -254,6 +254,7 @@ (define glib #:configure-flags #~(list "--default-library=both" "-Dman=false" "-Dselinux=disabled" + "-Druntime_dir=/var/run" (string-append "--bindir=" #$output:bin "/bin")) #:phases base-commit: b18b2d13488f2a92331ccad2dc8cbb54ee15582f -- 2.41.0 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* bug#66339: Gnome-team dbus socket in /var/run/dbus, not /run/dbus 2023-10-06 21:12 ` bug#66339: [PATCH gnome-team v5] gnu: glib: Set runstatedir Vivien Kraus via Bug reports for GNU Guix @ 2023-10-07 14:39 ` Maxim Cournoyer 2023-10-08 15:40 ` Bruno Victal 0 siblings, 1 reply; 14+ messages in thread From: Maxim Cournoyer @ 2023-10-07 14:39 UTC (permalink / raw) To: Vivien Kraus; +Cc: rg, 66339, Liliana Marie Prikler Hi, Vivien Kraus <vivien@planete-kraus.eu> writes: > Glib has made /run the default runstatedir: > > https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3101 > > However, in Guix, the default runstatedir is /var/run. > > * gnu/packages/glib.scm (glib): Set runtime_dir to /var/run. > --- > > I changed my mind again! Following the IRC discussion, Guix has a separate > /var/run and /run (and puts /run/current-system/ in /run). So, /var/run/dbus > is actually the correct place to put the system session socket. I don't follow; why does it matter that Guix puts its current-system directory under /run? /run is to be shared by many applications, like /tmp, no? I still see /var/run as the legacy directory of /run, so I'd prefer we standardize to use the modern variant to reduce this kind of friction with the applications which will only grow in the future. -- Thanks, Maxim ^ permalink raw reply [flat|nested] 14+ messages in thread
* bug#66339: Gnome-team dbus socket in /var/run/dbus, not /run/dbus 2023-10-07 14:39 ` bug#66339: Gnome-team dbus socket in /var/run/dbus, not /run/dbus Maxim Cournoyer @ 2023-10-08 15:40 ` Bruno Victal 0 siblings, 0 replies; 14+ messages in thread From: Bruno Victal @ 2023-10-08 15:40 UTC (permalink / raw) To: Maxim Cournoyer, Vivien Kraus; +Cc: rg, 66339, Liliana Marie Prikler Hi, On 2023-10-07 15:39, Maxim Cournoyer wrote: > Hi, > > Vivien Kraus <vivien@planete-kraus.eu> writes: > >> Glib has made /run the default runstatedir: >> >> https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3101 >> >> However, in Guix, the default runstatedir is /var/run. >> >> * gnu/packages/glib.scm (glib): Set runtime_dir to /var/run. >> --- >> >> I changed my mind again! Following the IRC discussion, Guix has a separate >> /var/run and /run (and puts /run/current-system/ in /run). So, /var/run/dbus >> is actually the correct place to put the system session socket. I recommend consulting the dbus spec [1] (System message bus subsection). If I understood it correctly, `/var/run/dbus' is correct when the environment variable DBUS_SYSTEM_BUS_ADDRESS is not set. The /var/run/dbus or /run/dbus confusion is clarified in the third paragraph: “On systems where /var/run/ is known to be synonymous with /run/ (such as most Linux operating system distributions), implementations might prefer to make use of that knowledge to connect to or listen on unix:path=/run/dbus/system_bus_socket instead, […]” So it's up for the dbus implementation to detect whether /var/run/ is a symlink to /run and whether it wants to explicitly choose /run if that's the case though none of this is mandatory. […] > I still see /var/run as the legacy directory of /run, so I'd prefer we > standardize to use the modern variant to reduce this kind of friction > with the applications which will only grow in the future. My understanding is that the implementation should be placing them under /var/run/dbus but this is orthogonal to the value of runstatedir. In view with [2] I think runstatedir should be /run and Guix should be modernized to have /var/run symlinked to /run. [1]: <https://dbus.freedesktop.org/doc/dbus-specification.html> [2]: <https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch05s13.html> -- Furthermore, I consider that nonfree software must be eradicated. Cheers, Bruno. ^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2023-10-09 20:37 UTC | newest] Thread overview: 14+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <3121a39dc569ff872afe74a8871ef71456ea5451.camel@univ-reims.fr> 2023-10-04 10:47 ` bug#66339: [WIP PATCH gnome-team] gnu: dbus-service: make the session available under /run/dbus Vivien Kraus via Bug reports for GNU Guix 2023-10-04 18:30 ` Liliana Marie Prikler 2023-10-04 10:47 ` bug#66339: [PATCH gnome-team v2] " Vivien Kraus via Bug reports for GNU Guix 2023-10-05 4:41 ` Liliana Marie Prikler 2023-10-04 10:47 ` bug#66339: [PATCH gnome-team v3] " Vivien Kraus via Bug reports for GNU Guix 2023-10-06 18:50 ` Liliana Marie Prikler 2023-10-04 10:47 ` bug#66339: [PATCH gnome-team v4] " Vivien Kraus via Bug reports for GNU Guix 2023-10-06 21:41 ` Liliana Marie Prikler 2023-10-04 10:47 ` bug#66339: [PATCH gnome-team v6] " Vivien Kraus via Bug reports for GNU Guix 2023-10-08 14:53 ` Liliana Marie Prikler 2023-10-09 20:36 ` Liliana Marie Prikler 2023-10-06 21:12 ` bug#66339: [PATCH gnome-team v5] gnu: glib: Set runstatedir Vivien Kraus via Bug reports for GNU Guix 2023-10-07 14:39 ` bug#66339: Gnome-team dbus socket in /var/run/dbus, not /run/dbus Maxim Cournoyer 2023-10-08 15:40 ` Bruno Victal
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/guix.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.