Can't restart KDE Plasma from a TTY

I would like to be able to terminate and then reload KDE from a tty ever so often before I get hangups which I’m in now. Using all the typical cmds like:

kwin_x11 --replace &
plasmashell -- replace &
kstart5 plasmashell
kstart plasmashell
kquitapp5 plasmashell

The “start plasmashell” cmds gives me:

Find the Command: Start is not found locally
Find the Command: /cache/pgkfile/*

Irrelevant. Gives me options to install packages not related to KDE the other.

The top 2 cmds above with the “&” lead to the real issue and is as follows: This is not the original as its my second hand notes from my other machine:

Qt. Qpa.xcb: could not connect to display

Could not load the Qt platform plugin "xcb" in "" even though it was found. 
This app failed to start because no QT platform plugin could be initialized. 
Reinstalling the application may fix this problem.

Available platform plugins: *list of common plugins including xcb*

One of the links to a similar problem had this resolved by installing the libQt5DBus.so.5 lib for xcb. Getting into the weeds with all that in a tty not knowing what I’m doing seems like a bad idea. I did an update but didn’t restart yet when KDE needed to be terminated.

Resources I’ve read fully and tried:

https://bbs.archlinux.org/viewtopic.php?id=266891

I would post inxi output but I don’t have a way to do that when my graphical session is frozen; unable to paste it to something so I just picked some key info like kernel version. I couldn’t Pgup the inxi output to see the KDE version unfortunately. I have my HW inxi on here.

Current kernel: 5.18.12-zen1-1-zen

System:    *See above * 64 compiler: gcc v: 11.1.0
           parameters: BOOT_IMAGE=/@/boot/vmlinuz-linux-zen
           root=UUID=b3313c80-ab52-480d-9e9a-0f5523dc311a rw rootflags=subvol=@ quiet splash
           rd.udev.log_priority=3 vt.global_cursor_default=0 systemd.unified_cgroup_hierarchy=1
           resume=UUID=edae4f59-58e7-43b3-ae50-453efb741e26 loglevel=3
           Desktop: KDE Plasma 5.23.3 tk: Qt 5.15.2 info: latte-dock wm: kwin_x11 vt: 1 dm: SDDM
           Distro: Garuda Linux base: Arch Linux
Machine:   Type: Desktop Mobo: Micro-Star model: B550-A PRO (MS-7C56) v: 1.0 serial: <filter>
           UEFI: American Megatrends LLC. v: A.50 date: 01/15/2021
CPU:       Info: 8-Core model: AMD Ryzen 7 5700G with Radeon Graphics bits: 64 type: MT MCP
           arch: Zen 3 family: 19 (25) model-id: 50 (80) stepping: 0 microcode: A50000B cache:
           L2: 4 MiB
           flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm bogomips: 121375
           Speed: 4232 MHz min/max: 1400/3800 MHz boost: enabled Core speeds (MHz): 1: 4232
           2: 4467 3: 4424 4: 4226 5: 4547 6: 4119 7: 3852 8: 4306 9: 4415 10: 4408 11: 4490
           12: 4143 13: 4203 14: 4297 15: 3863 16: 3947
           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: AMD Cezanne driver: amdgpu v: kernel bus-ID: 30:00.0 chip-ID: 1002:1638
           class-ID: 0300
           Display: x11 server: X.Org 1.21.1.1 compositor: kwin_x11 driver: loaded: amdgpu,ati
           unloaded: modesetting alternate: fbdev,vesa display-ID: :0 screens: 1
           Screen-1: 0 s-res: 3440x1440 s-dpi: 96 s-size: 910x381mm (35.8x15.0")
           s-diag: 987mm (38.8")
           Monitor-1: HDMI-A-0 res: 3440x1440 dpi: 110 size: 797x333mm (31.4x13.1")
           diag: 864mm (34")
           OpenGL: renderer: AMD RENOIR (DRM 3.42.0 5.14.16-zen1-1-zen LLVM 12.0.1)
           v: 4.6 Mesa 21.2.4 direct render: Yes
Audio:     Device-1: AMD driver: snd_hda_intel v: kernel bus-ID: 30:00.1 chip-ID: 1002:1637
           class-ID: 0403
           Device-2: AMD Family 17h HD Audio vendor: Micro-Star MSI driver: snd_hda_intel
           v: kernel bus-ID: 30:00.6 chip-ID: 1022:15e3 class-ID: 0403
           Sound Server-1: ALSA v: k5.14.16-zen1-1-zen running: yes
           Sound Server-2: JACK v: 1.9.19 running: no
           Sound Server-3: PulseAudio v: 15.0 running: no
           Sound Server-4: PipeWire v: 0.3.40 running: yes
Network:   Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet vendor: Micro-Star MSI
           driver: r8169 v: kernel port: f000 bus-ID: 2a:00.0 chip-ID: 10ec:8168 class-ID: 0200
           IF: enp42s0 state: up speed: 100 Mbps duplex: full mac: <filter>
Drives:    Local Storage: total: 950.15 GiB used: 182.08 GiB (19.2%)
           SMART Message: Unable to run smartctl. Root privileges required.
           ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Corsair model: Corsair MP600 CORE
           size: 931.51 GiB block-size: physical: 512 B logical: 512 B speed: 63.2 Gb/s lanes: 4
           type: SSD serial: <filter> rev: EGFM52.3 temp: 31.9 C scheme: GPT
           ID-2: /dev/sda maj-min: 8:0 type: USB vendor: Lexar model: USB Flash Drive
           size: 14.91 GiB block-size: physical: 512 B logical: 512 B type: SSD serial: <filter>
           rev: 1100 scheme: MBR
           SMART Message: Unknown USB bridge. Flash drive/Unsupported enclosure?
           ID-3: /dev/sdb maj-min: 8:16 type: USB vendor: SanDisk model: Cruzer Glide
           size: 3.73 GiB block-size: physical: 512 B logical: 512 B type: N/A serial: <filter>
           rev: 2.01 scheme: MBR
           SMART Message: Unknown USB bridge. Flash drive/Unsupported enclosure?
Partition: ID-1: / raw-size: 78.12 GiB size: 78.12 GiB (100.00%) used: 21.18 GiB (27.1%) fs: btrfs
           dev: /dev/nvme0n1p3 maj-min: 259:3
           ID-2: /boot/efi raw-size: 300 MiB size: 299.4 MiB (99.80%) used: 576 KiB (0.2%)
           fs: vfat dev: /dev/nvme0n1p1 maj-min: 259:1
           ID-3: /home raw-size: 818.91 GiB size: 818.91 GiB (100.00%) used: 160.9 GiB (19.6%)
           fs: btrfs dev: /dev/nvme0n1p4 maj-min: 259:4
           ID-4: /var/log raw-size: 78.12 GiB size: 78.12 GiB (100.00%) used: 21.18 GiB (27.1%)
           fs: btrfs dev: /dev/nvme0n1p3 maj-min: 259:3
           ID-5: /var/tmp raw-size: 78.12 GiB size: 78.12 GiB (100.00%) used: 21.18 GiB (27.1%)
           fs: btrfs dev: /dev/nvme0n1p3 maj-min: 259:3
Swap:      Kernel: swappiness: 133 (default 60) cache-pressure: 100 (default)
           ID-1: swap-1 type: partition size: 34.18 GiB used: 0 KiB (0.0%) priority: -2
           dev: /dev/nvme0n1p2 maj-min: 259:2
           ID-2: swap-2 type: zram size: 29.29 GiB used: 2.2 MiB (0.0%) priority: 100
           dev: /dev/zram0
Sensors:   System Temperatures: cpu: 33.5 C mobo: N/A gpu: amdgpu temp: 25.0 C
           Fan Speeds (RPM): N/A
Info:   *Outdated*

The commands are startplasma-wayland or startplasma-x11.

4 Likes

I'm getting "Display not set or can't connect to the x server" error for those cmds and variants like the --replace & flags. I included "DISPLAY:0" as well. I'm sure that's the correct ID as I only have 1 monitor.

Are you using a display manager? Or why are you in the TTY to begin with? The actual issue here is somewhat unclear.

Please post the output of garuda-inxi. You can use a termbin URL if that helps.

garuda-inxi | nc termbin.com 9999
1 Like

I assuming its X display manager yes. The start of my first post explains why I'm in tty2 using Ctrl+Alt+F2 since KDE locked up however all processes (using journal -xe to check, etc.) and the mouse move fine. I terminated KDE Plasma and now want to restart it to continue where I left off with my session.

I'll try the termbin and edit this if successful.

A display manager is a GUI for logging in to the session (instead of using the shell). If you aren’t sure, you are probably using SDDM. Typically you just type in your password and your display manager takes care of launching the session for you.

It sounds like the original (frozen) session is still up–is that right? If so, that is why you are getting this:

X isn’t designed to run multiple sessions at the same time from the same user. Each X session has files associated with it that have their ownership handled in a specific way. If you want to run more than one X session at the same time with the same user, you will have to configure a setup specifically designed to handle that.

If you want to get back to the original session, you need to switch back to TTY1. If it is frozen, partially frozen, or otherwise not working correctly you should reboot your machine from the TTY.

1 Like

I suppose I wasn't successful in killing the hung KDE process if I still see the frozen screen however I thought that was just some graphical buffer left over (don't know the correct terminology). When I put commands in to terminate KDE plasma it never gave an error. Once I get back control of the session in TTY1 (can't issue cmds from TTY1 so that's why I drop to tty2) I'll save what I was doing and reboot. I see no reason why I can't restart KDE from tty2 if I specify where I want my actions to be done.

I guess the fact that it’s not working seems like a reason. :laughing:

If the session is frozen, restarting the shell and the compositor might not be enough. You can kill the process running Plasma, which will launch a new login screen where you can start a fresh session.

killall startplasma-x11

I would say there is not a benefit to restarting the session this way instead of just rebooting.

1 Like

@Heat_195 please try to run from TTY2 at next freeze:

kquitapp5 plasmashell; plasmashell > /dev/null 2>&1 & disown; sleep 2; exit

I used this in my .bash_aliases to make it easier, you may want to do the same:

alias restartplasma='kquitapp5 plasmashell; plasmashell > /dev/null 2>&1 & disown; sleep 2; exit'
4 Likes

you can look at this if it helps your case. I have personally tried all the commands from tty2 and it works for me.

Just remember to startx in tty1.

I tried using this when KDE Plasma hung again just 19 days after restart and it just refreshed tty2 where I had to enter my login details again but nothing changed for tty1.

Then I tried what @NaN posted so that sent me to my sddm screen and logging in it started a new session but none of my open apps were intact.

This is the article that gave me the impression you could restart kde plasma with anything not launched in Konsole or using KDE framework like Kate editor, still being accessible:

Specifically:

Why Restart KDE Plasma Desktop Without Rebooting

  • To solve the sluggishness of your operating system. Sluggishness of your PC often happens when your machine stays on for a long time. Full system reboot may not be necessary because it is not an issue that affects the whole operating system.
  • To save on time. Rebooting the entire system takes a long time as it involves killing a batch of processes, while restarting the Desktop environment alone is instant as it focuses only on specific processes.
  • To avoid interference with your current open and running work. Rebooting will kill all the open and running processes.
  • To display the changes and updates made on your operating system instantly.
  • To recover some components of the KDE desktop, such as the start menu or panel, which may disappear on some rare occasions.

I hope you tried these commands from TTY 2 one by one and see if it helps before killing the xorg display server and using startx. That was meant to be a last resort sort of thing since at that point you are just one step away from restarting the entire system.

To restart plasmashell

killall plasmashell; kstart5 plasmashell

and if that doesn't work to restart kwin

setsid kwin_x11 --replace &

PS: These above two commands are essentially what your article is asking you to do as well.

2 Likes

Yes I tried all those even before I made this topic. I used the restart plasmashell "killall" part on my curr session since I may not have used that exact one recently and it does get rid of the processes with said name, but when I got back to tty1 its as if nothing has happened! All KDE apps are normal and functioning too. kstart5 plasmashell never has worked. The 2nd command with setsid gives the errors I pasted in my OP (xcb libraries).