NFS "No such file or directory"

Creating a bug report/issue

I have searched the existing open and closed issues

Required Information

  • DietPi version | cat /boot/dietpi/.version
    G_DIETPI_VERSION_CORE=8
    G_DIETPI_VERSION_SUB=24
    G_DIETPI_VERSION_RC=1
    G_GITBRANCH=‘master’
    G_GITOWNER=‘MichaIng’

  • Distro version | echo $G_DISTRO_NAME $G_RASPBIAN
    bookworm 0

  • Kernel version | uname -a
    Linux DietPi 6.1.21-v7+ #1642 SMP Mon Apr 3 17:20:52 BST 2023 armv7l GNU/Linux

  • Architecture | dpkg --print-architecture
    armhf

  • SBC model | echo $G_HW_MODEL_NAME or (EG: RPi3)
    RPi 2 Model B (armv7l)

  • Power supply used | (EG: 5V 1A RAVpower)
    Generic high current supply

  • SD card used | (EG: SanDisk ultra)
    Samsung (did not power down and remove to check further)

Additional Information (if applicable)

  • Software title | (NFS server)
  • Was the software title installed freshly or updated/migrated?
    Fresh install
  • Can this issue be replicated on a fresh installation of DietPi?
    This is a fresh install
    ← If you sent a “dietpi-bugreport”, please paste the ID here →
    no bug report, probably not a bug

Steps to reproduce

I have a fresh install with only transmission bittorrent and NFS server installed over the basic system. I use the following in my fstab file on the remote system, which worked okay on my previous system:

192.168.0.250:/mnt/usb_1 /home/dad/dietpi_NAS nfs auto,nofail,noatime,nolock,intr,tcp,actimeo=180>

It doesn’t mount so I tried the following command to see if there is a message:

192.168.0.250:/mnt/usb_1 /home/dad/dietpi_NAS nfs auto,nofail,noatime,nolock,intr,tcp,actimeo=180>

It comes back with:

mount.nfs4: timeout set for Fri Dec 15 16:32:46 2023
mount.nfs4: trying text-based options 'proto=tcp,port=2049,vers=4.2,addr=192.168.0.250,clientaddr=192.168.0.164'
mount.nfs4: mount(2): No such file or directory
mount.nfs4: trying text-based options 'proto=tcp,port=2049,addr=192.168.0.250'
mount.nfs4: prog 100005, trying vers=3, prot=6
mount.nfs4: trying 192.168.0.250 prog 100005 vers 3 prot TCP port 40939
mount.nfs4: mount(2): Permission denied
mount.nfs4: access denied by server while mounting 192.168.0.250:/mnt/usb_1

The command ‘showmount -e 192.168.0.250’ replies with:

Export list for 192.168.0.250:
/mnt/dietpi_userdata *
/mnt/usb_1           192.168.0.*

The computer I’m trying to connect from has NFS common package installed, and is running mx linux OS.

On the dietpi system there are two config files for NFS shares, although I presume only one is used. I’ll post both for completeness:

/etc/exports (not used?)
/mnt/usb_1 192.168.0.*(rw,sync,no_subtree_checkure,no_root_squash)
/etc/exports.d/dietpi.exports
/mnt/usb_1 192.168.0.*(rw,async,no_root_squash,fsid=0,crossmnt,no_subtree_check)

I’m probably making a simple mistake, but I don’t know what it is, and I’m not overly conversant with this kind of thing. If anyone could point me in the right direction or let me know what commands to try to shed more light on the issue, that would be very helpful.

Expected behaviour

Serve files to remote system over NFS

Actual behaviour

See error message above.

Extra details

I didn’t post the entry for “/mnt/dietpi_userdata *” in the section for /etc/exports.d/dietpi.exports, for some reason the formatting got messed up by the text entry system

I think the two configs conflict each other maybe? You could delete them and use dietpi-drive_manager to connect to the share.
The “no file or directory” comes probably from the option fsid=0, this will make the share available under 192.168.0.250/ and not 192.168.0.250/mnt/usb_1
mount.nfs4: mount(2): Permission denied comes maybe from wrong permissions at /mnt/usb_1 or the created folder on the remote machine, where you mount to.

1 Like

Hi Jappe, thanks for your help.

I altered /etc/exports.d/dietpi.exports and removed the option ‘fsid=0’ as per your suggestion.

I also removed the file /etc/exports as I don’t think it is used, it is a part of the normal nfs setup, but dietpi has overridden that location and uses /etc/exports.d/dietpi.exports instead. That is why the dietpi_userdata share is shown by the showmount command, it was only listed in the second file.

I have used chmod -R 777 on the entire share location, and the mount location on the remote client.

Unfortunately, the mount still doesn’t happen, and the error messages have not altered, so it seems to be something else. Probably something very closely related, but not exactly that. Thanks just the same.

on client side, showmount -e <ip.of.nfs.server> still show correct mount?

i mean the message says you don’t have the right permissions

mount.nfs4: mount(2): Permission denied
mount.nfs4: access denied by server while mounting 192.168.0.250:/mnt/usb_1

Did you export your settings after you changed it?
exportfs -a
Maybe you can also try to mount with a specific version, for examle you can add vers=3 to the options.

You mentioned a “actimeo=180>” in your post. Is the ‘>’ really in your fstab?

1 Like

I’ve entered it incorrectly, when the line end is not shown in the terminal it shows > instead. For some reason it even copies/pastes that way.

The actual line is:

192.168.0.250:/mnt/usb_1 /home/dad/dietpi_NAS nfs auto,nofail,noatime,nolock,intr,tcp,actimeo=1800 0 0

I tried it. Because I removed the file /etc/exports it gave the message: exportfs: can’t open /etc/exports for reading

So I replaced that file and duplicated the settings from /etc/exports.d/dietpi.exports, and tried it again. It then gave the message:

exportfs: duplicated export entries:
exportfs: :/mnt/dietpi_userdata
exportfs: :/mnt/dietpi_userdata
exportfs: duplicated export entries:
exportfs: 192.168.0.
:/mnt/usb_1
exportfs: 192.168.0.
:/mnt/usb_1

So I removed the settings duplication and just left the file empty. It wants the file there but doesn’t use it.

I then tried the mount command again at the client machine, but the error message remains identical.

Yes, showmount -e still shows:

Export list for 192.168.0.250:
/mnt/dietpi_userdata *
/mnt/usb_1 192.168.0.*

I noticed a new line in the error messages, but I’m not sure if it’s new or it was always there and I missed it when I copied the original attempts to connect. The line is:

mount.nfs4: config file error: line 1: ignoring line due to no section

When I enter the command:

sudo mount -t nfs4 -vvvv -o proto=tcp,port=2049 192.168.0.250:/mnt/usb_1 /home/dad/dietpi_NAS

The full output is:

mount.nfs4: config file error: line 1: ignoring line due to no section
mount.nfs4: timeout set for Sat Dec 16 10:53:27 2023
mount.nfs4: trying text-based options ‘proto=tcp,port=2049,vers=4.2,addr=192.168.0.250,clientaddr=192.168.0.164’
mount.nfs4: mount(2): No such file or directory
mount.nfs4: trying text-based options ‘proto=tcp,port=2049,addr=192.168.0.250’
mount.nfs4: prog 100005, trying vers=3, prot=6
mount.nfs4: trying 192.168.0.250 prog 100005 vers 3 prot TCP port 32845
mount.nfs4: mount(2): Permission denied
mount.nfs4: access denied by server while mounting 192.168.0.250:/mnt/usb_1

In /etc/fstab I altered the entry to specify to use version 3, as suggested:

192.168.0.250:/mnt/usb_1 /home/dad/dietpi_NAS nfs vers=3,auto,nofail,noatime,nolock,intr,tcp,actimeo=1800 0 0

When I enter “sudo mount -a” the output is:

mount.nfs: config file error: line 1: ignoring line due to no section
mount.nfs: access denied by server while mounting 192.168.0.250:/mnt/usb_1

I don’t know if the first line is significant or not. I checked in the dietpi, the file /etc/nfs.conf has everything commented out except the following:

[general]
pipefs-directory=/run/rpc_pipefs
[mountd]
manage-gids=y

to which I added:

[NFSMount_Global_Options]
Defaultvers=3

after seeing that this fixed the problem for one person previously. It didn’t alter anything here however.

There is also a directory called /etc/nfs.conf, but in that directory there is no file of any kind.

What about trying to use a simpler fstab line for the first start?
E.g.
192.168.0.250:/mnt/usb_1 /home/dad/dietpi_NAS nfs nofail,noauto,x-systemd.automount
If this works, you could change entries and monitor which entry makes trouble.

Additionally, I rather prefer hostnames instead of IP addresses (work within fstab).

It doesn’t make sense to configure fstab as long as manually mounting the share is not working

Can you share current export configuration files. As well following from server side.

df -h
lsblk -o name,fstype,label,size,ro,type,mountpoint,partuuid,uuid

Hi all

Thanks for everyones help. I gave up and used Samba, that’s working quite nicely.

Okay, have a chuckle. Samba wouldn’t give me write access no matter what I tried. After remembering (again) why I went to NFS a long time ago, I reloaded NFS with settings I found on a thread from someone else who doesn’t rate Samba. To sum up, the fstab entry is virtually unchanged:

192.168.0.250:/mnt/usb_1 /home/dad/NAS_nfs nfs vers=3,auto,nofail,noatime,nolock,intr,tcp,actimeo=1800 0 0

On the dietpi NFS server I edited only /etc/exports.d/dietpi.exports and added this line:

/mnt/usb_1 *(rw,no_root_squash,no_subtree_check)

Now it works. When using ‘sudo mount -a’ it still throws the message:

mount.nfs: config file error: line 1: ignoring line due to no section

But it mounts anyway. So, possibly, the options ‘async’ or ‘crossmnt’ were maybe the problem. Who knows. I’ll use it now and completely forget this very quickly, my brain is very protective of my sanity lol.

Theoretically you could add the different options one by one to see where it fails.