GNU bug report logs - #70165
D-Bus system service breaks reconfiguration when /var/run/dbus is present + /run and /var/run are on separate file systems.

Previous Next

Package: guix;

Reported by: Hilton Chain <hako <at> ultrarare.space>

Date: Wed, 3 Apr 2024 16:39:03 UTC

Severity: normal

To reply to this bug, email your comments to 70165 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to vivien <at> planete-kraus.eu, liliana.prikler <at> gmail.com, bug-guix <at> gnu.org:
bug#70165; Package guix. (Wed, 03 Apr 2024 16:39:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Hilton Chain <hako <at> ultrarare.space>:
New bug report received and forwarded. Copy sent to vivien <at> planete-kraus.eu, liliana.prikler <at> gmail.com, bug-guix <at> gnu.org. (Wed, 03 Apr 2024 16:39:04 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Hilton Chain <hako <at> ultrarare.space>
To: bug-guix <at> gnu.org
Subject: D-Bus system service breaks reconfiguration when /var/run/dbus is
 present + /run and /var/run are on separate file systems.
Date: Thu, 04 Apr 2024 00:36:06 +0800
Hi,

I have /var/run and /run on separate file systems, recently I noticed system
reconfiguration stopped with "guix system: error: rename-file: Invalid
cross-device link":

--8<---------------cut here---------------start------------->8---
newfstatat(AT_FDCWD, "/run", {st_mode=S_IFDIR|0755, st_size=440, ...}, AT_SYMLINK_NOFOLLOW) = 0
newfstatat(AT_FDCWD, "/run/dbus", {st_mode=S_IFDIR|0700, st_size=40, ...}, AT_SYMLINK_NOFOLLOW) = 0
mkdir("/run", 0777)                     = -1 EEXIST (File exists)
mkdir("/run/dbus", 0777)                = -1 EEXIST (File exists)
chown("/run/dbus", 988, 983)            = 0
chmod("/run/dbus", 0755)                = 0
symlink("/run/dbus", "/var/run/dbus")   = -1 EEXIST (File exists)
readlink("/var/run/dbus", 0x1634730, 100) = -1 EINVAL (Invalid argument)
openat(AT_FDCWD, "/var/run/dbus", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 17
newfstatat(17, "", {st_mode=S_IFDIR|0755, st_size=80, ...}, AT_EMPTY_PATH) = 0
getdents64(17, 0x16dfe10 /* 4 entries */, 32768) = 112
rename("/var/run/dbus/system_bus_socket", "/run/dbus/system_bus_socket") = -1 EXDEV (Invalid cross-device link)
close(13)                               = 0
write(2, "\33[1m\33[0mguix system: error: rena"..., 67guix system: error: rename-file: Invalid cross-device link
) = 67
exit_group(1)                           = ?
+++ exited with 1 +++
--8<---------------cut here---------------end--------------->8---

It's because /var/run/dbus was used for dbus service before, and now migration
to /run/dbus is done with ‘rename-file’:

--8<---------------cut here---------------start------------->8---
(rename-file (string-append "/var/run/dbus/" next)
             (string-append "/run/dbus/" next))
--8<---------------cut here---------------end--------------->8---

I think the logic can be improved for this case, but not sure how at the moment.
What do you think?

Thanks




Information forwarded to bug-guix <at> gnu.org:
bug#70165; Package guix. (Thu, 04 Apr 2024 18:53:01 GMT) Full text and rfc822 format available.

Message #8 received at 70165 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: Hilton Chain <hako <at> ultrarare.space>, 70165 <at> debbugs.gnu.org
Cc: Vivien Kraus <vivien <at> planete-kraus.eu>
Subject: Re: bug#70165: D-Bus system service breaks reconfiguration when
 /var/run/dbus is present + /run and /var/run are on separate file systems.
Date: Thu, 04 Apr 2024 20:52:09 +0200
Am Donnerstag, dem 04.04.2024 um 00:36 +0800 schrieb Hilton Chain:
> Hi,
> 
> I have /var/run and /run on separate file systems, recently I noticed
> system reconfiguration stopped with "guix system: error: rename-file:
> Invalid cross-device link":
> 
> --8<---------------cut here---------------start------------->8---
> newfstatat(AT_FDCWD, "/run", {st_mode=S_IFDIR|0755, st_size=440,
> ...}, AT_SYMLINK_NOFOLLOW) = 0
> newfstatat(AT_FDCWD, "/run/dbus", {st_mode=S_IFDIR|0700, st_size=40,
> ...}, AT_SYMLINK_NOFOLLOW) = 0
> mkdir("/run", 0777)                     = -1 EEXIST (File exists)
> mkdir("/run/dbus", 0777)                = -1 EEXIST (File exists)
> chown("/run/dbus", 988, 983)            = 0
> chmod("/run/dbus", 0755)                = 0
> symlink("/run/dbus", "/var/run/dbus")   = -1 EEXIST (File exists)
> readlink("/var/run/dbus", 0x1634730, 100) = -1 EINVAL (Invalid
> argument)
> openat(AT_FDCWD, "/var/run/dbus",
> O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 17
> newfstatat(17, "", {st_mode=S_IFDIR|0755, st_size=80, ...},
> AT_EMPTY_PATH) = 0
> getdents64(17, 0x16dfe10 /* 4 entries */, 32768) = 112
> rename("/var/run/dbus/system_bus_socket",
> "/run/dbus/system_bus_socket") = -1 EXDEV (Invalid cross-device link)
> close(13)                               = 0
> write(2, "\33[1m\33[0mguix system: error: rena"..., 67guix
> system: error: rename-file: Invalid cross-device link
> ) = 67
> exit_group(1)                           = ?
> +++ exited with 1 +++
> --8<---------------cut here---------------end--------------->8---
> 
> It's because /var/run/dbus was used for dbus service before, and now
> migration to /run/dbus is done with ‘rename-file’:
> 
> --8<---------------cut here---------------start------------->8---
> (rename-file (string-append "/var/run/dbus/" next)
>              (string-append "/run/dbus/" next))
> --8<---------------cut here---------------end--------------->8---
> 
> I think the logic can be improved for this case, but not sure how at
> the moment.
> What do you think?
Is there a *good* reason to have those be separate file systems? :D
What does the FHS say?

Anyhow, cross-fs symlinks and rename-file ought to work assuming that
both file-systems are already mounted.  Is one of them not needed for
boot?

Cheers




Information forwarded to bug-guix <at> gnu.org:
bug#70165; Package guix. (Fri, 05 Apr 2024 01:55:01 GMT) Full text and rfc822 format available.

Message #11 received at 70165 <at> debbugs.gnu.org (full text, mbox):

From: Hilton Chain <hako <at> ultrarare.space>
To: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
Cc: Vivien Kraus <vivien <at> planete-kraus.eu>, 70165 <at> debbugs.gnu.org
Subject: Re: bug#70165: D-Bus system service breaks reconfiguration when
 /var/run/dbus is present + /run and /var/run are on separate file systems.
Date: Fri, 05 Apr 2024 09:53:25 +0800
On Fri, 05 Apr 2024 02:52:09 +0800,
Liliana Marie Prikler wrote:
>
> Am Donnerstag, dem 04.04.2024 um 00:36 +0800 schrieb Hilton Chain:
> > Hi,
> >
> > I have /var/run and /run on separate file systems, recently I noticed
> > system reconfiguration stopped with "guix system: error: rename-file:
> > Invalid cross-device link":
> >
> > --8<---------------cut here---------------start------------->8---
> > newfstatat(AT_FDCWD, "/run", {st_mode=S_IFDIR|0755, st_size=440,
> > ...}, AT_SYMLINK_NOFOLLOW) = 0
> > newfstatat(AT_FDCWD, "/run/dbus", {st_mode=S_IFDIR|0700, st_size=40,
> > ...}, AT_SYMLINK_NOFOLLOW) = 0
> > mkdir("/run", 0777)                     = -1 EEXIST (File exists)
> > mkdir("/run/dbus", 0777)                = -1 EEXIST (File exists)
> > chown("/run/dbus", 988, 983)            = 0
> > chmod("/run/dbus", 0755)                = 0
> > symlink("/run/dbus", "/var/run/dbus")   = -1 EEXIST (File exists)
> > readlink("/var/run/dbus", 0x1634730, 100) = -1 EINVAL (Invalid
> > argument)
> > openat(AT_FDCWD, "/var/run/dbus",
> > O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 17
> > newfstatat(17, "", {st_mode=S_IFDIR|0755, st_size=80, ...},
> > AT_EMPTY_PATH) = 0
> > getdents64(17, 0x16dfe10 /* 4 entries */, 32768) = 112
> > rename("/var/run/dbus/system_bus_socket",
> > "/run/dbus/system_bus_socket") = -1 EXDEV (Invalid cross-device link)
> > close(13)                               = 0
> > write(2, "\33[1m\33[0mguix system: error: rena"..., 67guix
> > system: error: rename-file: Invalid cross-device link
> > ) = 67
> > exit_group(1)                           = ?
> > +++ exited with 1 +++
> > --8<---------------cut here---------------end--------------->8---
> >
> > It's because /var/run/dbus was used for dbus service before, and now
> > migration to /run/dbus is done with ‘rename-file’:
> >
> > --8<---------------cut here---------------start------------->8---
> > (rename-file (string-append "/var/run/dbus/" next)
> >              (string-append "/run/dbus/" next))
> > --8<---------------cut here---------------end--------------->8---
> >
> > I think the logic can be improved for this case, but not sure how at
> > the moment.
> > What do you think?
> Is there a *good* reason to have those be separate file systems? :D
> What does the FHS say?
>
> Anyhow, cross-fs symlinks and rename-file ought to work assuming that
> both file-systems are already mounted.  Is one of them not needed for
> boot?

Specifically, I'm using tmpfs for them:

--8<---------------cut here---------------start------------->8---
(file-system
  (type "tmpfs")
  (mount-point "/run")
  (device "tmpfs")
  (flags '(no-dev strict-atime))
  (options "mode=0755,nr_inodes=800k,size=20%")
  (needed-for-boot? #t)
  (check? #f))

(file-system
  (type "tmpfs")
  (mount-point "/var/run")
  (device "tmpfs")
  (flags '(no-suid no-dev strict-atime))
  (options "mode=0755,nr_inodes=800k,size=20%")
  (needed-for-boot? #t)
  (check? #f))
--8<---------------cut here---------------end--------------->8---


And here's a reproducer:

--8<---------------cut here---------------start------------->8---
test_dir="$(mktemp --directory)"

sudo mount --type tmpfs none "$test_dir"
touch "$test_dir/test"

guile -c "(rename-file \"$test_dir/test\" \"/tmp/test\")"

sudo umount "$test_dir"
rmdir "$test_dir"
--8<---------------cut here---------------end--------------->8---

--8<---------------cut here---------------start------------->8---
Backtrace:
In ice-9/boot-9.scm:
  1752:10  6 (with-exception-handler _ _ #:unwind? _ # _)
In unknown file:
           5 (apply-smob/0 #<thunk 7061ede8c300>)
In ice-9/boot-9.scm:
    724:2  4 (call-with-prompt ("prompt") #<procedure 7061ede99320 …> …)
In ice-9/eval.scm:
    619:8  3 (_ #(#(#<directory (guile-user) 7061ede8fc80>)))
In ice-9/command-line.scm:
   185:19  2 (_ #<input: string 7061ede89850>)
In unknown file:
           1 (eval (rename-file "/tmp/tmp.9wyzRfQ28l/test" "/tmp/…") #)
           0 (rename-file "/tmp/tmp.9wyzRfQ28l/test" "/tmp/test")

ERROR: In procedure rename-file:
In procedure rename-file: Invalid cross-device link
--8<---------------cut here---------------end--------------->8---




Information forwarded to bug-guix <at> gnu.org:
bug#70165; Package guix. (Sat, 06 Apr 2024 06:44:02 GMT) Full text and rfc822 format available.

Message #14 received at 70165 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: Hilton Chain <hako <at> ultrarare.space>
Cc: Ludovic Courtès <ludo <at> gnu.org>,
 Vivien Kraus <vivien <at> planete-kraus.eu>, 70165 <at> debbugs.gnu.org
Subject: Re: bug#70165: D-Bus system service breaks reconfiguration when
 /var/run/dbus is present + /run and /var/run are on separate file systems.
Date: Sat, 06 Apr 2024 08:43:28 +0200
Am Freitag, dem 05.04.2024 um 09:53 +0800 schrieb Hilton Chain:
> [H]ere's a reproducer:
> 
> --8<---------------cut here---------------start------------->8---
> test_dir="$(mktemp --directory)"
> 
> sudo mount --type tmpfs none "$test_dir"
> touch "$test_dir/test"
> 
> guile -c "(rename-file \"$test_dir/test\" \"/tmp/test\")"
> 
> sudo umount "$test_dir"
> rmdir "$test_dir"
> --8<---------------cut here---------------end--------------->8---
> 
> --8<---------------cut here---------------start------------->8---
> Backtrace:
> In ice-9/boot-9.scm:
>   1752:10  6 (with-exception-handler _ _ #:unwind? _ # _)
> In unknown file:
>            5 (apply-smob/0 #<thunk 7061ede8c300>)
> In ice-9/boot-9.scm:
>     724:2  4 (call-with-prompt ("prompt") #<procedure 7061ede99320 …>
> …)
> In ice-9/eval.scm:
>     619:8  3 (_ #(#(#<directory (guile-user) 7061ede8fc80>)))
> In ice-9/command-line.scm:
>    185:19  2 (_ #<input: string 7061ede89850>)
> In unknown file:
>            1 (eval (rename-file "/tmp/tmp.9wyzRfQ28l/test" "/tmp/…")
> #)
>            0 (rename-file "/tmp/tmp.9wyzRfQ28l/test" "/tmp/test")
> 
> ERROR: In procedure rename-file:
> In procedure rename-file: Invalid cross-device link
> --8<---------------cut here---------------end--------------->8---
If I understand this reproducer correctly, there aren't even symbolic
links involved, are there?

Adding Ludo to CC, because this looks like a Guile bug to me.

Cheers




Information forwarded to bug-guix <at> gnu.org:
bug#70165; Package guix. (Fri, 10 May 2024 14:24:01 GMT) Full text and rfc822 format available.

Message #17 received at 70165 <at> debbugs.gnu.org (full text, mbox):

From: "Collin J. Doering" <collin <at> rekahsoft.ca>
To: 70165 <at> debbugs.gnu.org
Subject: D-Bus system service breaks reconfiguration when /var/run/dbus is
 present + /run and /var/run are on separate file systems.
Date: Fri, 10 May 2024 10:22:19 -0400
[Message part 1 (text/plain, inline)]
Hi there,

I recently hit this issue, and was able work around it by:

1. Get root shell (via sudo or otherwise)
2. Disable dbus-system: 'herd stop guix-system'
3. Update guix: 'guix system reconfigure ...'
4. Reboot

Thought I would note it just in case its useful to someone else.

Kind regards,

-- 
Collin J. Doering

http://rekahsoft.ca
http://blog.rekahsoft.ca
http://git.rekahsoft.ca
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#70165; Package guix. (Thu, 23 May 2024 09:11:02 GMT) Full text and rfc822 format available.

Message #20 received at 70165 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
Cc: Hilton Chain <hako <at> ultrarare.space>, Vivien Kraus <vivien <at> planete-kraus.eu>,
 70165 <at> debbugs.gnu.org
Subject: Re: bug#70165: D-Bus system service breaks reconfiguration when
 /var/run/dbus is present + /run and /var/run are on separate file systems.
Date: Thu, 23 May 2024 11:10:06 +0200
Liliana Marie Prikler <liliana.prikler <at> gmail.com> skribis:

> Am Freitag, dem 05.04.2024 um 09:53 +0800 schrieb Hilton Chain:

[...]

>>            0 (rename-file "/tmp/tmp.9wyzRfQ28l/test" "/tmp/test")
>> 
>> ERROR: In procedure rename-file:
>> In procedure rename-file: Invalid cross-device link
>> --8<---------------cut here---------------end--------------->8---
> If I understand this reproducer correctly, there aren't even symbolic
> links involved, are there?
>
> Adding Ludo to CC, because this looks like a Guile bug to me.

‘rename-file’ merely wraps rename(2), which errors out with EXDEV
(“Invalid cross-link device”) when the source and targets are on
different file systems.

So the case above is behaving as expected.

What that means is that probably we shouldn’t be using ‘rename-file’
directly in cases where the source and target might be on different file
systems, and instead do something like:

  (define (rename-file* old new)
    ;; Like rename-file, but handle the case when OLD and NEW are on
    ;; different file systems.
    (catch 'system-error
      (lambda ()
        (rename-file old new))
      (lambda args
        (if (= EXDEV (system-error-errno args))
            (begin
              (copy-file old new)
              (delete-file old))
            (apply throw args)))))

(Untested.)

HTH!

Ludo’.




This bug report was last modified 1 year and 24 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.