1

I'm testing Ubuntu Core in a Raspberry Pi 3 and I would like to use NFS to connect to exports on my NAS.

In the "normal" servers that I have I just add a line in /etc/fstab for each mount, but in Ubuntu Core I saw that the /etc/fstab is autogenerated and that I shouldn't modify it:

# Auto-generated by /init
# DO NOT EDIT THIS FILE BY HAND - YOUR CHANGES WILL BE OVERWRITTEN
# (See writable-paths(5) for details)
/dev/root / rootfs defaults,ro 0 0
LABEL=writable /writable auto defaults 0 0

...

So my questions are:

  1. How should I do it then?
  2. Am I trying to do something that is not recommended?

Thanks!

  • You can change it at your own risk. It is not recommended but you can still do it that is if you know what you're doing and you know that you ain't gonna destroy your PC. So it's up to you – RedFedora Dec 17 '16 at 18:43
  • I don't know if autofs is available in Ubuntu Core. If it is (try sudo apt-get install autofs), you can use the automounter to add NFS connections without modifying /etc/fstab. – ridgy Dec 17 '16 at 19:37
  • I think that you can't install regular packages in Ubuntu Core @ridgy, only snaps – pachulo Dec 20 '16 at 15:49
0

Well, after asking this in the snappy channel of the Rocket server of Ubuntu zyga answered my question:

I don't think NFS is supported today

technically you'd have to mount your NFS directory somewhere and then bind mount that over to /var/snap/ but I don't know what kind of issues you will face

He also talked about a more native/easier option:

you may create a snap that mounts stuff to /media but that's not going to easily let you run stuff with data in NFS

you can design a snap that specifically loads data into the NFS share while keeping regular data in /var/snap as usual

Anyway, he warned me:

I think that is going to be very fragile given how NFS behaves

Summing it up, I think that the answers to my points are:

  1. Implementing a special snap.
  2. It's not a recommended thing to do.
| improve this answer | |
0

I find that using snaps over complicate things like this, so what I would do is download a static build of busybox for your architecture from here.

The reason for doing this is that its an easy alternative for mount, that has support for nfs, ubuntu core doesn't ship with the required helper executables to mount nfs.

After you download or copy over the busybox file you will need to set the executable bit, like this:

chmod +x /home/user/busybox

At this time you should be able to mount your nfs share like this:

sudo mkdir -p /mnt/my_nfs
sudo /home/user/busybox mount -o nolock 1.2.3.4:/share/path /mnt/my_nfs

Note: I had to add the -o nolock options, i'm not sure why, put you may not need it...

To make the mount happen automatically you will need to add systemd service file to run those commands, but the service file in /system-data/etc/systemd/system/ and then enable the service.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.