packages icon indicating copy to clipboard operation
packages copied to clipboard

Fresh install of autofs is misconfigured and won't start (T9916)

Open celticmagic opened this issue 2 years ago • 7 comments

TraceyC (#TClark77), 2021-09-20 02:41:46 UTC

Unable to start autofs with default configuration.

autofs and cifs-utils are installed. I've been able to mount the samba share through an entry in fstab, but I was looking to be able to auto mount the share after login rather than through /etc/fstab.

I set up a mount for my htpc's samba share, referencing this document:

https://help.ubuntu.com/community/Autofs

Then I restarted autofs with sudo systemctl restart autofs

It didn't work, there were no subdirectories under /cifs. I stopped autofs and ran this to find out why, as the doc recommends:

≻ sudo automount -f -v
Starting automounter version 5.1.6, master map auto.master
using kernel protocol version 5.05
lookup(dir): dir map /etc/auto.master.d missing or not readable
lookup(file): failed to read included master map dir:/etc/auto.master.d

The problem is that the directory, /etc/auto.master.d which is specified in /etc/auto.master is not present on Solus

Recommended fix:

Properly create the directory expected with whatever default contents it needs, or comment out that line

Commenting out the bogus directory in my config file allowed my mount to work and the /cifs/ to auto create the share directory.

celticmagic avatar Aug 16 '23 16:08 celticmagic

Maik Wöhl (#maikwoehl), 2021-09-21 15:08:16 UTC

The PKGBUILD in the AUR is also adding this dedicated directory.

To avoid changes to the master map of autofs I would vote for adding the directory, too.

celticmagic avatar Aug 16 '23 16:08 celticmagic

TraceyC (#TClark77), 2021-09-23 00:27:30 UTC

Also, the systemd unit is created, but not enabled. Given that the purpose of autofs is to automatically mount a filesystem at startup, I recommend making the install of autofs enable the system unit and start autofs

celticmagic avatar Aug 16 '23 16:08 celticmagic

Fabio (#livingsilver94), 2021-09-23 07:43:20 UTC

#TClark77 we need the new usysconf for that.

celticmagic avatar Aug 16 '23 16:08 celticmagic

Rune Morling (#ermo), 2021-09-23 17:02:52 UTC

#TClark77

If you're open to an alternative approach (= workaround), I've had success with configuring systemd automounts too. The trick seems to be to configure systemd to have an unlimited timeout for the units in question.

The following assumes that a share named //server/media_share will be mounted on /mnt/server/media_share.

Start by setting up a .mount unit for the network (cifs) drive:

# contents of /etc/systemd/system/mnt-server-media_share.mount
# NB: The name of the .mount unit needs to match the mount location!
[Unit]
Description=Server media_stash share
StartLimitIntervalSec=0

[Mount]
What=//server/media_share
Where=/mnt/server/media_share
Type=cifs
Options=guest,sec=ntlmssp,_netdev

[Install]
WantedBy=multi-user.target

Then, set up an .automount unit for the .mount unit:

# contents of /etc/systemd/system/mnt-server-media_share.automount
# NB: The name of the .automount unit needs to match the mount location!
[Unit]
Description=Automount unit for //server/media_share
StartLimitIntervalSec=0

[Automount]
Where=/mnt/server/media_share

[Install]
WantedBy=multi-user.target

Finally, enable the .automount unit with sudo systemctl enable --now mnt-server-media_share.automount.

The end result should be that the share will be automounted the first time something tries to access it.

Running sudo mount should show a corresponding mount point line starting with systemd-1:

systemd-1 on /mnt/server/media_share type autofs (... options ...)

celticmagic avatar Aug 16 '23 16:08 celticmagic

Maik Wöhl (#maikwoehl), 2021-09-24 17:44:48 UTC

Maybe it would be a good idea to add this approach to the Help Center. So anyone can search for "automount" on Solus and will find that approach.

I guess because Gnome and KDE have their own automount stuff for USB drives and SD cards, this is more for the advanced user?

celticmagic avatar Aug 16 '23 16:08 celticmagic

Rune Morling (#ermo), 2021-09-25 11:55:36 UTC

! In T9916#188406, #maikwoehl wrote: Maybe it would be a good idea to add this approach to the Help Center. So anyone can search for "automount" on Solus and will find that approach.

I guess because Gnome and KDE have their own automount stuff for USB drives and SD cards, this is more for the advanced user?

I've posted it as a HOWTO on the forum for now:

https://discuss.getsol.us/d/7455-howto-set-up-systemd-automount-functionality

celticmagic avatar Aug 16 '23 16:08 celticmagic

Beatrice T. Meyers (#DataDrake), 2022-03-13 00:26:36 UTC

Not quite sure how best to fix this yet, but we can at least put it in the right TODO list.

celticmagic avatar Aug 16 '23 16:08 celticmagic