Bug 452837 - Automount mounts non-removable devices, but KCM name suggests that it will only mount removable devices
Summary: Automount mounts non-removable devices, but KCM name suggests that it will on...
Status: RESOLVED FIXED
Alias: None
Product: systemsettings
Classification: Applications
Component: kcm_deviceautomounter (show other bugs)
Version: 5.24.4
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords: usability
Depends on:
Blocks:
 
Reported: 2022-04-22 00:44 UTC by Adam Williamson
Modified: 2023-05-21 22:34 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Williamson 2022-04-22 00:44:12 UTC
SUMMARY

With plasma-desktop 5.24.4, automounting of "known devices" on "Login" and "Attach" is enabled by default. These settings are shown under "Removable Devices" in System Settings. However, despite that name, it seems they affect non-removable devices. We found this out in a Fedora downstream bug: https://bugzilla.redhat.com/show_bug.cgi?id=2073708 . The problem happens if you try to install Fedora 36 over the top of an existing Fedora or RHEL installation which uses LVM. When the Fedora installer goes to delete the existing LVs, it activates them (this is "to be able to wipe the file system from them"), and KDE sees the device appear and automounts it (it's "known" because it was mounted earlier in the boot or install process, I think). It does this even if the LV is on an internal, non-removable hard disk.

STEPS TO REPRODUCE

This is the reproducer I know of:

1. Install Fedora or RHEL with an LVM layout, ideally with more than one LV (e.g. a /home and a root partition) - older Fedora releases on larger disks do this by default, otherwise you can do it in custom partitioning
2. Boot a current Fedora 36 KDE live image, e.g. https://kojipkgs.fedoraproject.org/compose/branched/Fedora-36-20220421.n.0/compose/Spins/x86_64/iso/Fedora-KDE-Live-x86_64-36-20220421.n.0.iso
3. Run through the installer, choosing to wipe the existing partitions to provide space for the install
4. Try and run the install; it will likely fail at the start, complaining that "device is active". This seems to be slightly racy, for me it happens about 1 in 2 tries. Snapshotting a VM after point 1 is a good idea

There are likely much simpler ways to do it, though. Probably just creating some LVs on a non-removable disk, then playing with mounting/unmounting and activating/deactivating them will do the trick.

OBSERVED RESULT
Filesystem on the LV on a non-removable disk gets automounted

EXPECTED RESULT
Filesystems on non-removable disk should not be automounted, since the config settings refer specifically to "Removable Devices"

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma:
(available in About System)
KDE Plasma Version: 5.24.3
KDE Frameworks Version: 5.91.0
Qt Version: 5.15.3

ADDITIONAL INFORMATION

Filing against this component because there doesn't seem to be a match for plasma-desktop, which is where the code seems to be: https://github.com/KDE/plasma-desktop/blob/master/solid-device-automounter/kded/DeviceAutomounter.cpp . It doesn't look to me like anything there is actually doing any kind of check that a filesystem is on a removable drive. Maybe the assumption is that only filesystems on "removable" drives would suddenly appear or disappear, but that's an incorrect assumption as we see with LVs.
Comment 1 Nate Graham 2022-04-22 15:58:44 UTC
> With plasma-desktop 5.24.4, automounting of "known devices" on "Login" and "Attach" is enabled by default. 
That's weird, it shouldn't be. However I can confirm on Fedora 35. So either Fedora is overriding the KDE default, or else we accidentally changed the default.

I recall a change to turn on automount by default, but it got reverted. Maybe we only reverted part of it? Will inveatigate.
Comment 2 Nate Graham 2022-04-22 16:25:16 UTC
Found it: https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/549#note_436564

My guess is that this was always broken, and it simply became exposed by us inadvertently turning on automount by default.
Comment 3 Adam Williamson 2022-04-22 17:07:54 UTC
Yeah, that's the commit I thought had changed things too. I didn't know how much of the change was intentional, though.
Comment 4 Nate Graham 2023-04-27 21:37:09 UTC
I think this is more of a UI issue; moving to the KCM to change the text.
Comment 5 Bug Janitor Service 2023-05-15 14:41:59 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/1520
Comment 6 Nate Graham 2023-05-21 22:34:04 UTC
Git commit 548c7e2ab684f9f16f502871f4f81fa7ea01da7b by Nate Graham.
Committed on 21/05/2023 at 22:32.
Pushed by ngraham into branch 'master'.

solid-device-automounter: change name to reflect what it does

This KCM isn't just for removable storage; it affects whether any type
of device can be auto-mounted. So let's change its name accordingly to
avoid confusing people.
FIXED-IN: 6.0

M  +2    -2    doc/kcontrol/solid-device-automounter/index.docbook
M  +3    -3    solid-device-automounter/kcm/device_automounter_kcm.json

https://invent.kde.org/plasma/plasma-desktop/commit/548c7e2ab684f9f16f502871f4f81fa7ea01da7b