bug-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#47007: dcb640f02b broke guix environment --container


From: Ludovic Courtès
Subject: bug#47007: dcb640f02b broke guix environment --container
Date: Tue, 09 Mar 2021 17:17:10 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

Hi,

Jelle Licht <jlicht@fsfe.org> skribis:

> There you go:
>
> 26123 stat("/gnu/store/mmhimfwmmidf09jw1plw3aw1g1zn2nkh-bash-static-5.0.16", 
> {st_mode=S_IFDIR|0555, st_size=4096, ...}) = 0
> 26123 mkdir("/tmp", 0777)               = -1 EEXIST (File exists)
> 26123 mkdir("/tmp/guix-directory.9IH6jJ", 0777) = -1 EEXIST (File exists)
> 26123 mkdir("/tmp/guix-directory.9IH6jJ/gnu", 0777) = 0
> 26123 mkdir("/tmp/guix-directory.9IH6jJ/gnu/store", 0777) = 0
> 26123 
> mkdir("/tmp/guix-directory.9IH6jJ/gnu/store/mmhimfwmmidf09jw1plw3aw1g1zn2nkh-bash-static-5.0.16",
>  0777) = 0
> 26123 mount("/gnu/store/mmhimfwmmidf09jw1plw3aw1g1zn2nkh-bash-static-5.0.16", 
> "/tmp/guix-directory.9IH6jJ//gnu/store/mmhimfwmmidf09jw1plw3aw1g1zn2nkh-bash-static-5.0.16",
>  0x15a2060, MS_RDONLY|MS_BIND|MS_RELATIME, NULL) = 0
> 26123 mount("/gnu/store/mmhimfwmmidf09jw1plw3aw1g1zn2nkh-bash-static-5.0.16", 
> "/tmp/guix-directory.9IH6jJ//gnu/store/mmhimfwmmidf09jw1plw3aw1g1zn2nkh-bash-static-5.0.16",
>  0x15a20f0, MS_RDONLY|MS_REMOUNT|MS_BIND|MS_RELATIME, NULL) = -1 EPERM 
> (Operation not permitted)

On my machine (Guix System), the same thing works:

--8<---------------cut here---------------start------------->8---
19524 
mkdir("/tmp/guix-directory.Js9BMV/gnu/store/mmhimfwmmidf09jw1plw3aw1g1zn2nkh-bash-static-5.0.16",
 0777) = 0
19524 mount("/gnu/store/mmhimfwmmidf09jw1plw3aw1g1zn2nkh-bash-static-5.0.16", 
"/tmp/guix-directory.Js9BMV//gnu/store/mmhimfwmmidf09jw1plw3aw1g1zn2nkh-bash-static-5.0.16",
 0x153e200, MS_RDONLY|MS_BIND|MS_RELATIME, NULL) = 0
19524 mount("/gnu/store/mmhimfwmmidf09jw1plw3aw1g1zn2nkh-bash-static-5.0.16", 
"/tmp/guix-directory.Js9BMV//gnu/store/mmhimfwmmidf09jw1plw3aw1g1zn2nkh-bash-static-5.0.16",
 0x153e0f0, MS_RDONLY|MS_REMOUNT|MS_BIND|MS_RELATIME, NULL) = 0
--8<---------------cut here---------------end--------------->8---

> /dev/sda1 / ext4 rw,relatime,data=ordered 0 0
> none /dev/pts devpts rw,relatime,gid=996,mode=620,ptmxmode=000 0 0
> none /sys/kernel/debug debugfs rw,relatime 0 0
> tmpfs /dev/shm tmpfs rw,nosuid,nodev,relatime 0 0
> /dev/sda1 /gnu/store ext4 ro,noatime,data=ordered 0 0

Here you have “ro,noatime,data=ordered” and I have “ro,relatime”.

At any rate, it seems the bug is that in your case it should be picking
MS_NOATIME and not MS_RELATIME, which is must have copied from /.

Indeed, the trick to find the right device in that commit is wrong
because it finds two devices in this case: root and the /gnu/store bind
mount.

--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> ,use(guix build syscalls)
scheme@(guile-user)> (filter (lambda (m)
                               (= (mount-device-number m) (stat:dev (lstat 
"/gnu/store"))))
                             (mounts))
$13 = (#<<mount> devno: 64768 source: "/dev/dm-0" point: "/" type: "ext4" 
options: "rw,relatime"> #<<mount> devno: 64768 source: "/dev/dm-0" point: 
"/gnu/store" type: "ext4" options: "ro,relatime">)
--8<---------------cut here---------------end--------------->8---

In my case it’s fine because they have the same options, but in your
case it breaks because they have different options and it picks the
wrong one.

Could you try the attached patch?

Thanks,
Ludo’.

diff --git a/gnu/build/file-systems.scm b/gnu/build/file-systems.scm
index aca4aad848..64c2557a43 100644
--- a/gnu/build/file-systems.scm
+++ b/gnu/build/file-systems.scm
@@ -920,11 +920,9 @@ corresponds to the symbols listed in FLAGS."
                           ;; MS_REMOUNT call below fails with EPERM.
                           ;; See <https://bugs.gnu.org/46292>
                           (if (memq 'bind-mount (file-system-flags fs))
-                              (or (and=> (find (let ((devno (stat:dev
-                                                             (lstat source))))
-                                                 (lambda (mount)
-                                                   (= (mount-device-number 
mount)
-                                                      devno)))
+                              (or (and=> (find (lambda (mount)
+                                                 (= (mount-point mount)
+                                                    source))
                                                (mounts))
                                          mount-flags)
                                   0)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]