You are not logged in.

#1 2018-02-04 15:43:44

godfather007
Member
Registered: 2018-02-04
Posts: 15

fstab mount

Hi,

i have a mount definition in my fstab.

Unfortunately it only comes up when i give the command " mount -a "

Any idea why it is not during boot?


Thanks in advance

Offline

#2 2018-02-04 15:52:55

seth
Member
Registered: 2012-09-03
Posts: 63,247

Offline

#3 2018-02-04 15:54:38

ayekat
Member
Registered: 2011-01-17
Posts: 1,618

Re: fstab mount

godfather007 wrote:

i have a mount definition in my fstab.

I have a glass with some liquid in it. Why is it orange?

Please post your fstab.

EDIT: alright, I am not familiar with systemd mounting at all, so I am unfortunately not able to help here.

Last edited by ayekat (2018-02-04 16:29:43)


pkgshackscfgblag

Offline

#4 2018-02-04 16:07:00

godfather007
Member
Registered: 2018-02-04
Posts: 15

Re: fstab mount

Sorry...

the entry is a little mixed up after trying many suggestions i've read:

//fs01.intern.domain/music   /mnt/music      cifs    nofail,x-systemd.automount,x-systemd.requires=network-online.target,x-systemd.device-timeout=10,credentials=/etc/smbcredentials,domain=intern.domain,sec=ntlmv2,vers=3,ro      0 0

Thanks again...

Offline

#5 2018-02-04 16:41:26

seth
Member
Registered: 2012-09-03
Posts: 63,247

Re: fstab mount

x-systemd.automount mounts on demand, ie. the device is mounted on your first try to access it.
You can *not* expect it to be mounted right after boot, but eg. "ls /mnt/music" should mount it.
I'm not sure whether that alone or only in combination w/ systemd.requires=network-online.target implies "noauto"; passing "auto" as explicit option might "fix" this - if you actually want that.

Offline

#6 2018-02-04 16:53:53

godfather007
Member
Registered: 2018-02-04
Posts: 15

Re: fstab mount

Actually, i tried to do the things through system.d but that didn't work out at all... so i inserted this entry in fstab.

I'm building an MPD-server to stream music over a share (from a windows file-server) so i would like the mount to be up as soon the mpd-daemon is started.

I think I could skip the " x-systemd.automount,x-systemd.requires=network-online.target,x-systemd.device-timeout=10 "   part..

"ls /mnt/music " does not mount the share :-(

Offline

#7 2018-02-04 16:57:37

seth
Member
Registered: 2012-09-03
Posts: 63,247

Re: fstab mount

Did you check "systemctl status network-online.target" is actually reached?
You should add _netdev if you want this to be automounted.

Offline

#8 2018-02-04 17:31:19

godfather007
Member
Registered: 2018-02-04
Posts: 15

Re: fstab mount

Thanks, i'm learning here..

It says:

Feb 04 18:22:46 mpd01 systemd[1]: Reached target Network is Online.

Offline

#9 2018-02-04 17:34:34

godfather007
Member
Registered: 2018-02-04
Posts: 15

Re: fstab mount

_netdev should be added in the fstab?

Nah, didn't work :-(

Last edited by godfather007 (2018-02-04 17:42:06)

Offline

#10 2018-02-04 20:05:50

seth
Member
Registered: 2012-09-03
Posts: 63,247

Re: fstab mount

What does yout entire fstab now actually look like?

I don't understand why no mount would be triggered when attempting to access the path.
Does systemd-fstab-generator fail?
Did you try to write an explicit mount service? (see "man systemd.mount")

Edit:

systemctl list-units | grep mount

Last edited by seth (2018-02-04 20:07:19)

Offline

#11 2018-02-04 21:04:55

godfather007
Member
Registered: 2018-02-04
Posts: 15

Re: fstab mount

Thanks for your help!

fstab:

//fs01.intern.domain/music   /mnt/music      cifs    nofail,x-systemd.automount,credentials=/etc/smbcredentials,domain=intern.domain,sec=ntlmv2,vers=3,ro,_netdev 0 0

and with command " systemctl list-units | grep mount "

● mnt-music.automount                                                                              loaded failed failed    mnt-music.automount
  proc-sys-fs-binfmt_misc.automount                                                                loaded active waiting   Arbitrary Executable File Formats File System Automount Point
  -.mount                                                                                          loaded active mounted   Root Mount
  boot.mount                                                                                       loaded active mounted   /boot
  dev-hugepages.mount                                                                              loaded active mounted   Huge Pages File System
  dev-mqueue.mount                                                                                 loaded active mounted   POSIX Message Queue File System
● mnt-music.mount                                                                                  loaded failed failed    Music Share at boot
  run-user-1000.mount                                                                              loaded active mounted   /run/user/1000
  sys-kernel-config.mount                                                                          loaded active mounted   Kernel Configuration File System
  sys-kernel-debug.mount                                                                           loaded active mounted   Kernel Debug File System
  tmp.mount                                                                                        loaded active mounted   Temporary Directory (/tmp)
  systemd-remount-fs.service                                                                       loaded active exited    Remount Root and Kernel File Systems


I created the " /etc/systemd/system/mnt-music.mount " which looks like this:

[Unit]
Description=Music Share at boot
Requires=systemd-networkd.service
After=network-online.target
Wants=network-online.target

[Mount]
What=//fs01.intern.domain/music
Where=/mnt/music
Options=credentials=/etc/sbmcredentials,sec=ntlmv2,vers=3,domain=intern.domain,ro,x-systemd.automount
Type=cifs
TimeoutSec=30

[Install]
WantedBy=multi-user.target

The systemd-fstab-generator creates a fresh entry... let me try

Offline

#12 2018-02-04 22:18:49

seth
Member
Registered: 2012-09-03
Posts: 63,247

Re: fstab mount

mnt-music.automount                                                                              loaded failed failed    mnt-music.automount

"Why"?

systemctl status mnt-music.automount

Offline

#13 2018-02-05 07:16:22

godfather007
Member
Registered: 2018-02-04
Posts: 15

Re: fstab mount

Good morning,

honestly, i don't know where it came from.

● mnt-music.automount
   Loaded: loaded (/etc/fstab; generated)
   Active: active (waiting) since Sun 2018-02-04 22:06:55 CET; 10h ago
    Where: /mnt/music
     Docs: man:fstab(5)
           man:systemd-fstab-generator(8)

Offline

#14 2018-02-05 13:46:01

seth
Member
Registered: 2012-09-03
Posts: 63,247

Re: fstab mount

Of course that doesn't tell much ;-)

There's also been

mnt-music.mount                                                                                  loaded failed failed    Music Share at boot

So what's the status about that (remove the x-systemd.automount option from the file, you also may want to comment the fstab entry to prevent the autogenerated service)

Offline

#15 2018-02-05 14:25:47

B1omman
Member
Registered: 2016-02-16
Posts: 36

Re: fstab mount

godfather007 wrote:

I created the " /etc/systemd/system/mnt-music.mount " which looks like this:

...
Options=credentials=/etc/sbmcredentials,sec=ntlmv2,vers=3,domain=intern.domain,ro,x-systemd.automount
...

Looks like a typo in your unit as well(, unless the typo is in your fstab): /etc/sbmcredentials

Offline

#16 2018-02-05 19:52:45

godfather007
Member
Registered: 2018-02-04
Posts: 15

Re: fstab mount

my god... quess what.... it works :-)

Thanks for pointing my typo

Offline

#17 2018-02-05 20:04:39

seth
Member
Registered: 2012-09-03
Posts: 63,247

Re: fstab mount

So this ...

godfather007 wrote:

Unfortunately it only comes up when i give the command " mount -a "

... was simply not true... ?

Offline

#18 2018-02-05 20:07:33

godfather007
Member
Registered: 2018-02-04
Posts: 15

Re: fstab mount

strangely thing, the fstab didnt work out finally.

It did using the " mount -a" command. Still strange..

Are the 2 entries related to each other in some way?

Offline

#19 2018-02-05 20:10:19

seth
Member
Registered: 2012-09-03
Posts: 63,247

Re: fstab mount

We need this in English, please ;-)

Do you mean the path fix worked on the mnt-music.mount service, but not the service autogenerated from fstab?
What is the exact condition at this point (is your mnt-music.mount still in place and what does fstab look like?)

Offline

#20 2018-02-05 20:14:26

godfather007
Member
Registered: 2018-02-04
Posts: 15

Re: fstab mount

Oh well,

after correcting and reload the mnt-music.mount, the mount was made.

Yesterday evening i tried to figure out that generator-fstab-thing but it didn't like me.

My fstab is still filled with the entry... i will remark it to see how it behaves.

Offline

#21 2018-02-05 20:19:02

godfather007
Member
Registered: 2018-02-04
Posts: 15

Re: fstab mount

Hm... it does show up when remarked

//fs01.intern.domain/music   /mnt/music      cifs    nofail,x-systemd.automount,credentials=/etc/smbcredentials,domain=intern.domain,sec=ntlmv2,vers=3,ro,_netdev 0 0

Last edited by godfather007 (2018-02-05 20:19:23)

Offline

#22 2018-02-05 20:19:52

godfather007
Member
Registered: 2018-02-04
Posts: 15

Re: fstab mount

So, they are related?

Offline

#23 2018-02-05 20:32:30

seth
Member
Registered: 2012-09-03
Posts: 63,247

Re: fstab mount

Please edit your posts rather than bumping (if no reply was made inbetween) and elaborate on "it does show up when remarked" (what is "it" and what is "remarked") and on what excatly you concern to be related (a service - and which - to the fstab entry?)

Also your fstab still contains the typo.
If you want it automounted at boot you'll also have to remove the "x-systemd.automount" and maybe "nofail" options.

Offline

#24 2018-02-06 05:58:50

B1omman
Member
Registered: 2016-02-16
Posts: 36

Re: fstab mount

godfather007 wrote:

Oh well,
after correcting and reload the mnt-music.mount, the mount was made.
Yesterday evening i tried to figure out that generator-fstab-thing but it didn't like me.
My fstab is still filled with the entry... i will remark it to see how it behaves.

Hm... it does show up when remarked
...

I think I can decipher what you mean, but I believe you would make yourself easier to understand if you just posted the the line you edited in fstab, together with the terminal output that you see when trying it out. Like it says in the link seth posted in the first response to this thread.

Now to what you did, I guess(?):

# sed 's/,x-systemd.automount//g' /etc/fstab && cat /etc/fstab
//fs01.intern.domain/music   /mnt/music   cifs   nofail,credentials=/etc/smbcredentials,domain=intern.domain,sec=ntlmv2,vers=3,ro,_netdev 0 0

# systemctl daemon-reload
# systemctl status mnt-music.automount
Unit mnt-music.automount could not be found.

$ ls /mnt/music
ls: cannot access '/mnt/music': No such file or directory

# sed 's/nofail/nofail,x-systemd.automount/g' /etc/fstab && cat /etc/fstab
//fs01.intern.domain/music   /mnt/music      cifs    nofail,x-systemd.automount,credentials=/etc/smbcredentials,domain=intern.domain,sec=ntlmv2,vers=3,ro,_netdev 0 0

# systemctl daemon-reload
# systemctl status mnt-music.automount
mnt-music.automount
   Loaded: loaded (/etc/fstab; generated)
   Active: active (waiting) since Sun 2018-02-04 22:06:55 CET; 10h ago
    Where: /mnt/music
     Docs: man:fstab(5)
           man:systemd-fstab-generator(8)

Something like that? Maybe removed some other options or something, but still missed to post it here.

godfather007 wrote:

So, they are related?

Yes, everything is related. x-systemd.automount tells systemd to generate the mnt-music.automount unit. The mnt-music.automount unit in turn trigger the mnt-music.mount unit that specifies for systemd.mount what to mount. Since you created your own (with a bad credential path), systemd never generated one (with the credential path from /etc/fstab) and the mount failed.

You only posted the output from:

systemctl status mnt-music.automount

But the output from:

systemctl status mnt-music.mount

would probably tell us all about it. The mount option nofail in /etc/fstab sets the mnt-music.automount not required by the local/remote-fs.target, but it is still a dependency as wanted and will probably try to mount early. One good/bad thing with nofail is that it suppress the fails, so the system boots even if some mount fail. This probably does not matter because of all the cross dependencies you have set up right now, I'm not sure how anything really links in your setup.

Something like this would probably be enough:

//fs01.intern.domain/music    /mnt/music    cifs    noauto,x-systemd.automount,credentials=/etc/smbcredentials,vers=3,ro 0 0

domain=intern.domain goes in your credentials file. noauto solves everything about the dependencies at boot while x-systemd.automount will create the mnt-music.automount with some requirements on network. Remove the mnt-music.mount unit you created yourself and let systemd create one from this /etc/fstab.

Offline

Board footer

Powered by FluxBB