trouble connecting NFS share to Ubuntu linux desktop

hrhall

Cadet
Joined
Jan 30, 2020
Messages
9
FreeNAS up and running, successfully accessed SMB shares from a Windows 10 laptop, all is well. But cannot get Ubuntu 18.04 to automatically mount the FreeNAS share directory (file type NFS).

After I boot up the Ubuntu desktop I can run a script file and see the NFS share and its contents from within the linux OS. No problems there. But can't get the share to mount automatically upon boot.

This is the script command, issued after boot:
Code:
sudo mount 192.168.1.174:/mnt/filebucket1/fenikan_warehouse /var/fenikan_warehouse


After running this command I can read and write to the share, reboot, and repeat with no problems.

So I tried editing the /etc/fstab file, by adding a line (the last line in this block of code):

Code:
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda4 during installation
UUID=bbfe684f-a360-4805-a53f-27a45d503482 /               ext4    errors=remount-ro 0       1
/swapfile                                 none            swap    sw              0       0
192.168.1.174:/mnt/filebucket1/fenikan_warehouse /var/fenikan_warehouse  nfs  defaults   0    0


So then reboot, and the file /var/fenikan_warehouse is empty.

Don't know what to try next. Any and all suggestions greatly appreciated.
 

SweetAndLow

Sweet'NASty
Joined
Nov 6, 2013
Messages
6,421
You can test by just running 'sudo mount /var/fenikan_warehouse'

See what output that gives you. Also it's super strange to mount something in /car, stick with a user home directory or /mnt/blah
 

KrisBee

Wizard
Joined
Mar 20, 2017
Messages
1,288

SweetAndLow

Sweet'NASty
Joined
Nov 6, 2013
Messages
6,421

hrhall

Cadet
Joined
Jan 30, 2020
Messages
9
Thanks for the help.
I did try changing the fstab file to include _netdev but the results were the same:

Code:
192.168.1.174:/mnt/filebucket1/fenikan_warehouse /var/fenikan_warehouse  nfs, _netdev  defaults   0    0


Using the systemd way, suggested by SweetAndLow, difficulties were encountered.

my automount file, looks like this:

Code:
[Unit]
Description=fenikanwarehouse automount

[Automount]
where=/mnt/net/NFS/fenikanwarehouse

[Install]
WantedBy=multi-user.target


Had to change name of target, could not escape the underscore character in fenikan_warehouse.

When I issue the systemctl daemon-reload and systemctl start this is what happens:

Code:
fenikan_27@SUNFLOWER:/etc/systemd/system$ systemctl daemon-reload
fenikan_27@SUNFLOWER:/etc/systemd/system$ systemctl start mnt-net-NFS-fenikanwarehouse.automount
Failed to start mnt-net-NFS-fenikanwarehouse.automount: Unit mnt-net-NFS-fenikanwarehouse.automount not found.

And that is where I'm stuck.

the file fenikanwarehouse.automount is located in the /etc/systemd/system directory, where also is located the fenikanwarehouse.service, so where is systemctl start looking for the file? Not sure what to do. Does the target need to exist before the mounting? I did create it beforehand. Is it a matter of getting the permissions on the target directory correct?
 

KrisBee

Wizard
Joined
Mar 20, 2017
Messages
1,288
@hrhall I spun up a Ubuntu 18.04 desktop VM and your initial addition to /etc/fstab ought to have mounted your NFS share on boot even if you mounted the share under /var. My example is:

Code:
oot@ubuntu18d:/# lsb_release -a
No LSB modules are available.
Distributor ID:    Ubuntu
Description:    Ubuntu 18.04.4 LTS
Release:    18.04
Codename:    bionic
root@ubuntu18d:/# cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda1 during installation
UUID=411159eb-a430-4769-a449-a34dcb4cf5ad /               ext4    errors=remount-ro 0       1
/swapfile                                 none            swap    sw              0       0
192.168.0.111:/mnt/NasPool/sharenfs  /var/nfs  nfs defaults 0 0

root@ubuntu18d:/# nfsstat -m
/var/nfs from 192.168.0.111:/mnt/NasPool/sharenfs
Flags:    rw,relatime,vers=4.1,rsize=131072,wsize=131072,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=192.168.0.81,local_lock=none,addr=192.168.0.111

root@ubuntu18d:/# cd /var/nfs;ls -l
total 1
-rw-r--r-- 1 chris chris 0 Jan  4 11:31 linnfstest
drwxr-xr-x 2 chris chris 3 Jan  4 09:54 test
root@ubuntu18d:/var/nfs#


The systemd stuff shouldn't be necessary, nor the addition of that "_netdev" option. So on my VM example desktop ufw is inactive and both these Network Manager services are running normally:

Code:
 NetworkManager-wait-online.service loaded active exited  Network Manager Wait Online                                      
NetworkManager.service             loaded active running Network Manager 


Viewing the boot log with journalctl might offer some clues as what's happening on your Ubuntu desktop, eg: journalctl -b | grep -E "NFS|nfs" and check the syslog and boot.log
 
Last edited:

hrhall

Cadet
Joined
Jan 30, 2020
Messages
9
Thanks very much, Krisbee. Implementing your suggestion revealed that the mount command in my fstab had too many fields. Fixed that, and I think the share is mounting now, but I'm locked out of it, for some reason, have to review the procedure for adding datasets, allocating shares, etc.

Attempts to save a file to the location in question result in:

Code:
cannot create regular file '/mnt/net/NFS/fenikanwarehouse/freenastest.txt': Permission denied


Thanks again.
 
Top