[Nix-dev] NixOS network filesystems mounting

Rickard Nilsson rickard.nilsson at telia.com
Tue Apr 24 11:22:36 CEST 2012


Hi,

Den 2012-04-22 02:39:13 skrev Nicolas Pierron  
<nicolas.b.pierron at gmail.com>:

> Hi,
>
> On Tue, Apr 17, 2012 at 05:02, Rickard Nilsson
> <rickard.nilsson at telia.com> wrote:
>> What all this boils down to, is that I think the way NixOS mounts  
>> network
>> filesystems is a bit messy. It first tries to mount all filesystems, and
>> then when it get an ip-up event, it makes a new attempt which should  
>> cause
>> network filesystems to be mounted. However, wouldn't it be better to
>> separate local and network filesystems into two different stages? After
>> udev, mount all local paths. After ip-up, start the NFS daemons and  
>> mount
>> all remote paths. What do you think? I will try to experiment with this
>> and see how it works out. If it fails, I must at least find a way to not
>> start idmapd until ip-up.
>
> The problem I see is that we don't have strong dependencies for task /
> services and upstart, or our usage of upstart does not provide a good
> solution.  You can try and hope that this would not damage anybody
> else systems but this sounds like a dead-cause to me unless we can
> rely systemd like resources / services management.

Yes, the dependencies between services in NixOS are a bit fragile. Are
there any ongoing efforts on improving the situation? systemd seems
interesting, but it would probably not solve anything by itself.

In the meantime, I simply changed the NFS services not to start until
they get an ip-up event. That seems to work much better for me. I haven't
run the Nix tests, though.

My changes:

diff --git a/modules/services/network-filesystems/nfsd.nix  
b/modules/services/network-filesystems/nfsd.nix
index b4dc014..998b279 100644
--- a/modules/services/network-filesystems/nfsd.nix
+++ b/modules/services/network-filesystems/nfsd.nix
@@ -83,7 +83,7 @@ in
      jobs.nfsd =
        { description = "Kernel NFS server";

-        startOn = "started networking";
+        startOn = "ip-up";

          path = [ pkgs.nfsUtils ];

diff --git a/modules/tasks/filesystems/nfs.nix  
b/modules/tasks/filesystems/nfs.nix
index 0f48249..1273a60 100644
--- a/modules/tasks/filesystems/nfs.nix
+++ b/modules/tasks/filesystems/nfs.nix
@@ -46,10 +46,8 @@ in
          cp -v ${pkgs.klibc}/lib/klibc/bin.static/nfsmount $out/bin
        '';

-    environment.etc = singleton idmapdConfFile;
-
      # Ensure that statd and idmapd are started before mountall.
-    jobs.mountall.preStart =
+    jobs."mountall-ip-up".preStart =
        ''
          ensure statd || true
          ensure idmapd || true
@@ -80,8 +78,6 @@ in

          path = [ pkgs.nfsUtils pkgs.sysvtools pkgs.utillinux ];

-        startOn = "started udev";
-
          preStart =
            ''
              ensure rpcbind



More information about the nix-dev mailing list