Bug 413973

Summary: Editing partitions resets touchpad configuration
Product: [Applications] partitionmanager Reporter: joey.joey586
Component: generalAssignee: Andrius Štikonas <andrius>
Status: RESOLVED FIXED    
Severity: normal CC: freefreeno81, georgefb899, jplx256, nate
Priority: NOR    
Version: 4.0.0   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=407191
https://bugs.kde.org/show_bug.cgi?id=414559
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description joey.joey586 2019-11-09 13:01:38 UTC
SUMMARY
After applying partition changes, touchpad suddenly refuses to click

STEPS TO REPRODUCE
1. Enable the "tap-to-click" setting for touchpads in the KDE settings
2. Use partitionmanager to modify/create a partition
3. After applying partition changes, touchpad refuses to tap-click
4. Logging out and logging back in reverses the effect

OBSERVED RESULT
Touchpad configuration appears to be reset back to defaults after applying changes to partition

EXPECTED RESULT
Touchpad behavior should not have been modified by partitionmanager

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: Arch Linux, kernel 5.3.8
(available in About System)
KDE Plasma Version: 5.17.2
KDE Frameworks Version: 5.63.0
Qt Version: 5.13.2

ADDITIONAL INFORMATION
Comment 1 Andrius Štikonas 2019-11-19 22:06:59 UTC
Hmm, I am unable to reproduce this.

kpmcore master
KDE Frameworks: 5.64
Qt: 5.13.2

Windowing system: Wayland

Maybe it works on wayland?
Comment 2 joey.joey586 2019-11-21 18:32:25 UTC
It still happens for me on partitionmanager 4.0.0
Maybe an Elan touchpad issue?
I have a Lenovo Ideapad 320 (2016)

Operating System: Arch Linux 
KDE Plasma Version: 5.17.3
KDE Frameworks Version: 5.64.0
Qt Version: 5.13.2
Kernel Version: 5.3.11-arch1-1
OS Type: 64-bit
Processors: 4 × Intel® Core™ i5-7200U CPU @ 2.50GHz
Memory: 11.5 GiB of RAM
Comment 3 joey.joey586 2019-11-21 18:35:24 UTC
Oh I forgot to add:
I'm running Xorg 1.20.5
Comment 4 Andrius Štikonas 2019-11-21 19:06:39 UTC
(In reply to joey.joey586 from comment #3)
> Oh I forgot to add:
> I'm running Xorg 1.20.5

Same here, 1.20.5...


Maybe you can try to figure out which command resets partition manager configuration?

If you run partitionmanager with

KPMCORE_DEBUG=y partitionmanager
then it will print to terminal the commands that it is running.

Check what commands are launched partitionmanager and try running them manually.
In particular. try to see if any of the udev stuff causes this.
Comment 5 joey.joey586 2019-11-22 17:52:59 UTC
I've run the command as you suggested. Here's the output:
[poweruser@poweruser ~]$ KPMCORE_DEBUG=y partitionmanager
Loaded backend plugin:  "pmsfdiskbackendplugin"
"Command: /usr/bin/dumpe2fs "
"Command: /usr/bin/e2label "
"Command: /usr/bin/mkfs.ext2 "
"Command: /usr/bin/e2fsck -V"
"Command: /usr/bin/tune2fs "
"Command: /usr/bin/resize2fs "
"Command: /usr/bin/dumpe2fs "
"Command: /usr/bin/e2label "
"Command: /usr/bin/mkfs.ext2 "
"Command: /usr/bin/e2fsck -V"
"Command: /usr/bin/tune2fs "
"Command: /usr/bin/resize2fs "
"Command: /usr/bin/dumpe2fs "
"Command: /usr/bin/e2label "
"Command: /usr/bin/mkfs.ext2 "
"Command: /usr/bin/e2fsck -V"
"Command: /usr/bin/tune2fs "
"Command: /usr/bin/resize2fs "
"Command: /usr/bin/mkswap "
"Command: /usr/bin/mkfs.fat "
"Command: /usr/bin/fatlabel "
"Command: /usr/bin/fatresize "
"Command: /usr/bin/fatresize "
"Command: /usr/bin/mkfs.fat "
"Command: /usr/bin/fatlabel "
"Command: /usr/bin/fatresize "
"Command: /usr/bin/fatresize "
"Command: /usr/bin/ntfsresize "
"Command: /usr/bin/ntfslabel "
"Command: /usr/bin/mkfs.ntfs "
"Command: /usr/bin/ntfsclone "
"Command: /usr/bin/debugreiserfs "
"Command: /usr/bin/reiserfstune "
"Command: /usr/bin/mkfs.reiserfs "
"Command: /usr/bin/fsck.reiserfs "
"Command: /usr/bin/resize_reiserfs "
"Command: /usr/bin/reiserfstune "
"Command: /usr/bin/xfs_db "
"Command: /usr/bin/mkfs.xfs "
"Command: /usr/bin/xfs_repair "
"Command: /usr/bin/xfs_growfs -V"
"Command: /usr/bin/xfs_copy "
"Command: /usr/bin/jfs_debugfs "
"Command: /usr/bin/jfs_tune -V"
"Command: /usr/bin/mkfs.jfs -V"
"Command: /usr/bin/fsck.jfs -V"
"Command: /usr/bin/mkfs.btrfs "
"Command: /usr/bin/btrfs "
"Command: /usr/bin/btrfstune "
"Command: /usr/bin/cryptsetup "
"Command: /usr/bin/mkfs.exfat "
"Command: /usr/bin/exfatfsck "
"Command: /usr/bin/exfatlabel "
"Command: /usr/bin/mkfs.nilfs2 "
"Command: /usr/bin/nilfs-tune "
"Command: /usr/bin/nilfs-tune "
"Command: /usr/bin/nilfs-resize "
"Command: /usr/bin/nilfs-tune "
"Command: /usr/bin/lvm "
"Command: /usr/bin/mkfs.f2fs "
"Command: /usr/bin/fsck.f2fs "
"Command: mkfs.f2fs "
"Command: /usr/bin/resize.f2fs "
"Command: /usr/bin/udfinfo "
"Command: /usr/bin/udflabel "
"Command: /usr/bin/mkudffs "
"Command: mkudffs --help"
"Command: /usr/bin/cryptsetup "
"Command: /usr/bin/mkfs.fat "
"Command: /usr/bin/fatlabel "
"Using backend plugin: pmsfdiskbackendplugin (1)"
"Scanning devices..."
"Command: lsblk --nodeps --paths --sort name --json --output type,name"
"Command: blockdev --getsize64 /dev/sda"
"Command: blockdev --getss /dev/sda"
"Command: sfdisk --json /dev/sda"
"Command: lsblk --nodeps --noheadings --output model /dev/sda"
"Command: lsblk --nodeps --noheadings --output tran /dev/sda"
"Command: smartctl --all --json /dev/sda"
"Device found: WDC WD1600BEVT-22ZCT0"
smartctl initialization failed for  "/dev/sda" :  No such file or directory
error during smart output parsing for  "/dev/sda" :  No such file or directory
"Command: udevadm info --query=property /dev/sda1"
"Command: lsblk --noheadings --nodeps --output mountpoint /dev/sda1"
"Command: dumpe2fs -h /dev/sda1"
"Command: udevadm info --query=property /dev/sda1"
"Command: udevadm info --query=property /dev/sda1"
"Command: udevadm info --query=property /dev/sda3"
"Command: lsblk --noheadings --nodeps --output mountpoint /dev/sda3"
"Command: udevadm info --query=property /dev/sda3"
"Command: blockdev --getsize64 /dev/sdb"
"Command: blockdev --getss /dev/sdb"
"Command: sfdisk --json /dev/sdb"
"Command: lsblk --nodeps --noheadings --output model /dev/sdb"
"Command: lsblk --nodeps --noheadings --output tran /dev/sdb"
"Command: smartctl --all --json /dev/sdb"
"Device found: SD MMC MS PRO"
smartctl initialization failed for  "/dev/sdb" :  No such file or directory
error during smart output parsing for  "/dev/sdb" :  No such file or directory
"Command: udevadm info --query=property /dev/sdb1"
"Command: lsblk --noheadings --nodeps --output mountpoint /dev/sdb1"
"Command: udevadm info --query=property /dev/sdb1"
"Command: udevadm info --query=property /dev/sdb1"
"Command: lvm vgs --foreign --readonly --noheadings --units B --nosuffix --options vg_name"
"Scan finished."
"Add operation: Delete partition ‘/dev/sdb1’ (14.56 GiB, exfat)"
"Applying operations..."
"Command: lsblk --noheadings --nodeps --output mountpoint /dev/sdb1"
"Command: wipefs --all /dev/sdb1"
"Command: udevadm settle --timeout=10"
"Command: blockdev --rereadpt /dev/sdb"
"Command: udevadm trigger"
"Command: udevadm settle --timeout=10"
"Command: udevadm settle --timeout=10"
"Command: blockdev --rereadpt /dev/sdb"
"Command: udevadm trigger"
"Command: udevadm settle --timeout=10"
"Command: sfdisk --force --delete /dev/sdb 1"
"Command: udevadm settle --timeout=10"
"Command: blockdev --rereadpt /dev/sdb"
"Command: udevadm trigger"
"Command: udevadm settle --timeout=10"
"Command: udevadm settle --timeout=10"
"Command: blockdev --rereadpt /dev/sdb"
"Command: udevadm trigger"
"Command: udevadm settle --timeout=10"
"Using backend plugin: pmsfdiskbackendplugin (1)"
"Scanning devices..."
"Command: lsblk --nodeps --paths --sort name --json --output type,name"
"Command: blockdev --getsize64 /dev/sda"
"Command: blockdev --getss /dev/sda"
"Command: sfdisk --json /dev/sda"
"Command: lsblk --nodeps --noheadings --output model /dev/sda"
"Command: lsblk --nodeps --noheadings --output tran /dev/sda"
"Command: smartctl --all --json /dev/sda"
"Device found: WDC WD1600BEVT-22ZCT0"
smartctl initialization failed for  "/dev/sda" :  No such file or directory
error during smart output parsing for  "/dev/sda" :  No such file or directory
"Command: udevadm info --query=property /dev/sda1"
"Command: lsblk --noheadings --nodeps --output mountpoint /dev/sda1"
"Command: dumpe2fs -h /dev/sda1"
"Command: udevadm info --query=property /dev/sda1"
"Command: udevadm info --query=property /dev/sda1"
"Command: udevadm info --query=property /dev/sda3"
"Command: lsblk --noheadings --nodeps --output mountpoint /dev/sda3"
"Command: udevadm info --query=property /dev/sda3"
"Command: blockdev --getsize64 /dev/sdb"
"Command: blockdev --getss /dev/sdb"
"Command: sfdisk --json /dev/sdb"
"Command: lsblk --nodeps --noheadings --output model /dev/sdb"
"Command: lsblk --nodeps --noheadings --output tran /dev/sdb"
"Command: smartctl --all --json /dev/sdb"
"Device found: SD MMC MS PRO"
smartctl initialization failed for  "/dev/sdb" :  No such file or directory
error during smart output parsing for  "/dev/sdb" :  No such file or directory
"Command: lvm vgs --foreign --readonly --noheadings --units B --nosuffix --options vg_name"
"Scan finished."
Failed to unregister window menu, reason: org.freedesktop.DBus.Error.ServiceUnknown ("The name com.canonical.AppMenu.Registrar was not provided by any .service files")
[poweruser@poweruser ~]$
Comment 6 joey.joey586 2019-11-22 18:21:37 UTC
I think I found it; I ran these commands (as root):

udevadm settle --timeout=10
udevadm trigger

and the touchpad refuses to tap-to-click
Comment 7 Andrius Štikonas 2019-11-22 18:45:17 UTC
(In reply to joey.joey586 from comment #6)
> I think I found it; I ran these commands (as root):
> 
> udevadm settle --timeout=10
> udevadm trigger
> 
> and the touchpad refuses to tap-to-click

Do you need both commands to trigger this bug? Or just udevadm trigger?

I don't think running udevadm is supposed to cause touchpad to stop working. Maybe try reporting bug about that (I guess to Archlinux bug tracker)
Comment 8 joey.joey586 2019-11-22 19:08:29 UTC
Sorry. I tested it again; it only needs "udevadm trigger" to cause the touchpad issue.
Comment 9 Andrius Štikonas 2019-11-22 19:14:41 UTC
(In reply to joey.joey586 from comment #8)
> Sorry. I tested it again; it only needs "udevadm trigger" to cause the
> touchpad issue.

I had some other bug from Arch user (different symptoms):

https://bugs.kde.org/show_bug.cgi?id=407191
udevadm trigger was causing high CPU usage. Maybe something bad with udev in Arch?
Comment 10 joey.joey586 2019-11-22 20:28:01 UTC
I was able to reproduce this bug on KDE Neon Live USB. I typed "udevadm trigger" and the same thing happens.
Comment 11 joey.joey586 2019-11-22 20:29:23 UTC
Sorry, i meant sudo udevadm trigger
Comment 12 joey.joey586 2019-11-22 20:31:30 UTC
So I don't think this is an Archlinux-specific issue
Comment 13 Andrius Štikonas 2019-11-22 20:39:11 UTC
--subsystem-match=SUBSYSTEM
           Trigger events for devices which belong to a matching subsystem(In reply to joey.joey586 from comment #12)
> So I don't think this is an Archlinux-specific issue

Hmm, possibly something else then. Maybe it's hardware specific.
Not sure what I can do on partition manager side to avoid this.

Maybe I can try to only trigger events for some udev subsystem. I'm now looking at udev trigger manpage, there is some option that might be useful

--subsystem-match=SUBSYSTEM
           Trigger events for devices which belong to a matching subsystem

If that work, this particular proble in KDE Partition Manager on your system might be workarounded...

Nevertheless, you might still want to report your underlying bug somewhere (maybe udev bugtracker, although, I'm not sure, but udev people might point you to the right direction)
Comment 14 joey.joey586 2019-11-22 20:56:08 UTC
I was unable to reproduce the bug in Fedora 31 GNOME Live USB, so i suspect this is a Plasma-specific issue. I'll try testing with Manjaro KDE next to make sure this is a Plasma-specific issue
Comment 15 joey.joey586 2019-11-22 21:42:03 UTC
I was unable to reproduce this issue in Manjaro KDE. Probably a regression?

Manjaro:

kde plasma version: 5.13.4
kde frameworks version: 5.48.0
qt version: 5.11.1
kernel version: 4.14.65



kde neon:

Operating System: KDE neon 5.16
KDE Plasma Version: 5.16.3
KDE Frameworks Version: 5.60.0
Qt Version: 5.12.3
Kernel Version: 4.18.0-25-generic
OS Type: 64-bit
Processors: 4 × Intel® Core™ i5-7200U CPU @ 2.50GHz
Memory: 11.5 GiB of RAM
Comment 16 Andrius Štikonas 2019-11-22 21:54:20 UTC
(In reply to joey.joey586 from comment #15)
> I was unable to reproduce this issue in Manjaro KDE. Probably a regression?
> 
> Manjaro:
> 
> kde plasma version: 5.13.4
> kde frameworks version: 5.48.0
> qt version: 5.11.1
> kernel version: 4.14.65
> 
> 
> 
> kde neon:
> 
> Operating System: KDE neon 5.16
> KDE Plasma Version: 5.16.3
> KDE Frameworks Version: 5.60.0
> Qt Version: 5.12.3
> Kernel Version: 4.18.0-25-generic
> OS Type: 64-bit
> Processors: 4 × Intel® Core™ i5-7200U CPU @ 2.50GHz
> Memory: 11.5 GiB of RAM

Most likely due to KDE Paritition Manager 3.3 < 4.

It used libparted library to do partitioning operations. Now KPM switched to running without root, so we replaced library calls with running executables, so I had to call udevadm trigger.
Comment 17 joey.joey586 2019-11-23 05:29:36 UTC
Yup, running the "udevadm trigger --subsystem-match=<SUBSYSTEM> fixes the issue.

So should I file a bug to udev or should this be considered a bug on partitionmanager?
Comment 18 Andrius Štikonas 2019-11-23 06:56:53 UTC
(In reply to joey.joey586 from comment #17)
> Yup, running the "udevadm trigger --subsystem-match=<SUBSYSTEM> fixes the
> issue.
> 
> So should I file a bug to udev or should this be considered a bug on
> partitionmanager?

Well, <SUBSYSTEM> has to be replaced with something I think "block". Otherwise, I think you are not triggering any events.

I suggest filing bug to udev too.
Comment 19 joey.joey586 2019-11-23 07:22:04 UTC
I tried "udevadm trigger --subsystem-match=all" since i didnt know what options are available that can be triggered.

I tried "udevadm trigger --subsystem-match=block" as you suggested and the touchpad issue didn't happen.

Oddly enough the touchpad issue didn't happen with Manjaro KDE when I ran "udevadm trigger" without the subsystem option.

Where can I find the available options that --subsystem-match can trigger. (the udevadm manpage doesn't seem to have a complete list). I'd like to go over each one of them to see  which one is causing the touchpad issue.
Comment 20 joey.joey586 2019-11-23 07:27:20 UTC
Do i file the udev bug to the systemd github or is there another place for that? (this is my first time filing bugs so i'm somewhat clueless)
Comment 21 Andrius Štikonas 2019-11-23 07:37:41 UTC
(In reply to joey.joey586 from comment #20)
> Do i file the udev bug to the systemd github or is there another place for
> that? (this is my first time filing bugs so i'm somewhat clueless)

I would try there. If it's not the right place, they'll point you.

I think you can find subsystems in /sys/class folder.
Comment 22 joey.joey586 2019-11-23 09:35:26 UTC
I found what's causing the touchpad issue; if I run "udevadm trigger -s input" the touchpad configuration resets back to defaults.

I've already posted the bug issue on github here: https://github.com/systemd/systemd/issues/14123#issue-527534449
Comment 23 joey.joey586 2019-11-25 15:41:04 UTC
The systemd github had just replied an hour ago. They say it's most likely not their bug and more likely due to how KDE or libinput handles the configuration once "udevadm trigger -s input" is run.

However, I doubt if this is a libinput issue, since I ran the same commands on Fedora GNOME 31 (which also uses libinput) and nothing happened. Could it be the way KDE handles its touchpad management/configuration?
Comment 24 joey.joey586 2019-11-25 15:43:32 UTC
Or as a temporary workaround, can Partitionmanager be patched to not include the "input" class when editing a partition?
Comment 25 Andrius Štikonas 2019-11-25 17:46:10 UTC
partitionmanager will be patched not to include non-block devices. There 
is no reason to include them.

Maybe also worth opening KD bug against touchpad kcm?

On 2019-11-25 15:43, bugzilla_noreply@kde.org wrote:
> https://bugs.kde.org/show_bug.cgi?id=413973
> 
> --- Comment #24 from joey.joey586@gmail.com ---
> Or as a temporary workaround, can Partitionmanager be patched to not 
> include
> the "input" class when editing a partition?
Comment 26 Andrius Štikonas 2019-12-02 22:02:39 UTC
Git commit dfce039421187b5698e35c2e8fa73f1274671887 by Andrius Štikonas.
Committed on 02/12/2019 at 22:01.
Pushed by stikonas into branch 'master'.

Only trigger udev events for block device subsystem.

Triggerring other subsystems is not necessary and occasionally
results in triggering unrelated bugs.

M  +1    -1    src/plugins/sfdisk/sfdiskpartitiontable.cpp

https://invent.kde.org/kde/kpmcore/commit/dfce039421187b5698e35c2e8fa73f1274671887
Comment 27 Jan Przybylak 2019-12-08 23:16:24 UTC
*** Bug 412373 has been marked as a duplicate of this bug. ***
Comment 28 joey.joey586 2019-12-10 16:51:30 UTC
@Jan Przybylak Could you please try and confirm if this bug exists for you as well?
https://bugs.kde.org/show_bug.cgi?id=414559

I believe it's indirectly related to this Partitionmanager bug
Comment 29 Jan Przybylak 2019-12-10 16:58:48 UTC
It does. I executed the `sudo udevadm trigger -s input` and the Trackpad started feeling like it had switched from Synaptics to libinput (or the default settings, or both).
I was able to revert this by simply opening KDE's Trackpad settings and applying them again.
Comment 30 joey.joey586 2019-12-10 18:44:34 UTC
Is yours a Lenovo laptop (or something else?)
Also, try to run "sudo udevadm trigger -s input" on a distro/live iso with GNOME desktop and see if the same thing happens.
Comment 31 Jan Przybylak 2019-12-10 19:00:23 UTC
You're right, I'm on a Lenovo ThinkPad T440.

It seems like the issue is not present on a live iso of Fedora Workstation.
Comment 32 joey.joey586 2019-12-10 19:36:40 UTC
Ah, I see. I'm on a Lenovo Ideapad 320 (2016)
I'll try testing on some other laptops I have (MSI vr420 and Ideapad s10-3s) to see if the bug also occurs on these devices.
Comment 33 joey.joey586 2019-12-11 05:03:05 UTC
Tested on my Lenovo Ideapad s10-3s. Bug happens on Fedora 31 KDE live iso.
Was unable to test on my MSI due to lack of RAM.
Comment 34 Andrius Štikonas 2020-01-30 23:43:38 UTC
*** Bug 416968 has been marked as a duplicate of this bug. ***
Comment 35 Andrius Štikonas 2020-10-05 11:19:39 UTC
*** Bug 412233 has been marked as a duplicate of this bug. ***
Comment 36 Nate Graham 2020-10-05 14:32:17 UTC
This may be fixed for partition manager, but the root cause remains: https://bugs.kde.org/show_bug.cgi?id=414559

I have no idea why running `sudo udevadm trigger -s input` makes this happen. Any assistance to fix that would be greatly appreciated.
Comment 37 Andrius Štikonas 2020-10-05 14:53:36 UTC
(In reply to Nate Graham from comment #36)
> This may be fixed for partition manager, but the root cause remains:
> https://bugs.kde.org/show_bug.cgi?id=414559
> 
> I have no idea why running `sudo udevadm trigger -s input` makes this
> happen. Any assistance to fix that would be greatly appreciated.

I can't reproduce it at all here, even I manually run udevadm trigger -s input. Maybe it is only triggered on some distros (depending on udev rules?)
Comment 38 Nate Graham 2020-10-05 15:22:52 UTC
What distro are you using? I'm on openSUSE Tumbleweed and I can reproduce it.
Comment 39 Andrius Štikonas 2020-10-05 15:29:22 UTC
(In reply to Nate Graham from comment #38)
> What distro are you using? I'm on openSUSE Tumbleweed and I can reproduce it.

Gentoo