Bug 438874 - Disk & Devices applet doesn't show USB removable devices and SD cards after disconnecting and re-connecting them
Summary: Disk & Devices applet doesn't show USB removable devices and SD cards after d...
Status: VERIFIED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Disks & Devices (show other bugs)
Version: master
Platform: Arch Linux Linux
: VHI major
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords: regression
: 438478 439412 442690 442718 443699 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-06-18 15:36 UTC by Domker
Modified: 2021-10-14 15:32 UTC (History)
32 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.23


Attachments
USB Flash drive connected 1nd time after computer startup - visible in Dolphin and in the "Device Notifier" applet (485.35 KB, image/png)
2021-06-18 15:36 UTC, Domker
Details
The same flash drive connected the second time - visible in Dolphin, not visible in the applet. (522.28 KB, image/png)
2021-06-18 15:38 UTC, Domker
Details
Another USB flash drive connected (for the first time) - visible in Dolphin, not visible in the applet. (529.61 KB, image/png)
2021-06-18 15:39 UTC, Domker
Details
A USB flash drive connected (with 2 partitions) - visible every time in Dolphin and in the applet. (505.44 KB, image/png)
2021-06-18 15:39 UTC, Domker
Details
A connected USB flash drive, which previously did not show up for the second and next time in the applet, but at the moment when the previous USB flash drive with 2 partitions is connected as well, sh (537.18 KB, image/png)
2021-06-18 15:40 UTC, Domker
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Domker 2021-06-18 15:36:41 UTC
Created attachment 139497 [details]
USB Flash drive connected 1nd time after computer startup - visible in Dolphin and in the "Device Notifier" applet

SUMMARY
I noticed that USB flash drives are not detected by "Device Notifier" when reconnected.
If the flash drive has more than one partition, it is always shown by the applet, both on the first connection and on subsequent ones.
This happens regardless of which USB port the flash drive is connected to.

First screenshot: 
USB Flash drive connected 1nd time after computer startup - visible in Dolphin and in the "Device Notifier" applet

Second screenshot: 
The same flash drive connected the second time - visible in Dolphin, not visible in the applet.

Third screenshot:
Another USB flash drive connected (for the first time) - visible in Dolphin, not visible in the applet.

Fourth screenshot:
A USB flash drive connected (with 2 partitions) - visible every time in Dolphin and in the applet.

Fifth screenshot:
A connected USB flash drive, which previously did not show up for the second and next time in the applet, but at the moment when the previous USB flash drive with 2 partitions is connected as well, shows up normally, but only again for once time.

STEPS TO REPRODUCE
1. Connect USB Flash drive (with one partition)
2. Disconnect USB Flash drive
3. Connect USB Flash drive again

OBSERVED RESULT
The USB Flash drive is visible in Dolphin, but not visible in the "Device Notifier" applet.

EXPECTED RESULT
The "Device Notifier" applet should show the device every time it is connected.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux
KDE Plasma Version: 5.22.1
KDE Frameworks Version: 5.83.0
Qt Version: 5.15.2
Kernel Version: 5.12.11-arch1-1 (64-bit)
Graphics Platform: X11
Processors: 8 × Intel® Core™ i7-4790K CPU @ 4.00GHz
Memory: 15.6 GiB of RAM
Graphics Processor: NVIDIA GeForce GTX 980/PCIe/SSE2
Comment 1 Domker 2021-06-18 15:38:17 UTC
Created attachment 139498 [details]
The same flash drive connected the second time - visible in Dolphin, not visible in the applet.
Comment 2 Domker 2021-06-18 15:39:06 UTC
Created attachment 139499 [details]
Another USB flash drive connected (for the first time) - visible in Dolphin, not visible in the applet.
Comment 3 Domker 2021-06-18 15:39:54 UTC
Created attachment 139500 [details]
A USB flash drive connected (with 2 partitions) - visible every time in Dolphin and in the applet.
Comment 4 Domker 2021-06-18 15:40:33 UTC
Created attachment 139501 [details]
A connected USB flash drive, which previously did not show up for the second and next time in the applet, but at the moment when the previous USB flash drive with 2 partitions is connected as well, sh
Comment 5 Andrew M 2021-06-24 01:51:00 UTC
I am also experiencing this issue. Also on Arch Linux (plasma-desktop 5.22.1-1).

Workaround:
1. Insert device
2. Run `kquitapp5 plasmashell; sleep 1; plasmashell` in KRunner (so that it isn't a child job in a terminal)
3. It should appear in "Disks & Devices"
Comment 6 guimarcalsilva 2021-06-24 03:52:17 UTC
I can confirm this is happening on Plasma 5.22.2
Comment 7 Franz Trischberger 2021-06-24 04:04:48 UTC
Same issue here on opensuse tumbleweed.
This was introduced in 5.22, 5.21 was just fine.

I observe this when changing SD cards in my sd card reader. I came back from a foto shoot with different cameras using a handfull of sd cards. Fortunately I realised rather quickly (read: after rebooting twice to get the new cards displayed) that dolphin still lists the devices. After mounting the devices still don't show up in the device notifier, so I have to unmount them also using dolphin.
Comment 8 Antonio Orefice 2021-06-25 10:15:22 UTC
Thank you for opening the bug report, i was just going to fill one myself.
Confirmed of me, of course.
Comment 9 Paul 2021-06-27 12:55:28 UTC
Also confirming the problem.

There is some discussion on the openSUSE forums regarding this issue. ( https://forums.opensuse.org/showthread.php/556030-Problems-mounting-USB-stick ). 

It appears that removing the "System Tray" and then re-instating it has "cured" the problem for some users. 

Although that was not the case for either of my (openSUSE) Tumbleweed machines, both running:

Operating System: openSUSE Tumbleweed 20210623
KDE Plasma Version: 5.22.1
KDE Frameworks Version: 5.83.0
Qt Version: 5.15.2
Comment 10 nucleo 2021-06-29 15:50:36 UTC
The same bug on Fedora 34.

Linux/KDE Plasma: Fedora 34
KDE Plasma Version: 5.22.2
KDE Frameworks Version: 5.83.0
Qt Version: 5.15.2
Comment 11 Chris 2021-06-30 16:02:02 UTC
This is also happening with Slackware. 
Operating System: Slackware-current
KDE Plasma Version: 5.22.2
KDE Frameworks Version: 5.83.0
Qt Version: 5.15.2
Kernel Version: 5.12.13 (64-bit)
Graphics Platform: X11

My work around is to use Dolphin to mount or open the drive. 

I have notice that if a second USB is plugged in, detected and removed, the first USB will be normally recognized by Disk and Devices.
Comment 12 MikeC 2021-07-04 19:46:51 UTC
This is likely also related to https://bugs.kde.org/show_bug.cgi?id=438478
Comment 13 Francisco Cribari 2021-07-05 18:44:31 UTC
I run Arch Linux + KDE, and I'm also affected by this bug. I'm using Dolphin to mount and unmount devices. I believe this bug is related to https://bugs.kde.org/show_bug.cgi?id=438478 .
Comment 14 MikeC 2021-07-07 19:20:38 UTC
Not fixed in plasma 5.22.3
Comment 15 MikeC 2021-07-09 15:36:31 UTC
With the update to kde-applications 21.04.3-1 this seems to be fixed.
Comment 16 Franz Trischberger 2021-07-09 16:17:59 UTC
(In reply to MikeC from comment #15)
> With the update to kde-applications 21.04.3-1 this seems to be fixed.

Update to 21.04.3 on arch linux did NOT fix the issue here.
Comment 17 MikeC 2021-07-10 10:45:43 UTC
I went back to trying two external usb ssds that I had used previously for the test - each of those has a single ext4 partition - and the original problem is still there in that once one has been mounted, dismounted and physically unplugged, then the second drive plugged in to usb does not lead to a Disks & Devices pop-up offering to mount the drive, but the same can can be mounted from Dolphin.  The drive I tried that did work had multiple partitions and can be unmounted and then when physically plugged back in the Disks & Devices pop-up offers a mount. So the bug is still there and needs fixing.
Comment 18 MikeC 2021-07-31 15:44:29 UTC
I wonder if this is related: https://github.com/indilib/indi/pull/1521
Comment 19 Ilya Bizyaev 2021-08-01 12:22:56 UTC
This is confusing to novice users who forget to do something, eject the USB drive and then cannot work with it anymore.

Operating System: openSUSE Leap 15.3
KDE Plasma Version: 5.22.4
KDE Frameworks Version: 5.84.0
Qt Version: 5.15.2
Comment 20 Unknown 2021-08-02 17:28:16 UTC
Can confirm this issue on Fedora 34. Very annoying.

Operating System: Fedora 34
KDE Plasma Version: 5.22.4
KDE Frameworks Version: 5.83.0
Qt Version: 5.15.2
Kernel Version: 5.13.6-200.fc34.x86_64 (64-bit)
Graphics Platform: X11
Comment 21 Antonio Orefice 2021-08-06 07:43:55 UTC
(In reply to MikeC from comment #18)
> I wonder if this is related: https://github.com/indilib/indi/pull/1521

I don't think so...
If you open removable devices from systemsettings5, you can still see attached and detached devices there; it seems just plasma that ignores them.
Comment 22 MikeC 2021-08-06 15:09:40 UTC
OK so it looks like it needs fixing in the plasma packages.
Comment 23 Nate Graham 2021-08-09 21:32:17 UTC
Can confirm the issue with the following simple reproduction steps:

1. Plug in a USB flash drive
2. In the Disks & Devices popup, click "Mount and open"
3. In the Disks & Devices popup, click, "Safely remove"
4. Unplug the USB flash drive
5. Plug the USB flash drive in again

It does re-appear in Dolphin, so the problem would appear to be in the applet itself or in the data engine that translates the signals from Solid.
Comment 24 Nate Graham 2021-08-09 21:34:14 UTC
*** Bug 438478 has been marked as a duplicate of this bug. ***
Comment 25 Gianluca Pettinello 2021-08-15 06:57:26 UTC
Hello everybody, is this bug fixed?
Thanks 
Gianluca
Comment 26 Nate Graham 2021-08-16 13:07:29 UTC
If it was fixed, the bug report would be marked as RESOLVED. :)
Comment 27 Francisco Cribari 2021-08-16 13:26:00 UTC
I am still experiencing the problem (Arch Linux and an external HD with a single ext4 partition).
Comment 28 Domker 2021-08-16 20:26:13 UTC
The bug still exists on Arch Linux (current).

Operating System: Arch Linux
KDE Plasma Version: 5.22.4
KDE Frameworks Version: 5.85.0
Qt Version: 5.15.2
Kernel Version: 5.13.10-arch1-1 (64-bit)
Comment 29 Chris 2021-08-18 09:43:35 UTC
Operating System: Slackware64-current
KDE Plasma Version: 5.22.4
KDE Frameworks Version: 5.85.0
Qt Version: 5.15.2
Kernel Version: 5.13.11 (64-bit)
Graphics Platform: X11

This still exits. Applies for any USB I've tried, one shot only thru Disk & Devices, subsequent plug-ins of same USB device results in nothing from Disk & Devices. Device does appear in Dolphin and in System settings Removable Storage > Removable Devices, Attached Devices. This also applies to cell phones plugged in to USB ports.
Comment 30 Chris 2021-08-18 10:46:33 UTC
Forgot to add. As reported earlier devices can be mounted via Dolphin.

I also noticed in System settings Removable Storage > Removable Devices if a device shown as "<size> Removable Media", other media with the same type "Removable Media" do not show up in Disk & Devices; e.g., 28.8 GiB Removable Media, 1.0 GiB Removable Media, 14.6 GiB Removable Media are not picked up by Disk & Devices after the first of these is plugged in.

This device is never picked up by Disk & Devices:
Model: Kingmax Kingmax (scsi)
Disk /dev/sdc: 15.8GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  15.8GB  15.8GB  primary  fat32        boot, lba


Another thing I have noticed is the device is not showing in System settings Removable Storage > Removable Devices, Attached Devices after showing up in Disk & Devices after using Mount or one of the other available options.

Regarding the cell phone, on first plug in, it is detected by Disk & Devices, when the connection is allowed by the phone, the notification disappears. Phone is accessible using Dolphin. Phone connection never shows in System settings Removable Storage > Removable Devices. Note the the phone does appear in System settings Removable Storage > Removable Devices, Digital Camera.

Maybe related or not. On my laptop when a device is detected (first mount) by Disk & Devices, Safely Remove sometimes results in a Plasma crash and it reloads. "Details: Executable: PID: 3275 Siganl: Segmentation fault (11). This has never happened on my desktop. The "not useful crash information follows:

Application: Plasma (plasmashell), signal: Segmentation fault

[KCrash Handler]
#4  0x00007fa8df158250 in  () at /usr/lib64/libQt5Qml.so.5
#5  0x00007fa8df102030 in  () at /usr/lib64/libQt5Qml.so.5
#6  0x00007fa8df103796 in QQmlVMEMetaObject::metaCall(QObject*, QMetaObject::Call, int, void**) () at /usr/lib64/libQt5Qml.so.5
#7  0x00007fa8df03ac7d in  () at /usr/lib64/libQt5Qml.so.5
#8  0x00007fa8817f3c53 in  ()
#9  0x0000000000000000 in  ()
[Inferior 1 (process 3275) detached]
Comment 31 Chris 2021-08-18 12:52:50 UTC
(In reply to Chris from comment #30)
> Maybe related or not. On my laptop when a device is detected (first mount)
> by Disk & Devices, Safely Remove sometimes results in a Plasma crash and it
> reloads. "Details: Executable: PID: 3275 Siganl: Segmentation fault (11).
> This has never happened on my desktop. The "not useful crash information
> follows:
> 
> Application: Plasma (plasmashell), signal: Segmentation fault
> 
> [KCrash Handler]
> #4  0x00007fa8df158250 in  () at /usr/lib64/libQt5Qml.so.5
> #5  0x00007fa8df102030 in  () at /usr/lib64/libQt5Qml.so.5
> #6  0x00007fa8df103796 in QQmlVMEMetaObject::metaCall(QObject*,
> QMetaObject::Call, int, void**) () at /usr/lib64/libQt5Qml.so.5
> #7  0x00007fa8df03ac7d in  () at /usr/lib64/libQt5Qml.so.5
> #8  0x00007fa8817f3c53 in  ()
> #9  0x0000000000000000 in  ()
> [Inferior 1 (process 3275) detached]
There is a reason I dislike the word never. "This has never happened on my desktop."; well it just did.
Comment 32 antonio 2021-08-23 19:01:07 UTC
same problem (plasma 5.22.4)
Comment 33 MikeC 2021-08-23 19:14:22 UTC
This has been running a couple of months - it would be nice if this could now be worked towards a patch to fix it. It seems not to be taken by a developer yet.
Comment 34 Attila 2021-08-24 14:27:03 UTC
Here is my workaround until this bug has been fixed.
You need two USB devices. Let's call the first one "a dummy USB device".

1. Just Plug in the dummy USB device.
2. You don't need to mount it. No access is needed. Don't remove the dummy device.
3. Plug in the USB device which you want to access.
4. The device notifier should come up.
5. You can mount it, access it and unmout it.
6. Unplug the USB device.
7. You can pluin the same USB device or another one and the device notifier should always come up.
Comment 35 Antonio Orefice 2021-09-02 14:57:25 UTC
(In reply to Attila from comment #34)
> Here is my workaround until this bug has been fixed.
> You need two USB devices. Let's call the first one "a dummy USB device".
> 
> 1. Just Plug in the dummy USB device.
> 2. You don't need to mount it. No access is needed. Don't remove the dummy
> device.
> 3. Plug in the USB device which you want to access.
> 4. The device notifier should come up.
> 5. You can mount it, access it and unmout it.
> 6. Unplug the USB device.
> 7. You can pluin the same USB device or another one and the device notifier
> should always come up.

It doesn't work for me,
but what works for me is:
plug usb-device1,unplug it.
plug usb-device2,unplug it,
replug usb-device1

It seems that unplug something doesn't trigger something, which is triggered by the plug of something else; just speculating ofc.
Comment 36 Gabriele Avi 2021-09-02 17:09:58 UTC
Same problem with a clean installation of Arch with kde plasma 5.22.5. The fix suggested by Attila in comment no. 34 works for me. Let's hope this bug will be fixed soon.
Comment 37 Fabio 2021-09-03 17:31:07 UTC
I just created a merge request that fixes this bug for me.
It would be nice if someone could confirm if this is working.

https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/1039
Comment 38 Fabio Bas 2021-09-03 18:01:09 UTC
Git commit 61e2ea2323ae63c5805c87353701ba6fb722205a by Fabio Bas.
Committed on 03/09/2021 at 17:23.
Pushed by ngraham into branch 'master'.

Update solid connectedSources when a new source gets added by hotplug

M  +1    -1    applets/devicenotifier/package/contents/ui/devicenotifier.qml

https://invent.kde.org/plasma/plasma-workspace/commit/61e2ea2323ae63c5805c87353701ba6fb722205a
Comment 39 nucleo 2021-09-03 19:29:05 UTC
Commit from Comment 38 works for me.
Comment 40 Patrick Silva 2021-09-04 11:19:12 UTC
*** Bug 439412 has been marked as a duplicate of this bug. ***
Comment 41 Xwang 2021-09-08 07:01:56 UTC
(In reply to Fabio from comment #37)
> I just created a merge request that fixes this bug for me.
> It would be nice if someone could confirm if this is working.
> 
> https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/1039

Is there any howto which explains how I can test your merge?
I'm using archlinux.
Comment 42 Fabio 2021-09-09 15:20:15 UTC
> Is there any howto which explains how I can test your merge?
> I'm using archlinux.

I have no idea about the correct way to do this kind of testing on Arch, but as a dirty hack you can just grab the three updated files from https://invent.kde.org/plasma/plasma-workspace/-/tree/master/applets/devicenotifier/package/contents/ui and replace the ones in your current installation; in my case they are in the /usr/share/plasma/plasmoids/org.kde.plasma.devicenotifier/contents/ui folder.
Once the files are replaced, you need to restart plasma for it to pick up the new version.
Comment 43 Domker 2021-09-09 20:11:51 UTC
(In reply to Xwang from comment #41)
> (In reply to Fabio from comment #37)
> > I just created a merge request that fixes this bug for me.
> > It would be nice if someone could confirm if this is working.
> > 
> > https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/1039
> 
> Is there any howto which explains how I can test your merge?
> I'm using archlinux.

Live swapping files is the worst possible way to patch something!!


$patch -d "plasma-workspace-5.22.5" -p1 < 1039.patch

(plasma-workspace-5.22.5 - direcotry with source code of plasma-workspace)

patching file applets/devicenotifier/package/contents/ui/DeviceItem.qml
Hunk #1 FAILED at 31.
Hunk #2 succeeded at 123 (offset 4 lines).
Hunk #3 succeeded at 140 (offset 4 lines).
Hunk #4 FAILED at 189.
Hunk #5 succeeded at 233 (offset 4 lines).
Hunk #6 FAILED at 250.
3 out of 6 hunks FAILED -- saving rejects to file applets/devicenotifier/package/contents/ui/DeviceItem.qml.rej
patching file applets/devicenotifier/package/contents/ui/devicenotifier.qml
Hunk #1 succeeded at 88 (offset 13 lines).
Hunk #2 succeeded at 112 (offset 13 lines).

!! It FAILED becouse patch is for plasma-workspace v5.23, not v5.22.5 !!

>>> You need make own patch file based on differences in "ui" direcotry:

1. Make new directory:
$ mkdir test_build && cd "$_"

2. Clone source package master repo where patch is merged:
$ git clone https://invent.kde.org/plasma/plasma-workspace.git

3. Rename it to "b":
$ mv plasma-workspace b

4. Download (and extract) source code plasma-workspace (current version) present in Arch Linux, rename directory to "a":
$ wget "https://download.kde.org/stable/plasma/5.22.5/plasma-workspace-5.22.5.tar.xz" -qO - | tar xvJ
$ mv plasma-workspace-5.22.5 a

5. Now you have directory "a" with current source code (plasma-workspace in Arch Linux) and direcotry "b" with merged patch. Make own custom.patch with differences in "ui" directories:

$ diff -ur a/applets/devicenotifier/package/contents/ui b/applets/devicenotifier/package/contents/ui > custom.patch

If You have now "custom.patch" file, remove "a" and "b" directories:
$ rm -rf a b

>>> Now you need build own patched package "plasma-workspace-5.22.5":

1. Go to: https://github.com/archlinux/svntogit-packages/tree/packages/plasma-workspace/trunk and download "PKGBUILD", "kde.pam" files, for quick download use this:

$ wget "https://raw.githubusercontent.com/archlinux/svntogit-packages/packages/plasma-workspace/trunk/PKGBUILD" && wget "https://raw.githubusercontent.com/archlinux/svntogit-packages/packages/plasma-workspace/trunk/kde.pam"

2. Edit "PKGBUILD" file:
source=(https://download.kde.org/stable/plasma/$pkgver/$pkgbase-$pkgver.tar.xz{,.sig} kde.pam
        https://invent.kde.org/plasma/plasma-workspace/-/commit/6379d1ec.patch)
        
REPLACE WITH:

source=(https://download.kde.org/stable/plasma/$pkgver/$pkgbase-$pkgver.tar.xz{,.sig} kde.pam
        https://invent.kde.org/plasma/plasma-workspace/-/commit/6379d1ec.patch custom.patch)
        
AND:
prepare() {
  patch -d $pkgbase-$pkgver -p1 < 6379d1ec.patch # Fix power management inhibition
}

REPLACE WITH:
prepare() {
  patch -d $pkgbase-$pkgver -p1 < 6379d1ec.patch # Fix power management inhibition
  patch -d $pkgbase-$pkgver -p1 < custom.patch
}



SAVE CHANGES in PKGBUILD FILE!

3. Update checksums in PKGBUILD:
$ updpkgsums PKGBUILD


3. Now build and install patched "plasma-workspace" package:
$ makepkg -sri --skippgpcheck PKGBUILD

#option -s (download and install dependencies)
#option -r (remove dependency after successful package build, in this case: pps-tools-1.0.2-1  gpsd-3.23-1  plasma-wayland-protocols-1.4.0-1)
#option -i (install the package if it has been built)

After installing the package restart your PC. For me, a patch made in this way works.

If something doesn't work, just force reinstall plasma-workspace from the repository.
( sudo rm /var/cache/pacman/pkg/plasma-workspace-5.22.5-2-x86_64.pkg.tar.zst{,.sig} && sudo pacman -S plasma-workspace )
Comment 44 Xwang 2021-09-09 20:26:00 UTC
(In reply to Domker from comment #43)
> (In reply to Xwang from comment #41)
> > (In reply to Fabio from comment #37)
> > > I just created a merge request that fixes this bug for me.
> > > It would be nice if someone could confirm if this is working.
> > > 
> > > https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/1039
> > 
> > Is there any howto which explains how I can test your merge?
> > I'm using archlinux.
> 
> Live swapping files is the worst possible way to patch something!!
> 
> 
> $patch -d "plasma-workspace-5.22.5" -p1 < 1039.patch
> 
> (plasma-workspace-5.22.5 - direcotry with source code of plasma-workspace)
> 
> patching file applets/devicenotifier/package/contents/ui/DeviceItem.qml
> Hunk #1 FAILED at 31.
> Hunk #2 succeeded at 123 (offset 4 lines).
> Hunk #3 succeeded at 140 (offset 4 lines).
> Hunk #4 FAILED at 189.
> Hunk #5 succeeded at 233 (offset 4 lines).
> Hunk #6 FAILED at 250.
> 3 out of 6 hunks FAILED -- saving rejects to file
> applets/devicenotifier/package/contents/ui/DeviceItem.qml.rej
> patching file applets/devicenotifier/package/contents/ui/devicenotifier.qml
> Hunk #1 succeeded at 88 (offset 13 lines).
> Hunk #2 succeeded at 112 (offset 13 lines).
> 
> !! It FAILED becouse patch is for plasma-workspace v5.23, not v5.22.5 !!
> 
> >>> You need make own patch file based on differences in "ui" direcotry:
> 
> 1. Make new directory:
> $ mkdir test_build && cd "$_"
> 
> 2. Clone source package master repo where patch is merged:
> $ git clone https://invent.kde.org/plasma/plasma-workspace.git
> 
> 3. Rename it to "b":
> $ mv plasma-workspace b
> 
> 4. Download (and extract) source code plasma-workspace (current version)
> present in Arch Linux, rename directory to "a":
> $ wget
> "https://download.kde.org/stable/plasma/5.22.5/plasma-workspace-5.22.5.tar.
> xz" -qO - | tar xvJ
> $ mv plasma-workspace-5.22.5 a
> 
> 5. Now you have directory "a" with current source code (plasma-workspace in
> Arch Linux) and direcotry "b" with merged patch. Make own custom.patch with
> differences in "ui" directories:
> 
> $ diff -ur a/applets/devicenotifier/package/contents/ui
> b/applets/devicenotifier/package/contents/ui > custom.patch
> 
> If You have now "custom.patch" file, remove "a" and "b" directories:
> $ rm -rf a b
> 
> >>> Now you need build own patched package "plasma-workspace-5.22.5":
> 
> 1. Go to:
> https://github.com/archlinux/svntogit-packages/tree/packages/plasma-
> workspace/trunk and download "PKGBUILD", "kde.pam" files, for quick download
> use this:
> 
> $ wget
> "https://raw.githubusercontent.com/archlinux/svntogit-packages/packages/
> plasma-workspace/trunk/PKGBUILD" && wget
> "https://raw.githubusercontent.com/archlinux/svntogit-packages/packages/
> plasma-workspace/trunk/kde.pam"
> 
> 2. Edit "PKGBUILD" file:
> source=(https://download.kde.org/stable/plasma/$pkgver/$pkgbase-$pkgver.tar.
> xz{,.sig} kde.pam
>        
> https://invent.kde.org/plasma/plasma-workspace/-/commit/6379d1ec.patch)
>         
> REPLACE WITH:
> 
> source=(https://download.kde.org/stable/plasma/$pkgver/$pkgbase-$pkgver.tar.
> xz{,.sig} kde.pam
>        
> https://invent.kde.org/plasma/plasma-workspace/-/commit/6379d1ec.patch
> custom.patch)
>         
> AND:
> prepare() {
>   patch -d $pkgbase-$pkgver -p1 < 6379d1ec.patch # Fix power management
> inhibition
> }
> 
> REPLACE WITH:
> prepare() {
>   patch -d $pkgbase-$pkgver -p1 < 6379d1ec.patch # Fix power management
> inhibition
>   patch -d $pkgbase-$pkgver -p1 < custom.patch
> }
> 
> 
> 
> SAVE CHANGES in PKGBUILD FILE!
> 
> 3. Update checksums in PKGBUILD:
> $ updpkgsums PKGBUILD
> 
> 
> 3. Now build and install patched "plasma-workspace" package:
> $ makepkg -sri --skippgpcheck PKGBUILD
> 
> #option -s (download and install dependencies)
> #option -r (remove dependency after successful package build, in this case:
> pps-tools-1.0.2-1  gpsd-3.23-1  plasma-wayland-protocols-1.4.0-1)
> #option -i (install the package if it has been built)
> 
> After installing the package restart your PC. For me, a patch made in this
> way works.
> 
> If something doesn't work, just force reinstall plasma-workspace from the
> repository.
> ( sudo rm
> /var/cache/pacman/pkg/plasma-workspace-5.22.5-2-x86_64.pkg.tar.zst{,.sig} &&
> sudo pacman -S plasma-workspace )

Thank you!
I'll try do that next weekend.
Anyway the bug will be in any case fixed when plasma-workspace-5.23 will be available. Is it correct?
Comment 45 Chris 2021-09-12 09:41:13 UTC
(In reply to Fabio from comment #42)
> > Is there any howto which explains how I can test your merge?
> > I'm using archlinux.
> 
> I have no idea about the correct way to do this kind of testing on Arch, but
> as a dirty hack you can just grab the three updated files from
> https://invent.kde.org/plasma/plasma-workspace/-/tree/master/applets/
> devicenotifier/package/contents/ui and replace the ones in your current
> installation; in my case they are in the
> /usr/share/plasma/plasmoids/org.kde.plasma.devicenotifier/contents/ui folder.
> Once the files are replaced, you need to restart plasma for it to pick up
> the new version.
Thanks for this. Works for me. 

FYI, I did not do a "Live swapping of files". I dropped out of Plasma to the CLI and the replaced the files. Ran startx to get back in to Plasma.

May not be related. I still occasionally see a Plasma restart when "Safely Removing" the device. Very rare of this desktop, more often on my laptop. Since replacing the files on Sept 4 (Your post over at the Slackware Forum), I've only seen this once on my laptop. Using a USB device is a daily thing.
Comment 46 Domker 2021-09-12 19:41:03 UTC
> Thank you!
> I'll try do that next weekend.
> Anyway the bug will be in any case fixed when plasma-workspace-5.23 will be
> available. Is it correct?
Yes fixed version is 5.23. As you have it marked in the header.
Comment 47 Patrick Silva 2021-09-20 01:36:58 UTC
*** Bug 442690 has been marked as a duplicate of this bug. ***
Comment 48 Patrick Silva 2021-09-20 04:27:51 UTC
*** Bug 442718 has been marked as a duplicate of this bug. ***
Comment 49 Patrick Silva 2021-10-14 15:32:23 UTC
*** Bug 443699 has been marked as a duplicate of this bug. ***