As reported in Launchpad here: https://bugs.edge.launchpad.net/ubuntu/lucid/+source/gnome-disk-utility/+bug/484429 It seems that udisks doesn't tear down cleartext LUKS devices when its slave is forcibly removed, for example, by unplugging a USB drive which holds a LUKS-encrypted partition. Re-inserting the device then yields the usual password prompt to decrypt the device, but fails to load it with a cryptsetup error: Error unlocking device: cryptsetup exited with exit code 239: Device udisks-luks-uuid-7bdbda08-473f-41eb-9837-88a4285b1c05-uid1000 already exists.
Created attachment 38888 [details] [review] use luks_holder property to identify luks cleartext device It seems that using device->priv->luks_holder for the device that is being remove still contains the name of the cleartext LUKS device that requires that slave, so it's possible to use it to immediately get which device to use for force_luks_teardown().
Created attachment 38904 [details] [review] updated patch udisks would segfault if the device was ejected from Nautilus... this is because luks_holder is NULL in that case.
I can reproduce this bug.
Thanks! This patch makes a sense, and I confirm that it now behaves correctly with both regular unmount and yanking out a mounted encrypted USB stick. Pushed to git master. I'll try to write a test case for this, too.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.