Bug 485507

Summary: Unspecified Error With LUKS Encrypted Removable Drives
Product: [Frameworks and Libraries] frameworks-solid Reporter: asheriif <verifyrecover38>
Component: generalAssignee: Kai Uwe Broulik <kde>
Status: RESOLVED FIXED    
Severity: grave CC: brokencanoe, dinucci.alejandro, edmund.laugasson, hunterofgypsy, joanmaspons, kdelibs-bugs, loud.gibberish218, lukas, mahasler, nate, robby.engelmann, tonurics, um-li, xdlolpite111
Priority: HI    
Version: 6.1.0   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=477915
Latest Commit: Version Fixed In: Frameworks 6.2
Sentry Crash Report:
Attachments: Error

Description asheriif 2024-04-13 20:38:00 UTC
Created attachment 168475 [details]
Error

SUMMARY

Since a couple of days ago (unfortunately cannot pinpoint the exact update), I'm not able to unlock and open LUKS encrypted removable devices through KDE, be it by clicking the device under Removable Devices in Dolphin or by clicking Mount and Open in Device Notifier applet when the device is plugged into the system.

STEPS TO REPRODUCE

1. Plug in external LUKS encrypted SSD or Flash Drive.
2. Open Dolphin and click on the name of the device under Removable Devices OR
3. Click Mount and Open in Device Notifier Applet.

OBSERVED RESULT

Dolphin gives the error:
> An error occurred while accessing '1.7 TiB Encrypted Drive', the system responded: An unspecified error has occurred: Object does not exist at path “/”

EXPECTED RESULT

I'm prompted for passphrase then the volume is unlocked and mounted.

SOFTWARE/OS VERSIONS

Operating System: Arch Linux 
KDE Plasma Version: 6.0.3
KDE Frameworks Version: 6.1.0
Qt Version: 6.7.0
Kernel Version: 6.8.6-arch1-1 (64-bit)
Graphics Platform: Wayland

ADDITIONAL INFORMATION

It seems like something goes wrong during the setup() phase as this is what I see with dbus-monitor when this happens:

--------------------------------------
signal time=1713039122.056183 sender=:1.75 -> destination=(null destination) serial=359 path=/org/kde/solid/Device__2Forg_2Ffreedesktop_2FUDisks2_2Fblock_5Fdevices_2Fsdb; interface=org.kde.Solid.Device; member=setupRequested
signal time=1713039122.057963 sender=:1.75 -> destination=(null destination) serial=360 path=/org/kde/solid/Device__2Forg_2Ffreedesktop_2FUDisks2_2Fblock_5Fdevices_2Fsdb; interface=org.kde.Solid.Device; member=setupDone
   int32 1
   string "An unspecified error has occurred: Object does not exist at path “/”"
--------------------------------------

- I'm able to replicate this with two different devices (one an external SSD, one a flash drive).
- Please see attached screenshots.
- There's nothing in the journal when this happens.
- I'm able to unlock and mount the devices manually using either udisksctl or cryptsetup

Thanks.
Comment 1 Marcel Hasler 2024-04-14 18:52:44 UTC
I can confirm this. It works fine on my desktop which still has Frameworks 6.0.0 but is broken on my laptop after upgrading to 6.1.0.
Comment 2 Canoe 2024-04-15 13:12:17 UTC
Confirmed, luks mounting is broken, meaning I can no longer access any of my backups, - or backup:
 
KDE Plasma Version 6.0.3
KDE Frameworks Version 6.1.0
Qt Version : 6.7.0
Kernel version : 6.8.5-arch1-1 (64bit)
Graphics Platform : Wayland
Comment 3 Tonurics 2024-04-15 18:57:06 UTC
Also writing in to confirm the issue.

Operating System: Arch Linux 
KDE Plasma Version: 6.0.3
KDE Frameworks Version: 6.1.0
Qt Version: 6.7.0
Kernel Version: 6.8.5-arch1-1 (64-bit)
Graphics Platform: X11
Comment 4 Marcel Hasler 2024-04-15 20:04:06 UTC
Downgrading Solid back to 6.0.0 fixes the issue.

Looking at the change log, there's really only one commit (https://invent.kde.org/frameworks/solid/-/commit/f000b6e99f741c66744a8995f6521e9158ebf289). I think the problem here is that the property "CleartextDevice" returned from the new code defaults to '/' if the device hasn't been unlocked yet, whereas the old code returned an empty string, which clients apparently expect.
Comment 5 asheriif 2024-04-15 20:21:14 UTC
Ahh good catch. Should be pretty simple to fix. How can we help the devs? I don't see an option to raise a PR.
Comment 6 Marcel Hasler 2024-04-15 20:23:15 UTC
Looking at the code some more, it seems that many functions explicitly check for both cases, e.g. in StorageAccess::filePath():

    const QString path = clearTextPath();
    if (path.isEmpty() || path == "/") {
        QString();
    }

Other functions, such as StorageAccess::setup() (which I think might be the culprit here), don't:

    if (m_device->isEncryptedContainer() && clearTextPath().isEmpty()) {
        return requestPassphrase();
    } else {
        return mount();
    }

Perhaps it would make sense to refactor this check into an own function (e.g. StorageAccess::isUnlocked()).
Comment 7 Marcel Hasler 2024-04-15 20:24:40 UTC
I've assigned the bug to the author of the commit (I hope that's okay to do).
Comment 8 Bug Janitor Service 2024-04-15 20:44:36 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/solid/-/merge_requests/163
Comment 9 Nate Graham 2024-04-16 08:37:53 UTC
*** Bug 485617 has been marked as a duplicate of this bug. ***
Comment 10 Robby Engelmann 2024-04-16 10:01:27 UTC
and also in master from yesterday:
Operating System: openSUSE Tumbleweed 20240414
KDE Plasma Version: 6.0.80
KDE Frameworks Version: 6.2.0
Qt Version: 6.7.0
Kernel Version: 6.8.5-1-default (64-bit)
Graphics Platform: Wayland
Processors: 20 × 13th Gen Intel® Core™ i7-13700H
Memory: 62.5 GiB of RAM
Graphics Processor: Mesa Intel® Graphics
Manufacturer: TUXEDO
Product Name: TUXEDO InfinityBook Pro Gen8 (MK1)
Comment 11 Antonio Rojas 2024-04-16 20:44:27 UTC
*** Bug 485645 has been marked as a duplicate of this bug. ***
Comment 12 hunterofgypsy 2024-04-17 00:33:19 UTC
This is a polkit issue

I have the same problem
Comment 13 hunterofgypsy 2024-04-17 00:52:48 UTC
was wrong, downgrading solid fixed it
Comment 14 jmaspons 2024-04-17 06:10:54 UTC
Also hit Neon User Edition

Operating System: KDE neon 6.0
KDE Plasma Version: 6.0.3
KDE Frameworks Version: 6.1.0
Qt Version: 6.7.0
Kernel Version: 6.5.0-27-generic (64-bit)

Workaround to mount from the cli https://askubuntu.com/a/279218/281142
Comment 15 Kai Uwe Broulik 2024-04-17 10:59:04 UTC
Git commit 9ecaf388ccd41d2831ab3833c26627f72ab78f40 by Kai Uwe Broulik.
Committed on 17/04/2024 at 10:55.
Pushed by broulik into branch 'master'.

udisks: Return empty string for "root" clearTextPath

There cannot be an empty object path on DBus, so "/" is used to denote
no clear text device. Return empty string explicitly here to avoid
littering even more places with empty || "/" checks.

M  +5    -1    src/solid/devices/backends/udisks2/udisksstorageaccess.cpp

https://invent.kde.org/frameworks/solid/-/commit/9ecaf388ccd41d2831ab3833c26627f72ab78f40
Comment 16 Marcel Hasler 2024-04-17 17:34:38 UTC
Thanks! Will there be a 6.1.1 release to fix this? I see that Arch already provides a patched version, but many others will likely be affected by this regression, as well.
Comment 17 Nicolas Fella 2024-04-19 12:43:04 UTC
Git commit a3b18591ba144fae0cd0cfc087a45c64000d4e51 by Nicolas Fella, on behalf of Kai Uwe Broulik.
Committed on 19/04/2024 at 11:03.
Pushed by nicolasfella into branch 'Frameworks/6.1'.

udisks: Return empty string for "root" clearTextPath

There cannot be an empty object path on DBus, so "/" is used to denote
no clear text device. Return empty string explicitly here to avoid
littering even more places with empty || "/" checks.

M  +5    -1    src/solid/devices/backends/udisks2/udisksstorageaccess.cpp

https://invent.kde.org/frameworks/solid/-/commit/a3b18591ba144fae0cd0cfc087a45c64000d4e51
Comment 18 tuxx 2024-04-29 20:44:26 UTC
I've found the same bug on Garuda (Arch) with KDE Frameworks 6.1.0.

It happens with all LUKS Encrypted drives which are not mounted, regardless if it's external or internal.
I'm running the OS on a m2 btrfs LUKS Encrypted drive, when I try to access my second m2 encrypted drive connected to the motherboard I get the same error. 

Unencrypted drives mounts OK.

Operating System: Garuda Linux 
KDE Plasma Version: 6.0.3
KDE Frameworks Version: 6.1.0
Qt Version: 6.7.0
Kernel Version: 6.8.5-zen1-1-zen (64-bit)
Graphics Platform: X11
Comment 19 tuxx 2024-04-30 09:39:49 UTC
(In reply to tuxx from comment #18)
> I've found the same bug on Garuda (Arch) with KDE Frameworks 6.1.0.
> 
> It happens with all LUKS Encrypted drives which are not mounted, regardless
> if it's external or internal.
> I'm running the OS on a m2 btrfs LUKS Encrypted drive, when I try to access
> my second m2 encrypted drive connected to the motherboard I get the same
> error. 
> 
> Unencrypted drives mounts OK.
> 
> Operating System: Garuda Linux 
> KDE Plasma Version: 6.0.3
> KDE Frameworks Version: 6.1.0
> Qt Version: 6.7.0
> Kernel Version: 6.8.5-zen1-1-zen (64-bit)
> Graphics Platform: X11

it fixes in Garuda with the last update, LUKS decrypts OK.

plasmashell 6.0.4
Qt: 5.15.13
KDE Frameworks: 5.115.0
kf5-config: 1.0

Kernel: 6.8.7-zen1-2-zen arch: x86_64 bits: 64 compiler: gcc
v: 13.2.1
Desktop: KDE Plasma v: 6.0.4 tk: Qt v: N/A wm: kwin_x11 dm: SDDM
Distro: Garuda base: Arch Linux