NFS share mount at system startup

I’d like to mount an NFS or a Samba share at startup on my Turris Omnia. On every sane Linux distro, this is as easy as putting a single line to /etc/fstab.

But using the /etc/fstab approach does not work on Turris for two reasons: 1) there is no init script to run mount -a and 2) the /etc/fstab file is overwritten (cleared) on every TOS update. I know how to create an init script, but I’m not sure how to prevent updates from overwriting the fstab file. It’s confusing.

The block-mount approach also does not work, because it doesn’t support network shares (makes sense since those are not block devices).

I’ve found this forum topic, but I don’t like that approach because it means hardcoding the share parameters to some random file, a great place to hide information about the filesystems and never find them again.

Why is it such a struggle to automount a share? Or am I missing some simple solution?

1 Like


This is indeed somewhat irritating.
I found 1) that /etc/fstab is updated by the package base-files (using opkg search /etc/fstab).
2) I found on this openwrt forum that editing /etc/sysupgrade.conf might preserve the fstab file when upgrading Turris OS. I still have to test if this will work, I’ll try not to forget to report back.
I just read through Remove sysupgrade (#133) · Issues · Turris / Turris OS / Turris Build · GitLab, and sysupgrade.conf is probably just a stale leftover file

Sysupgrade is present in Turris OS 5.0+. We should remove it. It is a dangerous to have it in system.


A last resort for me would be to write a script which restores fstab at each reboot, but hopefully number (2) works.

1 Like

It is, because /etc/fstab is one of the most essential Linux configuration files, and the auto updater silently clears it every time it runs. Documentation does not mention this, forum posts remain unresponded.

I have tried the /etc/sysupgrade.conf method, but the updater does not respect this file. As a workaround, I have created an alternative fstab file, but now I have to use the mount -T command-line option.

First, can you tell if manual mount works? At least that would mean you have all the modules installed to mount NFS shares.
next is the auto-mount question.
Sorry I am a bit too lazy to log in to my MOX to double check by myself, but on the OpenWRT documentation they mention settings in /etc/config/fstab. The user can makes changes in /etc/config that are not overwritten by the system. By default on OpenWRT the file :etc/config/fstab doesn’t exist - not sure about Turris OS.
OpenWRT docs fstab
Also I think you need “autofs” option in your mount options (otherwise your system might struggle if your NFS server is not available), but it is not clear to me if you need to install autofs packages and/or blockd packages (that would include autofs).
Sorry i am not super clear but I think there are a couple of avenues you can explore here.

1 Like

By the way on desktop linux these days it is recommended to use automount mechanisms for network shares (like systemd-automount) instead of additional lines in /etc/fstab.