Hi,

I use systemd on an ArchLinux system and I use some remote fs that are described in /etc/fstab (with the x-systemd.automount option). On start-up, everything is fine and the fs is mounted when I cd into one of the directories. Actually, this is quite impressive because it is so simple to configure! Thank you all for that!

However, on shutdown the network is stopped (i.e. I use NetworkManager.service, so actually the NetworkManager process is stopped) but the remote-fs are unmounted through umount.target after that. So, the system hang until the timeout occurs and finally the system is powered down/rebooted.

If I check the unit generated by fstab-generator for one of the remote filesystems, I get:

# Automatically generated by systemd-fstab-generator

[Unit]
SourcePath=/etc/fstab
DefaultDependencies=no
After=remote-fs-pre.target
Wants=remote-fs-pre.target
Conflicts=umount.target
Before=umount.target

[Mount]
What=//192.168.1.37/be
Where=/mnt/be
Type=cifs
FsckPassNo=0
Options=/home/mlo/.samba/credentials,noauto,user,x-systemd.automount,x-systemd.device-timeout=60

If I understand it correctly, there is no dependency between the mount and the network target and this is why my network manager daemon stops before the remote filesystems are unmounted.

So I changed fstab-generator to add Requires=network.target and After=network.target (corresponding trivial patch attached to this email) to the generated mount units. It seems to work quite well but I just switched to systemd and I don't undertand all the consequences of this change...

Could you check it and see if it is correct or tell me why it is not?

The patch has to be applied against v189 (the ArchLinux package version).

Thank you.

--
Michel

diff -burN systemd-189-old/src/fstab-generator/fstab-generator.c systemd-189/src/fstab-generator/fstab-generator.c
--- systemd-189-old/src/fstab-generator/fstab-generator.c	2012-09-05 11:33:47.539403886 +0200
+++ systemd-189/src/fstab-generator/fstab-generator.c	2012-09-05 11:33:01.919651029 +0200
@@ -271,7 +271,7 @@
               "SourcePath=/etc/fstab\n"
               "DefaultDependencies=no\n", f);
 
-        if (!path_equal(where, "/"))
+        if (!path_equal(where, "/")) {
                 fprintf(f,
                         "After=%s\n"
                         "Wants=%s\n"
@@ -279,6 +279,11 @@
                         "Before=" SPECIAL_UMOUNT_TARGET "\n",
                         pre,
                         pre);
+                if (isnetwork)
+                        fprintf(f,
+                                "Requires=" SPECIAL_NETWORK_TARGET "\n"
+                                "After=" SPECIAL_NETWORK_TARGET "\n");
+        }
 
 
         if (!noauto && !nofail && !automount)
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to