No autofs.service

trying to setup automounting for nfs shares. cannot find autofs.service after installing storage-utils package. is this by design or a bug? there is also no documentation for this scenerio. can anyone share steps to get autofs working. thanks.

currently have systemd auto/mount units setup, but not satisfactory. it automounts fine if the server is already online. but if server is offline to begin with, the mount stays empty even after the server comes online.

I would look into whether this service is being started with systemctl using the sub commands
Unit Commands:
list-units [PATTERN…] List units currently in memory
list-automounts [PATTERN…]

This what I just ran on my system. The clear-linux distribution may handles the autofs.services task a different way? I did not see that service listed, but I know that auto mounting takes place when a
a usb drive is plugged in. You will see a mount appear under /run/media//

systemctl list-automounts
WHAT WHERE MOUNTED IDLE TIMEOUT UNIT
binfmt_misc /proc/sys/fs/binfmt_misc no 0 proc-sys-fs-binfmt_misc.automount

1 automounts listed.
Pass --all to see loaded but inactive automounts, too

Oh wait you want something to mount windows nfs shares you need to install samba.

no, another linux machine with nfs server.

have done same as you, hence my original question.

You’re right nfs is for mounting remote Unix/Linux servers. I used that years ago with Cent-OS and Red-Hat. I have no occasion to use that service now, so I have not chased down how to make that work in Clear Linux, but I know it must be supported. I believe a feature like mounting remote Linux servers is baked into the Linux Kernal, Check distribution like Ubuntu and see how they support
that feature. Seem like Clear Linux has borrowed some of how system administration is handled from
Ubuntu. i.e. things like systemctl tool.

Found this URL on Clear Linux OS Forum, about your issue, it’s from 2019. Don’t know
if it will solve your problem but give you a start.

Issues with mounting NFS share - General Discussion - Clear Linux OS Forum

thankyou for looking. i came across that post before. the issue is not the same, as i have no problem manually moutning the share, and no problem automounting the share as long as the server is up before the client.

Bing the way I remember setting up nfs being mounted on client when I had multiple linux machines, was that I had lines in the fstab that referenced the server name on the left and on the right mount point on the client and the file options defined. The nfs server had to be up and running. The client
mount points would be empty until the nfs server was running. What you’re describing is bad behavior
and needs to be remedied somehow, either it’s a bug or there is some kind of acceptable work around
available to make it work.

What you could do, once you have an nfs mount point fully mounted type:
mount | grep -i and see what you could add to your manually maintained. /etc/fstab on your client machine(s). See if once the client reboots you get the behavior back you expect about nfs mount points.

I am thinking there should be a way to get this to work for people who want to set up a small lab
in a college with a cluster of linux workstations using a common nfs server, running Clear Linux.

I have not bothered with fstab on clearlinux - i should probably revisit it. thankyou for the detailed response.

Hi @bing,

I will describe my steps to configure it here in my cluster. I hope it helps. The head node is the node sharing the storage.

In all nodes install the nfs-utils

sudo swupd bundle-add nfs-utils

In the head node, in file /etc/exports add what you want to share, like:

/global 192.168.0.0/24(rw,no_root_squash,async)

Enable the services:

sudo systemctl enable rpcbind.service
sudo systemctl start rpcbind.service
sudo systemctl enable rpc-statd.service
sudo systemctl start rpc-statd.service
sudo systemctl enable nfs-server.service
sudo systemctl start nfs-server.service

In the other nodes, edit the file /etc/fstab to add the partitions, something like:

192.168.0.1:/global /global nfs defaults 0 0

Enable the services:

sudo systemctl enable rpcbind.service
sudo systemctl start rpcbind.service
sudo systemctl enable rpc-statd.service
sudo systemctl start rpc-statd.service
sudo systemctl enable nfs-client.target
sudo systemctl start nfs-client.target

Mount everythong in fstab:

sudo mount -a.

@rfkspada what you describe is how I remembered administrating nfs, but better.
Thanks for this input, hopefully. @bing will be able to make use of your how-to.
I know I am keeping your post for future reference.

Thankyou for the detailed instructions. i have indeed used similar steps setting up nfs share for both server and client, but forgoing with fstab instead created mount and automount units directly for the share. I use slightly different options, and everything works except:

my server is a desktop that is online sometimes, the client is a laptop. as taken from my first post, the client cannot automount the share if the server comes online after. And i have since discovered, the laptop hangs at shutdown and reboot, if the share that was mounted is not there anymore (server going offline before laptop reboot/shutdown).

For on demand filesystems, adding x-systemd.automount to the options in fstab works for me.

/etc/fstab (edited):
//serverA/music 	/mnt/serverA/music		cifs	uid=user1,gid=user1,rw,credentials=/a/credfile	0 0
//serverA/video 	/mnt/serverA/video		cifs	uid=user1,gid=user1,rw,credentials=/a/credfile	0 0
//serverB/storage	/mnt/serverB/storage	cifs	uid=user1,gid=user1,rw,credentials=/a/credfile,x-systemd.automount	0 0
//serverB/backup	/mnt/serverB/backup		cifs	uid=user1,gid=user1,rw,credentials=/a/credfile,x-systemd.automount	0 0

# now shutting down serverB and rebooting PC.

user1@clear2~ $ systemctl list-automounts
WHAT                WHERE                    MOUNTED IDLE TIMEOUT UNIT                             
//serverB/backup    /mnt/serverB/backup      no      0            mnt-serverB-backup.automount
//serverB/storage   /mnt/serverB/storage     no      0            mnt-serverB-storage.automount
binfmt_misc         /proc/sys/fs/binfmt_misc no      0            proc-sys-fs-binfmt_misc.automount

3 automounts listed.
Pass --all to see loaded but inactive automounts, too.
user1@clear2~ $

# now starting up serverB

user1@clear2~ $ cd /mnt/serverB/backup
user1@clear2/mnt/serverB/backup $ systemctl list-automounts
WHAT                WHERE                    MOUNTED IDLE TIMEOUT UNIT                             
//serverB/backup    /mnt/serverB/backup      yes     0            mnt-serverB-backup.automount
//serverB/storage   /mnt/serverB/storage     no      0            mnt-serverB-storage.automount
binfmt_misc         /proc/sys/fs/binfmt_misc no      0            proc-sys-fs-binfmt_misc.automount

3 automounts listed.
Pass --all to see loaded but inactive automounts, too.
user1@clear2/mnt/serverB/backup $

thankyou for showing your setup. i have an systemd.automount unit file, which i think is equivalent to x-systemd.automount option in fstab.

i understand the thread has shifted focus from my original title (as there really is no autofs.service and none of the devs care to explain). trying to figure out function fom systemd.mount/automount that mirror autofs functions. part of the hurdle is to figure out the options in the mounts that allow the laptop to reboot or shutdown cleanly if the share is not present - some kind of auto detect when server goes offline and auto unmount. otherwise the laptop hangs.

I guess less options as I don’t have any of those issues, and the automount unit that was automatically created for me is pretty sparse.

user1@clear2~ $ cat /run/systemd/generator/mnt-serverB-backup.automount
# Automatically generated by systemd-fstab-generator

[Unit]
SourcePath=/etc/fstab
Documentation=man:fstab(5) man:systemd-fstab-generator(8)

[Automount]
Where=/mnt/serverB/backup