Bug 366156 - ksmserver crashes when switching from nvidia to intel profile/GPU on laptop with hybrid graphics
Summary: ksmserver crashes when switching from nvidia to intel profile/GPU on laptop w...
Alias: None
Product: ksmserver
Classification: Plasma
Component: general (show other bugs)
Version: 5.12.4
Platform: Neon Linux
: NOR crash
Target Milestone: ---
Assignee: phd
Depends on:
Reported: 2016-07-27 07:36 UTC by soee
Modified: 2021-08-01 22:18 UTC (History)
13 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:

ksmserver-20160726-175540.kcrash.txt (7.33 KB, text/plain)
2016-07-27 07:36 UTC, soee
.xsession-errors file content (76.92 KB, text/plain)
2016-07-27 08:11 UTC, soee
ksmserver-logout-greeter crash on Kubuntu 16.04 from Kubuntu PPA (3.54 KB, text/plain)
2017-01-01 17:48 UTC, Vincas Dargis
crass information (3.52 KB, text/plain)
2017-05-13 17:51 UTC, gürol

Note You need to log in before you can comment on or make changes to this bug.
Description soee 2016-07-27 07:36:03 UTC
Each time i try to switch GPU profile from nvidia to intel on a laptop with Optimus technology the ksmserver crashes. 

I think this started since upgrade to Plasma 5.7 or latest Frameworks (5.23/5.24).

Reproducible: Always

Steps to Reproduce:
1. Work/have nvidia GPU set as active on your machine
2. Using nvidia-settings GUI or command line change GPU profile to intel
3. Try to logout and login again (as it it required to make the changes work)
4. After Logout button is clicked ksmserver crashes

Actual Results:  
ksmserver crashes when trying to logout after we try to switch from nvidia to intel GPU profile. Having the crash window visible (without decorations) we can save stack trace and/or click on "Restart application" button and sometimes clicking it moves us to sddm and sometimes screen becomes unresponsive.

Expected Results:  
After GPU profile is changed from nvidia to intel and we click on Logout button, we should be moved to sddm without any crashes.

I have attached crash report so it might help finding the problem source.
Comment 1 soee 2016-07-27 07:36:52 UTC
Created attachment 100326 [details]

Crash report.
Comment 2 soee 2016-07-27 07:41:40 UTC
I should also mention that doing it from the other side -  switching from intel to nvidia profile  - does not generate any crash.
Comment 3 soee 2016-07-27 08:11:03 UTC
Created attachment 100327 [details]
.xsession-errors file content

I removed one text that spammed this file (more than 13.00 lines were): kde.systemtray: Wrong IconThemePath "/home/soee/.dropbox-dist/dropbox-lnx.x86_64-6.4.14/images" : too short or does not end with 'icons'
Comment 4 soee 2016-07-27 08:13:04 UTC
Typo: the removed text was in more than 13.000 lines.
Comment 5 Vincas Dargis 2017-01-01 17:47:59 UTC
I have upgraded KDE from Kubuntu Backports on Kubuntu 16.04 (amd64) and experienced same problem. Just switched from Intel to NVIDIA in nvidia-settings, and now I can't log out because of ksmserver-logout-greeter crash.

If I switch back to original mode (to Intel), it works as expected. 

Will attach backtrace.
Comment 6 Vincas Dargis 2017-01-01 17:48:47 UTC
Created attachment 103125 [details]
ksmserver-logout-greeter crash on Kubuntu 16.04 from Kubuntu PPA
Comment 7 Vincas Dargis 2017-01-01 17:49:30 UTC
Please confirm this bug.
Comment 8 Clemens 2017-02-12 10:09:37 UTC
I get the same error on Kubuntu 16.10. Each time I press logout or shutdown, ksmserver crashes. Please confirm this bug.
Comment 9 marco martinez 2017-04-27 20:16:58 UTC
same problem here, not only ksmserver-logout-greeter crashes, but also does konsole, apport and most of the kdeapps. As a temporary fix, I am currently using bumblebee for gpu offloading
Comment 10 gürol 2017-05-13 17:51:38 UTC
Created attachment 105512 [details]
crass information

I have the same problem. When I switch from Nvidia to Intel, ksmserver-logout-greeter crashes.
Comment 11 V字龍(Vdragon) 2017-06-30 10:28:20 UTC
Note that if running `/usr/lib/<multiarch>/libexec/ksmserver-logout-greeter --mode logout` it outputs LibGL errors such as unable to use swrast renderer etc.
Comment 12 Aron Heinecke 2017-07-02 11:58:34 UTC
same problem here
Comment 13 Syfer Polski 2017-08-27 16:45:58 UTC
*** This bug has been confirmed by popular vote. ***
Comment 14 Robert 2017-12-26 00:58:48 UTC
Same problem here on fully updated KDE neon 5.11.4. Have to restart using the command line each time I want to switch the GPU. Only then can I use the other video card.

This has been around for quite a while, it should be given higher priority.
Comment 15 Carlos Molina 2018-07-15 23:10:14 UTC
I can confirm that the big is present in Linux Mint 18.3 Sylvia (KDE edition):

inxi -Fxz

System:    Host: carlos-xiaomi-air Kernel: 4.13.0-45-generic x86_64 (64 bit gcc: 5.4.0)
           Desktop: KDE Plasma 5.8.9 (Qt 5.6.1) Distro: Linux Mint 18.3 Sylvia
Machine:   System: Timi (portable) product: TM1604 v: XMAKB3M0P0705
           Mobo: Timi model: TM1604 v: XMAKB3M0P0705 Bios: Insyde v: XMAKB3M0P0705 date: 08/30/2017
CPU:       Dual core Intel Core i5-7200U (-HT-MCP-) cache: 3072 KB
           flags: (lm nx sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx) bmips: 10848
           clock speeds: max: 3100 MHz 1: 870 MHz 2: 825 MHz 3: 811 MHz 4: 844 MHz
Graphics:  Card-1: Intel Device 5916 bus-ID: 00:02.0
           Card-2: NVIDIA Device 1d12 bus-ID: 01:00.0
           Display Server: X.Org 1.18.4 driver: nvidia Resolution: 1920x1080@59.98hz
           GLX Renderer: GeForce MX150/PCIe/SSE2
           GLX Version: 4.5.0 NVIDIA 384.130 Direct Rendering: Yes
Audio:     Card Intel Device 9d71 driver: snd_hda_intel bus-ID: 00:1f.3
           Sound: Advanced Linux Sound Architecture v: k4.13.0-45-generic
Network:   Card: Intel Device 24fd driver: iwlwifi bus-ID: 02:00.0
           IF: wlp2s0 state: up speed: N/A duplex: N/A mac: <filter>
Drives:    HDD Total Size: NA (-) ID-1: /dev/nvme0n1 model: N/A size: 256.1GB
Partition: ID-1: / size: 226G used: 44G (21%) fs: ext4 dev: /dev/dm-0
           ID-2: /boot size: 473M used: 192M (43%) fs: ext2 dev: /dev/nvme0n1p2
           ID-3: swap-1 size: 8.49GB used: 0.00GB (0%) fs: swap dev: /dev/dm-1
RAID:      No RAID devices: /proc/mdstat, md_mod kernel module present
Sensors:   System Temperatures: cpu: 46.0C mobo: 35.0C gpu: 0.0:46C
           Fan Speeds (in rpm): cpu: N/A
Info:      Processes: 186 Uptime: 30 min Memory: 1885.2/7886.9MB
           Init: systemd runlevel: 5 Gcc sys: 5.4.0 Client: Shell (bash 4.3.481) inxi: 2.2.35
Comment 16 Carlos Molina 2018-07-15 23:55:48 UTC
Also, see:

Comment 17 Bug Janitor Service 2020-11-23 16:38:57 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kdeclarative/-/merge_requests/37
Comment 18 Nate Graham 2020-12-16 21:36:35 UTC
Git commit 090610124d4650150af49a8e30f6b77ad9803dfe by Nate Graham, on behalf of Piotr Henryk Dabrowski.
Committed on 16/12/2020 at 21:35.
Pushed by ngraham into branch 'master'.

[KQuickAddons] QtQuickSettings::checkBackend() for fallback to software backend

Fixes very annoying crashes of QtQuick KDE applications:
ksmserver-logout-greeter, krunner (if not running before), and others
occuring when the OpenGL driver stops being available (e.g. on upgrade).

This issue often occurs after upgrading graphic drivers, preventing reboot,
which in turn is needed for the drivers to work and not cause this crash.

No changes are required in the above applications, as they all already use
Related: bug 422995, bug 421493, bug 398199, bug 375913, bug 346519

M  +36   -3    src/quickaddons/qtquicksettings.cpp
M  +2    -1    src/quickaddons/qtquicksettings.h

Comment 19 Christoph Feck 2020-12-16 21:55:31 UTC
Nice, does the patch also affect already running OpenGL applications?