Strange issues with the keyboard -- doesn't recognize shift, sticky keys turn itself on randomly

Hello,

my lenovo x1 thinkpad g4, with manjaro kde installed (all
software up to date) is displaying weird keyboard issues.

the biggest problem is that sticky keys-like functionality
turns itself on randomly. With an external keyboard attached,
i’m able to turn it off by pressing right shift five times,
but with internal laptop keyboard this sometimes works and
sometimes doesn’t, when i cannot turn it off, only rebooting
helps.

Also, when i use internal keyboard, right shift doesn’t work
at all and left shift doesn’t work with some keys, like m, t,
x, y etc. I cannot really see any pattern there.

I don’t think this is hardware fault because sometimes it
works fine.

It may be related to sddm-greeter, because it doesn’t work
properly as well, it doesn’t show a login screen, to switch
users one needs to login to tty and execute startx.

systemctl status for sddm outputs the following:

 sddm.service - Simple Desktop Display Manager
     Loaded: loaded (/usr/lib/systemd/system/sddm.service; enabled; vendor preset: disabled)
     Active: active (running) since Thu 2020-07-30 22:46:43 CEST; 9min ago
       Docs: man:sddm(1)
             man:sddm.conf(5)
   Main PID: 565 (sddm)
      Tasks: 11 (limit: 18871)
     Memory: 154.2M
     CGroup: /system.slice/sddm.service
             ├─565 /usr/bin/sddm
             └─819 /usr/lib/Xorg -nolisten tcp -auth /var/run/sddm/{5ecea412-a362-4639-946a-0ba3acb5e535} -background none -noreset -displayfd 17 -seat seat0 vt1

Jul 30 22:46:46 snusmumriken sddm[565]: Greeter starting...
Jul 30 22:46:46 snusmumriken sddm[565]: Adding cookie to "/var/run/sddm/{5ecea412-a362-4639-946a-0ba3acb5e535}"
Jul 30 22:46:46 snusmumriken sddm-helper[1103]: [PAM] Starting...
Jul 30 22:46:46 snusmumriken sddm-helper[1103]: [PAM] Authenticating...
Jul 30 22:46:46 snusmumriken sddm-helper[1103]: [PAM] returning.
Jul 30 22:46:46 snusmumriken sddm-helper[1103]: pam_unix(sddm-greeter:session): session opened for user sddm by (uid=0)
Jul 30 22:46:46 snusmumriken sddm[565]: Greeter session started successfully
Jul 30 22:46:46 snusmumriken sddm[565]: Message received from greeter: Connect
Jul 30 22:46:48 snusmumriken sddm[565]: Auth: sddm-helper exited with 6
Jul 30 22:46:48 snusmumriken sddm[565]: Greeter stopped.

stacktrace for sddmgreeter looks like this:

-- Logs begin at Mon 2019-10-28 13:02:18 CET, end at Thu 2020-07-30 22:51:37 CEST. --

Jul 30 22:46:48 snusmumriken sddm-greeter[1116]: Failed to create OpenGL context for format QSurfaceFormat(version 2.0, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSize 24, redBufferSize -1, greenBufferSize -1, blueBufferSize -1, alphaBufferSize -1, stencilBufferSize 8, samples -1, swapBehavior QSurfaceFormat::DoubleBuffer, swapInterval 1, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::NoProfile)
Jul 30 22:46:48 snusmumriken systemd-coredump[1162]: Process 1116 (sddm-greeter) of user 968 dumped core.
                                                     
                                                     Stack trace of thread 1116:
                                                     #0  0x00007fc34523c355 raise (libc.so.6 + 0x3c355)
                                                     #1  0x00007fc345225853 abort (libc.so.6 + 0x25853)
                                                     #2  0x00007fc34564f9ac _ZNK14QMessageLogger5fatalEPKcz (libQt5Core.so.5 + 0x919ac)
                                                     #3  0x00007fc346a8b7a9 _ZN13QSGRenderLoop28handleContextCreationFailureEP12QQuickWindow (libQt5Quick.so.5 + 0x1d37a9)
                                                     #4  0x00007fc346a8cd10 n/a (libQt5Quick.so.5 + 0x1d4d10)
                                                     #5  0x00007fc346a8e4ca n/a (libQt5Quick.so.5 + 0x1d64ca)
                                                     #6  0x00007fc345c58955 _ZN7QWindow5eventEP6QEvent (libQt5Gui.so.5 + 0x148955)
                                                     #7  0x00007fc3458717ba _ZN16QCoreApplication15notifyInternal2EP7QObjectP6QEvent (libQt5Core.so.5 + 0x2b37ba)
                                                     #8  0x00007fc345c4d7e0 _ZN22QGuiApplicationPrivate18processExposeEventEPN29QWindowSystemInterfacePrivate11ExposeEventE (libQt5Gui.so.5 + 0x13d7e0)
                                                     #9  0x00007fc345c21b4c _ZN22QWindowSystemInterface22sendWindowSystemEventsE6QFlagsIN10QEventLoop17ProcessEventsFlagEE (libQt5Gui.so.5 + 0x111b4c)
                                                     #10 0x00007fc33eaaac8c n/a (libQt5XcbQpa.so.5 + 0x5ec8c)
                                                     #11 0x00007fc343f0e43c g_main_context_dispatch (libglib-2.0.so.0 + 0x5243c)
                                                     #12 0x00007fc343f5c1d9 n/a (libglib-2.0.so.0 + 0xa01d9)
                                                     #13 0x00007fc343f0d221 g_main_context_iteration (libglib-2.0.so.0 + 0x51221)
                                                     #14 0x00007fc3458ca331 _ZN20QEventDispatcherGlib13processEventsE6QFlagsIN10QEventLoop17ProcessEventsFlagEE (libQt5Core.so.5 + 0x30c331)
                                                     #15 0x00007fc34587013c _ZN10QEventLoop4execE6QFlagsINS_17ProcessEventsFlagEE (libQt5Core.so.5 + 0x2b213c)
                                                     #16 0x00007fc3458785c4 _ZN16QCoreApplication4execEv (libQt5Core.so.5 + 0x2ba5c4)
                                                     #17 0x000055e5745c9c05 main (sddm-greeter + 0x19c05)
                                                     #18 0x00007fc345227002 __libc_start_main (libc.so.6 + 0x27002)
                                                     #19 0x000055e5745c9f3e _start (sddm-greeter + 0x19f3e)
                                                     
                                                     Stack trace of thread 1117:
                                                     #0  0x00007fc3452f505f __poll (libc.so.6 + 0xf505f)
                                                     #1  0x00007fc34689a63b n/a (libxcb.so.1 + 0xc63b)
                                                     #2  0x00007fc34689c37b xcb_wait_for_event (libxcb.so.1 + 0xe37b)
                                                     #3  0x00007fc33eaa9c51 n/a (libQt5XcbQpa.so.5 + 0x5dc51)
                                                     #4  0x00007fc34568ce0f n/a (libQt5Core.so.5 + 0xcee0f)
                                                     #5  0x00007fc344e97422 start_thread (libpthread.so.0 + 0x9422)
                                                     #6  0x00007fc3452ffbf3 __clone (libc.so.6 + 0xffbf3)
                                                     
                                                     Stack trace of thread 1118:
                                                     #0  0x00007fc3452f505f __poll (libc.so.6 + 0xf505f)
                                                     #1  0x00007fc343f5c168 n/a (libglib-2.0.so.0 + 0xa0168)
                                                     #2  0x00007fc343f0d221 g_main_context_iteration (libglib-2.0.so.0 + 0x51221)
                                                     #3  0x00007fc3458ca331 _ZN20QEventDispatcherGlib13processEventsE6QFlagsIN10QEventLoop17ProcessEventsFlagEE (libQt5Core.so.5 + 0x30c331)
                                                     #4  0x00007fc34587013c _ZN10QEventLoop4execE6QFlagsINS_17ProcessEventsFlagEE (libQt5Core.so.5 + 0x2b213c)
                                                     #5  0x00007fc34568bc32 _ZN7QThread4execEv (libQt5Core.so.5 + 0xcdc32)
                                                     #6  0x00007fc33e992098 n/a (libQt5DBus.so.5 + 0x17098)
                                                     #7  0x00007fc34568ce0f n/a (libQt5Core.so.5 + 0xcee0f)
                                                     #8  0x00007fc344e97422 start_thread (libpthread.so.0 + 0x9422)
                                                     #9  0x00007fc3452ffbf3 __clone (libc.so.6 + 0xffbf3)
                                                     
                                                     Stack trace of thread 1120:
                                                     #0  0x00007fc3452f505f __poll (libc.so.6 + 0xf505f)
                                                     #1  0x00007fc343f5c168 n/a (libglib-2.0.so.0 + 0xa0168)
                                                     #2  0x00007fc343f0d221 g_main_context_iteration (libglib-2.0.so.0 + 0x51221)
                                                     #3  0x00007fc3458ca331 _ZN20QEventDispatcherGlib13processEventsE6QFlagsIN10QEventLoop17ProcessEventsFlagEE (libQt5Core.so.5 + 0x30c331)
                                                     #4  0x00007fc34587013c _ZN10QEventLoop4execE6QFlagsINS_17ProcessEventsFlagEE (libQt5Core.so.5 + 0x2b213c)
                                                     #5  0x00007fc34568bc32 _ZN7QThread4execEv (libQt5Core.so.5 + 0xcdc32)
                                                     #6  0x00007fc346671789 n/a (libQt5Qml.so.5 + 0x30b789)
                                                     #7  0x00007fc34568ce0f n/a (libQt5Core.so.5 + 0xcee0f)
                                                     #8  0x00007fc344e97422 start_thread (libpthread.so.0 + 0x9422)
                                                     #9  0x00007fc3452ffbf3 __clone (libc.so.6 + 0xffbf3)
Jul 30 22:47:02 snusmumriken ModemManager[524]: <error> [modem0] SIM is missing and SIM hot swap is configured, but ports are not opened.
Jul 30 22:47:39 snusmumriken bluetoothd[859]: RFCOMM server failed for Headset Voice gateway: rfcomm_bind: Address already in use (98)
Jul 30 22:47:39 snusmumriken bluetoothd[859]: RFCOMM server failed for :1.80/Profile/HSPHS/00001108-0000-1000-8000-00805F9B34FB: rfcomm_bind: Address already in use (98)
Jul 30 22:48:37 snusmumriken sudo[2011]: pam_unix(sudo:auth): conversation failed
Jul 30 22:48:37 snusmumriken sudo[2011]: pam_unix(sudo:auth): auth could not identify password for [sara]
Jul 30 22:48:37 snusmumriken sudo[2011]:     sara : 1 incorrect password attempt ; TTY=pts/2 ; PWD=/home/sara ; USER=root ; COMMAND=/usr/bin/vi /etc/X11/xinit/xinitrc

I followed a solution posted on stack overflow and pasted
below code to the usr/share/sddm/scripts/Xsetup file:

xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto

…But it didn’t change anything. I got around it by setting an automatic login in sddm section of system settings.

inxi -Fazy output is the following:

System:
  Kernel: 5.8.1-3-MANJARO x86_64 bits: 64 compiler: N/A 
  parameters: BOOT_IMAGE=/boot/vmlinuz-5.8-x86_64 
  root=UUID=4a43c15d-b197-46e4-be1f-0da42269de21 rw quiet apparmor=1 
  security=apparmor resume=UUID=dc96cc0b-1e90-47b8-807c-575c63cab037 
  udev.log_priority=3 
  Desktop: KDE Plasma 5.19.4 tk: Qt 5.15.0 wm: kwin_x11 dm: SDDM 
  Distro: Manjaro Linux 
Machine:
  Type: Laptop System: LENOVO product: 20FCS14X04 v: ThinkPad X1 Carbon 4th 
  serial: <filter> Chassis: type: 10 serial: <filter> 
  Mobo: LENOVO model: 20FCS14X04 v: SDK0J40697 WIN serial: <filter> 
  UEFI: LENOVO v: N1FET49W (1.23 ) date: 02/08/2017 
Battery:
  ID-1: BAT0 charge: 30.1 Wh condition: 44.6/52.1 Wh (86%) volts: 16.3/15.2 
  model: SMP 00HW029 type: Li-poly serial: <filter> status: Charging 
CPU:
  Topology: Dual Core model: Intel Core i7-6600U bits: 64 type: MT MCP 
  arch: Skylake family: 6 model-id: 4E (78) stepping: 3 microcode: D6 
  L2 cache: 4096 KiB 
  flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 bogomips: 22408 
  Speed: 1550 MHz min/max: 400/3400 MHz Core speeds (MHz): 1: 1727 2: 1619 
  3: 1751 4: 1801 
  Vulnerabilities: Type: itlb_multihit status: KVM: Vulnerable 
  Type: l1tf mitigation: PTE Inversion 
  Type: mds mitigation: Clear CPU buffers; SMT vulnerable 
  Type: meltdown mitigation: PTI 
  Type: spec_store_bypass 
  mitigation: Speculative Store Bypass disabled via prctl and seccomp 
  Type: spectre_v1 
  mitigation: usercopy/swapgs barriers and __user pointer sanitization 
  Type: spectre_v2 mitigation: Full generic retpoline, IBPB: conditional, 
  IBRS_FW, STIBP: conditional, RSB filling 
  Type: srbds status: Vulnerable: No microcode 
  Type: tsx_async_abort mitigation: Clear CPU buffers; SMT vulnerable 
Graphics:
  Device-1: Intel Skylake GT2 [HD Graphics 520] vendor: Lenovo driver: i915 
  v: kernel bus ID: 00:02.0 chip ID: 8086:1916 
  Device-2: Chicony Integrated Camera type: USB driver: uvcvideo bus ID: 1-8:4 
  chip ID: 04f2:b5c1 
  Display: x11 server: X.Org 1.20.8 compositor: kwin_x11 driver: modesetting 
  unloaded: intel alternate: fbdev,vesa display ID: :0 screens: 1 
  Screen-1: 0 s-res: 2560x1440 s-dpi: 144 s-size: 451x254mm (17.8x10.0") 
  s-diag: 518mm (20.4") 
  Monitor-1: eDP-1 res: 2560x1440 hz: 60 dpi: 210 size: 310x174mm (12.2x6.9") 
  diag: 355mm (14") 
  OpenGL: renderer: N/A v: N/A direct render: N/A 
Audio:
  Device-1: Intel Sunrise Point-LP HD Audio vendor: Lenovo 
  driver: snd_hda_intel v: kernel alternate: snd_soc_skl bus ID: 00:1f.3 
  chip ID: 8086:9d70 
  Sound Server: ALSA v: k5.8.1-3-MANJARO 
Network:
  Device-1: Intel Ethernet I219-LM vendor: Lenovo driver: e1000e v: 3.2.6-k 
  port: efa0 bus ID: 00:1f.6 chip ID: 8086:156f 
  IF: enp0s31f6 state: down mac: <filter> 
  Device-2: Intel Wireless 8260 driver: iwlwifi v: kernel port: efa0 
  bus ID: 04:00.0 chip ID: 8086:24f3 
  IF: wlp4s0 state: up mac: <filter> 
  IF-ID-1: wwp0s20f0u2i12 state: down mac: <filter> 
Drives:
  Local Storage: total: 238.47 GiB used: 78.92 GiB (33.1%) 
  SMART Message: Required tool smartctl not installed. Check --recommends 
  ID-1: /dev/nvme0n1 vendor: Toshiba model: N/A size: 238.47 GiB block size: 
  physical: 512 B logical: 512 B speed: 31.6 Gb/s lanes: 4 serial: <filter> 
  rev: 510657LA scheme: GPT 
Partition:
  ID-1: / raw size: 221.26 GiB size: 216.78 GiB (97.98%) 
  used: 78.92 GiB (36.4%) fs: ext4 dev: /dev/nvme0n1p2 
Swap:
  Kernel: swappiness: 60 (default) cache pressure: 100 (default) 
  ID-1: swap-1 type: partition size: 16.91 GiB used: 0 KiB (0.0%) priority: -2 
  dev: /dev/nvme0n1p3 
Sensors:
  System Temperatures: cpu: 73.0 C mobo: N/A 
  Fan Speeds (RPM): cpu: 5521 
Info:
  Processes: 236 Uptime: 1h 43m Memory: 15.37 GiB used: 2.82 GiB (18.3%) 
  Init: systemd v: 245 Compilers: gcc: 10.1.0 alt: 8/9 Packages: pacman: 1401 
  lib: 401 flatpak: 0 Shell: Zsh v: 5.8 running in: konsole inxi: 3.1.05 

Do you guys have any suggestions? Should i paste some others command
output? I don’t really know how to diagnose keyboard issues, everything i find on google or manjaro forum isn’t really similar to my issue.

kind regards and thanks for help!!