Bug 376498 - "Safe remove" should not be available for external drives containing OS install and/or /home folder
Summary: "Safe remove" should not be available for external drives containing OS insta...
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Disks & Devices (show other bugs)
Version: 5.9.1
Platform: Other Linux
: NOR normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-02-14 23:16 UTC by nRoof
Modified: 2020-11-25 00:04 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.20


Attachments
output of solid-hardware5 (15.18 KB, text/plain)
2017-02-18 11:21 UTC, nRoof
Details

Note You need to log in before you can comment on or make changes to this bug.
Description nRoof 2017-02-14 23:16:38 UTC
Reproducible: Always

Steps to reproduce:
1. Install any GNU/Linux distro and Plasma on external storage media, such as USB flash drive or USB HDD/SSD (or regular one in external USB enclosure).
2. Boot into it.
3. Open the Device Notifier icon in system tray and check volumes available for "safe unmount".
4. Open the default file manager (Dolphin) and right click the drive

Expected results: "safe remove" feature should not be available for volumes containing / and/or /home folders and they should not be displayed in Device Notifier on step #3. They cannot be safely unmounted anyway, so there's no reason to show these volumes as safely removable.

Actual results: "safe remove" is available. When clicked, it complains that the volume cannot be unmounted because it's still used by something. Due to this, for example, Device Notifier icon wastes space on the screen if there are no other removable devices connected.

I have up-to-date Arch Linux with KDE Plasma installed on SSD inside external USB enclosure. If this matters, the drive is Samsung 840 Pro and the enclosure is one of those based on ASM1351 chipset. The drive in enclosure is handled by uas driver in the system. cat /sys/block/sdb/removable returns 0 (sdb is the subject drive). The volumes, which are displayed in the tray are mounted at / and /home.

The system is booted in UEFI mode, and what's interesting is that the ESP (EFI System Partition), which is mounted at /boot, is not shown in system tray. I switched to UEFI boot only recently, and noticed, that before the switch, the /boot was shown in system tray among the other volumes. Not sure, however, if this info is helpful.

None of these volumes are shown in system tray when the drive is connected to the motherboard using regular internal SATA interface.

Also reproducible on freshly updated Kubuntu 16.10.
I was not able to reproduce the issue on latest and freshly updated Ubuntu (Unity), Fedora Workstation (Gnome), and Arch with Gnome. They all don't show the external drive in this case as safely removable, but show any other USB storage devices as such.
Comment 1 nRoof 2017-02-16 19:47:27 UTC
Just a small clarification on the last paragraph of the Description. It means that other popular desktop environments handle this correctly, and the issue seems to be not specific to any GNU/Linux distro. Also, Files (nautilus) file manager, which comes with Gnome, doesn't show the removable drive either, even when ran in Plasma session.
Comment 2 Kai Uwe Broulik 2017-02-17 09:33:15 UTC
Device notifier by default only shows removable media to which the root partition does not count, ie. it is not shown here. The partition is still shown in Dolphin which I agree is not optimal.

The question is, however, how to identify these devices. I'm not keen on adding a random "if this thing has a mountpoint which contains / or $HOME, hide it". UDisks should instead have a hint about this. I compared the hints for my / partition as well as for another partition (/data) but they look identical (both have "HintSystem" set and no "HintIgnore" or "HintAuto").

My UEFI partition doesn't have the "Filesystem" Udisks interface and thus does not show up as a storage device. /boot might have HintIgnore set, I don't know.

It would help if you could provide the output of `solid-hardware5 details UDI` with UDI being your drives (you can find them using `solid-hardware5 list`) and indicate which drives should be hidden. Thanks.
Comment 3 nRoof 2017-02-18 11:21:07 UTC
Created attachment 104089 [details]
output of solid-hardware5

Added the output. Serial numbers of all the devices are replaced to SN1, SN2, etc. in the output.

Outputs are sorted by devices how they appear in /org/freedesktop/UDisks2/drives/ list. After each device go its corresponding root block device and all its partition block devices.

Descriptions of devices from the output:
1. Generic__USB3_2e0_CRW_____0_SN1 and Generic__USB3_2e0_CRW_____1_SN1 are actually a single card reader with two slots. First slot is empty, and some SD card is inserted into the second one. It is displayed as safely removable, which is expected.
2. Samsung_SSD_840_PRO_Series_SN2 is the subject SSD in the external USB enclosure.
3. SN3 is an internal NVME drive.
4. HGST_HTE721010A9E630_SN4 is an internal HDD.

What should be hidden from Device Notifier and their short descriptions:
Block.device = '/dev/sdb2' : / partition
Block.device = '/dev/sdb3' : /home partition (LUKS encrypted and mounted at boot via /etc/crypttab)
Comment 4 grizzlyuser 2018-12-17 15:38:11 UTC
Please see bug 399659, which is very similar. Perhaps similar solution can fix the current bug as well.
Comment 5 Nate Graham 2020-11-25 00:04:39 UTC
This has been fixed in the UI redesign in Plasma 5.20.