Skip to content

automounting luks cleartext devices

Thomas Gläßle edited this page Jun 1, 2017 · 2 revisions

This article is for automounting devices that have not been unlocked by udiskie. If you're looking for a way to automatically unlock devices using keyfiles, see here.

One can automount LUKS-cleartext-devices with udiskie, even if they have not been unlocked using udiskie (for example unlocking by udev-rule).

To do this, however, two udisks-properties have to be modified: udisks_system and udisks_auto.

By default, LUKS-mappers are treatet as internal devices and therefore ignored by udiskie. Additionally, the udisks-automount-option is set to false. Both have to be switched around.

This can be done with udev.

Take the UUID of the luks-device (in this example 11ae7fe0-dffc-4110-b8ae-cb590c65c8d9) and create from it the following rule:

ENV{ID_FS_UUID}=="11ae7fe0-dffc-4110-b8ae-cb590c65c8d9", ENV{UDISKS_SYSTEM}="0", ENV{UDISKS_AUTO}="1"

to be written to for example /etc/udev/rules.d/30-my-rule.rules

With this rule in place, udev will upon noticing the device with the specified UUID modify those two parameters and as a consequence, udiskie will automount them just fine upon appearing.

This rule is now specific for a certain device (and you would need to create more rules specifying other devices). This approach does not match every LUKS-device, but uses whitelisting instead of blacklisting.