You are not logged in.
Pages: 1
So, I've come across an interesting situation.
I have an NFS volume available from home. Naturally, I wanted to be able to easily mount it without typing a full address path and so on, so I added it to my /etc/fstab.
# home NFS
home.int:/srv/nfs4/media /home/myuser/media nfs4 ro,defaults,noauto,user 0 0
This is all well and good and allowed me to issue a simple `mount media` to gain access to my media at home. However, when I poweroff or reboot the system, it hangs seemingly forever on this mount. My next step, of course, was to have this mount managed by systemd. Specficially, I want to use the `systemctl --user` command, as this mount is specific to my user; however, I'm constantly stopped because only root can use mount, despite the fact that I have the NFS volume listed in fstab.
[Unit]
Description = mephisto media library
[Mount]
What = home.int:/srv/nfs4/media
Where = /home/myuser/media
#Type = nfs4
#Options = ro,defaults,noauto,user
[Install]
WantedBy = default.target.wants
Note that I get an error saying only root can use Type or Options. Without them, the error simply states that only root and use mount.
At the time of writing this, I think perhaps it might all be easier if I didn't use 'noauto', and thus on poweroff it might know to unmount this volume. However, I don't want to auto-mount if I can avoid it.
Any ideas? Thoughts?
Offline
I may be mistaken, but I don't think you need it in both places. systemd will pick up what you have in fstab, and create it's own internal unit file at runtime for that mount. If you've then created a unit file for the same mount, your unit and runtime unit from fstab may be conflicting?
Side note, you don't need "defaults" if you're specifying options in fstab. The 'defaults' option is just a place-holder if you're not specifying any other options (because the file needs 6 fields per line).
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
I may be mistaken, but I don't think you need it in both places. systemd will pick up what you have in fstab, and create it's own internal unit file at runtime for that mount. If you've then created a unit file for the same mount, your unit and runtime unit from fstab may be conflicting?
You're correct that I don't need it in both places; however, the man page doesn't reference user unit files vs. fstab (though unit files in /usr and /etc are talked about). Nonetheless, I'll try it with the fstab entry removed and report back.
Side note, you don't need "defaults" if you're specifying options in fstab. The 'defaults' option is just a place-holder if you're not specifying any other options (because the file needs 6 fields per line).
It was my understanding that defaults means rw, suid, dev, exec, auto, nouser, async, and relatime (unless otherwise overwritten), at least according to the man page.
EDIT: Commenting out the fstab entry had no effect. Still receive error stating that only root can use mount.
Last edited by jdubs (2016-02-23 03:02:59)
Offline
You're correct that I don't need it in both places; however, the man page doesn't reference user unit files vs. fstab (though unit files in /usr and /etc are talked about). Nonetheless, I'll try it with the fstab entry removed and report back.
Like I said, I could be wrong on it... I'm not completely up to speed with systemd but I do recall reading about that somewhere.
It was my understanding that defaults means rw, suid, dev, exec, auto, nouser, async, and relatime (unless otherwise overwritten).
Exactly, those are the "defaults" -- they don't need to be specified, unless you're NOT overwriting any of them in which case the word "defaults" just provides something for the 4th column of fstab
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
Pages: 1