You are not logged in.

#1 2012-04-17 11:22:40

swanson
Member
From: Sweden
Registered: 2011-02-05
Posts: 759

Systemd nfs client mount share ???

Just installed systemd, systemd-arch-units and initscripts-systemd  as per the wiki and all went well except mounting a nfs share from my server. (networking is OK!)
This is the old working mount command run from rc.local before installing systemd;

 mount -t nfs4 -o rw,hard,async,intr,rsize=49152,wsize=49152,proto=tcp 192.168.0.250:/ /media/SERVER_NYTT &

Did not mount at all with systemd, not even when run manually from command line. From systemd log netfs and nfs-common failed to start.

So I tried from fstab instead;

192.168.0.250:/ /media/SERVER_NYTT nfs rw,hard,async,intr,rsize=49152,wsize=49152,proto=tcp 0 0

This did work but 'mount' showed that systemd had mounted with nfs default options instead of mine (wsize, rsize ...). Still errors from systemd starting netfs and nfs.

So I disabled netfs and nfs-common/rpcbind from rc.conf and created this systemd file (/etc/systemd/system/192.168.0.250.mount);

[Unit]
 Description=ServerNfs
 Wants=network.target rpc-statd.service
 After=network.target rpc-statd.service 
 
 [Mount]
 What=192.168.0.250:/
 Where=/media/SERVET_NYTT
 Type=nfs
Options=rw,hard,async,intr,rsize=49152,wsize=49152,proto=tcp
DirectoryMode=0777
 StandardOutput=syslog
 StandardError=syslog

From the sparce wiki and 'man systemd.mount'. Now nothing happens. With my limited understanding I thought it would start neccessary services (wants) and replace the entry in fstab.

I will now enable systemd services rpcbind, rpcstatd and see what happens.

Overall the transition to systemd went very well indeed; slim, openbox, network, .xinitrc, e4rat all started OK much to my surprise! There's still some fine-tuning to do like nfs, and possibly automounting and at last weeding out unneccessary services.

But any help with this nfs client problem is much appreciated.

Offline

#2 2012-04-17 11:34:12

swanson
Member
From: Sweden
Registered: 2011-02-05
Posts: 759

Re: Systemd nfs client mount share ???

After activating rpcstad and rcpbind still no mount. And running sudo mount -a, which should activate this;

192.168.0.250:/ /media/SERVER_NYTT nfs rw,hard,async,intr,rsize=49152,wsize=49152,proto=tcp 0 0

I get this; mount.nfs: mount point /media/SERVER_NYTT does not exist
It did exist before the systemd install, but systemd took it away. I recreated it manually and now it's gone again. Seems that systemd takes charge of /media in some way.
Logs give this; 'Apr 17 13:25:12 localhost rpc.statd[289]: Failed to read /var/lib/nfs/state: Success'

Well on with trials ...

Offline

#3 2012-04-17 11:43:21

swanson
Member
From: Sweden
Registered: 2011-02-05
Posts: 759

Re: Systemd nfs client mount share ???

Mounting from fstab does work sort of;

192.168.0.250:/ on /media/SERVER_NYTT type nfs4 (rw,relatime,vers=4,rsize=32768,wsize=32768,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=192.168.0.251,minorversion=0,local_lock=none,addr=192.168.0.250)

systemd does not use my mount options from fstab nor from my own systemd *.mount file.

What's wrong? I know that the *.mount file must be named exactly after the source but escaped. Like /dev/sda should become dev-sda.mount as filename. I have '192.168.0.250.mount' as file name, since that's the server.

Offline

#4 2012-04-17 11:56:07

tomegun
Developer
From: France
Registered: 2010-05-28
Posts: 661

Re: Systemd nfs client mount share ???

@swanson: I don't know exactly what the problem is. However, I have a few suggestions:

The mount file should be named after the dest not the src. I.e. you'll have media-SERVER_NYTT.mount (and the system will create dev-sda.device for you).

systemd will mount a tmpfs on /media, so any folder you create there will be gone on reboot (which is why your "mount -a" did not work). I suggest putting these kind of mount points in /srv or /mnt instead. systemd should create any missing folders for you, so this should not be the problem for your initial issue.

Why did you originally have your line in rc.local rather than in fstab, this sounds a bit odd, maybe there is something else wrong?

Offline

#5 2012-04-17 12:07:25

swanson
Member
From: Sweden
Registered: 2011-02-05
Posts: 759

Re: Systemd nfs client mount share ???

Thanks this will help!

The initial problem is that my long standing nfs share will not mount with my own mount options. But with your input I will try again. But is my assumption that a *mount file will replace the entry in fstab for a nfs share?

I will also move my custom user mounts to /mnt as you recommend, since neither mounting a DVD from  /dev/sr0 nor an iso image with cdemu gives the right permissions.

Concerning mouting from rc.local; it's an old betwork problem that got solved that way. I know that with systemd you can set time outs and that seems promising.

Offline

#6 2012-04-17 12:09:46

tomegun
Developer
From: France
Registered: 2010-05-28
Posts: 661

Re: Systemd nfs client mount share ???

It is correct that you can use mountfiles in place of fstab. However, there is usually not much point in doing this. I mount my nfs share using an fstab entry just like I would with sysvinit.

Offline

#7 2012-04-17 12:49:23

swanson
Member
From: Sweden
Registered: 2011-02-05
Posts: 759

Re: Systemd nfs client mount share ???

Do you use any of this;

Alternatively, you can mark these entries in /etc/fstab with the x-systemd.automount and x-systemd-device-timeout= options (see systemd.mount .. 

I did read the man for systemd.mount but couldn't make out what to put in the fstab line.
By the way, I renamed the mountfile to the target mountpoint but no success. I then reactivated the fstab line, with the new mountpoint in /mnt and that worked fine with mount -a. Except the mount options are not as I want, as they are in fstab. They were before systemd, and now they are as default for nfs4.

Another problem was that the mountpoint for /dev/sr0 was set to /media/DVD in fstab. I changed that to /mnt/DVD, but it's not working after reboot. Digging on ...

Offline

#8 2012-04-17 12:58:19

65kid
Member
From: Germany
Registered: 2011-01-26
Posts: 663

Re: Systemd nfs client mount share ???

swanson wrote:

Do you use any of this;

Alternatively, you can mark these entries in /etc/fstab with the x-systemd.automount and x-systemd-device-timeout= options (see systemd.mount .. 

I did read the man for systemd.mount but couldn't make out what to put in the fstab line.
By the way, I renamed the mountfile to the target mountpoint but no success. I then reactivated the fstab line, with the new mountpoint in /mnt and that worked fine with mount -a. Except the mount options are not as I want, as they are in fstab. They were before systemd, and now they are as default for nfs4.

have a look here regarding the x-systemd-automount option. I seem to be only one who has noticed a problem with this option, comment=systemd.automount works fine for automounting though. I haven't changed the wiki because I'm still not sure if the problem is on my side.

Offline

#9 2012-04-17 13:01:38

tomegun
Developer
From: France
Registered: 2010-05-28
Posts: 661

Re: Systemd nfs client mount share ???

I never tried the x-systemd-automount optoin. I have been meaning to try it/check if it is supported by util-linux.

If you do "mount -a", then systemd is not involved at all, so if this is giving problems then my guess is something outside of systemd is wrong (such as invalid mount options, check dmesg?).

Offline

#10 2012-04-17 13:36:16

swanson
Member
From: Sweden
Registered: 2011-02-05
Posts: 759

Re: Systemd nfs client mount share ???

After some tests I can conclude that my mount options isn't accepted, and it's not to do with systemd.

More will come ...

Offline

#11 2012-04-17 17:26:40

swanson
Member
From: Sweden
Registered: 2011-02-05
Posts: 759

Re: Systemd nfs client mount share ???

Still mounting from fstab, but it works ok for now. Still wish I could understand native systemd mounting of nfs shares.

All else is up and running nicely! e4rat works ok, did a new 'collect' and it's really nice!
Edited fstab and disabled the dvd/cdrom line and now udisks mounts ok. Had a little problem with console-kit but managed to edit the slim.service to start the right slim version (svn in my local/bin).
Learned that systemctl rescue works as 'telinit 1' and that 'systemctl isolate runlevel5.target' should take you back to X.

But one big lesson never mentioned anywhere is that systemd takes over /media as tmpfs. For all those of us who in recent years have learned to use /media as mounting dir instead of /mnt, this is  a problem. But it is fixable.

Offline

#12 2012-04-17 17:49:50

tomegun
Developer
From: France
Registered: 2010-05-28
Posts: 661

Re: Systemd nfs client mount share ???

systemd will leave /media alone as of the next release (/media was meant to be used by udisks and similar tools, which have now moved to /run/media).

There is no benefit of using mount units over fstab, but it's a bit strange if it does not work for you (it should be the same). The main use of the mount units is that they can be shipped by packages (such as systemd itself), and fstab should be only for the admin.

Offline

#13 2012-04-17 18:12:50

swanson
Member
From: Sweden
Registered: 2011-02-05
Posts: 759

Re: Systemd nfs client mount share ???

Ah, I see. Thanks for the support!

Offline

Board footer

Powered by FluxBB