Autofs won't work on new install

Hi,

Another problem that is baffeling me. I installed manjaro gnome on my laptop a couple of months ago and configured autofs to automount my nfs shares on a nas. Installed the packages from aur etc en copy pasted a few files from a working setup. It al worked within a few minutes. Now I am trying to do the same on my new ryzen based pc and I cannot get it to work. These are the steps that:

  • install manjaro and update the system
  • install autofs from aur
  • check if nfs and tools are installed (nfsutils)
  • ran some commands:
showmount -e 192.168.1.100

output:

Export list for 192.168.1.100:
/export                             192.168.1.0/24
/export/USB-Clonezilla-backups-omv6 192.168.1.0/24
/export/Configs                     192.168.1.0/24
/export/Torrent                     192.168.1.0/24
/export/NewPresciousData            192.168.1.0/24
/export/Backup3TB                   192.168.1.0/24
sudo mount -t nfs 192.168.1.100:/Torrent /mnt
ls /mnt

ls /mnt shows the correct content of the share.

sudo systemctl enable autofs 

Copy working auto.master and auto.shares files to the autofs dir. Files have correct permissions. auto.master file:

#
# Sample auto.master file
# This is a 'master' automounter map and it has the following format:
# mount-point [map-type[,format]:]map [options]
# For details of the format look at auto.master(5).
#
/misc	/etc/autofs/auto.misc
#
# NOTE: mounts done from a hosts map will be mounted with the
#	"nosuid" and "nodev" options unless the "suid" and "dev"
#	options are explicitly given.
#
/net	-hosts
#
# Include /etc/autofs/auto.master.d/*.autofs
# To add an extra map using this mechanism you will need to add
# two configuration items - one /etc/autofs/auto.master.d/extra.autofs file
# (using the same line format as the auto.master file)
# and a separate mount map (e.g. /etc/auto.extra or an auto.extra NIS map)
# that is referred to by the extra.autofs file.
#
+dir:/etc/autofs/auto.master.d
#
# If you have fedfs set up and the related binaries, either
# built as part of autofs or installed from another package,
# uncomment this line to use the fedfs program map to access
# your fedfs mounts.
#/nfs4  /usr/sbin/fedfs-map-nfs4 nobind
#
# Include central master map if it can be found using
# nsswitch sources.
#
# Note that if there are entries for /net or /misc (as
# above) in the included master map any keys that are the
# same will not be seen as the first read key seen takes
# precedence.
#
+auto.master
/mnt /etc/autofs/auto.shares --timeout=600 --ghost

auto.shares file:

NewPresciousData-nfs -fstype=nfs,rw,soft,retry=0 192.168.1.100:/NewPresciousData
Torrent-nfs -fstype=nfs,rw,soft,retry=0 192.168.1.100:/Torrent
Configs-nfs -fstype=nfs,rw,soft,retry=0 192.168.1.100:/Configs
Backup3TB-nfs -fstype=nfs,rw,soft,retry=0 192.168.1.100:/Backup3TB
USB-Clonezilla-backups-omv6-nfs -fstype=nfs,rw,soft,retry=0 192.168.1.100:/USB-Clonezilla-backups-omv6
sudo systemctl start autofs
sudo systemctl status autofs 

output:

● autofs.service - Automounts filesystems on demand
     Loaded: loaded (/usr/lib/systemd/system/autofs.service; enabled; preset: disabled)
     Active: active (running) since Sun 2022-12-18 14:29:47 CET; 21min ago
   Main PID: 986 (automount)
      Tasks: 6 (limit: 37473)
     Memory: 4.7M
        CPU: 6ms
     CGroup: /system.slice/autofs.service
             └─986 /usr/bin/automount --systemd-service --dont-check-daemon

dec 18 14:29:47 woonkamer-amd-gnome systemd[1]: Starting Automounts filesystems on demand...
dec 18 14:29:47 woonkamer-amd-gnome systemd[1]: Started Automounts filesystems on demand.
~
~
~
~
~
~
~
~
~
~
~
~
lines 1-12/12 (END)

After a reboot no nfs mount can be found in /mnt. Any ideas what is happening??

Thanx

Yes… You started the autofs but you did not enable it for automatic starting at boot time. :wink:

The proper command is… :arrow_down:

sudo systemctl enable --now autofs

See… :arrow_down:

man systemctl

:wink:

That isn’t mentioned in the manjaro wiki. I’ve just tried it and didn’t work after a reboot.

Are you sure the NFS volumes themselves are mounted at boot? Mounting them only once won’t survive a reboot.

Check your /etc/fstab.

I would favor SystemD mount/automount units instead of autofs.

Or the traditional fstab with options for network mounts.

1 Like

Did you try invoking the specific directory?

Such as,

ls -l /mnt/NewPresciousData-nfs/

(Still going to be annoying and recommend SystemD over autofs)

thats why i’m using autofs right?

autofs has always worked fine before. not planning on switching.

To rule something out, try this, even if you’re using the ghost option.

sudo systemctl enable autofs Command to enable autofs so it can be started either manually or at next boot

sudo systemctl start autofs Command to manually start autofs
Using autofs (automount) with NFS - Manjaro

I’ll join the chorus - systemd mount/automount units is more reliable and much easier to troubleshoot.

No one demand that - but you will make life easier for yourself.

1 Like

translated:

can't get acces to /mnt/NewPresciousData-nfs/': file or directory doesn't exist

Tried after a manual mount and after a reboot. Same error.

This was always so easy. Never had problems with using the same files on different machines. Just install the software, apply some basic steps and copy over the configs. I was aware of the alternatives but thank you for the suggestion anyway.

If manually mounting the NFS share doesn’t work, then it’s not an issue of autofs.

What error do you get when trying to manually mount it? What does journalctl or dmesg reveal?

(Not the error when trying to access it, but when you manually try to mount it.)


Or are you saying that if done manually, it mounts successfully?

You shouldn’t use /mnt, it’s for temporary mounts. Use a dedicated mountpoint like /data.

The directory must exists prior to mounting.

Have tried different mountpoints, including in home directory. On my other systems /mnt works just fine. Just tried /data to be sure and the same problem exists.

I can mount it manually with with:

sudo mount -t nfs 192.168.1.100:/Torrent /mnt

But after a reboot autofs doen’t automount. In either case I get the same error with your command.

But your latest post now shows you’re mounting directly to /mnt, not a subdirectory.

So can you even list or access any of the contents after manually mounting?

It always showed mounting directly to /mnt. And yes after manually mounting the nfs share I can see its content as stated in my first post.

I’m trying to understand if invoking the directory (supposedly automatically created by autofs, even as a “ghost” folder) still yields “No such file or directory”.


Let’s try from scratch.

:question: Manually mounting always works, regardless of the mountpoint (whether it’s /mnt/ directly, or /mnt/NewPreciousData-nfs/)

:question: When you restart the autofs.service, do you see your “ghost” directories nested under /mnt/, even before trying to access anything?

:question: Upon failing to access any NFS contents when using the autofs method, do you still see them in your mtab when you check with the mount command (without any parameters.)

1 yes
2 no
3 which mount command? mount -t nfs?