Troubleshooting Systemd Automounts Causing Boot Delays

inix -b
❱inxi -b
System:
  Host: greg-venusseries Kernel: 6.12.4-1-MANJARO arch: x86_64 bits: 64
  Desktop: KDE Plasma v: 6.2.4 Distro: Manjaro Linux
Machine:
  Type: Desktop System: Micro (HK) Tech product: Venus Series v: N/A
    serial: <superuser required>
  Mobo: Shenzhen Meigao Equipment model: AHWSA serial: <superuser required>
    UEFI: American Megatrends LLC. v: AHWSA.1.22 date: 03/12/2024
CPU:
  Info: 14-core (6-mt/8-st) 13th Gen Intel Core i9-13900H [MST AMCP]
    speed (MHz): avg: 492 min/max: 400/5200:5400:4100
Graphics:
  Device-1: Intel Raptor Lake-P [Iris Xe Graphics] driver: i915 v: kernel
  Display: x11 server: X.Org v: 21.1.14 with: Xwayland v: 24.1.4 driver: X:
    loaded: modesetting dri: iris gpu: i915 resolution: 3840x2160~60Hz
  API: OpenGL v: 4.6 compat-v: 4.5 vendor: intel mesa v: 24.2.8-arch1.1
    renderer: Mesa Intel Graphics (RPL-P)
  Info: Tools: api: clinfo, eglinfo, glxinfo, vulkaninfo
    de: kscreen-console,kscreen-doctor wl: wayland-info
    x11: xdpyinfo, xprop, xrandr
Network:
  Device-1: Intel Ethernet I226-V driver: igc
  Device-2: Intel Ethernet I226-LM driver: igc
  Device-3: MEDIATEK MT7922 802.11ax PCI Express Wireless Network Adapter
    driver: mt7921e
Drives:
  Local Storage: total: 1.84 TiB used: 175.93 GiB (9.3%)
Info:
  Memory: total: 32 GiB note: est. available: 31.07 GiB used: 5.55 GiB (17.8%)
  Processes: 391 Uptime: 7m Shell: fish inxi: 3.3.37

I switched to using systemd automounts because I was having a lot of trouble with suspend/wake cycles hanging, and I was advised on the forum to learn to use this method.

But now I’m experiencing an issue with automounts in my Manjaro Linux setup that’s causing significant boot delays. I’ve configured several SMB shares using systemd with .automount units, and while they work perfectly once the system is running (mounting on demand and unmounting after the TimeoutIdleSec interval), they are still being accessed during boot, causing long delays.

Here is an example of one of my automount configurations:

/etc/systemd/system/mnt-TRUENAS_manjaro_home.mount:

[Unit]
Description=Mount SMB Share - manjaro_home Mount
After=network-online.target
Wants=network-online.target

[Mount]
What=//192.168.1.100/manjaro-home
Where=/mnt/TRUENAS_manjaro_home
Type=cifs
Options=vers=2.0,credentials=/home/greg/.smbcredentials-scale,iocharset=utf8,file_mode=0666,dir_mode=0777,_netdev

[Install]
#WantedBy=multi-user.target

/etc/systemd/system/mnt-TRUENAS_manjaro_home.automount:

[Unit]
Description=Automount SMB Share - TRUENAS Manjaro Home
ConditionPathExists=/mnt/TRUENAS_manjaro_home

[Automount]
Where=/mnt/TRUENAS_manjaro_home
TimeoutIdleSec=30

[Install]
#WantedBy=multi-user.target

Despite the automount setup, the .mount units seem to be triggered during boot. Here’s the relevant portion of the output from systemd-analyze blame:

17.942s mnt-mandie_music_local.mount
17.917s mnt-TRUENASSCALE_cavern.mount
17.902s mnt-TRUENASSCALE_mandie.mount
17.846s mnt-TRUENASSCALE_media.mount
17.795s mnt-TRUENAS_cavern.mount
11.847s mnt-TRUENASSCALE_home.mount
11.828s mnt-TRUENASSCALE_manjaro_home.mount
11.712s mnt-TRUENAS_manjaro_home.mount

I’ve confirmed that the shares are functioning as expected after boot, but something is attempting to access the mount points during startup, triggering these delays. I’ve tried adding the noauto option to the .mount units and confirmed that the .automount units are enabled, but the issue persists.

What I’ve done so far:

  1. Verified that the .automount units are enabled and the .mount units are not explicitly enabled.
  2. Added the noauto option to the .mount files.
  3. Increased the TimeoutIdleSec in .automount files to reduce unnecessary mount/unmount cycles.
  4. Tried WantedBy included & not included.
  5. Checked journalctl logs but haven’t found any clear indicators of what’s accessing the mount points during boot.

Has anyone encountered this issue before? How can I prevent these automounts from being triggered during boot? Any help or pointers would be greatly appreciated!

Cheers,

there is actually trouble on automount / ntfs with Truenas

ntfs, windows ?

All mounts are SMB/CIFS mounting into a BTRFS system.

and this ?

How do you know that?

It shows how much time it takes to start a service/socked/mount/… unit. It has nothing to do with the boot process. Of course if a service is started at boot, the time showed might add to the overall boot time.
Btw. do you use a Wifi or a Ethernet cable?

Do it again. The process is listed if the automount is triggered, or if the mount service is enabled.

For example

journalctl -b -u mnt-TRUENAS_manjaro_home.mount -u mnt-TRUENAS_manjaro_home.automount

If you check both mount and automount unit, the first line should contain with
“Got automount request for … triggered by …” .

To get a better picture of all units started in the boot process, create a plot.
For example

systemd-analyze plot > boot.svg

If you open the svg file with a browser you can search in it for units you want to look into.

You can completely remove that section from the .mount unit and disable it. I don’t know if it’ll make a difference, but maybe it does.

Hi, thx for the response.

it did a reboot just now and it looks like it was just the mounts that are to a server that is not on atm so these mounts would not be able to connect at all. But it does not show an error for all of the mounts from that server just 3 of 5.

Jan 19 09:06:29 greg-venusseries kernel: CIFS: VFS: Error connecting to socket. Aborting operation.
Jan 19 09:06:29 greg-venusseries kernel: CIFS: VFS: cifs_mount failed w/return code = -113
Jan 19 09:06:29 greg-venusseries systemd[1]: mnt-TRUENAS_media.mount: Failed with result 'exit-code'.
Jan 19 09:06:29 greg-venusseries systemd[1]: Failed to mount Mount SMB Share - TRUENAS media.
Jan 19 09:06:36 greg-venusseries kernel: CIFS: VFS: Error connecting to socket. Aborting operation.
Jan 19 09:06:36 greg-venusseries kernel: CIFS: VFS: cifs_mount failed w/return code = -113
Jan 19 09:06:36 greg-venusseries systemd[1]: mnt-TRUENAS_cavern.mount: Failed with result 'exit-code'.
Jan 19 09:06:36 greg-venusseries systemd[1]: Failed to mount Mount SMB Share - TRUENAS Cavern.
Jan 19 09:06:42 greg-venusseries kernel: CIFS: VFS: Error connecting to socket. Aborting operation.
Jan 19 09:06:42 greg-venusseries kernel: CIFS: VFS: cifs_mount failed w/return code = -113
Jan 19 09:06:42 greg-venusseries systemd[1]: mnt-TRUENAS_manjaro_home.mount: Failed with result 'exit-code'.
Jan 19 09:06:42 greg-venusseries systemd[1]: Failed to mount Mount SMB Share - manjaro_home Mount.
Jan 19 09:06:49 greg-venusseries kernel: CIFS: VFS: Error connecting to socket. Aborting operation.
Jan 19 09:06:49 greg-venusseries kernel: CIFS: VFS: cifs_mount failed w/return code = -113
Jan 19 09:06:49 greg-venusseries systemd[1]: mnt-mandie_music_local.mount: Failed with result 'exit-code'.
Jan 19 09:06:49 greg-venusseries systemd[1]: Failed to mount Mount SMB Share - mandie_music_local.

heres just one

❱journalctl -b -u mnt-TRUENAS_media.mount
Jan 19 09:06:23 greg-venusseries systemd[1]: Mounting Mount SMB Share - TRUENAS media...
Jan 19 09:06:29 greg-venusseries mount[954]: mount error(113): could not connect to 192.168.1.100Unable to find suitable address.
Jan 19 09:06:29 greg-venusseries systemd[1]: mnt-TRUENAS_media.mount: Mount process exited, code=exited, status=32/n/a
Jan 19 09:06:29 greg-venusseries systemd[1]: mnt-TRUENAS_media.mount: Failed with result 'exit-code'.
Jan 19 09:06:29 greg-venusseries systemd[1]: Failed to mount Mount SMB Share - TRUENAS media.

It seems to show different mounts every time i reboot. Sometimes from the server that is not on atm and sometimes from the server that is on, sometimes a mixture.

However in this case it is showing only the server that is off, but the server is going to be off mostly but i still want the automounts setup for it?

The TRUENAS* is the server that is off
The TRUENASSCALE* is the server that is on

Something else to try:

Once again, I have no idea if this’ll make a differeence, but you could try smb instead of CIFS.

I have many systemd mount and auto-mount units, but no CIFS/SMB. My network mounts are all SSHFS.

Im not sure how mean?

change
Type=cifs to Type=smb
in the .mount file?

1 Like

I think so.

Edit:

The graph indicates, it is not the automount, but the mount is still enabled.

Unfortunately, not the combination of mount and automount output. But it seems you have other problems with your mounts that needs to be addressed first.

Remove the lines from your mount unit.

After=network-online.target
Wants=network-online.target

systemd infers network when you are using _netdev in options - so you may actually be causing delays in boot by having the above lines.

On the other hand you have removed the [Install] section in your automount and this is needed to correctly install the automount unit.

[Install]
WantedBy=multi-user.target

Also remember ONLY enable the automount unit - as enabling both, the mount unit will case delays and the automount will fail.

sudo systemctl disable --now <unit-name>.mount
sudo systemctl enable --now <unit-name>.automount
2 Likes

Jan 19 09:41:45 greg-venusseries mount[16371]: mount: /mnt/TRUENASSCALE_media: unknown filesystem type ‘smb’

Im sure i have tried that before, i shall give it another go.

are you sure they are supposed to be disabled and not just stopped? would that not , well, disable them?

I shall try it.

Yes - and that is the point - the mount unit is started by systemd when it - via the automount definition - detects access to the local folder.

When you are using an automount - which is the optimal solution for network mounts - It is very important that you do not enable the .mount unit.

Only enable and start the .automount.

The flow is

→ access the mountpoint
→ systemd start the mount unit
→ systemd configures the connection based on the settings in the mount unit
→ access the data
→ when TimeoutIdeSec is reached
→ systemd stop the mount unit

Dis-/enabling .mount units only en-/disables them from being started automatically at boot. Which you don’t want for an automount.

Well it looks you you cracked it, i have a couple of cycles with no hangs or waiting errors with the mounts.

I shall test it a couple of times and tick @linux-aarhus as the solution. (finger crossed).

Im so grateful. Thank you.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.