I would do this via rc.local and leave fstab alone. (Yes, I know a lot of the hardcores will go apoplectic over this and tell you to do it with some weird systemd thing or something, but ignore them)
Note, BTW, that you don't need "sudo" in rc.local, since rc.local runs as root anyway.
Next, if you're going to do it via rc.local, the first thing you need to do is get some logging going on, so you can tell what is happening and what is not working. The best way to do that is to put the following line into rc.local:
Code: Select all
exec > /tmp/rc-local.out 2>&1;set -x
just after:
# By default this script does nothing.
Now, after you boot, you'll be able to see what happens by looking at the file (/tmp/rc-local.out).
Presumably, you'll see some kind of error message from the mount command.
Next, you need to put some kind of delay in rc.local to wait for the network - note that even though you have ethernet, there's still some time involved in getting it up and running. One way is to do a ping loop, but the easiest way would be just loop your mount command. Something like:
Code: Select all
until mount -t cifs -o username=Plex,password=XXXXXXXX,vers=1.0 //192.168.1.1/Plex /home/pi/Plex/Library
do sleep 5;done
That will just keep trying it until it works.
Finally, note that pre-systemd, there was a problem with doing stuff like this in rc.local, since if you did anything wrong and rc.local didn't finish (say, if the above loop never succeeds), then your system would not finish booting (essentially becoming locked). Now that we have systemd, this doesn't happen anymore (rc.local is run asynchronously, like everything else).