Cannot declare an NFS mount using the <file-system> record

  • Done
  • quality assurance status badge
Details
3 participants
  • Giovanni Biscuolo
  • Ludovic Courtès
  • Maxim Cournoyer
Owner
unassigned
Submitted by
Maxim Cournoyer
Severity
normal
M
M
Maxim Cournoyer wrote on 10 Feb 2020 20:41
(name . bug-guix)(address . bug-guix@gnu.org)
87pnem2ps1.fsf@gmail.com
When I try adding an NFS mount point to my Guix System, like:


Toggle snippet (9 lines)
[...]
(file-system
(device "192.168.1.10:/mnt/scratch/")
(mount-point "/mnt/scratch/")
(type "nfs")
(options "rw,async,soft,noexec"))
[...]

Reconfiguring fails with the message:

error: device '192.168.1.10' not found: No such file or directory
hint: If '192.168.1.10' is a file system label, write
`(file-system-label "192.168.1.10")' in your `device' field.

So it doesn't appear to be possible to declare an NFS mount currently,
despite commit 0c85db79f7a8abc3bcdbf8931d959fe94306a5a1 that'd suggest
it should be possible.

Maxim
M
M
Maxim Cournoyer wrote on 12 Feb 2020 09:54
(address . 39551@debbugs.gnu.org)
87d0akfao2.fsf@gmail.com
Hello,

Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:

Toggle quote (22 lines)
> When I try adding an NFS mount point to my Guix System, like:
>
> [...]
> (file-system
> (device "192.168.1.10:/mnt/scratch/")
> (mount-point "/mnt/scratch/")
> (type "nfs")
> (options "rw,async,soft,noexec"))
> [...]
>
> Reconfiguring fails with the message:
>
> error: device '192.168.1.10' not found: No such file or directory
> hint: If '192.168.1.10' is a file system label, write
> `(file-system-label "192.168.1.10")' in your `device' field.
>
> So it doesn't appear to be possible to declare an NFS mount currently,
> despite commit 0c85db79f7a8abc3bcdbf8931d959fe94306a5a1 that'd suggest
> it should be possible.
>
> Maxim

The attached patch fixes this issue
From 6aad93c3a2ccef9936cadeeab92edece7afac0dd Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Mon, 10 Feb 2020 15:06:50 -0500
Subject: [PATCH] scripts: system: Disable checks for NFS shares.

Fixes issue #39551 (https://bugs.nu.org/39551).

* guix/scripts/system.scm (check-file-system-availability): Ignore file
systems of the NFS type.
---
guix/scripts/system.scm | 2 ++
1 file changed, 2 insertions(+)

Toggle diff (15 lines)
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index b0386a1392..26a1599a93 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -566,6 +566,8 @@ any, are available. Raise an error if they're not."
(and (file-system-mount? fs)
(not (member (file-system-type fs)
%pseudo-file-system-types))
+ ;; Fixes issue #39551 (see: https://bugs.gnu.org/39551).
+ (not (string-prefix? "nfs" (file-system-type fs)))
(not (memq 'bind-mount (file-system-flags fs)))))
file-systems))
--
2.25.0
G
G
Giovanni Biscuolo wrote on 12 Feb 2020 19:30
878sl7bqud.fsf@roquette.mug.biscuolo.net
Hello,

Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:

Toggle quote (2 lines)
> The attached patch fixes this issue

[...]

Toggle quote (13 lines)
> diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
> index b0386a1392..26a1599a93 100644
> --- a/guix/scripts/system.scm
> +++ b/guix/scripts/system.scm
> @@ -566,6 +566,8 @@ any, are available. Raise an error if they're not."
> (and (file-system-mount? fs)
> (not (member (file-system-type fs)
> %pseudo-file-system-types))
> + ;; Fixes issue #39551 (see: https://bugs.gnu.org/39551).
> + (not (string-prefix? "nfs" (file-system-type fs)))
> (not (memq 'bind-mount (file-system-flags fs)))))
> file-systems))

Please is it possible to also add nfs4 to this fix?

Thanks! Gio'

--
Giovanni Biscuolo

Xelera IT Infrastructures
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEERcxjuFJYydVfNLI5030Op87MORIFAl5ERFsACgkQ030Op87M
ORK/ug/8Cu5dlInqojWT2Ki79/1WTOMl8BUiGAILx9mx7Of8R8xhU/3235sIH6sG
hBkPJV+pLInMeIfKq5yLEvV1gDbvhzLwAnHoTvpxKRK+Q2mNiXD9EKBc+BqHUdUJ
nkvmQZuJD7K9pAGKyMHZTUuUBYyD0t5P1SxOlpku0y1Mrire505rRHFoo8tMmshG
GA1PHttLni9VRbnqmbnfaWeKf5S0MUVsVXNvK5dQt8nKUELn0Xs0dtcHWG4kTgId
Lv+clDFyBqBmkYrijCatrLYf2LrLgwi97wE82jgNwrqcdIAMz+XFxNymMKoz+vJu
8hup2V5PUZ28s//RVPV3ba/FBDzCY3zLG5dS1Zm7daeIcoBYnTzpvl6zWnvWwk++
dtSljJMFRIy+PLZ3IWxoct7Dr0xIrlB2fRkCJsptvVDIfXZNbThzN3jujXrZrJyi
F7zwdocHxffL2i0W0A9stSTNzR0cj18qhAbY9ENEXRhZwsEPuqrPHzWUmjkwTF2t
SESKp10m0nMxWxs4ZHmxq6YvQ2fFJu62cy0S4CKuPGFQ8T8//oLBt8tYzhSTNFb0
nNrFkO6aN08r8+j9VB1jGBEazyl+UinaPhOoH3dP5/5Ci36dTdf0/ZH1p1D/NQDI
XUPKju19XVpiAM/nQIwpBUFYy2wUwx/b+GPMFFh1QQCgEHbSwFU=
=QWss
-----END PGP SIGNATURE-----

M
M
Maxim Cournoyer wrote on 12 Feb 2020 20:12
(name . Giovanni Biscuolo)(address . g@xelera.eu)(address . 39551@debbugs.gnu.org)
8736bf39i7.fsf@gmail.com
Hello Giovanni,

Giovanni Biscuolo <g@xelera.eu> writes:

Toggle quote (25 lines)
> Hello,
>
> Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:
>
>> The attached patch fixes this issue
>
> [...]
>
>> diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
>> index b0386a1392..26a1599a93 100644
>> --- a/guix/scripts/system.scm
>> +++ b/guix/scripts/system.scm
>> @@ -566,6 +566,8 @@ any, are available. Raise an error if they're not."
>> (and (file-system-mount? fs)
>> (not (member (file-system-type fs)
>> %pseudo-file-system-types))
>> + ;; Fixes issue #39551 (see: https://bugs.gnu.org/39551).
>> + (not (string-prefix? "nfs" (file-system-type fs)))
>> (not (memq 'bind-mount (file-system-flags fs)))))
>> file-systems))
>
> Please is it possible to also add nfs4 to this fix?
>
> Thanks! Gio'

It should work already, given that I'm checking for a string *prefix* of
"nfs" :-).
M
M
Maxim Cournoyer wrote on 12 Feb 2020 20:13
bug#39551: [PATCH v2] Cannot declare an NFS mount using the <file-system> record
(address . 39551@debbugs.gnu.org)
87wo8r1uvt.fsf_-_@gmail.com
Attached is v2 of the patch, fixing the comment in the code as reported
by Tobias.

Thank you!
From 666ce396f2a53bec4d88ee90c1612166421f3ed8 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Mon, 10 Feb 2020 15:06:50 -0500
Subject: [PATCH] scripts: system: Do not validate network file systems.

Fixes issue #39551 (https://bugs.gnu.org/39551).

* guix/scripts/system.scm (check-file-system-availability): Ignore file
systems of the NFS type.
---
guix/scripts/system.scm | 2 ++
1 file changed, 2 insertions(+)

Toggle diff (15 lines)
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index b0386a1392..ac2475c551 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -566,6 +566,8 @@ any, are available. Raise an error if they're not."
(and (file-system-mount? fs)
(not (member (file-system-type fs)
%pseudo-file-system-types))
+ ;; Don't try to validate network file systems.
+ (not (string-prefix? "nfs" (file-system-type fs)))
(not (memq 'bind-mount (file-system-flags fs)))))
file-systems))
--
2.23.0
M
M
Maxim Cournoyer wrote on 13 Feb 2020 16:45
(address . 39551@debbugs.gnu.org)
87r1yybidp.fsf@gmail.com
Still more work needs to be done to have working NFS mounts though,

Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:

Toggle quote (5 lines)
> Attached is v2 of the patch, fixing the comment in the code as reported
> by Tobias.
>
> Thank you!

Naively inputting what you'd use in /etc/fstab into your <file-system>
record is not going to work because (gnu build file-systems)'s
mount-file-systems uses the *system call* mount rather than the user
command (mount(2) vs mount(8)), which don't accept the same arguments.

E.g.:

Toggle snippet (13 lines)
scheme@(guix-user)> ,import (gnu system file-systems)
scheme@(guix-user)> ,import (gnu build file-systems)
scheme@(guix-user)> (define fs (file-system
(device "192.168.51.34:/mnt/scratch/yocto-sstate")
(mount-point "/mnt/scratch/yocto-sstate")
(type "nfs")
(options "rw,async,soft,noexec")))

scheme@(guix-user)> (mount-file-system fs)
No file system check procedure for 192.168.51.34:/mnt/scratch/yocto-sstate; skipping
guix/build/syscalls.scm:486:8: In procedure mount: mount "192.168.51.34:/mnt/scratch/yocto-sstate" on "/root//mnt/scratch/yocto-sstate": Invalid argument

Although:

Toggle snippet (9 lines)
cat /etc/fstab
# This file was generated from your Guix configuration. Any changes
# will be lost upon reboot or reconfiguration.

LABEL=btrfs-pool / btrfs subvol=rootfs,compress=lzo
LABEL=btrfs-pool /home btrfs subvol=home,compress=lzo
192.168.51.34:/mnt/scratch/yocto-sstate /mnt/scratch/yocto-sstate nfs rw,async,soft,noexec

# mount /mnt/scratch/yocto-sstate
# echo $?
0
L
L
Ludovic Courtès wrote on 13 Feb 2020 22:37
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)(address . 39551@debbugs.gnu.org)
87a75m2mpd.fsf@gnu.org
Howdy!

Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:

Toggle quote (7 lines)
>>From 666ce396f2a53bec4d88ee90c1612166421f3ed8 Mon Sep 17 00:00:00 2001
> From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
> Date: Mon, 10 Feb 2020 15:06:50 -0500
> Subject: [PATCH] scripts: system: Do not validate network file systems.
>
> Fixes issue #39551 (https://bugs.gnu.org/39551).

Nitpick: for consistency, you can make it:


That’ll make grepping easier.

Toggle quote (3 lines)
> * guix/scripts/system.scm (check-file-system-availability): Ignore file
> systems of the NFS type.

LGTM. Thanks for finding the root cause and coming up with a fix!

Ludo’.
M
M
Maxim Cournoyer wrote on 18 Feb 2020 18:28
Re: bug#39551: Cannot declare an NFS mount using the <file-system> record
(name . Giovanni Biscuolo)(address . g@xelera.eu)(address . 39551-done@debbugs.gnu.org)
87v9o3yfcu.fsf@gmail.com
Giovanni Biscuolo <g@xelera.eu> writes:

Toggle quote (25 lines)
> Hello,
>
> Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:
>
>> The attached patch fixes this issue
>
> [...]
>
>> diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
>> index b0386a1392..26a1599a93 100644
>> --- a/guix/scripts/system.scm
>> +++ b/guix/scripts/system.scm
>> @@ -566,6 +566,8 @@ any, are available. Raise an error if they're not."
>> (and (file-system-mount? fs)
>> (not (member (file-system-type fs)
>> %pseudo-file-system-types))
>> + ;; Fixes issue #39551 (see: https://bugs.gnu.org/39551).
>> + (not (string-prefix? "nfs" (file-system-type fs)))
>> (not (memq 'bind-mount (file-system-flags fs)))))
>> file-systems))
>
> Please is it possible to also add nfs4 to this fix?
>
> Thanks! Gio'

Done with commit adbdf188c28c503a9c875b793bc88548d3cd702f. Please not
that booting with NFS still seems to be problematic, at least in my
experience. I had to use set mount? to #f and check? to #f as well in
the <file-system> record. I'll try to address these issues separately.

Maxim
Closed
?