Difficulty with fstab

Hello ,

the automatic mount by fstab, does not work for network units.
After full boot, ‘sudo mount -a’ works normally.
My network drives require a login/password that is in /root/.credentials
Is a mistake on my part?
Is there a way to set a delay before mounting the network units?

@clr-jpb~ sudo systemctl list-units --all *.mount Mot de passe : UNIT LOAD ACTIVE SUB DESCRIPTION -.mount loaded active mounted / ● **home-JeanPhilippe-svg.mount** loaded **failed** **failed** /home/JeanPhilippe/svg ● **home-JeanPhilippe-synodev.mount** loaded **failed** **failed** /home/JeanPhilippe/synodev proc-sys-fs-binfmt_misc.mount loaded inactive dead Arbitrary Executable File Formats File System run-user-1000-doc.mount loaded active mounted /run/user/1000/doc run-user-1000-gvfs.mount loaded active mounted /run/user/1000/gvfs run-user-1000.mount loaded active mounted /run/user/1000 ● sys-fs-fuse-connections.mount not-found inactive dead sys-fs-fuse-connections.mount ● sys-kernel-config.mount not-found inactive dead sys-kernel-config.mount tmp.mount loaded active mounted Temporary Directory (/tmp) usr-lib-debug.mount loaded active mounted /usr/lib/debug usr-src-debug.mount loaded active mounted /usr/src/debug var-lib-machines.mount loaded inactive dead Virtual Machine and Container Storage (Compatibility) ... @clr-jpb~ sudo mount -a
@clr-jpb~ $ sudo systemctl list-units --all *.mount
UNIT LOAD ACTIVE SUB DESCRIPTION
-.mount loaded active mounted /
home-JeanPhilippe-svg.mount loaded active mounted /home/JeanPhilippe/svg
home-JeanPhilippe-synodev.mount loaded active mounted /home/JeanPhilippe/synodev
proc-sys-fs-binfmt_misc.mount loaded inactive dead Arbitrary Executable File Formats File System
run-user-1000-doc.mount loaded active mounted /run/user/1000/doc
run-user-1000-gvfs.mount loaded active mounted /run/user/1000/gvfs
run-user-1000.mount loaded active mounted /run/user/1000
● sys-fs-fuse-connections.mount not-found inactive dead sys-fs-fuse-connections.mount
● sys-kernel-config.mount not-found inactive dead sys-kernel-config.mount
tmp.mount loaded active mounted Temporary Directory (/tmp)
usr-lib-debug.mount loaded active mounted /usr/lib/debug
usr-src-debug.mount loaded active mounted /usr/src/debug
var-lib-machines.mount loaded inactive dead Virtual Machine and Container Storage (Compatibility)

Make sure you have the auto flag set. Can you show your fstab entry? You can censor parts you don’t want to disclose, of course.

Thank you for your answer,
I already have the auto flag, but I have a lot of other flags I’m not sure about.

fstab
//192.168.1.21/homes/JeanPhilippe/svgposte /home/JeanPhilippe/svg cifs credentials=/root/.smbcredentials,iocharset=utf8,auto,gid=100,uid=1000,_netdev 0 0
//192.168.1.21/web /home/JeanPhilippe/synodev cifs credentials=/root/.smbcredentials,iocharset=utf8,auto,gid=100,uid=1000,_netdev 0 0

Even without _netdev, systemd will automatically move these units from local-fs.target to remote-fs.target. You can see this by running systemctl show remote-fs.target - you’ll see your mounts are listed as part of Requires=.

You can query the status and journals for each of these mounts with systemctl status $unit and journalctl -u $unit. $unit here is something like home-JeanPhilippe-synodev.mount.

I don’t see anything wrong with your fstab entries, though. I don’t use _netdev myself, but I don’t think it would hurt.

I see the error but I can’t find the cause of the error?
Are the root and network operational at the time of the fstab analysis?

JeanPhilippe@clr-jpb~ $ systemctl status home-JeanPhilippe-synodev.mount
Warning: The unit file, source configuration file or drop-ins of home-JeanPhilippe-synodev.mount changed on disk. Run ‘systemctl daemon-reload’ to reload units.
● home-JeanPhilippe-synodev.mount - /home/JeanPhilippe/synodev
Loaded: loaded (/etc/fstab; generated)
Active: failed (Result: exit-code) since Mon 2019-09-30 07:50:37 CEST; 23s ago
Where: /home/JeanPhilippe/synodev
What: //192.168.1.21/web
Docs: man:fstab(5)
man:systemd-fstab-generator(8)

sept. 30 07:50:37 clr-jpb systemd[1]: Mounting /home/JeanPhilippe/synodev…
sept. 30 07:50:37 clr-jpb mount[529]: mount error(2): No such file or directory
sept. 30 07:50:37 clr-jpb mount[529]: Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messages (dmesg)
sept. 30 07:50:37 clr-jpb systemd[1]: home-JeanPhilippe-synodev.mount: Mount process exited, code=exited, status=32/n/a
sept. 30 07:50:37 clr-jpb systemd[1]: home-JeanPhilippe-synodev.mount: Failed with result ‘exit-code’.
sept. 30 07:50:37 clr-jpb systemd[1]: Failed to mount /home/JeanPhilippe/synodev.
JeanPhilippe@clr-jpb~ $ sudo mount -a
Mot de passe :
JeanPhilippe@clr-jpb~ $ systemctl status home-JeanPhilippe-synodev.mount
Warning: The unit file, source configuration file or drop-ins of home-JeanPhilippe-synodev.mount changed on disk. Run ‘systemctl daemon-reload’ to reload units.
● home-JeanPhilippe-synodev.mount - /home/JeanPhilippe/synodev
Loaded: loaded (/etc/fstab; generated)
Active: active (mounted) since Mon 2019-09-30 07:51:09 CEST; 2s ago
Where: /home/JeanPhilippe/synodev
What: //192.168.1.21/web
Docs: man:fstab(5)
man:systemd-fstab-generator(8)

Try to enable the following process

sudo systemctl enable systemd-networkd-wait-online

Ran into this issue and the problem was that it was trying to mount before obtaining an IP address.