Mounting network shares with autofs (alternative to fstab)

I am using AUTOFS NFS on my vero 4K and it is really good. But if i restart my vero 4k I can not watch my movies, because I am loosing connection until I ssh to my vero 4K and restart autofs with comand sudo systemctl restart autofs

This is what I do not like. Is it expected behavier of AUTOFS after restart of vero 4K?

After reboot, what is the output of sudo systemctl status autofs?

osmc@osmc:~$ sudo systemctl status autofs
● autofs.service - Automounts filesystems on demand
Loaded: loaded (/lib/systemd/system/autofs.service; disabled; vendor preset:
Active: inactive (dead)

Run sudo systemctl enable autofs && reboot then check if the mounts are active when the machine comes back up.

I entered as you advised sudo systemctl enable autofs && reboot
Vero 4k restarted when I connected by ssh and interned again

osmc@osmc:~$ sudo systemctl status autofs
● autofs.service - Automounts filesystems on demand
Loaded: loaded (/lib/systemd/system/autofs.service; disabled; vendor preset:
Active: inactive (dead)

After that I entered:
osmc@osmc:~$ sudo systemctl restart autofs
osmc@osmc:~$ sudo systemctl status autofs
● autofs.service - Automounts filesystems on demand
Loaded: loaded (/lib/systemd/system/autofs.service; disabled; vendor preset:
Active: active (running) since Sat 2020-05-09 21:57:31 EEST; 46s ago
Process: 1586 ExecStart=/usr/sbin/automount $OPTIONS --pid-file /var/run/autof
Main PID: 1587 (automount)
CGroup: /system.slice/autofs.service
└─1587 /usr/sbin/automount --pid-file /var/run/autofs.pid

May 09 21:57:31 osmc systemd[1]: Starting Automounts filesystems on demand…
May 09 21:57:31 osmc systemd[1]: Started Automounts filesystems on demand.
lines 1-10/10 (END)

It works perfect, but after power failure, or if I restart Vero 4K myself my mounts by AUTOFS is not active…

That should have changed

osmc@osmc:~$ sudo systemctl status autofs
● autofs.service - Automounts filesystems on demand
Loaded: loaded (/lib/systemd/system/autofs.service; disabled; vendor preset:

Into

osmc@osmc:~$ sudo systemctl status autofs
● autofs.service - Automounts filesystems on demand
Loaded: loaded (/lib/systemd/system/autofs.service; enabled; vendor preset:

That’s what I expected too!
When the unit is enabled then it should start on boot everytime.

What output is returned when issuing sudo systemctl enable autofs?

Thanks for your help ActionA
Here is the output, but it is not after restart of the vero 4k, but after restart of AUTOFS

osmc@osmc:~$ sudo systemctl enable autofs
Synchronizing state of autofs.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable autofs
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_TIME = “lt_LT.UTF-8”,
LC_MONETARY = “lt_LT.UTF-8”,
LC_ADDRESS = “lt_LT.UTF-8”,
LC_TELEPHONE = “lt_LT.UTF-8”,
LC_NAME = “lt_LT.UTF-8”,
LC_MEASUREMENT = “lt_LT.UTF-8”,
LC_IDENTIFICATION = “lt_LT.UTF-8”,
LC_NUMERIC = “lt_LT.UTF-8”,
LC_PAPER = “lt_LT.UTF-8”,
LANG = “en_US.UTF-8”
are supported and installed on your system.
perl: warning: Falling back to a fallback locale (“en_US.UTF-8”).
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_TIME = “lt_LT.UTF-8”,
LC_MONETARY = “lt_LT.UTF-8”,
LC_ADDRESS = “lt_LT.UTF-8”,
LC_TELEPHONE = “lt_LT.UTF-8”,
LC_NAME = “lt_LT.UTF-8”,
LC_MEASUREMENT = “lt_LT.UTF-8”,
LC_IDENTIFICATION = “lt_LT.UTF-8”,
LC_NUMERIC = “lt_LT.UTF-8”,
LC_PAPER = “lt_LT.UTF-8”,
LANG = “en_US.UTF-8”
are supported and installed on your system.
perl: warning: Falling back to a fallback locale (“en_US.UTF-8”).
osmc@osmc:~$

Run sudo dpkg-reconfigure locales , de-select anything you find with an asterisk except for en_US.UTF-8, and select Ok. On the next page, I also select en_US.UTF-8. as the default locale for the system environment on the next page, and again select Ok. Grab a cold refreshing beverage while the process completes, then try to sudo systemctl enable autofs. Use the status command we used before and check that the unit reports as enabled.

1 Like

I entered as you adviced: sudo dpkg-reconfigure locales
Actually it was selected just en_US.UTF-8 . I scrolled all the way down and selected OK. On the next page I selected en_US.UTF-8

And here is my output actually not sure is it ok. I will reboot my Vero 4K and check will it mount automatically AUTOFS

Generating locales (this might take a while)…
en_US.UTF-8… done
Generation complete.
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_TIME = “lt_LT.UTF-8”,
LC_MONETARY = “lt_LT.UTF-8”,
LC_ADDRESS = “lt_LT.UTF-8”,
LC_TELEPHONE = “lt_LT.UTF-8”,
LC_NAME = “lt_LT.UTF-8”,
LC_MEASUREMENT = “lt_LT.UTF-8”,
LC_IDENTIFICATION = “lt_LT.UTF-8”,
LC_NUMERIC = “lt_LT.UTF-8”,
LC_PAPER = “lt_LT.UTF-8”,
LANG = “C”
are supported and installed on your system.
perl: warning: Falling back to the standard locale (“C”).
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_TIME = “lt_LT.UTF-8”,
LC_MONETARY = “lt_LT.UTF-8”,
LC_ADDRESS = “lt_LT.UTF-8”,
LC_TELEPHONE = “lt_LT.UTF-8”,
LC_NAME = “lt_LT.UTF-8”,
LC_MEASUREMENT = “lt_LT.UTF-8”,
LC_IDENTIFICATION = “lt_LT.UTF-8”,
LC_NUMERIC = “lt_LT.UTF-8”,
LC_PAPER = “lt_LT.UTF-8”,
LANG = “C”
are supported and installed on your system.
perl: warning: Falling back to the standard locale (“C”).
osmc@osmc:~$ sudo systemctl enable autofs
Synchronizing state of autofs.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable autofs
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_TIME = “lt_LT.UTF-8”,
LC_MONETARY = “lt_LT.UTF-8”,
LC_ADDRESS = “lt_LT.UTF-8”,
LC_TELEPHONE = “lt_LT.UTF-8”,
LC_NAME = “lt_LT.UTF-8”,
LC_MEASUREMENT = “lt_LT.UTF-8”,
LC_IDENTIFICATION = “lt_LT.UTF-8”,
LC_NUMERIC = “lt_LT.UTF-8”,
LC_PAPER = “lt_LT.UTF-8”,
LANG = “en_US.UTF-8”
are supported and installed on your system.
perl: warning: Falling back to a fallback locale (“en_US.UTF-8”).
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_TIME = “lt_LT.UTF-8”,
LC_MONETARY = “lt_LT.UTF-8”,
LC_ADDRESS = “lt_LT.UTF-8”,
LC_TELEPHONE = “lt_LT.UTF-8”,
LC_NAME = “lt_LT.UTF-8”,
LC_MEASUREMENT = “lt_LT.UTF-8”,
LC_IDENTIFICATION = “lt_LT.UTF-8”,
LC_NUMERIC = “lt_LT.UTF-8”,
LC_PAPER = “lt_LT.UTF-8”,
LANG = “en_US.UTF-8”
are supported and installed on your system.
perl: warning: Falling back to a fallback locale (“en_US.UTF-8”).
osmc@osmc:~$

O it helped :slight_smile: Thanks very much!

Now after restart of vero 4k

osmc@osmc:~$ sudo systemctl status autofs
● autofs.service - Automounts filesystems on demand
Loaded: loaded (/lib/systemd/system/autofs.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2020-05-09 23:10:26 EEST; 1min 41s ago
Process: 392 ExecStart=/usr/sbin/automount $OPTIONS --pid-file /var/run/autofs.pid (code=exited, status=0/SUCCESS)
Main PID: 486 (automount)
CGroup: /system.slice/autofs.service
└─486 /usr/sbin/automount --pid-file /var/run/autofs.pid

May 09 23:10:26 osmc systemd[1]: Starting Automounts filesystems on demand…
May 09 23:10:26 osmc systemd[1]: Started Automounts filesystems on demand.
osmc@osmc:~$

Great! So after reboot, you are now finding your mounts in place and functioning?

Yes after reboot, I am finding my mounts in place and functioning.
Already restarted 3 times :slight_smile: and all 3 times is Ok. Really thanks ActionA:+1:

2 Likes

No problem! Enjoy OSMC!

1 Like

H @fzinken,
I suggest indicating in what syntax to add NFS mount options to the /etc/auto.nfs.shares - I had to Google it elsewhere. I tried to filter out the options that may be downgraded in the negotiation but will not limit the performance from the suggestions of @THEM in thread Consistently interrupted playback - #6 by THEM
My suggestion is:

/mnt/TV-F -fstype=nfs,noatime,nolock,local_lock=all,async,rsize=1048576,wsize=1048576 192.168.0.1:/TV-F

  • The rsize and wsize may be downgraded if server does not allow that big, but we mostly deal with streaming big files anyhow, so the bigger the better
  • Locking does not usually happen, but better just disable remote and local alike
  • async should be default, but let’s just try and force it
  • let’s not update atime at all (otherwise it defaults to relatime for me that I know is almost as efficient, but this is the most performant available)

All this and other choices helped me to get very close to the theoretical bandwith of Gigabit Ethernet in Buffering issues - #34 by petersasi. :slight_smile:

@fzinken is it possible to use credentials for nfs using autofs, the above examples only show using creds in smb

HI,

yes, but the NFS server would need to support it, probably kerberos.

Thanks Tom.

The IP address of one of my servers changed after it rebooted following a firmware update. What are the commands to edit the mapped/mounted share on Vero?

I can see the share I need to edit when I do ls -lah /mnt/ … but how do I edit? Thank you.

just edit the IP in your auto.smb.shares or auto.nfs.shares file depending on which one you use.

@fzinken to the rescue again, thank you sir. Simply typing auto.smb.shares returns a command not found error. Sorry, don’t know the exact commands to enter.