Score:0

Udisks2 rule to ignore BTRFS-in-LUKS array member disks

lb flag

On Ubuntu 20.04 PC's with a btrfs (in crypto / LUKS) raid-1 disk array, file managers (nautiuls, thunar, etc) show duplicate entries for the [logically] same disk, and repeatedly mount duplicate /media/User/DiskLabel-N. Request: I'd like to prevent user clicks in the file manager from mounting multiple copies of the array; they pollute the UI, as well as cause the file-manager to behave sluggishly. A bonus would be to hide the all (or all but one) entry in the file-manager, as we have hard-coded mounts for these arrays already.

I believe this tracks udisk2 not having ignore rules for the such an array disks, but am not succeeding with UDISKS_IGNORE rules to manually hide the UUIDs of the array disks. Note similar (accepted & fixed) issue for zfs zvol's a couple years ago: https://bugs.freedesktop.org/show_bug.cgi?id=100864 + https://github.com/storaged-project/udisks/pull/376

Example symptoms, on machine with THREE-disk array:

  • after clean boot OR umount /media/*/dataarray*
    • mount | grep '/media/.*/dataarray' --> #empty
    • in nautilus, the left pane shows TWO "dataarray-1" entries
  • in nautilus, click repeatedly on the disks in the left pane labeled
    • on the first click (only), a third "dataarray-1" entry appears in the left pane alongside the other physical disks
    • on subsequent clicks, new mounts are created in the shortcut area
      • journalctl logs one of these for each click udisksd[1933]: Mounted /dev/dm-4 at /media/TheUser/dataarray-13 on behalf of uid 1000

example disk topology:

$ lsblk
NAME                               MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
...
sdc                                  8:32   1   1.4T  0 disk  
└─sdc1                               8:33   1   1.4T  0 part  
  └─data_btrfs_n1                  253:6    0   1.4T  0 crypt /mnt/data-array # Note: mounted at boot via fstab+crypttab with keyfile on the FDE boot disk
sdd                                  8:48   1   1.4T  0 disk  
└─sdd1                               8:49   1   1.4T  0 part  
  └─data_btrfs_n2                  253:4    0   1.4T  0 crypt # eg /dev/dm-4 in the journal
sde                                  8:64   1   1.4T  0 disk  
└─sde1                               8:65   1   1.4T  0 part  
  └─data_btrfs_n3                  253:5    0   1.4T  0 crypt 



$ blkid
...
/dev/sdc1: UUID="222..." TYPE="crypto_LUKS" PARTUUID="..."
/dev/sdd1: UUID="333..." TYPE="crypto_LUKS" PARTUUID="..."
/dev/sde1: UUID="111..." TYPE="crypto_LUKS" PARTUUID="..."

and udev rules in /etc/udev/rules.d/10-local.rules

SUBSYSTEM=="block", ENV{ID_FS_UUID}=="111...", ENV{UDISKS_IGNORE}="1"
SUBSYSTEM=="block", ENV{ID_FS_UUID}=="222...", ENV{UDISKS_IGNORE}="1"
SUBSYSTEM=="block", ENV{ID_FS_UUID}=="333...", ENV{UDISKS_IGNORE}="1"
lb flag
I'm finding several layers of components have issues / questions submitted about this; for future reference, here's the most closely related https://gitlab.gnome.org/GNOME/gvfs/-/issues/519; and a corresponding (albeit stalled) candidate https://github.com/storaged-project/udisks/pull/838
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.