Kwin.sh high usage and loud fan when external screen is off

Hi there and Happy New Year to you all!

Here are my laptop specs according to neofetch:

OS: Manjaro Linux x86_64
Kernel: 6.6.65-1-MANJARO
DE: Plasma 6.2.4
WM: KWin
CPU: AMD Ryzen 7 4800HS with Radeon Graphics (16) @ 2.900GHz
GPU: NVIDIA GeForce GTX 1660 Ti Mobile
GPU: AMD ATI Radeon Vega Series / Radeon Vega Mobile Series

I have an external 32’’ Acer ED323QURA connected with HDMI to that laptop for over 2.5 years now. The following problem occurs since approx. 1 year.

kwin.sh uses almost 100% usage when the screen is off. It sets my fan speed to max when my external monitor is in sleep mode and when I come back it takes a couple of seconds to get my CPU heat down from almost 70 degrees.

I never used a screen saver in the first place, there were no setup changes.

When the screen is on, nothing abnormal happens. My CPU idles happily around 40-50 degrees and no fan noise.

Ideas??

Thanks in advance and best regards!

1 Like

We can begin with some system info;

inxi --admin --verbosity=8 --filter --no-host --width

Perhaps some Journal spam

journalctl -p3 -xb --no-hostname

I must confess, I cannot see kwin.sh though right now I do see kwin_x11 which rarely reaches 1% cpu on a Ryzen 5600G… please check that, perhaps a mis-type.

It might be worth also creating a new User account to verify that these issues are system related, and not User related.

sudo useradd -m test

Set the password ‘test’ for test account

sudo passwd test

Now you can log out and log in to test.

It might be worth reducing the journal spam and then doing a reboot…

I actually have to repeat the command to get a blank journal output:

sudo journalctl --vacuum-time=1m; sudo journalctl --flush --rotate; sleep 2; sudo journalctl --vacuum-time=1m; sudo journalctl --flush --rotate; clear; journalctl -p3 -xb --no-hostname 

When you log in, remember to select your session. You should test both Wayland and X11 sessions.

Then reboot, check the journal and paste it here - also check the issue still remains in two kinds of session.

What is this kwin.sh script? It doesn’t seem to be part of Plasma 6.

Maybe it is something that you added in the past when using Plasma 5, and it is no longer relevant to Plasma 6?

A place you might want to look could be /etc/profile.d/kwin.sh, as it is referenced in this 4+ year old blog post: Running kwin wayland on Nvidia – David Edmundson’s Web Log

Tell kwin to run with EGLStreams.

You should set the environment variable “KWIN_DRM_USE_EGL_STREAMS=1”

The easiest place is to add a file /etc/profile.d/kwin.sh with the line
export KWIN_DRM_USE_EGL_STREAMS=1

Verify this is working with the command line tool env after rebooting.

That advice might be very out-of-date by now.

If the script isn’t in the /etc/profile.d/ directory, try running locate kwin.sh to see if it is somewhere else. Otherwise, htop should show the full path of the script.

I also found this 7 year old code snippet on GitHub: kwin.sh · GitHub. Apart from that, not much else on the web refers to a kwin.sh script.

Unless someone here with experience using Nvidia advises otherwise, you might just want to see what happens if you remove the kwin.sh script & reboot. Or you could post the contents of the script here so that it can be examined to see if it is necessary for your system.

3 Likes

@Ben thanks for the commands!

With the inxi I found kwin_x11 3 times:

  • wm: kwin_x11 vt: 2 dm: SDDM Distro: Manjaro base: Arch Linux
  • compositor: kwin_x11 driver: X: loaded: amdgpu,nvidia dri: radeonsi
  • 5: cpu: 10.5% command: kwin_x11 pid: 2700 mem: 216.0 MiB (0.5%)

What baffled me first was only kwin_x11, no kwin.sh whatsoever.

I then checked my system monitor again and only saw kwin.sh running. But when I clicked it, in the details bar it listed two processes (kwin.sh and kwin_x11) as running.

@scotty65: I think your clues were right, must have been something ancient.

I checked /etc/profile.d/, no entry here.

I then located kwin.sh and found two folders in .config:

  1. /old-autostart-scripts/
  2. /autostart

The timestamps there were 2018 and 2021 respectively.

I made a backup of both files/folders and deleted them, then rebooted. Now my system monitor is clean. The entries in inxi --admin --verbosity=8 --filter --no-host --width stayed the same.

I will go on from there, my guess is it’s solved now.

Thanks for your help and best wishes! :slight_smile:

2 Likes

Sounds good, kudos to @scotty65 for chasing up the script - I thought it would end up a typo… I was going to follow up with an rg -ri kwin.sh > ~/Desktop/kwin.sh.txt but you got it :wink:

1 Like

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