[PATCH] services: nfs: Require file-systems to be mounted before starting NFS shepherd service.

OpenSubmitted by Danny Milosavljevic.
Details
2 participants
  • Danny Milosavljevic
  • Ludovic Courtès
Owner
unassigned
Severity
normal
D
D
Danny Milosavljevic wrote on 7 Sep 2020 18:47
(address . guix-patches@gnu.org)(name . Danny Milosavljevic)(address . dannym@scratchpost.org)
20200907164745.15932-1-dannym@scratchpost.org
* gnu/services/nfs.scm (nfs-shepherd-services): Require file-systems to be
mounted before starting NFS shepherd service.
---
gnu/services/nfs.scm | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

Toggle diff (40 lines)
diff --git a/gnu/services/nfs.scm b/gnu/services/nfs.scm
index 859097e788..24f746485b 100644
--- a/gnu/services/nfs.scm
+++ b/gnu/services/nfs.scm
@@ -292,7 +292,7 @@
           (shepherd-service
            (documentation "Run the NFS statd daemon.")
            (provision '(rpc.statd))
-           (requirement '(/proc/fs/nfsd rpcbind-daemon))
+           (requirement '(/proc/fs/nfsd rpcbind-daemon file-systems))
            (start
             #~(make-forkexec-constructor
                (list #$(file-append nfs-utils "/sbin/rpc.statd")
@@ -311,7 +311,7 @@
           (shepherd-service
            (documentation "Run the NFS mountd daemon.")
            (provision '(rpc.mountd))
-           (requirement '(/proc/fs/nfsd rpc.statd))
+           (requirement '(/proc/fs/nfsd rpc.statd file-systems))
            (start
             #~(make-forkexec-constructor
                (list #$(file-append nfs-utils "/sbin/rpc.mountd")
@@ -326,7 +326,7 @@
           (shepherd-service
            (documentation "Run the NFS daemon.")
            (provision '(rpc.nfsd))
-           (requirement '(/proc/fs/nfsd rpc.statd networking))
+           (requirement '(/proc/fs/nfsd rpc.statd networking file-systems))
            (start
             #~(lambda _
                 (zero? (apply system* #$(file-append nfs-utils "/sbin/rpc.nfsd")
@@ -352,7 +352,7 @@
           (shepherd-service
            (documentation "Run the NFS mountd daemon and refresh exports.")
            (provision '(nfs))
-           (requirement '(/proc/fs/nfsd rpc.nfsd rpc.mountd rpc.statd rpcbind-daemon))
+           (requirement '(/proc/fs/nfsd rpc.nfsd rpc.mountd rpc.statd rpcbind-daemon file-systems))
            (start
             #~(lambda _
                 (let ((rpcdebug #$(file-append nfs-utils "/sbin/rpcdebug")))
L
L
Ludovic Courtès wrote on 9 Sep 2020 10:27
(name . Danny Milosavljevic)(address . dannym@scratchpost.org)(address . 43257@debbugs.gnu.org)
87imcnmk25.fsf@gnu.org
Hey!

Danny Milosavljevic <dannym@scratchpost.org> skribis:

Toggle quote (3 lines)
> * gnu/services/nfs.scm (nfs-shepherd-services): Require file-systems to be
> mounted before starting NFS shepherd service.

[...]

Toggle quote (8 lines)
> +++ b/gnu/services/nfs.scm
> @@ -292,7 +292,7 @@
> (shepherd-service
> (documentation "Run the NFS statd daemon.")
> (provision '(rpc.statd))
> - (requirement '(/proc/fs/nfsd rpcbind-daemon))
> + (requirement '(/proc/fs/nfsd rpcbind-daemon file-systems))

Why do we need all of ‘file-systems’ rather than just the state file
systems?

Curiously,
Ludo’.
D
D
Danny Milosavljevic wrote on 9 Sep 2020 12:13
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 43257@debbugs.gnu.org)
20200909121313.321a18d5@scratchpost.org
Hi Ludo,

On Wed, 09 Sep 2020 10:27:30 +0200
Ludovic Courtès <ludo@gnu.org> wrote:

Toggle quote (3 lines)
> Why do we need all of ‘file-systems’ rather than just the state file
> systems?

It really depends on what one uses it for, but for me it's this use case:

* I have an extra hard drive that contains things I want to serve via
NFS (it has nothing to do with the root file system).
* The extra hard drive has to be mounted when NFS service starts up,
otherwise exportfs errors out:
If I don't require "file-systems", even if that drive is listed in the
operating-system's file-systems list, it won't be mounted in time.

I ran into this problem when merging Stefan's
new "nfs-root-fs" system test into gnu/tests/nfs.scm .

Does this make sense or is it the wrong solution?
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl9YqsIACgkQ5xo1VCww
uqUHCggAhKmzN5oBbY3176t57kRoQrdCKX3e0g/8szUNbpjn08HfkVmlwwdEwvws
uj22uyuyuxEH6QfXH9swwVLSEUXEreuCWEK2WGzFoGXgI5bOHIBDso3gbgMCRZXr
meWyNTXwo1HCORHXhnvFZrwxMTA/lxZoK5+9AnImzJ2Q2ECd8eQoN5xwg9+H0i1G
OzAzLcffTVdw2VLeEiQHPZDUc/vYa8em1uRTrxHdAkAGZkQOx6Gx6XgBlcI6A/3l
TOkwOJ8VyLOGBnryx35wywyM3iJGY2Z8ZIQ13i57PYG4g0hHcrvxBEuX7mI0BSen
OfZZifBEPOZzvc0o8CrohYaFOY2+Yg==
=v5fM
-----END PGP SIGNATURE-----


L
L
Ludovic Courtès wrote on 10 Sep 2020 09:42
(name . Danny Milosavljevic)(address . dannym@scratchpost.org)(address . 43257@debbugs.gnu.org)
87wo12jcvx.fsf@gnu.org
Hi Danny,

Danny Milosavljevic <dannym@scratchpost.org> skribis:

Toggle quote (15 lines)
> On Wed, 09 Sep 2020 10:27:30 +0200
> Ludovic Courtès <ludo@gnu.org> wrote:
>
>> Why do we need all of ‘file-systems’ rather than just the state file
>> systems?
>
> It really depends on what one uses it for, but for me it's this use case:
>
> * I have an extra hard drive that contains things I want to serve via
> NFS (it has nothing to do with the root file system).
> * The extra hard drive has to be mounted when NFS service starts up,
> otherwise exportfs errors out:
> If I don't require "file-systems", even if that drive is listed in the
> operating-system's file-systems list, it won't be mounted in time.

Oh, I see.

Toggle quote (5 lines)
> I ran into this problem when merging Stefan's
> new "nfs-root-fs" system test into gnu/tests/nfs.scm .
>
> Does this make sense or is it the wrong solution?

I just realized that these services should just all depend on
‘user-processes’ (which depends on ‘file-systems’). So you should
probably just do that.

You can double-check with ‘guix system shepherd-graph’ that the
dependency graph looks good.

Thanks,
Ludo’.
D
D
Danny Milosavljevic wrote on 10 Sep 2020 15:20
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 43257@debbugs.gnu.org)
20200910152042.4b33a84f@scratchpost.org
Hi Ludo,

On Thu, 10 Sep 2020 09:42:58 +0200
Ludovic Courtès <ludo@gnu.org> wrote:

Toggle quote (4 lines)
> I just realized that these services should just all depend on
> ‘user-processes’ (which depends on ‘file-systems’). So you should
> probably just do that.

Okay. Thanks.

Toggle quote (3 lines)
> You can double-check with ‘guix system shepherd-graph’ that the
> dependency graph looks good.

$ ./pre-inst-env guix system shepherd-graph -e '(@@ (gnu tests nfs) %nfs-os)'
gnu/tests/nfs.scm:162:4: error: missing root file system

I can probably work around it somehow--but just logging this not-nice user
interface here.
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl9aKCoACgkQ5xo1VCww
uqUagAf6AxGg/QJJaKmg1DsrZNCpcYJvO4aD3j7sKRLcbWlJjJCPBHSBmqdgy4Ff
Vp25kOECf8MrtYc+O7Z+Ln/aJ6GmOtYOouFfRssTDkHSTyYmhnxu/CoJMDuvGeAT
v6111rw+DW+++uu9gHapXZ+VHeJZmg9grKtakx+rycKHUNHB+4IhFyWmTfZQfgSL
jVKJQQXxnRNRDWhCjEo0dtOQFbaVflCbHlI6/35WncjKNVRJ7amwkm4dqlDEfUs3
162WxXflWbEqp2rEhdTETx6FB5WCS4ytNQ0UqWjyWxrdzGXsFCvOY0M/Zz/dL5ju
uGQm6xHFjMzMR7RvCri2qMv6Mnp2bg==
=OZHl
-----END PGP SIGNATURE-----


L
L
Ludovic Courtès wrote on 11 Sep 2020 09:02
(name . Danny Milosavljevic)(address . dannym@scratchpost.org)(address . 43257@debbugs.gnu.org)
87h7s4vlse.fsf@gnu.org
Howdy,

Danny Milosavljevic <dannym@scratchpost.org> skribis:

Toggle quote (18 lines)
> On Thu, 10 Sep 2020 09:42:58 +0200
> Ludovic Courtès <ludo@gnu.org> wrote:
>
>> I just realized that these services should just all depend on
>> ‘user-processes’ (which depends on ‘file-systems’). So you should
>> probably just do that.
>
> Okay. Thanks.
>
>> You can double-check with ‘guix system shepherd-graph’ that the
>> dependency graph looks good.
>
> $ ./pre-inst-env guix system shepherd-graph -e '(@@ (gnu tests nfs) %nfs-os)'
> gnu/tests/nfs.scm:162:4: error: missing root file system
>
> I can probably work around it somehow--but just logging this not-nice user
> interface here.

Any suggestions? :-)

The only think I could think of is transparently adding a dummy root
file system for the purposes of ‘shepherd-graph’, but it’s not
necessarily a good idea either.

Thanks,
Ludo’.
D
D
Danny Milosavljevic wrote on 11 Sep 2020 10:23
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 43257@debbugs.gnu.org)
20200911102316.50a22465@scratchpost.org
Hi Ludo,

On Fri, 11 Sep 2020 09:02:09 +0200
Ludovic Courtès <ludo@gnu.org> wrote:

Toggle quote (6 lines)
> Any suggestions? :-)
>
> The only think I could think of is transparently adding a dummy root
> file system for the purposes of ‘shepherd-graph’, but it’s not
> necessarily a good idea either.

It depends on whether we want to have developer tools--but if we do, it would
be nice to be more forgiving on some errors (for example have a "developer"
switch that would add missing fields if they are harmless and don't change
the result. Or maybe just have a procedure available that would do that
which the dev could add a call to with "-e").

That said, not sure that it's a good idea.

I'm just always logging weird things so we actually can see them.

It's not necessarily something we can (or should) fix :-)

However, this %nfs-os is used almost unchanged for marionette-operating-system.

So I got this idea:

$ ./pre-inst-env guix system shepherd-graph -e '((@ (gnu tests) marionette-operating-system) (@@ (gnu tests nfs) %nfs-os)))'
gnu/tests.scm:161:2: error: missing root file system

... doesn't work either. Well now that's weird.

That operating-system is eventually passed to "virtual-machine".

So that means we can't use shepherd-graph on VMs?
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl9bM/QACgkQ5xo1VCww
uqXjGAf/dE++M4jEwGJJ6nRKDIrhgpGZHigfSMLyKsa/8rHZ5LQ5D54tFfwZNYrZ
IbqAPmgPBFL4vcUY5M07GLhPhpxXnAUtejzFpAqwjqTwVvRzRwqAOrWcOmvovhk0
TXINK1A4crmca9YdjZYUBx8oxxeQ1YyTGqrF4W4CKgk2L4Ciq7bJJyeGrz1rvqQI
dR5MqHVCurvnnk4oRGvzfZxoTR5zb33nkD0Yi5fbu0HBIIcdtY19yuwe4MCLMirA
EgrKNCvng+K3qfdD6Dm/BnsSeCQTIXikeHmCRSaSxMyJOXS1VJWeaV/eC2zUIXnv
QV8Br0LWlU+WT2X0UCLEjGKqqEXm4w==
=dV62
-----END PGP SIGNATURE-----


L
L
Ludovic Courtès wrote on 11 Sep 2020 16:47
(name . Danny Milosavljevic)(address . dannym@scratchpost.org)(address . 43257@debbugs.gnu.org)
87pn6stlot.fsf@gnu.org
Danny Milosavljevic <dannym@scratchpost.org> skribis:

Toggle quote (36 lines)
> Hi Ludo,
>
> On Fri, 11 Sep 2020 09:02:09 +0200
> Ludovic Courtès <ludo@gnu.org> wrote:
>
>> Any suggestions? :-)
>>
>> The only think I could think of is transparently adding a dummy root
>> file system for the purposes of ‘shepherd-graph’, but it’s not
>> necessarily a good idea either.
>
> It depends on whether we want to have developer tools--but if we do, it would
> be nice to be more forgiving on some errors (for example have a "developer"
> switch that would add missing fields if they are harmless and don't change
> the result. Or maybe just have a procedure available that would do that
> which the dev could add a call to with "-e").
>
> That said, not sure that it's a good idea.
>
> I'm just always logging weird things so we actually can see them.
>
> It's not necessarily something we can (or should) fix :-)
>
> However, this %nfs-os is used almost unchanged for marionette-operating-system.
>
> So I got this idea:
>
> $ ./pre-inst-env guix system shepherd-graph -e '((@ (gnu tests) marionette-operating-system) (@@ (gnu tests nfs) %nfs-os)))'
> gnu/tests.scm:161:2: error: missing root file system
>
> ... doesn't work either. Well now that's weird.
>
> That operating-system is eventually passed to "virtual-machine".
>
> So that means we can't use shepherd-graph on VMs?

No: that just means that ‘virtualized-operating-system’ adds a root file
system transparently, which is why we can afford not providing one in
OSes that are only meant to be used through ‘guix system vm’.

But ‘shepherd-graph’ doesn’t know about that: it takes your OS as is and
show you the info.

Hope that makes sense!

Ludo’.
D
D
Danny Milosavljevic wrote on 11 Sep 2020 19:50
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 43257@debbugs.gnu.org)
20200911195011.49c32229@scratchpost.org
Hi Ludo,

On Fri, 11 Sep 2020 16:47:14 +0200
Ludovic Courtès <ludo@gnu.org> wrote:

Toggle quote (7 lines)
> No: that just means that ‘virtualized-operating-system’ adds a root file
> system transparently, which is why we can afford not providing one in
> OSes that are only meant to be used through ‘guix system vm’.
>
> But ‘shepherd-graph’ doesn’t know about that: it takes your OS as is and
> show you the info.

That makes sense.

So that means a user/developer can't use shepherd-graph on VMs :P

That's a very bad user interface.

Especially since if you are using shepherd-graph chances are you already are
diagnosing a problem and don't want to have to diagnose more problems first
in order to solve that one.

Personally I'd make it emit a warning and add a rootfs if it's harmless in
order to have this usecase (using shepherd-graph on VMs) be supported. If
we want that.

But it's fine for now--I just wanted to make sure to point out the pain points.
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl9buNMACgkQ5xo1VCww
uqWXDwgAmq6Jcfn07xwxMSkyWqAyr3BmW8DxdCtRyhgjD1T1wAvQtGQ20EuhL7XD
W0YYPXoCk3FjXu7FTWu+0kcvQQg55niiWIBo8d8WFKH4hV3Xv04T16J1Z6YjRHRF
nQ3ILfB4YFv0a0/+yOyqo5n1STUKXdPSMrQc2LRKmPm6Z6MzdjEdKRZtoFnc5GgT
La6iwaUduGchbsxc6di+6SDwCg4hk0icfmS5wvoneniTt4++NnRPjWs3LHTzlOCO
s0+XXPKCdFLqzy1KUeY4otx7wIgpiPjJ4qnOiWN16e/F11XAxZPReyzlGq3OFwXC
ReMWwgkfiMRZbS43pxV6/0zrYBYnSA==
=ragx
-----END PGP SIGNATURE-----


D
D
Danny Milosavljevic wrote on 13 Sep 2020 21:52
Spooky problem in "nfs-root-os" system test
(address . 43257@debbugs.gnu.org)
20200913215214.7ff9b97f@scratchpost.org
Hi,

I've got some spooky problem in the NFS root test (or in the VM setup by Guix,
really).

It seems to hang the system test in a part I cannot change (so it's not inside
the test script).

In order to reproduce, start with guix master commit
898fbb60b2354e82e5b7f259b44dbfed112a83aa--or any recent Guix master commit.

So far it's still "fine"-ish:

$ make TESTS="nfs-root-fs" check-system
[... works fine and eventually fails because port 20001 is waited for but is
never opened by the server--so far so good]

Now edit gnu/tests/nfs.scm to change

;(rpcmountd-port 20001)

to

(rpcmountd-port 20001)

in order to fix the problem above--or so I thought.

$ make TESTS="nfs-root-fs" check-system
[... hangs in first VM--without even trying to start up the NFS server VM (as
far as I can tell)]

What is going on? Also, how to debug this?

(same happens when enabling (rpcstatd-port 20002) only.
Also, doesn't rpcstatd have TWO ports--one to broadcast and one to listen?
How does one set up both using the operating-system configuration?)
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl9eeG4ACgkQ5xo1VCww
uqX8ywgAkAPX6aAJNTjEdco0xrH16yucp92NwomwJ78Tdk+py2YYMjxoOlz3NgsZ
dznH+M2kJE/ObMpSq+Q0LzfpTpXqxuhIhDPq+nWVaok/RoVXYFEFo9NYqq4yt6qk
U+fUtQYYAiuwiih34Olrz8ncIi+YwX0UEoxKXl/5ai+nHf3DWLnjKSKT3MMiS1b3
eUGBcpgdtKG+7MPPn/8GMMkjuCRQZW6v1owofH8SUjISxBMEHmNvUnKP6rAQ39Mb
x9EAhJNcNJexMzb4m802pO4F6gfjvmJxJmdbN4wvQjnm6jkBW7hx+o0W2NiMdxqj
KkS4QSHOiFustW1RzkuiIOhQRJo5iA==
=qTlP
-----END PGP SIGNATURE-----


?