Difference between revisions of "Udisks"

From ArchWiki
Jump to: navigation, search
(Undo revision 403678 by Aaron chen (talk) - unnecessary and inconvenient, the redirect points right there...)
m (Broken standby timer (udisks2))
 
(118 intermediate revisions by 28 users not shown)
Line 1: Line 1:
 
[[Category:Hardware detection and troubleshooting]]
 
[[Category:Hardware detection and troubleshooting]]
[[zh-cn:Udisks]]
+
[[fr:Gestion de volumes avec udisks]]
 +
[[it:Execute on USB insert]]
 
[[ja:Udisks]]
 
[[ja:Udisks]]
 
[[ru:Udisks]]
 
[[ru:Udisks]]
 +
[[zh-hans:Udisks]]
 
{{Related articles start}}
 
{{Related articles start}}
 
{{Related|udev}}
 
{{Related|udev}}
Line 13: Line 15:
 
== Installation ==
 
== Installation ==
  
There are two versions of ''udisks'' called {{Pkg|udisks}} and {{Pkg|udisks2}}. Development of ''udisks'' has ceased in favor of ''udisks2''. [http://davidz25.blogspot.be/2012/03/simpler-faster-better.html]
+
There are two versions of ''udisks'' called {{AUR|udisks}} and {{Pkg|udisks2}}. Development of '''udisks''' has ceased in favor of '''udisks2'''. [http://davidz25.blogspot.be/2012/03/simpler-faster-better.html]
  
''udisksd'' ({{Pkg|udisks2}}) and ''udisks-daemon'' ({{Pkg|udisks}}) are started on-demand by [[D-Bus]], and should not be enabled explicitly (see {{ic|man udisksd}} and {{ic|man udisks-daemon}}). They can be controlled through the command-line with ''udisksctl'' and ''udisks'', respectively. See {{ic|man udisksctl}} and {{ic|man udisks}} for more information.
+
{{man|8|udisksd}} (for '''udisks2''') and {{ic|udisks-daemon}} (for '''udisks''') are started on-demand by [[D-Bus]], and should not be enabled explicitly. They can be controlled through the command-line with {{man|1|udisksctl}} and {{man|1|udisks|url=}}, respectively.
  
 
== Configuration ==
 
== Configuration ==
  
Actions a user can perform using udisks are restricted with [[Polkit]]. If your [[session]] is not activated or present, configure policykit manually. The following file sets common udisks permissions for the {{ic|storage}} group. [https://github.com/coldfix/udiskie#permissions]
+
Actions a user can perform using udisks are restricted with [[Polkit]]. If the [[session|user session]] is not activated or present (for example, when controlling udisks from a [[systemd/User]] service), adjust Polkit rules accordingly.
  
{{hc|/etc/polkit-1/rules.d/50-udisks.rules|
+
See [https://github.com/coldfix/udiskie/wiki/Permissions] for common udisks permissions for the {{ic|storage}} group, and [https://gist.github.com/grawity/3886114#file-udisks2-allow-mount-internal-js] for a more restrictive example. If you are using [[Dolphin]], you may see [https://gist.github.com/Scrumplex/8f528c1f63b5f4bfabe14b0804adaba7].
2=polkit.addRule(function(action, subject) {
+
 
  var YES = polkit.Result.YES;
+
== Usage ==
  var permission = {
+
 
    // only required for udisks1:
+
To manually mount a removable drive, for example {{ic|/dev/sdc}}:
    "org.freedesktop.udisks.filesystem-mount": YES,
 
    "org.freedesktop.udisks.filesystem-mount-system-internal": YES,
 
    "org.freedesktop.udisks.luks-unlock": YES,
 
    "org.freedesktop.udisks.drive-eject": YES,
 
    "org.freedesktop.udisks.drive-detach": YES,
 
    // only required for udisks2:
 
    "org.freedesktop.udisks2.filesystem-mount": YES,
 
    "org.freedesktop.udisks2.filesystem-mount-system": YES,
 
    "org.freedesktop.udisks2.encrypted-unlock": YES,
 
    "org.freedesktop.udisks2.eject-media": YES,
 
    "org.freedesktop.udisks2.power-off-drive": YES,
 
    // required for udisks2 if using udiskie from another seat (e.g. systemd):
 
    "org.freedesktop.udisks2.filesystem-mount-other-seat": YES,
 
    "org.freedesktop.udisks2.encrypted-unlock-other-seat": YES,
 
    "org.freedesktop.udisks2.eject-media-other-seat": YES,
 
    "org.freedesktop.udisks2.power-off-drive-other-seat": YES
 
  };
 
  if (subject.isInGroup("storage")) {
 
    return permission[action.id];
 
  }
 
});
 
}}
 
  
See [https://gist.github.com/grawity/3886114#file-udisks2-allow-mount-internal-js] for a more restrictive example. Note the {{ic|org.freedesktop.udisks2.filesystem-*}} settings, which are required to start udiskie from a [[systemd]] service.
+
$ udisksctl mount -b /dev/sdc1
  
== Mount helpers ==
+
To unmount:
  
Automatic mounting of devices is easily achieved with [[List of applications#Udisks|udisks wrappers]]. See also [[List of applications#Mount tools]] and [[File manager functionality#Mounting]].
+
$ udisksctl unmount -b /dev/sdc1
  
=== Devmon ===
+
See {{ic|udisksctl --help}} for more.
  
{{pkg|udevil}} includes [http://igurublog.wordpress.com/downloads/script-devmon devmon], which is compatible to ''udisks'' and ''udisks2''. It uses mount helpers with the following priority:
+
== Tips and tricks ==
  
# [http://ignorantguru.github.io/udevil/ udevil] (SUID)
+
=== Mount helpers ===
# pmount (SUID)
 
# udisks
 
# udisks2
 
  
To mount devices with ''udisks'' or ''udisks2'', remove the SUID permission from ''udevil'':
+
The automatic mounting of devices is easily achieved with udisks wrappers. See also [[List of applications/Utilities#Mount tools]].
  
# chmod -s /usr/bin/udevil
+
{{Note|[[Desktop environment]]s, such as [[GNOME]] and [[KDE]] may also provide a udisk wrapper.}}
  
{{Note|{{ic|chmod -x /usr/bin/udevil}} as root causes devmon to use ''udisks'' for device monitoring
+
* {{App|bashmount|A bash script to mount and manage removable media as a regular user with ''udisks2''.|https://github.com/jamielinux/bashmount|{{AUR|bashmount}}}}
}}
+
* {{App|udiskie| ''udisks2'' automounter with optional notifications, tray icon and support for password protected [[Dm-crypt/Device_encryption|LUKS devices]]. See the [https://github.com/coldfix/udiskie/wiki/Usage udiskie wiki] for details|https://github.com/coldfix/udiskie|{{Pkg|udiskie}}}}
 +
* {{App|udisksvm|GUI ''udisks2'' wrapper written in Python3 and using the Qt5 framework. It uses mouse clicks to mount, unmount removable devices or eject a CD/DVD. See the [https://github.com/berbae/udisksvm/blob/master/README README] file for details.|3=https://github.com/berbae/udisksvm|4={{AUR|udisksvm}}}}
 +
* {{App|udevil|Includes [http://igurublog.wordpress.com/downloads/script-devmon devmon], which is compatible to ''udisks'' and ''udisks2''.|https://github.com/IgnorantGuru/udevil|{{Pkg|udevil}}}}
  
{{Tip|To run devmon in the background and automatically mount devices, [[enable]] it with {{ic|devmon@.service}}, taking the user name as argument: {{ic|devmon@''user''.service}}. Keep in mind services run outside the [[session]]. Adjust Polkit rules where appropriate, or run {{ic|devmon}} from the user session (see [[Autostart]]).}}
+
{{Note|''devmon'' only uses ''udisks'' or ''udisks2'' for mounting (in this order) if ''udevil'' or ''pmount'' miss the SUID permission. To remove this permission, run {{ic|chmod -s /usr/bin/''udevil''}} as root.}}
  
=== inotify ===
+
==== udevadm monitor====
  
You may use {{Pkg|inotify-tools}} to monitor {{ic|/dev}}, and mount drives when a new block device is created. Stale mount points are automatically removed by ''udisksd'', such that no special action is required on deletion.
+
You may use {{ic|udevadm monitor}} to monitor block events and mount drives when a new block device is created. Stale mount points are automatically removed by ''udisksd'', such that no special action is required on deletion.
  
 
{{bc|<nowiki>
 
{{bc|<nowiki>
#!/bin/bash
+
#!/bin/sh
pattern='sd[b-z][1-9]$'
 
coproc inotifywait --monitor --event create,delete --format '%e %w%f' /dev
 
  
while read -r -u "${COPROC[0]}" event file; do
+
pathtoname() {
    if [[ $file =~ $pattern ]]; then
+
    udevadm info -p /sys/"$1" | awk -v FS== '/DEVNAME/ {print $2}'
case $event in
+
}
    CREATE)
+
 
echo "Settling..."; sleep 1
+
stdbuf -oL -- udevadm monitor --udev -s block | while read -r -- _ _ event devpath _; do
udisksctl mount --block-device $file --no-user-interaction
+
        if [ "$event" = add ]; then
;;
+
            devname=$(pathtoname "$devpath")
    DELETE)
+
            udisksctl mount --block-device "$devname" --no-user-interaction
;;
+
        fi
esac
 
    fi
 
 
done
 
done
 
</nowiki>}}
 
</nowiki>}}
 
== Tips and tricks ==
 
 
=== Disable hiding of devices (udisks2) ===
 
 
Udisks2 hides certain devices from the user by default. If this is undesired or otherwise problematic, copy {{ic|/usr/lib/udev/rules.d/80-udisks2.rules}} to {{ic|/etc/udev/rules.d/80-udisks2.rules}} and remove the following section in the copy:
 
 
{{bc|# ------------------------------------------------------------------------
 
# ------------------------------------------------------------------------
 
# ------------------------------------------------------------------------
 
# Devices which should not be display in the user interface
 
[...]
 
}}
 
  
 
=== Mount to /media (udisks2) ===
 
=== Mount to /media (udisks2) ===
Line 119: Line 81:
 
# See udisks(8)
 
# See udisks(8)
 
ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{UDISKS_FILESYSTEM_SHARED}="1"
 
ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{UDISKS_FILESYSTEM_SHARED}="1"
</nowiki>
+
</nowiki>}}
 +
 
 +
Since {{ic|/media}}, unlike {{ic|/run}}, is not mounted by default as a [[tmpfs]], you may also wish to create a [[Systemd#Temporary_files|tmpfiles.d]] snippet to clean stale mountpoints at every boot:
 +
 
 +
{{hc|/etc/tmpfiles.d/media.conf|
 +
D /media 0755 root root 0 -
 
}}
 
}}
  
=== Mount an ISO image ===
+
=== Mount loop devices ===
  
 
To easily mount ISO images, use the following command:
 
To easily mount ISO images, use the following command:
Line 129: Line 96:
  
 
This will create a loop device and show the ISO image ready to mount. Once unmounted, the loop device will be terminated by [[udev]].
 
This will create a loop device and show the ISO image ready to mount. Once unmounted, the loop device will be terminated by [[udev]].
 +
 +
{{Note|This mounts a read only image. To mount raw disk images, such as for [[QEMU]], remove the {{ic|-r}} flag, and release the image after use with {{ic|udisksctl loop-delete -b ''/dev/loop0''}}. Substitute {{ic|/dev/loop0}} with the name of the loop device.}}
  
 
=== Hide selected partitions ===
 
=== Hide selected partitions ===
Line 137: Line 106:
 
  KERNEL=="sda2", ENV{UDISKS_PRESENTATION_HIDE}="1"
 
  KERNEL=="sda2", ENV{UDISKS_PRESENTATION_HIDE}="1"
  
shows all partitions with the exception of {{ic|sda1}} and {{ic|sda2}} on your desktop. Notice if you are using {{Pkg|udisks2}} the above will not work as {{ic|UDISKS_PRESENTATION_HIDE}} is no longer supported. Instead use {{ic|UDISKS_IGNORE}} as follows:
+
shows all partitions with the exception of {{ic|sda1}} and {{ic|sda2}} on your desktop. Note that if you are using {{Pkg|udisks2}}, the above will not work as {{ic|UDISKS_PRESENTATION_HIDE}} is no longer supported. Instead, use {{ic|UDISKS_IGNORE}} as follows:
  
 
  KERNEL=="sda1", ENV{UDISKS_IGNORE}="1"
 
  KERNEL=="sda1", ENV{UDISKS_IGNORE}="1"
 
  KERNEL=="sda2", ENV{UDISKS_IGNORE}="1"
 
  KERNEL=="sda2", ENV{UDISKS_IGNORE}="1"
 +
 +
Because block device names can change between reboots, it is also possible to use UUIDs (as gathered from executing the {{ic|blkid /dev/sdX}} command) to hide partitions or whole devices:
 +
 +
==== Example ====
 +
 +
{{hc|# blkid /dev/sdX|2=
 +
/dev/sdX: LABEL="Filesystem Label" UUID="XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXXX" UUID_SUB="YYYYYYYY-YYYY-YYYY-YYYY-YYYYYYYYYYYY" TYPE="btrfs"
 +
}}
 +
 +
Then the following line can be used:
 +
 +
SUBSYSTEM=="block", ENV{ID_FS_UUID}=="XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXXX", ENV{UDISKS_IGNORE}="1"
 +
 +
The above line is also useful to hide multi device btrfs filesystems, as all the devices from a single btrtfs filesystem will share the same UUID across the devices but will have different SUB_UUID for each individual device.
 +
 +
=== Apply ATA settings (udisks2) ===
 +
 +
At start-up and when a drive is connected, udisksd will apply configuration stored in the file {{ic|/etc/udisks2/''IDENTIFIER''.conf}} where ''IDENTIFIER'' is the value of the Drive:Id property for the drive. Currently ATA settings are supported. See {{man|8|udisks}} for available options. These settings have essentially the same effect as those of [[hdparm]], but they are persistent as long as the udisks daemon is autostarted.
 +
 +
For example, to set standby timeout to 240 (20 minutes) for a drive, add the following:
 +
 +
{{hc|1=/etc/udisks2/''DriveId''.conf|
 +
2=[ATA]
 +
StandbyTimeout=240
 +
}}
 +
 +
To obtain the DriveId for your drive, use {{ic|1=$ udevadm info --query=all --name=/dev/''sdx'' {{!}} grep ID_SERIAL}}
 +
 +
Alternatively, use a GUI utility to manage the configuration file, such as {{Pkg|gnome-disk-utility}}.
  
 
== Troubleshooting ==
 
== Troubleshooting ==
  
=== udisks: Devices do not remain unmounted ===
+
=== Hidden devices (udisks2) ===
 +
 
 +
Udisks2 hides certain devices from the user by default. If this is undesired or otherwise problematic, copy {{ic|/usr/lib/udev/rules.d/80-udisks2.rules}} to {{ic|/etc/udev/rules.d/80-udisks2.rules}} and remove the following section in the copy:
 +
 
 +
{{bc|
 +
# ------------------------------------------------------------------------
 +
# ------------------------------------------------------------------------
 +
# ------------------------------------------------------------------------
 +
# Devices which should not be display in the user interface
 +
[...]
 +
}}
 +
 
 +
=== Devices do not remain unmounted (udisks) ===
  
 
''udisks'' remounts devices after a given period, or ''polls'' those devices. This can cause unexpected behaviour, for example when formatting drives, sharing them in a [[virtual machine]], power saving, or removing a drive that was not detached with {{ic|--detach}} before.  
 
''udisks'' remounts devices after a given period, or ''polls'' those devices. This can cause unexpected behaviour, for example when formatting drives, sharing them in a [[virtual machine]], power saving, or removing a drive that was not detached with {{ic|--detach}} before.  
Line 156: Line 166:
 
  # udisks --inhibit-all-polling
 
  # udisks --inhibit-all-polling
  
See {{ic|man udisks}} for more information.
+
See {{man|8|udisks}} for more information.
 +
 
 +
=== Broken standby timer (udisks2) ===
 +
 
 +
The udisks daemon polls [[S.M.A.R.T.]] data from drives regularly. Hard drives with a longer standby timeout than the polling interval may fail to enter standby. Drives that are already spun down are usually not affected. There seems no way to disable polling or change the interval as for {{Pkg|udisks2}} by now. See [https://bugs.launchpad.net/ubuntu/+source/udisks2/+bug/1281588], [https://bugs.freedesktop.org/show_bug.cgi?id=26508].
 +
 
 +
However, Standby timeout applied by udisks2 seems to be unaffected. To set standby timeout via udisks, see [[#Apply ATA settings (udisks2)]].
 +
 
 +
Other possible workarounds could be setting the timeout below the polling interval (10 minutes) or forcing a manaul spindown using {{ic|hdparm -y /dev/''sdx''}}.
  
 
== See also ==
 
== See also ==
  
* [http://wiki.gentoo.org/wiki/Udisks gentoo wiki: udisks]
+
* [[Gentoo:udisks]]
 
* [http://blog.fpmurphy.com/2011/08/introduction-to-udisks.html?output=pdf Introduction to udisks]
 
* [http://blog.fpmurphy.com/2011/08/introduction-to-udisks.html?output=pdf Introduction to udisks]

Latest revision as of 02:29, 5 November 2018

udisks provides a daemon udisksd, that implements D-Bus interfaces used to query and manipulate storage devices, and a command-line tool udisksctl, used to query and use the daemon.

Installation

There are two versions of udisks called udisksAUR and udisks2. Development of udisks has ceased in favor of udisks2. [1]

udisksd(8) (for udisks2) and udisks-daemon (for udisks) are started on-demand by D-Bus, and should not be enabled explicitly. They can be controlled through the command-line with udisksctl(1) and udisks(1), respectively.

Configuration

Actions a user can perform using udisks are restricted with Polkit. If the user session is not activated or present (for example, when controlling udisks from a systemd/User service), adjust Polkit rules accordingly.

See [2] for common udisks permissions for the storage group, and [3] for a more restrictive example. If you are using Dolphin, you may see [4].

Usage

To manually mount a removable drive, for example /dev/sdc:

$ udisksctl mount -b /dev/sdc1

To unmount:

$ udisksctl unmount -b /dev/sdc1

See udisksctl --help for more.

Tips and tricks

Mount helpers

The automatic mounting of devices is easily achieved with udisks wrappers. See also List of applications/Utilities#Mount tools.

Note: Desktop environments, such as GNOME and KDE may also provide a udisk wrapper.
  • bashmount — A bash script to mount and manage removable media as a regular user with udisks2.
https://github.com/jamielinux/bashmount || bashmountAUR
  • udiskieudisks2 automounter with optional notifications, tray icon and support for password protected LUKS devices. See the udiskie wiki for details
https://github.com/coldfix/udiskie || udiskie
  • udisksvm — GUI udisks2 wrapper written in Python3 and using the Qt5 framework. It uses mouse clicks to mount, unmount removable devices or eject a CD/DVD. See the README file for details.
https://github.com/berbae/udisksvm || udisksvmAUR
  • udevil — Includes devmon, which is compatible to udisks and udisks2.
https://github.com/IgnorantGuru/udevil || udevil
Note: devmon only uses udisks or udisks2 for mounting (in this order) if udevil or pmount miss the SUID permission. To remove this permission, run chmod -s /usr/bin/udevil as root.

udevadm monitor

You may use udevadm monitor to monitor block events and mount drives when a new block device is created. Stale mount points are automatically removed by udisksd, such that no special action is required on deletion.

#!/bin/sh

pathtoname() {
    udevadm info -p /sys/"$1" | awk -v FS== '/DEVNAME/ {print $2}'
}

stdbuf -oL -- udevadm monitor --udev -s block | while read -r -- _ _ event devpath _; do
        if [ "$event" = add ]; then
            devname=$(pathtoname "$devpath")
            udisksctl mount --block-device "$devname" --no-user-interaction
        fi
done

Mount to /media (udisks2)

By default, udisks2 mounts removable drives under the ACL controlled directory /run/media/$USER/. If you wish to mount to /media instead, use this rule:

/etc/udev/rules.d/99-udisks2.rules
# UDISKS_FILESYSTEM_SHARED
# ==1: mount filesystem to a shared directory (/media/VolumeName)
# ==0: mount filesystem to a private directory (/run/media/$USER/VolumeName)
# See udisks(8)
ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{UDISKS_FILESYSTEM_SHARED}="1"

Since /media, unlike /run, is not mounted by default as a tmpfs, you may also wish to create a tmpfiles.d snippet to clean stale mountpoints at every boot:

/etc/tmpfiles.d/media.conf
D /media 0755 root root 0 -

Mount loop devices

To easily mount ISO images, use the following command:

$ udisksctl loop-setup -r -f image.iso

This will create a loop device and show the ISO image ready to mount. Once unmounted, the loop device will be terminated by udev.

Note: This mounts a read only image. To mount raw disk images, such as for QEMU, remove the -r flag, and release the image after use with udisksctl loop-delete -b /dev/loop0. Substitute /dev/loop0 with the name of the loop device.

Hide selected partitions

If you wish to prevent certain partitions or drives appearing on the desktop, you can create a udev rule, for example /etc/udev/rules.d/10-local.rules:

KERNEL=="sda1", ENV{UDISKS_PRESENTATION_HIDE}="1"
KERNEL=="sda2", ENV{UDISKS_PRESENTATION_HIDE}="1"

shows all partitions with the exception of sda1 and sda2 on your desktop. Note that if you are using udisks2, the above will not work as UDISKS_PRESENTATION_HIDE is no longer supported. Instead, use UDISKS_IGNORE as follows:

KERNEL=="sda1", ENV{UDISKS_IGNORE}="1"
KERNEL=="sda2", ENV{UDISKS_IGNORE}="1"

Because block device names can change between reboots, it is also possible to use UUIDs (as gathered from executing the blkid /dev/sdX command) to hide partitions or whole devices:

Example

# blkid /dev/sdX
/dev/sdX: LABEL="Filesystem Label" UUID="XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXXX" UUID_SUB="YYYYYYYY-YYYY-YYYY-YYYY-YYYYYYYYYYYY" TYPE="btrfs"

Then the following line can be used:

SUBSYSTEM=="block", ENV{ID_FS_UUID}=="XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXXX", ENV{UDISKS_IGNORE}="1"

The above line is also useful to hide multi device btrfs filesystems, as all the devices from a single btrtfs filesystem will share the same UUID across the devices but will have different SUB_UUID for each individual device.

Apply ATA settings (udisks2)

At start-up and when a drive is connected, udisksd will apply configuration stored in the file /etc/udisks2/IDENTIFIER.conf where IDENTIFIER is the value of the Drive:Id property for the drive. Currently ATA settings are supported. See udisks(8) for available options. These settings have essentially the same effect as those of hdparm, but they are persistent as long as the udisks daemon is autostarted.

For example, to set standby timeout to 240 (20 minutes) for a drive, add the following:

/etc/udisks2/DriveId.conf
[ATA]
StandbyTimeout=240

To obtain the DriveId for your drive, use $ udevadm info --query=all --name=/dev/sdx | grep ID_SERIAL

Alternatively, use a GUI utility to manage the configuration file, such as gnome-disk-utility.

Troubleshooting

Hidden devices (udisks2)

Udisks2 hides certain devices from the user by default. If this is undesired or otherwise problematic, copy /usr/lib/udev/rules.d/80-udisks2.rules to /etc/udev/rules.d/80-udisks2.rules and remove the following section in the copy:

# ------------------------------------------------------------------------
# ------------------------------------------------------------------------
# ------------------------------------------------------------------------
# Devices which should not be display in the user interface
[...]

Devices do not remain unmounted (udisks)

udisks remounts devices after a given period, or polls those devices. This can cause unexpected behaviour, for example when formatting drives, sharing them in a virtual machine, power saving, or removing a drive that was not detached with --detach before.

To disable polling for a given device, for example a CD/DVD device:

# udisks --inhibit-polling /dev/sr0

or for all devices:

# udisks --inhibit-all-polling

See udisks(8) for more information.

Broken standby timer (udisks2)

The udisks daemon polls S.M.A.R.T. data from drives regularly. Hard drives with a longer standby timeout than the polling interval may fail to enter standby. Drives that are already spun down are usually not affected. There seems no way to disable polling or change the interval as for udisks2 by now. See [5], [6].

However, Standby timeout applied by udisks2 seems to be unaffected. To set standby timeout via udisks, see #Apply ATA settings (udisks2).

Other possible workarounds could be setting the timeout below the polling interval (10 minutes) or forcing a manaul spindown using hdparm -y /dev/sdx.

See also