Subject: bug#78574: gnome-disks cannot format partitions unless udisksd is run as root

From: Denis 'GNUtoo' Carikli <[email-masked]>
Date: Sat, 24 May 2025 04:28:28 +0200

Hi,

When running gnome-disks, even as root, I cannot format partitions with
it: the only "filesystem" that works is "unformated".

Ext4 seems available but when selected it fails to format the partition
and the rest of the filesystems are greyed out.

This is with (service udisks-service-type) in my system configuration.

However if run 'killall udisksd' and manually run udisksd as root,
gnome-disks can format most filesystems.

What happens behind the scenes is that gnome-disks uses some dbus
wrapper functions to ask the information to Udisks2 through the
/org/freedesktop/UDisks2/Manager org.freedesktop.UDisks2.Manager
CanFormat function. It then caches it.

I've confirmed with d-spy that this function returns true with
parameters like like 'exfat' (with the quotes) when udisksd runs as
root and false when it doesn't.

Udisksd then uses the bd_fs_can_mkfs function from blockdev to get the
information. I've not read yet the bd_utils_check_util_version that
does the actual check though. 

I've also tried to call bd_fs_can_mkfs in a standalone C program but it
didn't work (it probably needs a bit more setup than copying the
udisksd call to it).

And I also didn't look at the udisks-service-type yet. I'll try to find
more time to dig into bd_utils_check_util_version to understand why it
fails.

PS: I've tried to send a bug report on Codeberg to be able to test it
    but I only found 'guix-mirror' and no way to bug report there yet
    and I can't see the only bug report either due to Anubis even while
    being logged to Codeberg.

Denis.