LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Unable to Mount NAS on New Kubuntu 20.04.1 LTS System (https://www.linuxquestions.org/questions/linux-networking-3/unable-to-mount-nas-on-new-kubuntu-20-04-1-lts-system-4175684415/)

globalsarge 10-29-2020 01:54 PM

Unable to Mount NAS on New Kubuntu 20.04.1 LTS System
 
Hello,

I'm new to the site and excited to connect with such a resource.

My system is somewhat unique. I have 2 SSDs that I can switch on using a Kingwin power panel depending on which I want to boot into. I also have a "spinner" for data. One SSD is now 18.04.5LTS and the one that is the subject of this post is my new 20.04.1LTS drive. I also have a Network Attached Storage (NAS) server in the same rack (27U scratch built, in my home office).

I just upgraded my system hardware (mobo, CPU, and RAM) the OS is Kubuntu 20.04.1 LTS. As I am working through configuring the system, I find that I am unable to mount my NAS. I can ssh into the NAS, but it will not mount:

Here is my /etc/fstab file for your review:
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/sda2 during installation
UUID=9cb44c29-b632-4035-ab0c-26bab80761c3 / ext4    errors=remount-ro 0      1
# /boot/efi was on /dev/sda1 during installation
#
# This is the data drive mount to /media/Data
UUID=9d3f1ff1-99b4-418c-8dca-84916431f9d5 /media/Data    ext4    auto,exec,rw,noatime          0  2
#
# Network Attached Storage. Script added to System Autostart to mount if online.
192.168.1.105:/nas /media/NAS  nfs    rw,hard,noexec,noauto,user,retrans=1,retry=0          0  0
#
# This line mounts a RAM disk for temp files storage to prevent unnecessary SSD writes.
tmpfs  /media/tmpdisk  tmpfs  nodev,nosuid,noexec,nodiratime,size=1024M  0  0

This is the script I wrote and added to >System Settings>Startup>Autostart:
Code:

    #fstab_Mount NAS
    #!/bin/bash
    # script to mount NAS if it's powered on
    if ping -c1 -w3 192.168.1.105 >/dev/null 2>&1
    then
      mount /media/NAS
      echo "NAS is mounted to /media/NAS"
    else
      echo "NAS is not mounted"
    fi

When I attempt to run it just like I do on my K18.04.5 LTS system it errors out with:

Code:

$ ./fstab-mount-nas
mount: /media/NAS: bad option; for several filesystems (e.g. nfs, cifs) you might need a /sbin/mount.<type> helper program.
NAS is mounted to /media/NAS

I've not had any luck searching on this error. I've also tried:
$sudo mount -av which gets me:

Code:

    $ sudo mount -av
    /                            : ignored
    /media/Data        : already mounted
    /media/NAS        : ignored
    /media/tmpdisk  : already mounted

Why can't I mount my NAS and how do I correct the situation? Again, everything works on my Bionic system, but Fosa seems to have some issues with my script and/or fstab.

michaelk 10-30-2020 05:40 AM

Did you install the nfs-common package on the 20.04 system?

globalsarge 10-30-2020 07:18 AM

Thank you for the quick reply. To answer your question, yes i did install nfs-common after this issue showed up. Nothing changed from my perspective.

michaelk 10-30-2020 09:17 AM

What about a nfs-utils package?

computersavvy 10-30-2020 10:02 AM

Quote:

Originally Posted by globalsarge (Post 6179915)
Hello,


This is the script I wrote and added to >System Settings>Startup>Autostart:
Code:

    #fstab_Mount NAS
    #!/bin/bash
    # script to mount NAS if it's powered on
    if ping -c1 -w3 192.168.1.105 >/dev/null 2>&1
    then
      mount /media/NAS
      echo "NAS is mounted to /media/NAS"
    else
      echo "NAS is not mounted"
    fi

When I attempt to run it just like I do on my K18.04.5 LTS system it errors out with:

Code:

$ ./fstab-mount-nas
mount: /media/NAS: bad option; for several filesystems (e.g. nfs, cifs) you might need a /sbin/mount.<type> helper program.
NAS is mounted to /media/NAS

I've not had any luck searching on this error. I've also tried:
$sudo mount -av which gets me:

Code:

    $ sudo mount -av
    /                            : ignored
    /media/Data        : already mounted
    /media/NAS        : ignored
    /media/tmpdisk  : already mounted

Why can't I mount my NAS and how do I correct the situation? Again, everything works on my Bionic system, but Fosa seems to have some issues with my script and/or fstab.

On my system the mount command is located at /usr/bin/mount.
Maybe you could try changing the script and put the full path on the mount command and try that.

You also should make your shebang line " #!/bin/bash " the first line in your script. Its purpose is to execute the script with the proper interpretor and where it is located it becomes just a comment.

Have you tried manually mounting the media
Code:

sudo mount -t nfs 192.168.1.105:/nas /media/NAS
if that works then there is one thing I see on the line in your fstab that might be an issue.
Code:

192.168.1.105:/nas /media/NAS  nfs    rw,hard,noexec,noauto,user,retrans=1,retry=0          0  0
The error is complaining about an invalid option.
You might try removing/changing each of those mount options one at a time to see when/if the error disappears.
I looked at the man pages for both fstab and nfs, and I do not see the "noexec" option anywhere in either man page.

michaelk 10-30-2020 10:21 AM

Quote:

I looked at the man pages for both fstab and nfs, and I do not see the "noexec" option anywhere in either man page.
Check the mount man page for filesystem independent mount options.

Manually trying to mount the nfs share is a good suggestion.

Since the error is a associated with mount it isn't a path problem i.e. versus file not found.

computersavvy 10-30-2020 10:52 AM

Quote:

Check the mount man page for filesystem independent mount options.
Thanks, I over looked that.

JZL240I-U 10-30-2020 11:07 AM

Is this solved then? If so, please mark this thread as solved.

globalsarge 10-31-2020 08:29 PM

Quote:

Originally Posted by JZL240I-U (Post 6180186)
Is this solved then? If so, please mark this thread as solved.

Not yet, but I know to mark it as Solved when it is.

Okay,
1. I changed the script to put line 2 in the line 1 position. Good catch and good explanation. Thank you.

2. I removed noexec from the fstab line for /media/NAS mounting.

3. Attempting to install nfs-utils did not work. "E: Unable to locate package nfs-utils". nfs-common is installed which I already answered. So what's up with nfs-utils? Is it possible it's not in the new 20.04.1 repository yet?

I booted up both systems. I can ping the NAS and I can ssh into the NAS. When I run the fstab-mount-nas script I get the following:

$ sudo ./fstab-mount-nas
mount.nfs: Failed to resolve server //192.168.1.105: Name or service not known.

I almost forgot: As I mentioned in my original post, I maintain two SSD drives that are bootable. One is what I call the "current" version of Kubuntu which is 18.04.5LTS and the other drive, I call "New" LTS version, which is 20.04.1LTS. It's the latter I'm currently in the process of configuring. I think it's also important to understand that the fstab I'm using in 20.04 came from 18.04.

I was also able to find the fstab noexec, but the definition is not applicable so I did delete it from fstab.

globalsarge 11-01-2020 04:00 AM

Okay, I've been trying to get this issue resolved searching for a direction to take. I did remove all the options in the mount nas line except rw and I tried to mount -av with the following results:

/ : ignored
/media/Data : already mounted
mount.nfs: timeout set for Sun Nov 1 02:47:08 2020
mount.nfs: Failed to resolve server //192.168.1.105: Name or service not known
/media/tmpdisk : already mounted

Does this result shed any light on the issue?

I also configured my network-manager yaml file to add nameserver addresses, but it apparently didn't make any difference.

It seems that there are two parts to the problem:
1. mount.nfs fails to resolve the NAS IP address.
2. "Name or service not known" what service should be running, but isn't?

I don't understand why this fstab runs perfectly on my 18.04.5 LTS system and fails so badly on a new 20.04.1 LTS system.

Again, remember this 20.04.1 is a new system. I just started configuring it. I'm thinking there's some missing configuration that's causing this problem.

Any ideas?

computersavvy 11-01-2020 09:49 AM

Quote:

Originally Posted by globalsarge (Post 6180572)
$ sudo ./fstab-mount-nas
mount.nfs: Failed to resolve server //192.168.1.105: Name or service not known.

It seems that when that command was run communications was down to 192.168.1.105 or it may just be another manifestation of the real problem.

I now see another issue in the script that may be the real culprit.

The if statement should be in the form
Code:

if [ something to be tested ] ; then

      or

if [ something to be tested ]
then

because the [ ] part actually tells it to do the test.

Your if statement posted does not include the test
Code:

    if ping -c1 -w3 192.168.1.105 >/dev/null 2>&1
    then

I would suggest changing it to this and see if the problem is solved.
Code:

    if [ ping -c1 -w3 192.168.1.105 >/dev/null 2>&1 ]
    then

If that change works then it likely could be a change in bash to make it more standards compliant which may have been lax in the earlier version.

sgosnell 11-01-2020 10:36 AM

On my system I use nofail instead of retrans and retry. I use defaults,nofail,exec on all 3 drives I have exported as nfs and they all work. The nofail option allows the system to boot if the nfs drive isn't available, thus no need for a script. I do have an alias to mount just the nfs drives if necessary.
Code:

sudo mount -a -t nfs4
which mounts all nfs drives in fstab.

I also use nfs4 for the filesystem type instead of the plain nfs. At one time I had to use nfs3, but that went away recently with updates. I'm on Debian though, and I have no idea what Ubuntu uses.

globalsarge 11-01-2020 03:27 PM

Quote:

Originally Posted by computersavvy (Post 6180718)
It seems that when that command was run communications was down to 192.168.1.105 or it may just be another manifestation of the real problem.

I now see another issue in the script that may be the real culprit.

The if statement should be in the form
Code:

if [ something to be tested ] ; then

      or

if [ something to be tested ]
then

because the [ ] part actually tells it to do the test.

Your if statement posted does not include the test
Code:

    if ping -c1 -w3 192.168.1.105 >/dev/null 2>&1
    then

I would suggest changing it to this and see if the problem is solved.
Code:

    if [ ping -c1 -w3 192.168.1.105 >/dev/null 2>&1 ]
    then

If that change works then it likely could be a change in bash to make it more standards compliant which may have been lax in the earlier version.

Good idea, but I'm sorry to say, no joy! It's interesting that there has to be a space after and before the brackets. I got an "ambiguous redirect" error until I added the spaces. Now I just get the else message of "NAS is not mounted" It's very frustrating, but I do appreciate the direction and myriad of things to try.

BTW, for my own learning, what exactly is the test doing? If a single ping (-c1), that can take no more than 3 seconds (-w3) of the nas (what value is returned?) is that value > 0 (/dev/null/) (then 2>&1, variable 1 (&1) which, I assume is the whatever is returned from the -c1 -w3 ping). It seems to me that there's 2 tests being performed and I don't understand why.
1. is the ping > 0 [nas online = 1 (true), nas offline = 0 (false)]
2. 2>&1 ???

And why does this work perfectly when I boot the 18.04 SSD?

globalsarge 11-01-2020 03:35 PM

Quote:

Originally Posted by sgosnell (Post 6180735)
On my system I use nofail instead of retrans and retry. I use defaults,nofail,exec on all 3 drives I have exported as nfs and they all work. The nofail option allows the system to boot if the nfs drive isn't available, thus no need for a script. I do have an alias to mount just the nfs drives if necessary.
Code:

sudo mount -a -t nfs4
which mounts all nfs drives in fstab.

I also use nfs4 for the filesystem type instead of the plain nfs. At one time I had to use nfs3, but that went away recently with updates. I'm on Debian though, and I have no idea what Ubuntu uses.

Interesting, I tried both of your suggestions, separately of course. Again, no joy!

Here's the results:

I changed fstab to nfs4 then I attempted your mount command (I added the v options for verbosity):
$ sudo mount -av -t nfs4
/ : ignored
/media/Data : ignored
/media/NAS : ignored
/media/tmpdisk : ignored

Then I changed fstab file system back to nfs and the line options to your suggested ones. Now my return message is different:

$ sudo mount -av
/ : ignored
/media/Data : already mounted
mount.nfs: timeout set for Sun Nov 1 14:31:13 2020
mount.nfs: Failed to resolve server //192.168.1.105: Name or service not known
/media/tmpdisk : already mounted

Then I added the -t option and filesystem of nfs:

$ sudo mount -av -t nfs
/ : ignored
/media/Data : ignored
mount.nfs: timeout set for Sun Nov 1 14:35:16 2020
mount.nfs: Failed to resolve server //192.168.1.105: Name or service not known
/media/tmpdisk : ignored

I never thought this would be such a difficult issue to solve. Thank you for the suggestions and please don't stop "swinging", I really need to get this fixed.

sgosnell 11-01-2020 06:40 PM

Do the directories /media/Data, /media/NAS, and /media/tmpdisk exist? Can you post the exports file for the nfs server? And the present fstab for both the server and client? Things are looking somewhat strange from the error messages.


All times are GMT -5. The time now is 01:23 PM.