With systemd-automount, Nemo hangs

My goal: when I connect a certain USB harddisk, mount it and run a bash script.
To reach this goal, I have this in my fstab for this disk:
fstab:
UUID=76c6c02b-231d-4e0b-ac7a-5744175562ae /media/usbarchive btrfs defaults,noatime,noauto,compress-force=zstd:5,x-systemd.automount,x-system.idle-timeout="10min" 0 0
When I do sudo mount -a, this disk is not mounted, which is correct since it has noauto.

A systemd service file I created:
/etc/systemd/system/btrbk-usbarchive.service

[Unit]
Description=Run btrbk for usbarchive
Requires=media-usbarchive.mount
After=media-usbarchive.mount

[Service]
ExecStart=/home/asterix/docker/HOST/btrbk/archive-mail.sh
Type=forking

[Install]
WantedBy=media-usbarchive.mount

a udev rule I created: /etc/udev/rules.d/99-btrbk.rules
SUBSYSTEM=="block", ENV{ID_TYPE}=="disk", ENV{ID_FS_UUID}=="76c6c02b-231d-4e0b-ac7a-5744175562ae", ACTION=="add", TAG+="systemd", ENV{SYSTEMD_WANTS}="btrbk-usbarchive.service"

It works: when I connect the disk via USB, it is mounted to /media/usbarchive and the script is launched!

But Nemo File Manager has issues: I can’t launch it, it takes 2 minutes to launch. Syslog shows Nemo is constantly trying to mount /media/usbarchive even though the disk is not connected!
Nemo should not even be triggering the mount in fstab, since I use noauto. Note I use noauto for 3 other disks: Nemo leaves them alone even though they are unmounted internal SATA disks. Nemo shows these 3 disks under “Devices” but without eject button.

How can I make sure Nemo stays away from this disk, especially when the disk is not connected?

EDIT:
commenting out the line in fstab + rebooting makes Nemo start normally again. When uncommenting the line + sudo mount -a, Nemo still launches normally and I see usbarchive under devices without eject button (the disk is not connected). It goes wrong when I reboot. Then I can start Nemo and wait for almost 2 minutes for it to launch and it still behaves slow.

Does disabling media autorun/autostart tick / or ensuring the media automount tickbox isnt ticked in preferences/behaviour help? i.e. press Alt to display the nemo menu.

Forgot to mention I did that already for Nemo and also for Nemo with elevated rights. Makes no difference:
Alt > Edit > Preferences > Behavior > Media Handling > unticked “Automatically mount removable media when inserted and on startup” and also “Automatically open a folder for automounted media”

Now I also did:
gsettings set org.gnome.desktop.media-handling automount false, going to reboot to test.

edit: also makes no difference

Solved:

changed the mountpoint to something else instead of /media, apparently, Nemo will try to mount everything in /media regardless the Nemo preferences.

Changed it to /mnt and now Nemo works as expected.

1 Like

That’s a very unusual observation. Think its worth raising on the upstream tracker - even if its just to raise the awareness.