Mounting an cifs share in fstab

Latest response

This is probably beyond what I'm studying for in RHCSA, but I really want to know a fix for this other than a systemd automount. I noticed when trying to mount a samba share in RHEL8 using /etc/fstab there are some issues.

For example:
//localhost.localdomain/sambashare /sambamount cifs _netdev,username=myuser,password=mypass,vers=3.0 0 0

If I 'mount -a' in the terminal, it will mount fine with no problems.
If I set NetworkManager to DHCP, it will mount on boot with no problems.
If I set NetworkManager to a working static IP (passes a ping to DNS and url), then it will not mount on boot.
E.g. checking systemctl status sambamount.mount:
"mount process exited, code=exited status=-2"

I read that this has to do with the network not being online yet on mount attempt at boot. However, I enabled the service NetworkManager-wait-online.service on boot. My guess is this service is loading after the samba mount attempt? I'm curious why DHCP works, but having a static ip doesn't with fstab.

I tried other options too in fstab including adding "x-systemd.automount" as well as editing /etc/sysconfig/network-scripts/ interface DELAY.

My firewall is fine and configured correctly, I mean obviously or DHCP boot and mount -a wouldn't work. Also I set semanage on both the share and the mount point to fcontext label "samba_share_t" and double checked the contexts were correctly labeled with restorecon.

Is this a bug? My worry is that they will have us mount a samba share persistently for RHCSA (I know no one can tell me whether that is the case due to the NDA). If there's a question that wants the machine set to a static IP, and then later wants us to mount samba on boot persistently in fstab, then that is going to be an issue? Or maybe this has something to do with my virtualbox setup? If anyone knows a fix let me know. Or if you just think I should just try with systemd, let me know.

Thanks in advance

Responses