Autofs won't work on new install


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 /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?

No mount command. When you restart the actual autofs.service.

EDIT: I see the confusion. I meant checking after you restart the autofs.service, by using the mount command without any parameters. (Simply typing mount in the terminal will list the contents of your mtab, AKA current mounts.)

Not when using systemd-mount or the .mount / .automount units, it will be handled automatically :wink:

@Magician1981 new technologies replace old ones in due time, so trust the knowledge of those trying to help you and switch to the systemd way of mounting and auto-mounting…
It is already part of your default system install, and most other distros, no need to install and fiddle with old software…

When it comes to autofs most likely not starting at boot has already been pointed out with the systemctl enable --now command…

:information_source: :mega:I wish as a New-year present that no-one in the world will ever use the mount command again ever and all switch to systemd-mount eg:

  • systemd-mount -t nfs /mnt
    or similar commands…

systemd-mount can do much more as the prehistoric mount command with a much more user-friendly and understandable way of config…

  • Death to /etc/fstab :rofl:
    ~  mount                                                            ✔ 
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sys on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
dev on /dev type devtmpfs (rw,nosuid,relatime,size=15988712k,nr_inodes=3997178,mode=755,inode64)
run on /run type tmpfs (rw,nosuid,nodev,relatime,mode=755,inode64)
efivarfs on /sys/firmware/efi/efivars type efivarfs (rw,nosuid,nodev,noexec,relatime)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
/dev/nvme0n1p2 on / type btrfs (rw,relatime,ssd,discard=async,space_cache=v2,subvolid=256,subvol=/@)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,inode64)
cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
bpf on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime,mode=700)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=29,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=21569)
debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime)
mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,pagesize=2M)
tracefs on /sys/kernel/tracing type tracefs (rw,nosuid,nodev,noexec,relatime)
configfs on /sys/kernel/config type configfs (rw,nosuid,nodev,noexec,relatime)
fusectl on /sys/fs/fuse/connections type fusectl (rw,nosuid,nodev,noexec,relatime)
/dev/nvme0n1p2 on /home type btrfs (rw,relatime,ssd,discard=async,space_cache=v2,subvolid=257,subvol=/@home)
/dev/nvme0n1p2 on /var/cache type btrfs (rw,relatime,ssd,discard=async,space_cache=v2,subvolid=258,subvol=/@cache)
/dev/nvme0n1p2 on /var/log type btrfs (rw,relatime,ssd,discard=async,space_cache=v2,subvolid=259,subvol=/@log)
tmpfs on /tmp type tmpfs (rw,noatime,inode64)
/dev/nvme0n1p1 on /boot/efi type vfat (rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=3199956k,nr_inodes=799989,mode=700,uid=1000,gid=1000,inode64)
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
/dev/sdb1 on /run/media/magician/poep type ext4 (rw,nosuid,nodev,relatime,errors=remount-ro,uhelper=udisks2)
portal on /run/user/1000/doc type fuse.portal (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
/etc/autofs/auto.misc on /misc type autofs (rw,relatime,fd=5,pgrp=2773,timeout=300,minproto=5,maxproto=5,indirect,pipe_ino=29187)
-hosts on /net type autofs (rw,relatime,fd=11,pgrp=2773,timeout=300,minproto=5,maxproto=5,indirect,pipe_ino=32428)
/etc/autofs/auto.shares on /mnt type autofs (rw,relatime,fd=17,pgrp=2773,timeout=600,minproto=5,maxproto=5,indirect,pipe_ino=32431)

Some autofs refference near the bottom.

I’m aware of sotfware progres, however if it works it works…
This will automount at boot every time? What happens when nfs shares are not available when nas is offline? Thank you for your input.

The systemd automount functionality when properly setup does yes…

Then the unit (action) will just fail and not mount, simple as that :smile_cat:

I used this method and it is working for me.
If you need to see any of my config files I can show them to you.

I am having a look at some guides online right now, but your examples would surely help.


Found out what the problem was. Basically I created a new text file called auto.nas and put the contents of auto.shares in that file. Modified auto.master to point to the new ‘‘shares’’ file and it worked. My guess is that it had something to do with permissions right? Strange that on all other systems it was just a matter of copy pasting the files and restarting autofs service.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.