Udisk mounts local btrfs partition after moving from fstab to systemd.mount

I have a RAID 1 brtfs filesystem (on /dev/sda1 and /dev/sdb1). Since they are HDDs it was making my boot take 12+ seconds longer waiting on that mount. Even with the HDDs all ready spun up.

I don’t need this mount for any services on boot, so I moved it to a systemd mount, which works fine. (And also great for network mounts.) But udisksd picks it up every boot, and adds another mount to that filesystem in /run/media/$USER/UUID. Every time I restart or sleep, it will make a new directory, and I will have many of them until I clean them up. They are also all mounted with the filesystem, as of course you can mount btrfs multiple times from different mount points.

Jun 19 01:47:05 mbox udisksd[1929]: Cleaning up mount point /run/media/tdell/79d7cd2a-98ea-4866-a9a9-e1a84e2e6ae1 (device 8:17 is not mounted)
Jun 19 01:47:05 mbox udisksd[1929]: Error cleaning up mount point /run/media/tdell/79d7cd2a-98ea-4866-a9a9-e1a84e2e6ae1: Error removing directory: Device or resource busy
Jun 19 01:47:05 mbox udisksd[1929]: Cleaning up mount point /run/media/tdell/79d7cd2a-98ea-4866-a9a9-e1a84e2e6ae11 (device 8:17 is not mounted)
Jun 19 01:47:05 mbox udisksd[1929]: Error cleaning up mount point /run/media/tdell/79d7cd2a-98ea-4866-a9a9-e1a84e2e6ae11: Error removing directory: Device or resource busy
Jun 19 01:47:05 mbox udisksd[1929]: Cleaning up mount point /run/media/tdell/79d7cd2a-98ea-4866-a9a9-e1a84e2e6ae12 (device 8:17 is not mounted)
Jun 19 01:47:05 mbox udisksd[1929]: Error cleaning up mount point /run/media/tdell/79d7cd2a-98ea-4866-a9a9-e1a84e2e6ae12: Error removing directory: Device or resource busy
Jun 19 01:47:05 mbox udisksd[1929]: Cleaning up mount point /run/media/tdell/79d7cd2a-98ea-4866-a9a9-e1a84e2e6ae13 (device 8:17 is not mounted)
Jun 19 01:47:05 mbox udisksd[1929]: Error cleaning up mount point /run/media/tdell/79d7cd2a-98ea-4866-a9a9-e1a84e2e6ae13: Error removing directory: Device or resource busy
Jun 19 01:47:05 mbox udisksd[1929]: Cleaning up mount point /run/media/tdell/79d7cd2a-98ea-4866-a9a9-e1a84e2e6ae1 (device 8:17 is not mounted)
Jun 19 01:47:05 mbox udisksd[1929]: Error cleaning up mount point /run/media/tdell/79d7cd2a-98ea-4866-a9a9-e1a84e2e6ae1: Error removing directory: Device or resource busy
Jun 19 01:47:05 mbox udisksd[1929]: Cleaning up mount point /run/media/tdell/79d7cd2a-98ea-4866-a9a9-e1a84e2e6ae11 (device 8:17 is not mounted)
Jun 19 01:47:05 mbox udisksd[1929]: Error cleaning up mount point /run/media/tdell/79d7cd2a-98ea-4866-a9a9-e1a84e2e6ae11: Error removing directory: Device or resource busy
Jun 19 01:47:05 mbox udisksd[1929]: Cleaning up mount point /run/media/tdell/79d7cd2a-98ea-4866-a9a9-e1a84e2e6ae12 (device 8:17 is not mounted)
Jun 19 01:47:05 mbox udisksd[1929]: Error cleaning up mount point /run/media/tdell/79d7cd2a-98ea-4866-a9a9-e1a84e2e6ae12: Error removing directory: Device or resource busy
Jun 19 01:47:05 mbox udisksd[1929]: Cleaning up mount point /run/media/tdell/79d7cd2a-98ea-4866-a9a9-e1a84e2e6ae13 (device 8:17 is not mounted)
Jun 19 01:47:05 mbox udisksd[1929]: Error cleaning up mount point /run/media/tdell/79d7cd2a-98ea-4866-a9a9-e1a84e2e6ae13: Error removing directory: Device or resource busy
Jun 19 01:47:05 mbox udisksd[1929]: Cleaning up mount point /run/media/tdell/79d7cd2a-98ea-4866-a9a9-e1a84e2e6ae1 (device 8:17 is not mounted)
Jun 19 01:47:05 mbox udisksd[1929]: Error cleaning up mount point /run/media/tdell/79d7cd2a-98ea-4866-a9a9-e1a84e2e6ae1: Error removing directory: Device or resource busy
Jun 19 01:47:05 mbox udisksd[1929]: Cleaning up mount point /run/media/tdell/79d7cd2a-98ea-4866-a9a9-e1a84e2e6ae11 (device 8:17 is not mounted)
Jun 19 01:47:05 mbox udisksd[1929]: Error cleaning up mount point /run/media/tdell/79d7cd2a-98ea-4866-a9a9-e1a84e2e6ae11: Error removing directory: Device or resource busy
Jun 19 01:47:05 mbox udisksd[1929]: Cleaning up mount point /run/media/tdell/79d7cd2a-98ea-4866-a9a9-e1a84e2e6ae12 (device 8:17 is not mounted)
Jun 19 01:47:05 mbox udisksd[1929]: Error cleaning up mount point /run/media/tdell/79d7cd2a-98ea-4866-a9a9-e1a84e2e6ae12: Error removing directory: Device or resource busy
Jun 19 01:47:05 mbox udisksd[1929]: Cleaning up mount point /run/media/tdell/79d7cd2a-98ea-4866-a9a9-e1a84e2e6ae13 (device 8:17 is not mounted)
Jun 19 01:47:05 mbox udisksd[1929]: Error cleaning up mount point /run/media/tdell/79d7cd2a-98ea-4866-a9a9-e1a84e2e6ae13: Error removing directory: Device or resource busy
Jun 19 01:47:05 mbox udisksd[1929]: Cleaning up mount point /run/media/tdell/79d7cd2a-98ea-4866-a9a9-e1a84e2e6ae1 (device 8:17 is not mounted)
Jun 19 01:47:05 mbox udisksd[1929]: Error cleaning up mount point /run/media/tdell/79d7cd2a-98ea-4866-a9a9-e1a84e2e6ae1: Error removing directory: Device or resource busy
Jun 19 01:47:05 mbox udisksd[1929]: Cleaning up mount point /run/media/tdell/79d7cd2a-98ea-4866-a9a9-e1a84e2e6ae11 (device 8:17 is not mounted)
Jun 19 01:47:05 mbox udisksd[1929]: Error cleaning up mount point /run/media/tdell/79d7cd2a-98ea-4866-a9a9-e1a84e2e6ae11: Error removing directory: Device or resource busy
Jun 19 01:47:05 mbox udisksd[1929]: Cleaning up mount point /run/media/tdell/79d7cd2a-98ea-4866-a9a9-e1a84e2e6ae12 (device 8:17 is not mounted)
Jun 19 01:47:05 mbox udisksd[1929]: Error cleaning up mount point /run/media/tdell/79d7cd2a-98ea-4866-a9a9-e1a84e2e6ae12: Error removing directory: Device or resource busy
Jun 19 01:47:05 mbox udisksd[1929]: Cleaning up mount point /run/media/tdell/79d7cd2a-98ea-4866-a9a9-e1a84e2e6ae13 (device 8:17 is not mounted)
Jun 19 01:47:05 mbox udisksd[1929]: Error cleaning up mount point /run/media/tdell/79d7cd2a-98ea-4866-a9a9-e1a84e2e6ae13: Error removing directory: Device or resource busy

Every post I can find that seems relevant to this, says to make udev rules to stop Udisks from mounting that block device or UUID. I did that, but it doesn’t seem to have any effect either way. I think that is meant for removable media only? Also, udisks.conf seems to no options to do anything really, except for loading modules.

So I am really unsure how to stop this without disabling Udisk altogether. Which I can do, and mount external media manually.

I was optimistic when looking into: /etc/polkit-1/rules.d/99-manjaro.rules. But I can’t seem to find a way to blacklist only my HDDs.

I would use systemd.service instead of systemd.mount, because systemd.service has more logic than systemd.mount.

Mount has unique options that are perfect for background mounting… But that’s a moot point, because Udisks will still end up mounting it.

It’s hard to know where is your custom enabled Udisk script that you made.

Check $ systemctl list-unit-files --state=enabled

It’s just what Manjaro comes with to mount USB drives and the like, automatically. I didn’t touch anything Udisk-wise. I just moved it from my /etc/fstab, to a systemd.mount unit.

systemctl list-unit-files --state=enabled

UNIT FILE                          STATE   PRESET
mnt-hdd.mount                      enabled disabled
cups.path                          enabled disabled
apparmor.service                   enabled disabled
bluetooth.service                  enabled disabled
cups.service                       enabled disabled
gdm.service                        enabled disabled
getty@.service                     enabled enabled
haveged.service                    enabled disabled
libvirtd.service                   enabled disabled
ModemManager.service               enabled disabled
NetworkManager-dispatcher.service  enabled disabled
NetworkManager-wait-online.service enabled disabled
NetworkManager.service             enabled disabled
nfs-server.service                 enabled disabled
snapd.apparmor.service             enabled disabled
snapd.service                      enabled disabled
sshd.service                       enabled disabled
systemd-timesyncd.service          enabled enabled
ufw.service                        enabled disabled
cups.socket                        enabled disabled
libvirtd-ro.socket                 enabled disabled
libvirtd.socket                    enabled disabled
virtlockd.socket                   enabled disabled
virtlogd.socket                    enabled disabled
remote-fs.target                   enabled enabled
pamac-cleancache.timer             enabled disabled
pamac-mirrorlist.timer             enabled disabled
pkgfile-update.timer               enabled disabled

Did you correctly remove a specfic line from /etc/fstab after migrating to systemd.mount?
Can you show us the output of /etc/fstab ?

# <file system>             <mount point>  <type>  <options>  <dump>  <pass>
UUID=22BD-3A90                            /boot/efi      vfat    umask=0077 0 2
UUID=310e0472-f96e-485c-8fa1-585bcccfb624 /              btrfs   subvol=/@,defaults,noatime,autodefrag 0 0
UUID=310e0472-f96e-485c-8fa1-585bcccfb624 /home          btrfs   subvol=/@home,defaults,noatime,autodefrag 0 0
UUID=310e0472-f96e-485c-8fa1-585bcccfb624 /var/cache     btrfs   subvol=/@cache,defaults,noatime,autodefrag 0 0
UUID=310e0472-f96e-485c-8fa1-585bcccfb624 /var/log       btrfs   subvol=/@log,defaults,noatime,autodefrag 0 0
UUID=9f5a3a86-21ad-4bcc-9db7-2377aee3d05c swap           swap    defaults,noatime 0 0

#UUID=79d7cd2a-98ea-4866-a9a9-e1a84e2e6ae1       /mnt/hdd        btrfs   defaults,noatime,autodefrag,compress=zstd 0 0

Oh! So I leave it in, but not mount it there, Udisk would ignore it?

/etc/fstab looks right. Yes, I think Udisk ignores it.

Check what is the output:

  • $ udisksctl status
  • $ systemctl cat udisks2.service
  • $ systemctl status udisks2.service
  • $ systemctl cat mnt-hdd.mount
MODEL                     REVISION  SERIAL               DEVICE
--------------------------------------------------------------------------
Samsung SSD 970 EVO Plus 1TB 3B2QEXM7  S6S1NG0RA03670P      nvme0n1
Samsung SSD 990 PRO 2TB   0B2QJXD7  S73WNJ0TC04330Y      nvme1n1
WDC WD60EZRZ-00GZ5B1      80.00A80  WD-WX11DB65ZAR0      sda
WDC WD60EZRZ-00RWYB1      80.00A80  WD-WX21DC59A39H      sdb
Kingston Multi-Reader  -0 0031      08738122200994       sdc
Kingston Multi-Reader  -1 0031      08738122200994       sdd
Kingston Multi-Reader  -2 0031      08738122200994       sde
Kingston Multi-Reader  -3 0031      08738122200994       sdf

Actually, I already made that change and I think that worked… Just uncommented the line in /etc/fstab with noauto.

Since I can’t really mark one specific post as the solution. I’ll make this it. But with help from @Zesko.

Udisks appears to ignore devices in /etc/fstab. I just added the option: noauto. So basically the line is unused, but then I can use the systemd units for mounting, without Udisks making a mess of everything.

(I was even getting into how to write Polkit rules, and if it was doable that way. But that is so much easier! Not really obvious at first though.)

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