PC shuts down when unplugging keyboard

Hey all. Recently discovered a weird problem with my keyboard. For whatever reason while on manjaro, unplugging my keyboard results in an instant poweroff. I am dual booting windows and this does not happen while on windows. What’s going on?

INXI:

  Kernel: 5.16.5-1-MANJARO x86_64 bits: 64 compiler: gcc v: 11.1.0
    parameters: BOOT_IMAGE=/boot/vmlinuz-5.16-x86_64
    root=UUID=650d282c-6e51-4e56-ae13-802a79692648 rw quiet apparmor=1
    security=apparmor udev.log_priority=3 sysrq_always_enabled=1
    nvidia-drm.modeset=1
  Console: pty pts/1 wm: kwin_x11 DM: SDDM Distro: Manjaro Linux
    base: Arch Linux
Machine:
  Type: Desktop Mobo: ASRock model: B550M-ITX/ac serial: <filter>
    UEFI: American Megatrends LLC. v: P1.80 date: 08/09/2021
Battery:
  Message: No system battery data found. Is one present?
Memory:
  RAM: total: 31.27 GiB used: 3.47 GiB (11.1%)
  Array-1: capacity: 128 GiB slots: 2 EC: None max-module-size: 64 GiB
    note: est.
  Device-1: DIMM 0 size: 16 GiB speed: 3600 MT/s type: DDR4
    detail: synchronous unbuffered (unregistered) bus-width: 64 bits
    total: 64 bits manufacturer: Corsair part-no: CMK32GX4M2D3600C18
    serial: N/A
  Device-2: DIMM 0 size: 16 GiB speed: 3600 MT/s type: DDR4
    detail: synchronous unbuffered (unregistered) bus-width: 64 bits
    total: 64 bits manufacturer: Corsair part-no: CMK32GX4M2D3600C18
    serial: N/A
CPU:
  Info: model: AMD Ryzen 7 5800X socket: AM4 bits: 64 type: MT MCP arch: Zen 3
    family: 0x19 (25) model-id: 0x21 (33) stepping: 0 microcode: 0xA201016
  Topology: cpus: 1x cores: 8 tpc: 2 threads: 16 smt: enabled cache:
    L1: 512 KiB desc: d-8x32 KiB; i-8x32 KiB L2: 4 MiB desc: 8x512 KiB
    L3: 32 MiB desc: 1x32 MiB
  Speed (MHz): avg: 2400 high: 3800 min/max: 2200/4850 boost: enabled
    base/boost: 3800/4850 scaling: driver: acpi-cpufreq governor: schedutil
    volts: 1.1 V ext-clock: 100 MHz cores: 1: 3800 2: 2200 3: 2200 4: 2200
    5: 2200 6: 2200 7: 2200 8: 2200 9: 2200 10: 2200 11: 2200 12: 2200
    13: 2200 14: 2200 15: 2200 16: 3800 bogomips: 121416
  Flags: 3dnowprefetch abm adx aes aperfmperf apic arat avic avx avx2 bmi1
    bmi2 bpext cat_l3 cdp_l3 clflush clflushopt clwb clzero cmov cmp_legacy
    constant_tsc cpb cpuid cqm cqm_llc cqm_mbm_local cqm_mbm_total
    cqm_occup_llc cr8_legacy cx16 cx8 de decodeassists extapic extd_apicid
    f16c flushbyasid fma fpu fsgsbase fxsr fxsr_opt ht hw_pstate ibpb ibrs ibs
    invpcid irperf lahf_lm lbrv lm mba mca mce misalignsse mmx mmxext monitor
    movbe msr mtrr mwaitx nonstop_tsc nopl npt nrip_save nx ospke osvw
    overflow_recov pae pat pausefilter pclmulqdq pdpe1gb perfctr_core
    perfctr_llc perfctr_nb pfthreshold pge pku pni popcnt pse pse36 rapl rdpid
    rdpru rdrand rdseed rdt_a rdtscp rep_good sep sha_ni skinit smap smca smep
    ssbd sse sse2 sse4_1 sse4_2 sse4a ssse3 stibp succor svm svm_lock syscall
    tce topoext tsc tsc_scale umip v_spec_ctrl v_vmsave_vmload vaes vgif
    vmcb_clean vme vmmcall vpclmulqdq wbnoinvd wdt xgetbv1 xsave xsavec
    xsaveerptr xsaveopt xsaves
  Vulnerabilities:
  Type: itlb_multihit status: Not affected
  Type: l1tf status: Not affected
  Type: mds status: Not affected
  Type: meltdown status: Not affected
  Type: spec_store_bypass
    mitigation: Speculative Store Bypass disabled via prctl
  Type: spectre_v1
    mitigation: usercopy/swapgs barriers and __user pointer sanitization
  Type: spectre_v2 mitigation: Full AMD retpoline, IBPB: conditional,
    IBRS_FW, STIBP: always-on, RSB filling
  Type: srbds status: Not affected
  Type: tsx_async_abort status: Not affected
Graphics:
  Device-1: NVIDIA GA104 [GeForce RTX 3060 Ti Lite Hash Rate]
    vendor: eVga.com. driver: nvidia v: 510.47.03 alternate: nouveau,nvidia_drm
    bus-ID: 06:00.0 chip-ID: 10de:2489 class-ID: 0300
  Device-2: Logitech C920 HD Pro Webcam type: USB
    driver: snd-usb-audio,uvcvideo bus-ID: 3-1:2 chip-ID: 046d:0892
    class-ID: 0102 serial: <filter>
  Display: server: X.Org 1.21.1.3 compositor: kwin_x11 driver:
    loaded: nvidia display-ID: :0 screens: 1
  Screen-1: 0 s-res: 4480x1440 s-dpi: 108 s-size: 1054x342mm (41.5x13.5")
    s-diag: 1108mm (43.6")
  Monitor-1: HDMI-0 res: 2560x1440 hz: 144 dpi: 109
    size: 597x336mm (23.5x13.2") diag: 685mm (27")
  Monitor-2: DP-4 res: 1920x1080 hz: 60 dpi: 96 size: 509x286mm (20.0x11.3")
    diag: 584mm (23")
  OpenGL: renderer: NVIDIA GeForce RTX 3060 Ti/PCIe/SSE2
    v: 4.6.0 NVIDIA 510.47.03 direct render: Yes
Audio:
  Device-1: NVIDIA GA104 High Definition Audio vendor: eVga.com.
    driver: snd_hda_intel v: kernel bus-ID: 06:00.1 chip-ID: 10de:228b
    class-ID: 0403
  Device-2: AMD Starship/Matisse HD Audio vendor: ASRock
    driver: snd_hda_intel v: kernel bus-ID: 08:00.4 chip-ID: 1022:1487
    class-ID: 0403
  Device-3: Schiit Audio Schiit Modi 3+ type: USB driver: snd-usb-audio
    bus-ID: 1-1:2 chip-ID: 30be:1014 class-ID: 0102
  Device-4: Samson Q2U handheld mic with XLR type: USB
    driver: hid-generic,snd-usb-audio,usbhid bus-ID: 1-3:3 chip-ID: 17a0:0304
    class-ID: 0300
  Device-5: Logitech C920 HD Pro Webcam type: USB
    driver: snd-usb-audio,uvcvideo bus-ID: 3-1:2 chip-ID: 046d:0892
    class-ID: 0102 serial: <filter>
  Sound Server-1: ALSA v: k5.16.5-1-MANJARO running: yes
  Sound Server-2: PulseAudio v: 15.0 running: no
  Sound Server-3: PipeWire v: 0.3.45 running: yes
Network:
  Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet
    vendor: ASRock driver: r8169 v: kernel port: f000 bus-ID: 04:00.0
    chip-ID: 10ec:8168 class-ID: 0200
  IF: enp4s0 state: down mac: <filter>
  Device-2: Intel Wi-Fi 6 AX200 driver: iwlwifi v: kernel bus-ID: 05:00.0
    chip-ID: 8086:2723 class-ID: 0280
  IF: wlp5s0 state: up mac: <filter>
  IP v4: <filter> type: dynamic noprefixroute scope: global
    broadcast: <filter>
  IP v6: <filter> type: dynamic noprefixroute scope: global
  IP v6: <filter> type: dynamic noprefixroute scope: global
  IP v6: <filter> type: noprefixroute scope: link
  WAN IP: <filter>
Bluetooth:
  Device-1: Intel AX200 Bluetooth type: USB driver: btusb v: 0.8 bus-ID: 1-9:7
    chip-ID: 8087:0029 class-ID: e001
  Report: rfkill ID: hci0 rfk-id: 1 state: up address: see --recommends
Logical:
  Message: No logical block device data found.
RAID:
  Message: No RAID data found.
Drives:
  Local Storage: total: 2.29 TiB used: 652.8 GiB (27.9%)
  ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: A-Data model: SX8200PNP
    size: 476.94 GiB block-size: physical: 512 B logical: 512 B speed: 31.6 Gb/s
    lanes: 4 type: SSD serial: <filter> rev: 42B2S7JA temp: 31.9 C scheme: GPT
  SMART: yes health: PASSED on: 233d 6h cycles: 1,790
    read-units: 37,589,280 [19.2 TB] written-units: 38,139,407 [19.5 TB]
  ID-2: /dev/sda maj-min: 8:0 vendor: Western Digital
    model: WDS200T2B0A-00SM50 family: WD Blue / Red / Green SSDs size: 1.82 TiB
    block-size: physical: 512 B logical: 512 B sata: 3.3 speed: 6.0 Gb/s
    type: SSD serial: <filter> rev: 20WD temp: 37 C scheme: GPT
  SMART: yes state: enabled health: PASSED on: 72d 23h cycles: 419
  Message: No optical or floppy data found.
Partition:
  ID-1: / raw-size: 206.95 GiB size: 203.2 GiB (98.19%)
    used: 171.82 GiB (84.6%) fs: ext4 block-size: 4096 B dev: /dev/nvme0n1p4
    maj-min: 259:4 label: N/A uuid: 650d282c-6e51-4e56-ae13-802a79692648
  ID-2: /boot/efi raw-size: 100 MiB size: 96 MiB (96.00%)
    used: 28.7 MiB (29.9%) fs: vfat block-size: 512 B dev: /dev/nvme0n1p1
    maj-min: 259:1 label: N/A uuid: D0BD-3782
  ID-3: /media/data_ext4 raw-size: 1.06 TiB size: 1.04 TiB (98.34%)
    used: 168.84 GiB (15.9%) fs: ext4 block-size: 4096 B dev: /dev/sda1
    maj-min: 8:1 label: Data_Drive uuid: f0052fef-9c25-4d87-b81e-8915e65c9eaf
  ID-4: /media/ntfs1 raw-size: 781.25 GiB size: 781.25 GiB (100.00%)
    used: 312.1 GiB (39.9%) fs: ntfs block-size: 4096 B dev: /dev/sda2
    maj-min: 8:2 label: windows_data uuid: 2DACC02D17FAC320
Swap:
  Kernel: swappiness: 60 (default) cache-pressure: 100 (default)
  ID-1: swap-1 type: partition size: 976 MiB used: 0 KiB (0.0%) priority: -2
    dev: /dev/nvme0n1p5 maj-min: 259:5 label: N/A
    uuid: 8cd4c3ea-c8cf-4a2f-9b2d-77131a1f8690
Unmounted:
  ID-1: /dev/nvme0n1p2 maj-min: 259:2 size: 16 MiB fs: N/A label: N/A
    uuid: N/A
  ID-2: /dev/nvme0n1p3 maj-min: 259:3 size: 268.44 GiB fs: ntfs label: N/A
    uuid: 84043D0E043D04A8
USB:
  Hub-1: 1-0:1 info: Hi-speed hub with single TT ports: 10 rev: 2.0
    speed: 480 Mb/s chip-ID: 1d6b:0002 class-ID: 0900
  Device-1: 1-1:2 info: Schiit Audio Schiit Modi 3+ type: Audio
    driver: snd-usb-audio interfaces: 2 rev: 2.0 speed: 480 Mb/s power: 500mA
    chip-ID: 30be:1014 class-ID: 0102
  Device-2: 1-3:3 info: Samson Q2U handheld mic with XLR type: Audio,HID
    driver: hid-generic,snd-usb-audio,usbhid interfaces: 4 rev: 1.1
    speed: 12 Mb/s power: 100mA chip-ID: 17a0:0304 class-ID: 0300
  Hub-2: 1-4:4 info: Microchip Massdrop Hub ports: 2 rev: 2.0 speed: 12 Mb/s
    chip-ID: 04d8:eec5 class-ID: 0900
  Device-1: 1-4.2:6 info: Microchip CTRL Keyboard type: Keyboard,HID
    driver: hid-generic,usbhid interfaces: 3 rev: 2.0 speed: 12 Mb/s
    power: 500mA chip-ID: 04d8:eed2 class-ID: 0300 serial: <filter>
  Device-2: 1-8:5 info: ASRock LED Controller type: HID
    driver: hid-generic,usbhid interfaces: 1 rev: 1.1 speed: 12 Mb/s
    power: 100mA chip-ID: 26ce:01a2 class-ID: 0300 serial: <filter>
  Device-3: 1-9:7 info: Intel AX200 Bluetooth type: Bluetooth driver: btusb
    interfaces: 2 rev: 2.0 speed: 12 Mb/s power: 100mA chip-ID: 8087:0029
    class-ID: e001
  Hub-3: 2-0:1 info: Super-speed hub ports: 4 rev: 3.1 speed: 10 Gb/s
    chip-ID: 1d6b:0003 class-ID: 0900
  Hub-4: 3-0:1 info: Hi-speed hub with single TT ports: 4 rev: 2.0
    speed: 480 Mb/s chip-ID: 1d6b:0002 class-ID: 0900
  Device-1: 3-1:2 info: Logitech C920 HD Pro Webcam type: Video,Audio
    driver: snd-usb-audio,uvcvideo interfaces: 4 rev: 2.0 speed: 480 Mb/s
    power: 500mA chip-ID: 046d:0892 class-ID: 0102 serial: <filter>
  Device-2: 3-2:3 info: Glorious Model O Wireless type: Mouse,Keyboard
    driver: hid-generic,usbhid interfaces: 3 rev: 2.0 speed: 12 Mb/s
    power: 500mA chip-ID: 258a:2011 class-ID: 0301 serial: <filter>
  Hub-5: 4-0:1 info: Super-speed hub ports: 4 rev: 3.1 speed: 10 Gb/s
    chip-ID: 1d6b:0003 class-ID: 0900
Sensors:
  System Temperatures: cpu: 40.0 C mobo: N/A gpu: nvidia temp: 43 C
  Fan Speeds (RPM): fan-1: 0 fan-2: 950 fan-3: 0 fan-4: 0 fan-5: 0
    gpu: nvidia fan: 39%
Info:
  Processes: 380 Uptime: 13m wakeups: 0 Init: systemd v: 250 tool: systemctl
  Compilers: gcc: 11.1.0 clang: 13.0.0 Packages: 1485 pacman: 1473 lib: 434
  flatpak: 12 Shell: Zsh (sudo) v: 5.8 default: Bash v: 5.1.16
  running-in: yakuake inxi: 3.3.12

Hello,
Does this happen regardless the USB port used? How about disconnecting everything else?
Is the PSU ok? Quite possible because Linux uses less power at idle than Windows , and a little more than Windows when the system is pushed to its logical limits, when you unplug the keyboard to have a spike that simply shuts down the system to prevent damage …

3 Likes

You keyboard is powered from the system.

The standard rule for electrical devices is never disconnect while powered. This rule is in place because of how electricity behaves when disconnected.

The law of physics demands that electricity must discharge. If you pull a powered device the current will try to return to the powerline - you may have experienced this when a spark is generated when you pull the plug on the device.

The same thing happens when you disconnect even a low powered usb device - the discharge flips backwards into the computer.

So do not pull your keyboard unless the system is powered down - you may damage your system.

3 Likes

I have not tested this on other USB ports and AFAIK the PSU is fine. The machine itself has (relatively) new parts; I’d hope the PSU is fine.

I understand the logic here, but aren’t USB devices designed to be hotswap/hotpluggable? This keyboard is the only device that causes this sort of behavior.

no, usb isn’t hotplug/swap able. many people do misunderstand this fact.

2 Likes

Huh TIL. I guess I gotta be more careful with my stuff.

You are correct. You can usually connect a device without issue like you can plug a device into the main power grid.

The issue only manifest on disconnecting and it is usually the host device which will suffer the consequences. Most host devices do implement the necessary counter measure but a poorly designed guest device may cause a power build-up in the guest devices which is more than the host device can handle.

Example

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.

A while back I made a post here asking for help when it came to the weird issue I had with my keyboard shorting out my machine causing it to shut off when plugged/unplugged. At the time I said I only experienced the issue on my manjaro partition, but that was a half-lie as I didn’t actually test on my windows partition. I’ve since tested, on both windows and manjaro with similar results. However, since then, I’ve also found that switching cables remedied the issue. So then I thought that the CABLE was the problem. But then I tested the cable on 2 other machines with the exact same keyboard (and another keeb) and those 2 machines didn’t shutoff. So here I am wondering if the smart people here can help me deduce whether or not its my mobo or cable that is the issue here. Should I replace both?

Update to the latest BIOS
https://www.asrock.com/mb/AMD/B550M-ITXac/index.asp#BIOS
And once again, even tho you stated

I would double check that …

1 Like