Bug 460341

Summary: On X11 with proprietary NVIDIA GPU drivers, external monitor disabled after reboot or wake-from-sleep
Product: [Plasma] KScreen Reporter: Rainer Klier <rainer.klier>
Component: commonAssignee: kscreen-bugs-null <kscreen-bugs-null>
Status: VERIFIED FIXED    
Severity: normal CC: 3373462216, A.Fettouhi, alexander.fieroch, aminyahyaabadi74, arcadiy, bednarczyk.pawel, benny.zaminga, bertil.bonus, bobofenglish, bompus, brian, brianjcohen, bryan, c3i8zv295, cappelikan, chermnykh2001, clay.sa, comptechtalk, cyrylas, dasgeek, diggeloid, dpbasti, hajit.00, hellomiakoda, info, jeff.hayes87, jeroni, kde, kdebugs, lining_pan, linus.kardell, lk.droz, mat8nil49, me, miranda, mmarreroleyva, nate, nikunjgoyal31, noel.eliezer, n_hand, opendreas, paragoumba, pepko94, qaz.cetelic, r0ck3r, rf-kde, rockingcat, rs.me, spamless.9v5xj, steve, svn, s_chriscollins, volker.christian, yjcoshc
Priority: VHI Keywords: regression
Version: 5.27.1   
Target Milestone: ---   
Platform: Neon   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=462725
https://bugs.kde.org/show_bug.cgi?id=466705
https://bugs.kde.org/show_bug.cgi?id=470818
https://bugs.kde.org/show_bug.cgi?id=472542
Latest Commit: Version Fixed In: 5.27.2
Sentry Crash Report:
Attachments: output of "kscreen-console bug"
Bob English's kscreen-console bug
Steve's kscreen-console bug output for one monitor
Steve's kscreen-console bug output for one monitor connected
Steve's kscreen-console bug output for two working monitors
screenshot
nvidia-settings second monitor
second monitor thumbnail not showing
second monitor thumbnail not showing 2
attachment-2948777-0.html

Description Rainer Klier 2022-10-13 07:14:34 UTC
hi,
it seems, that in KDE frameworks 5.26 the setting of external screens is not remembered/(re-)stored.
today i updated my opensuse tumbleweed system (notebook with nvidia graphics running X11) to latest available KDE framework 5 packages in version 5.26, and after reboot i noticed, that my external monitor was not enabled.
i could enable it in system settings, but after reboot, it is disabled again.
i also can enable it with the "Anzeige Einrichtung" Widget in "Systemabschnitt der Kontrollleiste", but after reboot/re-login it is disabled again.
the monitor is enabled for example at the system-login because i can see the user-login screen on both monitors, but when then KDE desktop starts after login, the external monitor gets disabled.

STEPS TO REPRODUCE
1. enable the external monitor, if not enabled
2. reboot and login again or just re-login to KDE desktop
3. see that the external monitor is disabled again

OBSERVED RESULT
the external monitor is disabled

EXPECTED RESULT
the external monitor should keep the enabled setting and should be enabled

SOFTWARE/OS VERSIONS
Operating System: openSUSE Tumbleweed 20221008
KDE Plasma Version: 5.26.0
KDE Frameworks Version: 5.99.0
Qt Version: 5.15.6
Kernel Version: 6.0.0-1.g47c5c19-default (64-bit)
Graphics Platform: X11
Processors: 8 × Intel® Core™ i7-4700HQ CPU @ 2.40GHz
Memory: 23.4 GiB of RAM
Graphics Processor: NVIDIA GeForce GTX 765M/PCIe/SSE2
Manufacturer: ASUSTeK COMPUTER INC.
Product Name: G750JW
System Version: 1.0
Comment 1 Rainer Klier 2022-10-13 07:19:36 UTC
it could be related to https://bugs.kde.org/show_bug.cgi?id=459253
Comment 2 Nate Graham 2022-10-14 18:55:02 UTC
Vixed by Vlad Zahorodnii with https://invent.kde.org/plasma/kwin/commit/ff28dd06936d733ac6d65f41669b1331fa28d1cc in Plasma 5.26.1!
Comment 3 Nate Graham 2022-10-14 19:07:49 UTC
*** Bug 460332 has been marked as a duplicate of this bug. ***
Comment 4 Nate Graham 2022-10-17 20:19:47 UTC
*** Bug 460560 has been marked as a duplicate of this bug. ***
Comment 5 Nate Graham 2022-10-17 20:20:40 UTC
*** Bug 460529 has been marked as a duplicate of this bug. ***
Comment 6 Nate Graham 2022-10-18 18:45:46 UTC
*** Bug 460623 has been marked as a duplicate of this bug. ***
Comment 7 Nate Graham 2022-10-18 18:46:06 UTC
*** Bug 460658 has been marked as a duplicate of this bug. ***
Comment 8 Nate Graham 2022-10-18 19:02:19 UTC
*** Bug 460676 has been marked as a duplicate of this bug. ***
Comment 9 Bob English 2022-10-18 20:28:20 UTC
(In reply to Nate Graham from comment #2)
> Vixed by Vlad Zahorodnii with
> https://invent.kde.org/plasma/kwin/commit/
> ff28dd06936d733ac6d65f41669b1331fa28d1cc in Plasma 5.26.1!

By "Vixed" do you mean Fixed?  and if so, how do I apply the fix, as your link points to some page used by the programmers, I'm just a user, and it tells me nothing.

I will run an update now and see if this "Commit" was added to an update. Please stand by....
Comment 10 Bob English 2022-10-18 20:48:00 UTC
Updated the system and there was one for Plasma Display.  Rebooted >> No change.  Went into settings enabled the display, set as primary, still misreporting the refresh rate with 30Hz listed as the only rate the monitor can run at, which is false, it can do 60Hz.  When I hit apply, all that happens is that all of the open apps shift to the left, 1/2 on and 1/2 off screen, the dialog with the "Keep" and "revert" buttons does nothing on clicking (Cursor positioning incorrect?) and it reverts.  Reboot doesn't change anything.

So I cannot accept this as Fixed, as the problem still remains.
Comment 11 Bryan Stine 2022-10-18 21:07:42 UTC
(In reply to Bob English from comment #10)
> Updated the system and there was one for Plasma Display.  Rebooted >> No
> change.  Went into settings enabled the display, set as primary, still
> misreporting the refresh rate with 30Hz listed as the only rate the monitor
> can run at, which is false, it can do 60Hz.  When I hit apply, all that
> happens is that all of the open apps shift to the left, 1/2 on and 1/2 off
> screen, the dialog with the "Keep" and "revert" buttons does nothing on
> clicking (Cursor positioning incorrect?) and it reverts.  Reboot doesn't
> change anything.
> 
> So I cannot accept this as Fixed, as the problem still remains.

I’m inclined to agree. The commit cited is in wayland code, and I built kain on the Plasma/5.26 branch last night and still experience loss of the primary screen on resume from suspend on X11.
Comment 12 Bob English 2022-10-18 21:16:23 UTC
(In reply to Bryan D. Stine from comment #11)
> (In reply to Bob English from comment #10)
> > Updated the system and there was one for Plasma Display.  Rebooted >> No
> > change.  Went into settings enabled the display, set as primary, still
> > misreporting the refresh rate with 30Hz listed as the only rate the monitor
> > can run at, which is false, it can do 60Hz.  When I hit apply, all that
> > happens is that all of the open apps shift to the left, 1/2 on and 1/2 off
> > screen, the dialog with the "Keep" and "revert" buttons does nothing on
> > clicking (Cursor positioning incorrect?) and it reverts.  Reboot doesn't
> > change anything.
> > 
> > So I cannot accept this as Fixed, as the problem still remains.
> 
> I’m inclined to agree. The commit cited is in wayland code, and I built kain
> on the Plasma/5.26 branch last night and still experience loss of the
> primary screen on resume from suspend on X11.

Exactly!  I too am on X11, not Wayland, so I cannot see how it applies to us.
Comment 13 Rainer Klier 2022-10-19 10:05:37 UTC
(In reply to Nate Graham from comment #2)
> Vixed by Vlad Zahorodnii with
> https://invent.kde.org/plasma/kwin/commit/
> ff28dd06936d733ac6d65f41669b1331fa28d1cc in Plasma 5.26.1!

sadly, this is really not true.
today i updated to Plasma 5.26.1, and the problem remains.
as Bryan D. Stine and Bob English both write, the fix does not help, when running X11.
And i too am on X11, not Wayland.
Comment 14 David Edmundson 2022-10-19 10:43:19 UTC
Please include output of "kscreen-console bug" when in this broken state.
Comment 15 Rainer Klier 2022-10-19 11:17:18 UTC
(In reply to David Edmundson from comment #14)
> Please include output of "kscreen-console bug" when in this broken state.

what do you mean with that?
do you mean i should reboot/re-login and before manually re-enabling the disabled monitor, i should run "kscreen-console bug"?
Comment 16 Rainer Klier 2022-10-19 11:25:43 UTC
Created attachment 153027 [details]
output of "kscreen-console bug"

right after reboot, when external display is set to disabled, i ran "kscreen-console bug", before manually re-enabling the external display.
Comment 17 Nate Graham 2022-10-19 16:44:45 UTC
Re-opening since it seems like it's not fixed on X11 yet.
Comment 18 Bob English 2022-10-19 17:54:17 UTC
Created attachment 153040 [details]
Bob English's kscreen-console bug
Comment 19 Bob English 2022-10-19 17:59:19 UTC
Everything is normal, up to and including the KDE splash screen, then only one monitor comes on line.  In the settings it is set as primary;  I had it as secondary.
Comment 20 Nate Graham 2022-10-20 15:28:18 UTC
*** Bug 460685 has been marked as a duplicate of this bug. ***
Comment 21 retired 2022-10-20 17:27:34 UTC
Not sure if it's a duplicate, as layout is remembered (until it isn't). My problem is with monitor not powering on when layout is changed, say from "internal only" to "extend". All I get is a laptop screen flicker, until I spam layout change enough times.
Comment 22 John 2022-10-22 13:44:42 UTC
I have a laptop with two external monitors, one HDMI and on Display Port.  After resume from sleep, the DP monitor is disabled and the HDMI monitor displays a flickering shadow of the lock screen.  Mouse input on the laptop only works when the mouse is over the HDMI display.  If I then reboot, I can reconfigure my setup to work again.

As a work around I am using autorandr.  I saved a working profile and have it reload when the computer wakes from sleep. 

Here is some specific system information;

Operating System: Garuda Linux
KDE Plasma Version: 5.26.1
KDE Frameworks Version: 5.99.0
Qt Version: 5.15.6
Kernel Version: 6.0.2-zen1-1-zen (64-bit)
Graphics Platform: X11
Processors: 16 × 11th Gen Intel® Core™ i7-11800H @ 2.30GHz
Memory: 15.4 GiB of RAM
Graphics Processor: Mesa Intel® UHD Graphics
Manufacturer: LENOVO
Product Name: 82JF
System Version: Legion 5 Pro 16ITH6

01:00.0 VGA compatible controller: NVIDIA Corporation GA107BM [GeForce RTX 3050 Mobile] (rev a1) (prog-if 00 [VGA controller])
	Subsystem: Lenovo Device 3e87
	Flags: bus master, fast devsel, latency 0, IRQ 219, IOMMU group 17
	Memory at 6d000000 (32-bit, non-prefetchable) [size=16M]
	Memory at 6000000000 (64-bit, prefetchable) [size=4G]
	Memory at 6100000000 (64-bit, prefetchable) [size=32M]
	I/O ports at 4000 [size=128]
	Expansion ROM at 6e080000 [virtual] [disabled] [size=512K]
	Capabilities: <access denied>
	Kernel driver in use: nvidia
	Kernel modules: nouveau, nvidia_drm, nvidia
Comment 23 Bob English 2022-10-23 22:24:46 UTC
FWIW:  My graphics card (1 x Display port, 1 x HDMI) supports and runs both monitors, and on mine it is the one using a Display port that doesn't work, and the one on the HDMI is the one that works.
Comment 24 Rainer Klier 2022-10-24 11:56:07 UTC
i have a second user account on my computer, to be able to test issues, if they also occur on other accounts.
and today i found out, that the external monitor is enabled automtaically/by default on this second user account.
i can't explain why, and before the update to 5.26 it was of course also working with my main account.
i just wanted to tell you this fact.
Comment 25 Bob English 2022-10-24 18:49:36 UTC
(In reply to Rainer Klier from comment #24)
> i have a second user account on my computer, to be able to test issues, if
> they also occur on other accounts.
> and today i found out, that the external monitor is enabled automtaically/by
> default on this second user account.
> i can't explain why, and before the update to 5.26 it was of course also
> working with my main account.
> i just wanted to tell you this fact.

There are other duplicate bug reports, as listed above, but to read them you have to follow the links as their text isn't carried over to here which would be a good thing for clarity.  My original bug report had some important details, including that the problem is isolated to one account.  Heres what I wrote:

"After the system went into standby, when I unlocked the screen one of 2 monitors (the primary one at 4K) is black, no mouse pointer, nothing! Reboot doesn't help. In display settings the monitor is present, but not activated.  I find and select it from the drop down list, and can change the resolution, but the refresh rate cannot be selected, and it reads 30Hz with an i (for Info) next to it, I click the i and get "30 Hz is the only resolution this monitor can display" (it can do 60Hz for sure).  I log off and log on to a different user account and all is well, both monitors work, and as usual.

Conclusion:  Something wrong with Plasma settings of that one user account only.

Now, for the last week or so (I run updates daily) Plasma has not remembered any window sizes or positions, nor Icon locations after moving on the desktop between reboots. They seem to be stuck in time from when I used them one week ago.

Since only one user account is affected it must be related to one or more user specific Plasma display settings related files, and Plasma is not making changes to it/them, but now somehow did, but in a very bad way!  Maybe it's a module it uses to record changes, but I cannot tell yet until I logon to the other user account open a few apps resize their windows, move a few Icons around... reboot and see if the changes took, but I don't want it to break too!" 

Now I add this:  Before I shut down, I always close all open windows on all desktops, but now after rebooting some (not all) open again, as if I didn't close them. Although all of these problems may not be related, they all have one thing in common:  Plasma is not recording the desktop and displays configurations after suspending monitors, or reboots.
Comment 26 Rainer Klier 2022-10-25 06:53:23 UTC
(In reply to Rainer Klier from comment #24)
> i have a second user account on my computer, to be able to test issues, if
> they also occur on other accounts.
> and today i found out, that the external monitor is enabled automtaically/by
> default on this second user account.

i was wrong.
it doesn't have anything to do with the account.
today i first tried the test-account after switching on the computer, and here the behaviour was the same: external monitor was disabled.
then i logged of from the test-account and logged in to my account, and guess what, the second monitor was enabled by default.
Comment 27 Bob English 2022-10-25 08:28:45 UTC
(In reply to Rainer Klier from comment #26)
> (In reply to Rainer Klier from comment #24)
> > i have a second user account on my computer, to be able to test issues, if
> > they also occur on other accounts.
> > and today i found out, that the external monitor is enabled automtaically/by
> > default on this second user account.
> 
> i was wrong.
> it doesn't have anything to do with the account.
> today i first tried the test-account after switching on the computer, and
> here the behaviour was the same: external monitor was disabled.
> then i logged of from the test-account and logged in to my account, and
> guess what, the second monitor was enabled by default.

So it's flippant between accounts, that doesn't mean the account has nothing to do with it, but that it does!  It means that display settings for each account are saved per account, and whatever mechanism is saving them is screwing up.  I also have what I call a "Maintenance account" and I too logged into it to see if the problem was with it too, and it worked fine.  So just maybe if I log back into it, it too is missing a monitor, and when I go back to this one I will have two monitors again.  If so then the developers may get a better idea where to look, as something about the login process may have something to do with it, or effect whatever the issue is.

I will try tomorrow:  Dead tired now.
Comment 28 Nate Graham 2022-10-25 17:02:07 UTC
*** Bug 460960 has been marked as a duplicate of this bug. ***
Comment 29 Bob English 2022-10-25 17:30:29 UTC
(In reply to Rainer Klier from comment #26)
> (In reply to Rainer Klier from comment #24)
> > i have a second user account on my computer, to be able to test issues, if
> > they also occur on other accounts.
> > and today i found out, that the external monitor is enabled automtaically/by
> > default on this second user account.
> 
> i was wrong.
> it doesn't have anything to do with the account.
> today i first tried the test-account after switching on the computer, and
> here the behaviour was the same: external monitor was disabled.
> then i logged of from the test-account and logged in to my account, and
> guess what, the second monitor was enabled by default.

This morning I logged onto my maintenance account instead, and no change at all, so not what you were describing, that account still has two monitors, and this one still has my primary one off and it cannot be turned back on.

So you may have left out something, like :  Did you let the monitors suspend while in your "Test" account?  or What all did you do that would call for Plasma to save whatever changes?  Any which way, I cannot at all see how making changes in one account can change anything in another (Separate /home/USER folders with separate settings files) unless it happened system wide in the first place which this did not as shown by the evidence.

I sure hope you didn't just make it all up, or else you may be sending those trying to fix it on a wild and useless goose chase, and hindering the investigation, not helping it.
Comment 30 bertil.bonus 2022-10-25 18:20:45 UTC
I am also having troubles from this bug. 

My second monitor is connected by a HDMI to DVI cable on a Nvidia 1070 card.

The HDMI connected DVI monitor works but the main DP connected screen is blank/no signal.
Comment 31 Rainer Klier 2022-10-27 12:52:40 UTC
(In reply to Bob English from comment #29)
> I sure hope you didn't just make it all up, or else you may be sending those
> trying to fix it on a wild and useless goose chase, and hindering the
> investigation, not helping it.

today i first logged in with my test account, and it was not working (external monitor was disabled) the same way as with my account.
then i logged off without rebooting, and logged in with my account, and then it worked.
so it seems, like with the first login it doesn't work.
i will try afterwards what happens, if i again logout and login.
Comment 32 Bob English 2022-10-27 13:34:23 UTC
I will try just switching users too.

Also:  This silence from the developers isn't encouraging.
Comment 33 Nate Graham 2022-10-27 13:37:48 UTC
None of us can reproduce this issue, unfortunately.
Comment 34 Bob English 2022-10-27 13:55:43 UTC
Any other files to attach that may help?  Is there some file we can look into and change some setting manually, or even a file to delete that will make Plasma detect the monitors on reboot, hopefully without losing a whole bunch of other settings, so not the entire plasma setup...?
Comment 35 Bob English 2022-10-27 14:11:42 UTC
Just logged out, and got a login screen on both monitors.  Logged in to my maintenance account, both monitors working.  Logged out from it, and once again Login screen on both monitors, logged in to this, my main account, KDE splash  screen on both monitors, but as soon as the desktop showed up, back to only one monitor. :>(
Comment 36 Nate Graham 2022-10-27 16:29:46 UTC
Hopefully someone who's familiar with the inner workings of KScreen and KWin can help with that. Unfortunately that person is not me; I'm just bug triaging.
Comment 37 Bob English 2022-10-27 21:24:32 UTC
(In reply to Nate Graham from comment #36)
> Hopefully someone who's familiar with the inner workings of KScreen and KWin
> can help with that. Unfortunately that person is not me; I'm just bug
> triaging.

Thanks Triage guy! Will Wait for the surgeons.  :>)
Comment 38 bertil.bonus 2022-10-27 21:44:03 UTC
Is there a way to turn off the auto detect feature? Or some other workaround?
Comment 39 John 2022-10-27 23:15:01 UTC
(In reply to bertil.bonus from comment #38)
> Is there a way to turn off the auto detect feature? Or some other workaround?

As a work around I am using autorandr.  I saved a working profile and have it reload when the computer wakes from sleep.
Comment 40 Bob English 2022-11-01 23:32:35 UTC Comment hidden (spam)
Comment 41 bertil.bonus 2022-11-05 09:26:59 UTC Comment hidden (spam)
Comment 42 Nate Graham 2022-11-05 14:26:22 UTC Comment hidden (spam)
Comment 43 Bob English 2022-11-05 16:04:25 UTC Comment hidden (spam)
Comment 44 Bob English 2022-11-05 16:21:32 UTC Comment hidden (spam)
Comment 45 Nate Graham 2022-11-05 17:38:54 UTC Comment hidden (spam)
Comment 46 bertil.bonus 2022-11-05 23:36:51 UTC
Yes, might be unrelated. I was referred here from https://bugs.kde.org/show_bug.cgi?id=450068

I am on Neon user edition. I just log in once a day to update and see if it got better. Problem started with plasma 5.26. Thursday the 27 October the computer one again worked. Then I was away for a week but it now keeps on working perfectly.

Its a DP main screen that was problematic. Secondary screen connected by a HDMI to DVI cable worked. Nvidia 1070 card with 515.65.01 driver. I just updated with pkcon and discover.

I am sorry that I can not contribute more information.
Comment 47 Nate Graham 2022-11-07 19:04:31 UTC
*** Bug 461544 has been marked as a duplicate of this bug. ***
Comment 48 Nate Graham 2022-11-09 21:08:06 UTC
*** Bug 414803 has been marked as a duplicate of this bug. ***
Comment 49 Bob English 2022-11-09 21:45:19 UTC
I found a way to get both monitors back; Well until the system goes back to sleep.  It's from the EndeavourOS Forum:

If you delete any files with monitor layouts that are named like this: c2cda156c1e54840478e5af385672567 from:

$ /home/USER/.local/share/kscreen/ 
and
$ /home/USER/.local/share/kscreen/outputs

and logging off/ back in (not sure) or as I did: reboot, so new files will be regenerated as detected.

You can experiment with deleting one or more of the files to see if this fixes your issue.  If you want to play it safe, you can archive the existing files and restore them in case of disaster, and then also have them for later comparisons with the new ones.  I deleted them all (so 4), and rebooted:  Viola', 2 Monitors again.  I did have to change their orientation in the settings though.

Hopefully this can assist the dev's who still haven't arrived on the scene (or if, are hiding :>), to find the source of the bug.
Comment 50 Nate Graham 2022-11-10 15:17:41 UTC
That effectively deletes all of KScreen's config data, which suggests that it generating incorrect config data is the problem here.
Comment 51 Nate Graham 2022-11-10 17:19:12 UTC
*** Bug 461648 has been marked as a duplicate of this bug. ***
Comment 52 Nate Graham 2022-11-10 17:45:18 UTC
*** Bug 454902 has been marked as a duplicate of this bug. ***
Comment 53 Benny Zen 2022-11-12 10:51:34 UTC
My system had the very same issue. I had 2 monitors 34" DP-0 and 24" HDMI-1. Today I switched the second monitor with a second 34" connected using DP-2. Now the problem is gone. No bogus files in `~/.local/share/kscreen` after wake anymore. Sleep just works as before KDE 5.26.x. Maybe this helps someone figuring out the regression in latest releases.

No need to mention this was a somehow expensive "fix"^^
Comment 54 bertil.bonus 2022-11-13 11:58:41 UTC
My problem returned with the upgrade to 22.04. DP monitor disappeared. HDMI/DVI monitor remained.

Solved it by removing all files under 

$ /home/USER/.local/share/kscreen/ 
and
$ /home/USER/.local/share/kscreen/outputs

and logging off/ back in.
Comment 55 Bob English 2022-11-13 19:06:49 UTC
(In reply to bertil.bonus from comment #54)
> My problem returned with the upgrade to 22.04. DP monitor disappeared.
> HDMI/DVI monitor remained.
> 
> Solved it by removing all files under 
> 
> $ /home/USER/.local/share/kscreen/ 
> and
> $ /home/USER/.local/share/kscreen/outputs
> 
> and logging off/ back in.

Solved?  No, the problem still persists, as if you let your system suspend it will lose that monitor again.  Deleting those files is just a band aid, not a final solution.
Comment 56 bertil.bonus 2022-11-14 20:29:39 UTC
(In reply to Bob English from comment #55)
> (In reply to bertil.bonus from comment #54)
> > My problem returned with the upgrade to 22.04. DP monitor disappeared.
> > HDMI/DVI monitor remained.
> > 
> > Solved it by removing all files under 
> > 
> > $ /home/USER/.local/share/kscreen/ 
> > and
> > $ /home/USER/.local/share/kscreen/outputs
> > 
> > and logging off/ back in.
> 
> Solved?  No, the problem still persists, as if you let your system suspend
> it will lose that monitor again.  Deleting those files is just a band aid,
> not a final solution.

Yeah, you are right. Had to remove the files again.
Comment 57 retired 2022-11-14 22:04:56 UTC
Pretty sure that this bug could be marked as depending on https://bugs.kde.org/show_bug.cgi?id=450068 since connector IDs are volatile, and there's no permanent fix until that is solved in a robust way.
Comment 58 Nate Graham 2022-11-15 18:05:49 UTC
Not quite; that's a related bug but is specific to plasmashell's usage of connector IDs to map containments to screens. The root cause of this bug hasn't been found yet, and if it's related to the same underlying issue with volatile connector IDs, it would need to be fixed here, with any plasmashell fix not affecting it at all.
Comment 59 Alexander Fieroch 2022-11-16 07:57:21 UTC
Is there any workaround for this bug? 

I removed configuration files from
$ /home/USER/.local/share/kscreen/ 
and
$ /home/USER/.local/share/kscreen/outputs
but it doesn't change anything. Do I need to remove all of them, or should I keep the latest working configuration? Should I do this every time before going to sleep mode?

After awakening from sleep my three monitors have lost their configuration. Two of three monitors are disabled, have lost their position and orientation. Just enabling them again is not easy working because of another bug. My third monitor is not detected everytime, I can enable it, but the desktop does not use it, and it stays blank.
Comment 60 Bryan Stine 2022-11-16 18:59:06 UTC
(In reply to Alexander Fieroch from comment #59)
> Is there any workaround for this bug? 
> 
> I removed configuration files from
> $ /home/USER/.local/share/kscreen/ 
> and
> $ /home/USER/.local/share/kscreen/outputs
> but it doesn't change anything. Do I need to remove all of them, or should I
> keep the latest working configuration? Should I do this every time before
> going to sleep mode?
> 
> After awakening from sleep my three monitors have lost their configuration.
> Two of three monitors are disabled, have lost their position and
> orientation. Just enabling them again is not easy working because of another
> bug. My third monitor is not detected everytime, I can enable it, but the
> desktop does not use it, and it stays blank.

Disabling the kscreen service has made resume from suspend reliable for me. However, there are some caveats: I do need to rearrange the monitors when logging into a session (e.g. after reboot or logout); additionally, I'm doing this on a desktop system and I suspect disabling kscreen will make hotplugging displays an issue, or at least less convenient.
Comment 61 jeroni 2022-11-17 19:14:45 UTC
(In reply to Bryan Stine from comment #60)
> (In reply to Alexander Fieroch from comment #59)
> > Is there any workaround for this bug? 
> > 
> > I removed configuration files from
> > $ /home/USER/.local/share/kscreen/ 
> > and
> > $ /home/USER/.local/share/kscreen/outputs
> > but it doesn't change anything. Do I need to remove all of them, or should I
> > keep the latest working configuration? Should I do this every time before
> > going to sleep mode?
> > 
> > After awakening from sleep my three monitors have lost their configuration.
> > Two of three monitors are disabled, have lost their position and
> > orientation. Just enabling them again is not easy working because of another
> > bug. My third monitor is not detected everytime, I can enable it, but the
> > desktop does not use it, and it stays blank.
> 
> Disabling the kscreen service has made resume from suspend reliable for me.
> However, there are some caveats: I do need to rearrange the monitors when
> logging into a session (e.g. after reboot or logout); additionally, I'm
> doing this on a desktop system and I suspect disabling kscreen will make
> hotplugging displays an issue, or at least less convenient.

Surely works when kscreen service is disabled. I've handled the rearrange monitors by creating a script in /etc/profile.d and using xrandr by now....
Here is my setup:
cat /etc/profile.d/screen-config.sh                                                                                                     ✔  at 20:10:27  
xrandr --output HDMI-0 --mode 1920x1080 --pos 0x360 --output DP-0 --mode 3440x1440 --pos 1920x0 --rate 75 --primary --output DP-3 --mode 1920x1080 --pos 5360x360
Comment 62 René Fritz 2022-11-19 15:00:54 UTC
I have a laptop with Nvidia graphics and driver version 510 (tried 515 and 520). KDE Neon 22.04

I use external monitors connected with HDMI and USB-C (which is display port?) both in 4k.
Hotplug worked well but not always flawless in the past.

Lately only HDMI Monitor gets enabled on hotplug but not the one over USB-C. 
This behavior seems to be the same which many described here.
I can enable the USB-C monitor using kcm_kscreen but it gets disabled immediately. 
Can't tell which updated caused it. It was before 22.04 was available I thin.

My workaround
- plug in the USB-C Monitor, it will not be enabled
- enable the USB-C Monitor using nvidia-settings
- plug in the HDMI Monitor
- the monitor layout configured with kcm_kscreen will be restored

To me it seems not the monitor layout is the problem but enabling a display port monitor - maybe specific to nvidia?
I don't think the it's the nvidia driver because I'm pretty shure I used v 510 already when it still worked.

Slightly different and maybe not related:
I have another setup with two 4k daisy chained USB-C monitors. I had a problem there that sometimes one monitor got not enabled and enabling him manually using kcm_kscreen didn't work (nothing happens). Usually I tried plugin multiple times until it worked. This behavior got much more worse with recent update, which means it doesn't work 95% of the time.
Comment 63 qaz.cetelic@gmail.com 2022-11-21 18:45:55 UTC
I'm also experiencing the issue.

I've found a workaround:
1. Change display configuration
2. Kill the plasmashell (and let it restart)
3. A message notifying about plasma crashing appears
4. Change display configuration again
5. Confirm display changes (this pop-up does not appear before killing plasma shell)
6. External monitor works and display configuration is used.

Operating System: Fedora Linux 37
KDE Plasma Version: 5.26.3
KDE Frameworks Version: 5.100.0
Qt Version: 5.15.7
Kernel Version: 6.0.8-300.fc37.x86_64 (64-bit)
Graphics Platform: X11
Processors: 12 × Intel® Core™ i7-8750H CPU @ 2.20GHz
Graphics Processor: NVIDIA GeForce GTX 1060/PCIe/SSE2
System Version: V1.19
Comment 64 qaz.cetelic@gmail.com 2022-11-21 18:51:39 UTC
I've just rebooted, and the display configuration is still intact, and the external monitor is still connected. The workaround persists after rebooting.
Comment 65 David Edmundson 2022-11-25 11:42:55 UTC
>- enable the USB-C Monitor using nvidia-settings

If nvidia-settings is also adjusting monitors that's going to lead to unpredictable results having two daemons thinking they're in charge at once. It is possible nvidia-settings was previously disabling the monitor after kscreen enabled it.
Comment 66 René Fritz 2022-11-25 11:48:46 UTC
(In reply to David Edmundson from comment #65)
> >- enable the USB-C Monitor using nvidia-settings
> 
> If nvidia-settings is also adjusting monitors that's going to lead to
> unpredictable results having two daemons thinking they're in charge at once.
> It is possible nvidia-settings was previously disabling the monitor after
> kscreen enabled it.

nvidia-settings is a user space program where I manually activate the monitor (gui). There's no daemon involved as I know.
Normally I don't have nvidia-settings running. In the past I didn't had problems and nvidia-settings was installed too.
nvidia proprietary driver is used
Comment 67 Rainer Klier 2022-11-28 18:36:18 UTC
could it be that it has something to do with nvidia driver?

because today i updated a notebook with intel graphics to the same KDE Plasma/Frameworks/Qt version i am using on my nvidia equipped notebook, and on the intel based notebook an external hdmi-connected monitor was detected/remembered/used without any issue.
Comment 68 Nate Graham 2022-11-28 23:58:16 UTC
Good observation. Is anyone else affected by this issue using a non-NVIDIA GPU? All who have reported their GPU so far do seem to be using NVIDIA.
Comment 69 yjcoshc 2022-11-29 09:01:54 UTC
Most people would have to use their NVIDIA cards to connect to external monitors in case of hybrid cards. In KDE 5.25.5 (Ubuntu 22.10) I don't encounter this problem with the latest NVIDIA driver (520.56.06), and if I upgrade to 5.26 via the Kubuntu PPA then I could reproduce it by:

1. In "Energy Saving" settings, set to "Lock screen" when laptop lip closed
2. Use NVIDIA card and connect to an external monitor
3. In "Display and Monitor", disable the laptop screen and set the external monitor as the primary device
4. Close the laptop lip, make sure now only the external monitor is on
5. Turn off the external monitor and turn on it again after 10 seconds
6. In KDE 5.26, the external monitor shows nothing or "no signal", but in KDE 5.25.5, you can at least see the lock screen for entering the password.
Comment 70 r0ck3r 2022-11-29 12:00:20 UTC
I can confirm, that this is happening only with Nvidia proprietary driver and Plasma 5.26. I have tried to downgrade NVIDIA drivers to 470xx version, but no result. On nouveau bug did not happens
Comment 71 Rainer Klier 2022-11-29 12:06:46 UTC
(In reply to r0ck3r from comment #70)
> and Plasma 5.26. I have tried to downgrade NVIDIA drivers to 470xx version, but no result.

yes, i didn't post this yet, but i also use the 470 version of the nvidia driver, since the old GeForce GTX 765M GPU isn't supported any more by other driver versions, and as i wrote in the initial post, this problem is affecting me.

so it seems to happen with all current nvidia drivers (470, 510, 515, 525).
Comment 72 r0ck3r 2022-11-29 12:08:37 UTC
To provoke this bug is enought to run
    xset dpms force off
and wait for about 30 sec, and move mouse cursor after that.
I have triple monitor configuration and my main display, which is connected to DisplayPort, can't start. Rest two monitors, that is connected to HDMI, shows visual glitches. Disable kscreen service and using autorandr as autostart script can workaround this
Comment 73 r0ck3r 2022-11-29 12:10:00 UTC
(In reply to Rainer Klier from comment #71)
> (In reply to r0ck3r from comment #70)
> > and Plasma 5.26. I have tried to downgrade NVIDIA drivers to 470xx version, but no result.
> 
> yes, i didn't post this yet, but i also use the 470 version of the nvidia
> driver, since the old GeForce GTX 765M GPU isn't supported any more by other
> driver versions, and as i wrote in the initial post, this problem is
> affecting me.
> 
> so it seems to happen with all current nvidia drivers (470, 510, 515, 525).

yeah, looks so
Comment 74 Rainer Klier 2022-11-29 16:22:11 UTC
the changed description of this ticket is not completely correct.
"external DisplayPort monitor" is not correct, because, for example, my external monitor is connected via HDMI, and this issue affects me.
Comment 75 r0ck3r 2022-12-02 08:26:22 UTC
Just upgraded to plasma-5.26.4 in Fedora 37 and looks like bug is fixed
Comment 76 Benny Zen 2022-12-02 11:50:59 UTC
Unfortunately, I'm not that lucky. It's not fixed for me. Still experiencing the very same bug as before.
Comment 77 Nate Graham 2022-12-02 20:22:59 UTC
*** Bug 406099 has been marked as a duplicate of this bug. ***
Comment 78 r0ck3r 2022-12-03 08:25:30 UTC
(In reply to Benny Zen from comment #76)
> Unfortunately, I'm not that lucky. It's not fixed for me. Still experiencing
> the very same bug as before.

This is strange. So, probably, I've did something to disappear this bug. In plasma 5.26.3 I have disabled kscreen service and used autorandr as autoinit script and after upgrade I have configured screens in plasma settings, started kscreen service, disabled autorandr and rebooted.
May be, there can be a workaround. Could it be configuring screens with kscreen stopped?
Comment 79 Nate Graham 2022-12-06 00:33:43 UTC
*** Bug 462626 has been marked as a duplicate of this bug. ***
Comment 80 r0ck3r 2022-12-08 10:18:17 UTC
Bug appeared again for me on 5.26.4
Comment 81 Steven Robbins 2022-12-13 03:39:53 UTC
Created attachment 154552 [details]
Steve's kscreen-console bug output for one monitor

I think this is the same issue, but did not see my symptoms described.

I use an NVIDIA card, two monitors.  One of the monitors is switched between this machine and another.  Have been using this setup for ages.  Prior to October, when I switch the monitor to the other machine, KDE notices and automatically puts all windows on one screen; then, when I switch the monitor back KDE notices and uses both screens.

Since October, KDE does notice when I switch from 1 monitor to 2: In the "Display Configuration" section of System Settings, I can see the second monitor present, but the "Enabled" button is UNchecked.  I need to manually check it, then apply --> then the two-monitor configuration is restored.  Happens 100% of the time when I switch the monitor.

Attached is the "kscreen-console bug" output for the broken configuration: both monitors connected, but one is not enabled.
Comment 82 Steven Robbins 2022-12-13 03:42:08 UTC
Created attachment 154553 [details]
Steve's kscreen-console bug output for one monitor connected

For comparison, here is "kscreen-console bug" output for the situation where I've switched the one monitor to the second computer.  In other words, this is the legitimate "one monitor connected" situation.
Comment 83 Steven Robbins 2022-12-13 03:43:47 UTC
Created attachment 154554 [details]
Steve's kscreen-console bug output for two working monitors

For completeness, here's the working output -- both monitors enabled.
Comment 84 Nate Graham 2022-12-14 22:27:56 UTC
Seems like the same bug, yeah. 

Some folks investigated and were thinking that maybe the NVIDIA driver changed to try to take over multi-monitor stuff, and the NVIDIA driver and KScreen are now competing, and KScreen loses but confuses the driver, so the external screen ends up  disabled.

No solid evidence of this though; it's just a theory.
Comment 85 Rainer Klier 2022-12-15 11:02:09 UTC
(In reply to Nate Graham from comment #84)
> Some folks investigated and were thinking that maybe the NVIDIA driver
> changed to try to take over multi-monitor stuff, and the NVIDIA driver and

but when i first encountered this bug, back in october, i was using the same nvidia driver version 470.141.03 since august with previous version of KDE frameworks without this issue.
so the nvidia driver did not change back then, but KDE.
it first happened with 5.26.
there has to be a change in (most propably) KScreen which triggers this.
Comment 86 yjcoshc 2022-12-15 15:28:58 UTC
(In reply to Nate Graham from comment #84)
> Seems like the same bug, yeah. 
> 
> Some folks investigated and were thinking that maybe the NVIDIA driver
> changed to try to take over multi-monitor stuff, and the NVIDIA driver and
> KScreen are now competing, and KScreen loses but confuses the driver, so the
> external screen ends up  disabled.
> 
> No solid evidence of this though; it's just a theory.

I am now on Kubuntu 22.10 with KDE 5.25 and NVIDIA 525.60.11, and not affected by this issue. If this is only a kscreen bug, has anyone tried to downgrade kscreen to 5.25 on while keeping other components at 5.26?
Comment 87 yjcoshc 2022-12-15 17:53:33 UTC
(In reply to yjcoshc from comment #86)
> (In reply to Nate Graham from comment #84)
> > Seems like the same bug, yeah. 
> > 
> > Some folks investigated and were thinking that maybe the NVIDIA driver
> > changed to try to take over multi-monitor stuff, and the NVIDIA driver and
> > KScreen are now competing, and KScreen loses but confuses the driver, so the
> > external screen ends up  disabled.
> > 
> > No solid evidence of this though; it's just a theory.
> 
> I am now on Kubuntu 22.10 with KDE 5.25 and NVIDIA 525.60.11, and not
> affected by this issue. If this is only a kscreen bug, has anyone tried to
> downgrade kscreen to 5.25 on while keeping other components at 5.26?

Here is a dirty hack that I have tried to downgrade kscreen and solve the problem:
1. Download libkscreen from https://invent.kde.org/plasma/libkscreen/-/tree/Plasma/5.25 and kscreen from https://invent.kde.org/plasma/kscreen/-/tree/Plasma/5.25;
2. Install all the build dependencies. I am on Ubuntu (with the kubuntu backport PPA to try plasma 5.26) so I run "apt-get build-dep libkf5screen7 kscreen";
3. Remove kscreen by "apt remove kscreen". libkscreen from apt is not removable since plasma depends on it;
4. Build the libkscreen 5.25 and install it (override the one from apt);
5. Build the kscreen 5.25 and install it.

Now it should be enough to solve the problem.
Comment 88 Nate Graham 2022-12-15 19:07:28 UTC
If anyone here able to unstable git master KDE packages from their distro, I'd be very interested in knowing whether the massive multiscreen overhaul that was merged today fixes this issue for them.
Comment 89 Fonic 2022-12-16 18:06:42 UTC
(In reply to Rainer Klier from comment #85)
> (In reply to Nate Graham from comment #84)
> > Some folks investigated and were thinking that maybe the NVIDIA driver
> > changed to try to take over multi-monitor stuff, and the NVIDIA driver and
> 
> but when i first encountered this bug, back in october, i was using the same
> nvidia driver version 470.141.03 since august with previous version of KDE
> frameworks without this issue.
> so the nvidia driver did not change back then, but KDE.
> it first happened with 5.26.
> there has to be a change in (most propably) KScreen which triggers this.

I'm experiencing this bug in a slightly different manner (screen configuration reverts from 1920x1080 to 1024x768 for both screens after suspend/wakeup). I'm running Gentoo Linux with KScreen packages version 5.25.5 and NVIDIA drivers version 515.86.01. According to my package manager, the KScreen packages were installed on 10/02/22 and the NVIDIA driver on 12/10/22.

Since the bug started to show itself only a couple of days ago, I'd say it is related to the NVIDIA driver, not to KScreen. And since I'm running KScreen version 5.25.5, I'd also say it is not related to KScreen version 5.25.
Comment 90 Nate Graham 2022-12-16 18:08:31 UTC
Your bug is likely something else.
Comment 91 Fonic 2022-12-16 18:15:28 UTC
(In reply to Nate Graham from comment #90)
> Your bug is likely something else.

Highly unlikely - the only difference is that I'm using an Xorg config to configure the dual monitor setup, that's probably why the second display stays on and does not get disabled as reported by others.

The main issue is the same: KScreen is unable to save its screen layout/setup, which is noticeable in the Display Configuration menu - when hitting 'Apply', a popup appears to ask if the configuration should be kept or reverted. After confirming using 'Keep', the 'Apply' button gets activated again. Clicking it again brings up the popup again, etc.
Comment 92 Steven Robbins 2022-12-18 04:30:54 UTC
I've made some progress on this issue -- at least for my case, which is switching the monitor between two computers (see comment #81).

With debug logging [1] I was able to immediately see that when the monitor was connected, it was marked as disabled in the configuration received.  I made a straightforward change to KScreenDaemon::configChanged() that simply forces all connected outputs to be enabled.  In version 5.26.4 this looks as follows; I added the lines marked **:

void KScreenDaemon::configChanged()
{
    qCDebug(KSCREEN_KDED) << "Change detected";
    m_monitoredConfig->log();
    qCDebug(KSCREEN_KDED) << " -- after log";

    // Modes may have changed, fix-up current mode id
    bool changed = false;
    const auto outputs = m_monitoredConfig->data()->outputs();
    for (const KScreen::OutputPtr &output : outputs) {
**        if (output->isConnected())
**            output->setEnabled(true);
    ....

I don't understand the configuration mechanism well -- specifically I don't know what module is generating the configuration after connecting the monitor so I would bet that the above change is not suitable in general.  However, it fixes my itch so I thought I'd share it here.

[1] https://community.kde.org/Solid/Projects/ScreenManagement
Comment 93 Rainer Klier 2022-12-19 12:57:03 UTC
(In reply to Nate Graham from comment #88)
> If anyone here able to unstable git master KDE packages from their distro,
> I'd be very interested in knowing whether the massive multiscreen overhaul
> that was merged today fixes this issue for them.

i assume you are talking about this:
https://notmart.org/blog/2022/12/multi-screen/

in this blog post Marco Martin links to a bug list https://bugs.kde.org/buglist.cgi?bug_status=UNCONFIRMED&bug_status=CONFIRMED&bug_status=ASSIGNED&bug_status=REOPENED&classification=Plasma&component=Multi-screen%20support&list_id=2230740&product=plasmashell&query_format=advanced

this bug here is not in this list, because component and product is different.
does this mean the developers (Marco Martin, Ivan and Xaver) who were working on this improvement don't know anything about this bug?

i am looking forward installing 5.27, when available.
Comment 94 Nate Graham 2022-12-19 15:51:22 UTC
No KDE developer has been able to reproduce this issue, so Martin was not able to determine if that work fixes it or not.

Any of you who are experiencing this issue, if you could test it, that would be lovely. You'll have to be using unstable/git master packages from your distro, or Neon Unstable, or openSUSE Krypton. Or you'll have to compile a Plasma session from source code yourself.
Comment 95 Steven Robbins 2022-12-20 17:31:04 UTC
(In reply to Nate Graham from comment #94)
> No KDE developer has been able to reproduce this issue, so Martin was not
> able to determine if that work fixes it or not.
> 
> Any of you who are experiencing this issue, if you could test it, that would
> be lovely. You'll have to be using unstable/git master packages from your
> distro, or Neon Unstable, or openSUSE Krypton. Or you'll have to compile a
> Plasma session from source code yourself.

I'm willing to give it a go.  My distro (Debian) doesn't have 5.27 packages yet so it would be me compiling them.  Can you point me to  a list of packages that I would need to build?
Comment 96 Nate Graham 2022-12-20 17:44:09 UTC
Thanks! Here's the full list of projects that had changes related to the recent multi-screen overhaul:
- plasma-wayland-protocols
- kwin
- libkscreen
- kscreen
- plasma-workspace
Comment 97 Jaka Kranjc 2023-01-03 15:48:06 UTC
I'd just like to add that I have this problem on a single monitor system (regular desktop, HDMI connection) as well. Had it since the upgrade to Kubuntu 22.04, but thought it was a kernel problem, since it only happens every couple of sleep (suspend) cycles.
Comment 98 Robert J 2023-01-08 08:09:31 UTC
Hi,

I'm using KDE with Manjaro on my laptop with a 2K external monitor. Whenever I connect an additional HD external monitor (both over HDMI and also DisplayPort) it is disabled and I need to enable it manually every time, over System Settings’ Display Configuration. It does not remember it - but it used to work fine for years until recent updates. 

Meanwhile the main 2K external monitor which is connected permanently over DisplayPort remains enabled after OS resets - but if I unplug it and reconnect it gets disabled as well.

I tried to manipulate settings in /home/USER/.local/share/kscreen/ enabling the additional monitor and making files read only (it used to help in  the past) but it does not work any more.

There is also a related problem which has appeared with the problematic updates, I had no such problems in the past: whenever the additional external monitor (HD) is manually enabled, the screen height on the main monitor (2K) for full screen application is reduced to the screen height of the external monitor (HD): 1080 px. I still have full 1440 px height with taskbar below, but maximized applications are automatically resized to 1080 pixels instead of 1440 px. I can manually resize the windows to 1440 px, but not in maximized mode. If I unplug the additional monitor I get the correct 1440 px height for maximized apps back.

My graphics card: NVIDIA GeForce GTX 1650 (hybrid)
Comment 99 Robert J 2023-01-08 08:12:28 UTC
(In reply to Robert J from comment #98)

It is not a kernel or display driver problem, I have already tried to downgrade kernel and drivers (it is easy with Manjaro) but I could not get the correct behavior as I had it in the past.
Comment 100 Nate Graham 2023-01-09 22:33:27 UTC
*** Bug 464024 has been marked as a duplicate of this bug. ***
Comment 101 brian 2023-01-10 00:48:19 UTC
Discouraging that this bug has been opened since October, and I just updated my machine on Christmas to see it the first time.
Is there anything those of us suffering can do to give more information?
Comment 102 Benny Zen 2023-01-10 11:07:28 UTC
This is truly sad to say, but after more than a decade on KDE, I had to move to another DE. In current times of elevated energy prices having no sleep is just a no-go. No offense intended, but just my reality. Personally, I think a lot of users are affected by this one and do not even get what is going wrong behind the scenes. Looked at the code and tried to figure out how things work myself, but it's way above my horizon. So I leave it up to those guys familiar with it to fix it.
Comment 103 Brian Cohen 2023-01-13 15:47:17 UTC
Reading the description of the overhaul and the reasons behind it were illuminating:
https://notmart.org/blog/2022/12/multi-screen/

As a temporary workaround I now have my two monitors both hooked up to my laptop directly by HDMI ports instead of via a USB-c dock. Probably most people won't be able to do this; I have a Framework so I was able to buy another HDMI port to swap into one of the expansion bays.  

Hopefully the 5.27 release fixes these problems. I love so many things about KDE Plasma but ultimately I need to be productive first, and I can't do that if I have to reboot before connecting external screens.  If the overhaul in the 5.27 release doesn't resolve this I will very regrettably have to move to another DE.  

In the meantime I do plan to collect some debugging info to post here just in case, following these instructions:
https://community.kde.org/Solid/Projects/ScreenManagement
Comment 104 Nate Graham 2023-01-13 16:23:02 UTC
If the changes we made for 5.27 doesn't fix it automatically, we'll do a deep dive and figure out what this is and fix it for sure. I was hoping that at least one person affected could test with git master packages or Neon Unstable or something to see if 5.27 fixes it. There's also the possibility of testing the the 5.27 beta which will be coming out in 6 days.
Comment 105 Brian Cohen 2023-01-13 16:28:14 UTC
@Nate Graham I am willing to test it for sure.  I actually went digging a couple weeks ago to figure out how, including trying to track down a way through KDE Neon but got lost trying to figure out if KDE Neon Unstable had these changes integrated.  If you're saying Neon Unstable has 5.27 I can definitely test it, with the caveat that I am currently affected by this under Manjaro so I probably need to first install Neon Stable and verify that I can reproduce the problem there as a baseline.
Comment 106 Nate Graham 2023-01-13 16:29:42 UTC
Neon Unstable has everything needed, yep. Thanks a lot!
Comment 107 Benny Zen 2023-01-14 11:53:48 UTC
Just went over to KDE Neon and tried the `Unstable` image, like Nathan suggested. The about dialog says it's still KDE 5.26.8, but, and this is a huge but, the bug seems fixed. Tried sleep and after wake-up the screens are still assigned correctly. So yes, you were right. Thank you. Now we just need to wait until these changes make it into our distros.
Comment 108 Steven Robbins 2023-01-14 16:10:04 UTC
(In reply to Brian Cohen from comment #105)

> so I probably need to first install Neon Stable and verify
> that I can reproduce the problem there as a baseline.

That sounds like a good idea.  I tried last night with Neon "User Edition", however, and failed to trigger the bug.  Wondering what your experience was.
Comment 109 Steven Robbins 2023-01-15 18:29:41 UTC
(In reply to Steven Robbins from comment #108)
> (In reply to Brian Cohen from comment #105)
> 
> > so I probably need to first install Neon Stable and verify
> > that I can reproduce the problem there as a baseline.
> 
> That sounds like a good idea.  I tried last night with Neon "User Edition",
> however, and failed to trigger the bug.  Wondering what your experience was.

Despite not being able to reproduce the problem with "user edition", I tried the experiment (disconnecting one monitor via an HDMI switch; see comment 81) using "unstable edition".   I discovered a crash in plasmashell if the monitor is Primary (bug 464334).  But the monitor WAS re-enabled when reconnected.  It's unclear what this proves given that that I was unable to reproduce the bug in the older "user edition" KDE neon.
Comment 110 Oleksii Zolotarevskyi 2023-01-15 21:34:41 UTC
I've tried Manjaro "unstable" branch and still have the issue.
The packages were updated to:
	plasma-wayland-protocols `1.9.0-1` -> `1.9.0-1`
	kwin `5.26.4-1` -> `5.26.5-2`
	libkscreen `5.26.4-1` -> `5.26.5-1`
	kscreen `5.26.4-1` -> `5.26.5-1`
	plasma-workspace `5.26.4.1-1` -> `5.26.5-2`
Comment 111 Benny Zen 2023-01-16 12:26:22 UTC
(In reply to Steven Robbins from comment #109)
> (In reply to Steven Robbins from comment #108)
> > (In reply to Brian Cohen from comment #105)
> > 
> > > so I probably need to first install Neon Stable and verify
> > > that I can reproduce the problem there as a baseline.
> > 
> > That sounds like a good idea.  I tried last night with Neon "User Edition",
> > however, and failed to trigger the bug.  Wondering what your experience was.
> 
> Despite not being able to reproduce the problem with "user edition", I tried
> the experiment (disconnecting one monitor via an HDMI switch; see comment
> 81) using "unstable edition".   I discovered a crash in plasmashell if the
> monitor is Primary (bug 464334).  But the monitor WAS re-enabled when
> reconnected.  It's unclear what this proves given that that I was unable to
> reproduce the bug in the older "user edition" KDE neon.

(In reply to Oleksii Zolotarevskyi from comment #110)
> I've tried Manjaro "unstable" branch and still have the issue.
> The packages were updated to:
> 	plasma-wayland-protocols `1.9.0-1` -> `1.9.0-1`
> 	kwin `5.26.4-1` -> `5.26.5-2`
> 	libkscreen `5.26.4-1` -> `5.26.5-1`
> 	kscreen `5.26.4-1` -> `5.26.5-1`
> 	plasma-workspace `5.26.4.1-1` -> `5.26.5-2`

Confirmed. Even on Manjaro testing it's not fixed.
Comment 112 Nate Graham 2023-01-16 16:42:06 UTC
(In reply to Oleksii Zolotarevskyi from comment #110)
> I've tried Manjaro "unstable" branch and still have the issue.
> The packages were updated to:
> 	plasma-wayland-protocols `1.9.0-1` -> `1.9.0-1`
> 	kwin `5.26.4-1` -> `5.26.5-2`
> 	libkscreen `5.26.4-1` -> `5.26.5-1`
> 	kscreen `5.26.4-1` -> `5.26.5-1`
> 	plasma-workspace `5.26.4.1-1` -> `5.26.5-2`

Those aren't the right versions; you're still using the stable branch (which makes the Manjaro repo name confusing to me). You want the versions of Plasma things to be "5.26.80", not "5.26.5".
Comment 113 Brian Cohen 2023-01-16 17:09:54 UTC
(In reply to Steven Robbins from comment #109)
> (In reply to Steven Robbins from comment #108)
> > (In reply to Brian Cohen from comment #105)
> > 
> > > so I probably need to first install Neon Stable and verify
> > > that I can reproduce the problem there as a baseline.
> > 
> > That sounds like a good idea.  I tried last night with Neon "User Edition",
> > however, and failed to trigger the bug.  Wondering what your experience was.
> 
> Despite not being able to reproduce the problem with "user edition", I tried
> the experiment (disconnecting one monitor via an HDMI switch; see comment
> 81) using "unstable edition".   I discovered a crash in plasmashell if the
> monitor is Primary (bug 464334).  But the monitor WAS re-enabled when
> reconnected.  It's unclear what this proves given that that I was unable to
> reproduce the bug in the older "user edition" KDE neon.

Same thing.  I tried and failed this afternoon to establish a baseline by swapping out my hard drive, installing KDE Neon 'User' edition, enabled hibernation (https://askubuntu.com/a/1316444), hooked up my two screens via my USB-c dock, properly arranged them, disconnected from the dock, hibernated, resumed from hibernate, reconnected the dock.  Screens both properly activated and were properly arranged.
Comment 114 Nate Graham 2023-01-17 19:57:27 UTC
*** Bug 464300 has been marked as a duplicate of this bug. ***
Comment 115 Oleksii Zolotarevskyi 2023-01-18 00:31:50 UTC
(In reply to Nate Graham from comment #112)
> Those aren't the right versions; you're still using the stable branch (which
> makes the Manjaro repo name confusing to me). You want the versions of
> Plasma things to be "5.26.80", not "5.26.5".

I was able to reproduce the issue with both KDE Neon User and Unstable editions.
Packages versions (User -> Unstable):
	kwin-x11 `4:5.26.5-0xneon+22.04+jammy+release+build25` -> `4:5.26.5+p22.04+tunstable+git20230105.1313-0`
	kscreen `4:5.26.5-0xneon+22.04+jammy+release+build15` -> `4:5.26.5+p22.04+tunstable+git20230105.1302-0`
	plasma-workspace `4:5.26.5-0xneon+22.04+jammy+release+build20` -> `4:5.26.5+p22.04+tunstable+git20230105.1333-0`

Looks like in the Unstable edition at least some package versions are 5.26.5
Comment 116 René Fritz 2023-01-18 10:11:51 UTC
For me the bug is not resolved in kde neon unstable. 

I installed related packages in my kde neon user by adding
deb http://archive.neon.kde.org/unstable jammy main

I tried to identity the packages. There's no libkscreen package...

> Plasma things to be "5.26.80", not "5.26.5".

There aren't any packages with version 5.26.80 in KDE Neon unstable. So maybe I'm on the wrong track?

Here are the updated packages (some unrelated)

kscreen (4:5.26.5+p22.04+tunstable+git20230118.0241-0)
kwin-common (4:5.26.5+p22.04+tunstable+git20230118.0014-0)
kwin-data (4:5.26.5+p22.04+tunstable+git20230118.0014-0)
kwin-wayland (4:5.26.5+p22.04+tunstable+git20230118.0014-0)
kwin-wayland-backend-drm (4:5.26.5+p22.04+tunstable+git20230118.0014-0)
kwin-wayland-backend-fbdev (4:5.26.5+p22.04+tunstable+git20230118.0014-0)
kwin-wayland-backend-virtual (4:5.26.5+p22.04+tunstable+git20230118.0014-0)
kwin-wayland-backend-wayland (4:5.26.5+p22.04+tunstable+git20230118.0014-0)
kwin-wayland-backend-x11 (4:5.26.5+p22.04+tunstable+git20230118.0014-0)
kwin-x11 (4:5.26.5+p22.04+tunstable+git20230118.0014-0)
layer-shell-qt (5.26.5+p22.04+tunstable+git20230116.0525-0)
libappstream4:amd64 (0.15.6-0xneon+22.04+jammy+unstable+build5)
libappstreamqt2:amd64 (0.15.6-0xneon+22.04+jammy+unstable+build5)
libkdecorations2-5v5:amd64 (4:5.26.5+p22.04+tunstable+git20230114.0118-0)
libkdecorations2private10:amd64 (4:5.26.5+p22.04+tunstable+git20230114.0118-0)
libkf5guiaddons5:amd64 (5.102.0+p22.04+tunstable+git20230116.1229-0)
libkf5guiaddons-bin (5.102.0+p22.04+tunstable+git20230116.1229-0)
libkf5guiaddons-data (5.102.0+p22.04+tunstable+git20230116.1229-0)
libkf5plasma5:amd64 (5.102.0+p22.04+tunstable+git20230118.0218-0)
libkf5plasmaquick5:amd64 (5.102.0+p22.04+tunstable+git20230118.0218-0)
libkf5prison5:amd64 (5.102.0+p22.04+tunstable+git20230116.1320-0)
libkf5screen7:amd64 (4:5.26.5+p22.04+tunstable+git20230117.0100-0)
libkf5screen-bin (4:5.26.5+p22.04+tunstable+git20230117.0100-0)
libkuserfeedbackcore1:amd64 (1.2.0+p22.04+tunstable+git20230118.0141-0)
libkwineffects14 (4:5.26.5+p22.04+tunstable+git20230118.0014-0)
libkwinglutils14 (4:5.26.5+p22.04+tunstable+git20230118.0014-0)
liblayershellqtinterface5 (5.26.5+p22.04+tunstable+git20230116.0525-0)
libpolkit-qt5-1-1:amd64 (0.114.0+p22.04+tunstable+git20220920.0916-0)
libqalculate22:amd64 (4.5.1-0xneon+22.04+jammy+unstable+build10)
libqt5core5a:amd64 (5.15.8+p22.04+tunstable+git20230118.0109-0)
libqt5dbus5:amd64 (5.15.8+p22.04+tunstable+git20230118.0109-0)
libqt5gui5:amd64 (5.15.8+p22.04+tunstable+git20230118.0109-0)
libqt5network5:amd64 (5.15.8+p22.04+tunstable+git20230118.0109-0)
libqt5printsupport5:amd64 (5.15.8+p22.04+tunstable+git20230118.0109-0)
libqt5script5:amd64 (5.15.8+p22.04+tunstable+git20230118.0141-0)
libqt5sql5:amd64 (5.15.8+p22.04+tunstable+git20230118.0109-0)
libqt5widgets5:amd64 (5.15.8+p22.04+tunstable+git20230118.0109-0)
libqt5xml5:amd64 (5.15.8+p22.04+tunstable+git20230118.0109-0)
plasma-workspace (4:5.26.5+p22.04+tunstable+git20230118.0240-0)
plasma-workspace-wayland (4:5.26.5+p22.04+tunstable+git20230118.0240-0)
Comment 117 René Fritz 2023-01-18 10:37:26 UTC
> For me the bug is not resolved in kde neon unstable. 

Well it has changed a little bit. 

There's the new widget in the taskbar. When I click in "extend to right" it doesn't work.
A second click brings up the external display. 
In tests with kcontrol panel I can activate the monitor but not always. 

This didn't work for me before. It was almost impossible to activate the monitor.

Still plugging in the cable doesn't work. Sometimes all screens are black and nothing happens. Unplug shows the default screen again.

The layout is not restored.
Comment 118 Dmitrii Chermnykh 2023-01-21 12:23:58 UTC
I have similar problem with hybrid amd+nvidia setup, but only after wake from sleep (reboot works fine)

The problem first appeared on 5.26 branch, still persists on 5.27 beta with new kscreen backend

STEPS TO REPRODUCE
1. Use amd+nvidia hybrid setup (using ryzen 5800 + nvidia 3050 ti)
X11 displays configuration:
```
Section "Files"
        ModulePath "/usr/lib/nvidia"
        ModulePath "/usr/lib32/nvidia"
        ModulePath "/usr/lib32/nvidia/xorg/modules"
        ModulePath "/usr/lib32/xorg/modules"
        ModulePath "/usr/lib64/nvidia/xorg/modules"
        ModulePath "/usr/lib64/nvidia/xorg"
        ModulePath "/usr/lib64/xorg/modules"
EndSection

Section "ServerLayout"
        Identifier "layout"
        Screen 0 "integrated"
        Inactive "nvidia"
        Option "AllowNVIDIAGPUScreens"
EndSection

Section "Device"
        Identifier "integrated"
        Driver "modesetting"
        BusID "PCI:6:0:0"
        Option "TearFree" "true"
        Option "DRI" "3"
        Option "VariableRefresh" "on"
        Option "AsyncFlipSecondaries" "on"
EndSection

Section "Screen"
        Identifier "integrated"
        Device "integrated"
        Option "AllowExternalGpus"
EndSection

Section "Device"
        Identifier "nvidia"
        Driver "nvidia"
        BusID "PCI:1:0:0"
        Option "RegistryDwords" "EnableBrightnessControl=1"
        Option "AsyncFlipSecondaries" "on"
EndSection

Section "Screen"
        Identifier "nvidia"
        Device "nvidia"
EndSection
```

2. Connect external screen via type c cable with display port alt mode protocol 
3. Put laptop into sleep mode
4. Wake the laptop up from sleep
5. Only internal screen is available, the external one sees no signal
6. Switch to tty2 and back (ctrl+alt+f2 -> ctrl+alt+f1)
7. Kernel refreshed the available screens and the external screen is available once again

OBSERVED RESULT
External display loses signal after sleep-wakeup cycle

EXPECTED RESULT
External display reconnects automatically 

POSSIBLE WORKAROUNDS:
Ask kernel/x11 to rescan displays when quirky hardware is detected

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 
(available in About System)
archlinux packages
KDE Plasma Version: 5.26.5 
KDE Frameworks Version: 5.102.0
Qt Version: 5.15.8+kde+r174-1
NVIDIA drivers: 525.85.05-1
Linux kernel: 6.1.7-zen1-1-zen
Comment 119 retired 2023-01-24 18:19:20 UTC
Seems resolved in my case, so far. I use a laptop with Optimus setup. Nvidia drivers pinned at 520.56.06 because latest version breaks Optimus on my system. But that's on Nvidia probably.

Observed result:
External screen wakes up, there is a bunch of internal screen backlight flicker before the other monitor powers on.
Operating System: Arch Linux 
KDE Plasma Version: 5.26.90
KDE Frameworks Version: 5.102.0
Qt Version: 5.15.8
Kernel Version: 6.1.7-zen1-1-zen (64-bit)
Graphics Platform: X11
Processors: 16 × AMD Ryzen 7 4800H with Radeon Graphics
Memory: 15.0 GiB of RAM
Graphics Processor: AMD Radeon Graphics
Manufacturer: LENOVO
Product Name: 82B1
System Version: Lenovo Legion 5 15ARH05H
Comment 120 Oleksii Zolotarevskyi 2023-01-24 21:39:05 UTC
Unfortunately still reproducible in latest KDE Neon Unstable Edition.
Plasma version is reported as 5.28.80 (while the packages have 5.26.5 in the names).
Comment 121 Nate Graham 2023-01-25 16:46:57 UTC
Darn. Thanks for the info. We'll try to investigate it more thoroughly.
Comment 122 Rainer Klier 2023-01-26 07:51:09 UTC
two days ago i updated to:
KDE Plasma Version: 5.26.90
KDE Frameworks Version: 5.102.0
Qt Version: 5.15.8
Kernel Version: 6.1.7-2.g2ebd33f-default (64-bit)

but the issue is still present.
there is no difference.
and i can report additional info:
at the office, i have an additional monitor, which is connected to the notebook via a thunderbolt-2-dvi-adapter.
and when both monitors are connected (hdmi and thunderbolt) then all 3 screens are black/empty.
only the notebook screen is active, i can see the mouse pointer and move it around.
the external monitors are inaktive.
when i then unplug one of the external monitors, suddenly the notebook screen shows the desktop and i can enable the other external monitor.
with just one monitor attached, the behaviour is like before.
Comment 123 me 2023-01-26 08:59:21 UTC
I can confirm - same here!

(In reply to Rainer Klier from comment #122)
> two days ago i updated to:
> KDE Plasma Version: 5.26.90
> KDE Frameworks Version: 5.102.0
> Qt Version: 5.15.8
> Kernel Version: 6.1.7-2.g2ebd33f-default (64-bit)
> 
> but the issue is still present.
> there is no difference.
> and i can report additional info:
> at the office, i have an additional monitor, which is connected to the
> notebook via a thunderbolt-2-dvi-adapter.
> and when both monitors are connected (hdmi and thunderbolt) then all 3
> screens are black/empty.
> only the notebook screen is active, i can see the mouse pointer and move it
> around.
> the external monitors are inaktive.
> when i then unplug one of the external monitors, suddenly the notebook
> screen shows the desktop and i can enable the other external monitor.
> with just one monitor attached, the behaviour is like before.
Comment 124 John 2023-01-28 03:53:41 UTC
I installed KDE neon Testing Edition today.  Previously on my Garuda Linux system, a laptop plus two monitors, I would lose the external monitors when waking from sleep.  With neon Testing, I could not get both monitors working at all, UNTIL a wake from sleep!!!  I tried all the usual tricks, enabling and disabling monitors, using the display dialog to move them around and nothing.  The Display dialog listed all three monitors, but the one connected to the display port was not part of the desktop.  This despite being recognized by Plasma's Display dialog and the Nvidia X Server Settings program.  However, when I put the system to sleep, it woke with all three monitors working as they should!!!

The good news is that they stayed working through multiple sleep / wake cycles.  Previously, they would stop working with every sleep / wake cycle.  

Some system information:
System Version: Legion 5 Pro 16ITH6 (display port and HDMI port, both driving monitors)
NVIDIA Driver Version: 525.78.01
Operating System: KDE neon Testing Edition
KDE Plasma Version: 5.26.90
KDE Frameworks Version: 5.103.0
Qt Version: 5.15.8
Kernel Version: 5.15.0-58-generic (64-bit)
Graphics Platform: X11
Processors: 16 × 11th Gen Intel® Core™ i7-11800H @ 2.30GHz
Memory: 15.4 GiB of RAM
Graphics Processor: Mesa Intel® UHD Graphics
Manufacturer: LENOVO
Product Name: 82JF
Comment 125 retired 2023-01-28 19:08:17 UTC
Created attachment 155742 [details]
screenshot

Too soon? My external monitor didn't wake up after sleep. It was off on lock screen. After waking up it came back on, but my primary screen is corrupted. Logging off and back on fixes corruption.
Comment 126 Fonic 2023-02-12 10:27:23 UTC
(In reply to Fonic from comment #89)
> I'm experiencing this bug in a slightly different manner (screen
> configuration reverts from 1920x1080 to 1024x768 for both screens after
> suspend/wakeup). I'm running Gentoo Linux with KScreen packages version
> 5.25.5 and NVIDIA drivers version 515.86.01. According to my package
> manager, the KScreen packages were installed on 10/02/22 and the NVIDIA
> driver on 12/10/22.
> 
> Since the bug started to show itself only a couple of days ago, I'd say it
> is related to the NVIDIA driver, not to KScreen. And since I'm running
> KScreen version 5.25.5, I'd also say it is not related to KScreen version
> 5.26.

I'm starting to wonder if what I'm experiencing actually is the same bug as described here by others. Everything works fine for me, but after a couple of suspend/wake cycles (I'd say about 5-8), one of my two screens (sometimes both) are set to 1024x768. Once it starts happening, this occurs on EVERY subsequent suspend/wake cycle. Hibernation is not affected, though. This is SO annoying.

Disabling KScreen entirely and relying on the Xorg config alone for the screen setup does not seem to have any effect.

KDE Plasma Version: 5.26.5
KDE Frameworks Version: 5.99.0
Qt Version: 5.15.8
Kernel Version: 5.10.163-gentoo (64-bit)
Graphics Platform: X11
NVIDIA Drivers: 525.85.05
Comment 127 Benny Zen 2023-02-16 17:07:49 UTC
Just tested sleep in KDE Plasma 5.27 on Manjaro testing and wonder what: the bug is still there. 

Again I had to remove `~/.local/share/kscreen` folder and tediously rearrange all my screens.

So annoying. This is just unusable as a daily driver. I'm giving up on this, as months pass and no one seems to really care. Goodbye KDE.
Comment 128 Nate Graham 2023-02-17 20:33:52 UTC
*** Bug 465836 has been marked as a duplicate of this bug. ***
Comment 129 Nate Graham 2023-02-17 20:42:30 UTC
*** Bug 465866 has been marked as a duplicate of this bug. ***
Comment 130 Andreas 2023-02-19 13:26:16 UTC
Created attachment 156492 [details]
nvidia-settings second monitor

I have the same issues with Plasma 5.27 on Leap 15.4, X11, NVIDIA.
- settings are not saved after reconnecting the monitor
- after waking up from sleep (for example, after 15 minutes), the second monitor does not turn on and the reboot does not help.

Also, the second monitor does not work in offload mode, nvidia-settings shows the connected monitor, but it is not in the Plasma settings.
Comment 131 cappelikan 2023-02-19 23:10:33 UTC
I have two computers with two monitors based on nvidia gt210 and nvidia gt710, on gt210 with the nvidia-340 driver from the repository https://launchpad.net/~kelebek333/+archive/ubuntu/nvidia-legacy everything works without problems on nvidia-470 is crashing
Comment 132 cappelikan 2023-02-19 23:20:02 UTC
(In reply to cappelikan from comment #131)
> I have two computers with two monitors based on nvidia gt210 and nvidia
> gt710, on gt210 with the nvidia-340 driver from the repository
> https://launchpad.net/~kelebek333/+archive/ubuntu/nvidia-legacy everything
> works without problems on nvidia-470 is crashing

on both computers kde neon 5.27.0
Comment 133 brian 2023-02-20 03:47:02 UTC
I was surprised tonight that after upgrading to 5.27.0 from Fedora dnf update (full info below), the problem of more than two months suddenly seems fixed (my original Bug 464024).  It has survived a reboot and power down.  I will keep testing.

Really nice to see two monitors alive again :)


Operating System: Fedora Linux 37
KDE Plasma Version: 5.27.0
KDE Frameworks Version: 5.103.0
Qt Version: 5.15.8
Kernel Version: 6.1.11-200.fc37.x86_64 (64-bit)
Graphics Platform: X11
Processors: 8 × Intel® Core™ i7-6700K CPU @ 4.00GHz
Memory: 31.3 GiB of RAM
Graphics Processor: NVIDIA GeForce GTX 1080/PCIe/SSE2
Manufacturer: Gigabyte Technology Co., Ltd.
Comment 134 Steven Robbins 2023-02-20 04:00:55 UTC
(In reply to brian from comment #133)
> I was surprised tonight that after upgrading to 5.27.0 

Just upgraded my system to 5.27.0 today (Debian Sid) and sadly I have to report that the unplug/re-plug issue remains.


Operating System: Debian GNU/Linux 12
KDE Plasma Version: 5.27.0
KDE Frameworks Version: 5.103.0
Qt Version: 5.15.8
Kernel Version: 6.1.0-5-amd64 (64-bit)
Graphics Platform: X11
Processors: 16 × Intel® Core™ i9-9900K CPU @ 3.60GHz
Memory: 31.3 GiB of RAM
Graphics Processor: NVIDIA GeForce GTX 1050 Ti/PCIe/SSE2
Comment 135 brian 2023-02-20 04:06:47 UTC
(In reply to Steven Robbins from comment #134)
> (In reply to brian from comment #133)
> > I was surprised tonight that after upgrading to 5.27.0 
> 
> Just upgraded my system to 5.27.0 today (Debian Sid) and sadly I have to
> report that the unplug/re-plug issue remains.
> 

Being that I never had the second screen working at all after the initial failure, it is possible that there are more than one somewhat related issues that were thrown together in this bug report.  Or its also possible that once my screen sleeps, I'll be in your camp...
Comment 136 Nate Graham 2023-02-22 00:09:45 UTC
*** Bug 466035 has been marked as a duplicate of this bug. ***
Comment 137 Nate Graham 2023-02-22 03:10:57 UTC
*** Bug 466033 has been marked as a duplicate of this bug. ***
Comment 138 Linus Kardell 2023-02-22 15:54:02 UTC
It's recently gotten worse for me, because now it sometimes turns the second monitor off when resuming from screen energy saving. Both monitors are always enabled when resuming from suspend though (though that could be because I've just turned the monitors on, as I turn them off when suspending).

It looks like it tries to turn it on though, in the journal I get output like:

feb 22 16:12:04 feja kscreen_backend_launcher[17381]: kscreen.xrandr: RRSetCrtcConfig (enable output) 
                                                               Output: 481 ( "DP-4" ) 
                                                               New CRTC: 440 
                                                               Pos: QPoint(2560,0) 
                                                               Mode: KScreen::Mode(Id: "483" , Size: QSize(2560, 1440) @ 143.972 ) Preferred: "482" 
                                                               Rotation: KScreen::Output::None
feb 22 16:12:04 feja kscreen_backend_launcher[17381]: kscreen.xrandr: XRandRCrtc  440  m_timestamp update  31826050  =>  43872287
feb 22 16:12:04 feja kscreen_backend_launcher[17381]: kscreen.xrandr:         Result:  3  timestamp:  43872287
feb 22 16:12:04 feja kscreen_backend_launcher[17381]: kscreen.xrandr: Output failed to be Enabled:  "DP-4"

I also get the same thing if I try to reenable the screen after disabling it. In order to reenable the second screen, I first have to back out of the screen settings, wait until the screen shows "no signal", and then reenter the screen settings. I didn't leave and reenter the settings, or I reentered the settings before the screen started showing "no signal", I get and error like above.

Operating System: openSUSE Tumbleweed 20230220
KDE Plasma Version: 5.27.0
KDE Frameworks Version: 5.103.0
Qt Version: 5.15.8
Kernel Version: 6.1.12-1-default (64-bit)
Graphics Platform: X11
Processors: 16 × AMD Ryzen 7 5800X 8-Core Processor
Memory: 62.7 Gibyte of RAM
Graphics Processor: NVIDIA GeForce RTX 2080 Ti/PCIe/SSE2
Manufacturer: ASUS
Comment 139 brian 2023-02-23 01:23:49 UTC
Well it was nice while it lasted.  As I reported two days ago, my system was working after the 5.27.0 upgrade for the first time since Christmas.  It worked for a couple days including power offs, reboots.  But I never let the system sleep -- until today.  Once the screens slept, the second screen would not return on wake up.  And now even reboots and cold-boots will not let me re-activate that second screen again.  Its back to square one. 

And there were no system changes applied during this time.

My system details:
Operating System: Fedora Linux 37
KDE Plasma Version: 5.27.0
KDE Frameworks Version: 5.103.0
Qt Version: 5.15.8
Kernel Version: 6.1.11-200.fc37.x86_64 (64-bit)
Graphics Platform: X11
Processors: 8 × Intel® Core™ i7-6700K CPU @ 4.00GHz
Memory: 31.3 GiB of RAM
Graphics Processor: NVIDIA GeForce GTX 1080/PCIe/SSE2
Manufacturer: Gigabyte Technology Co., Ltd.
Comment 140 Bob English 2023-02-23 01:54:43 UTC
(In reply to brian from comment #139)
> Well it was nice while it lasted.  As I reported two days ago, my system was
> working after the 5.27.0 upgrade for the first time since Christmas.  It
> worked for a couple days including power offs, reboots.  But I never let the
> system sleep -- until today.  Once the screens slept, the second screen
> would not return on wake up.  And now even reboots and cold-boots will not
> let me re-activate that second screen again.  Its back to square one. 
> 
> And there were no system changes applied during this time.
> 
> My system details:
> Operating System: Fedora Linux 37
> KDE Plasma Version: 5.27.0
> KDE Frameworks Version: 5.103.0
> Qt Version: 5.15.8
> Kernel Version: 6.1.11-200.fc37.x86_64 (64-bit)
> Graphics Platform: X11
> Processors: 8 × Intel® Core™ i7-6700K CPU @ 4.00GHz
> Memory: 31.3 GiB of RAM
> Graphics Processor: NVIDIA GeForce GTX 1080/PCIe/SSE2
> Manufacturer: Gigabyte Technology Co., Ltd.

If you read this entire thread you would have found out there is a way to get the monitor back.  At least manually until this is fixed:

If you delete any files with monitor layouts that are named like this: c2cda156c1e54840478e5af385672567 from:

$ /home/USER/.local/share/kscreen/ 
and
$ /home/USER/.local/share/kscreen/outputs

and logging off/ back in (not sure) or as I did: reboot, so new versions of the files will be regenerated as detected:  Viola', 2 Monitors again.  I did have to change their orientation in the settings though.

Theres another workaround in this thread too.
Comment 141 Nate Graham 2023-02-24 17:34:00 UTC
*** Bug 466208 has been marked as a duplicate of this bug. ***
Comment 142 Nate Graham 2023-02-24 19:14:36 UTC
*** Bug 466263 has been marked as a duplicate of this bug. ***
Comment 143 Nate Graham 2023-02-24 19:45:49 UTC
*** Bug 466312 has been marked as a duplicate of this bug. ***
Comment 144 cappelikan 2023-02-25 16:53:54 UTC
Created attachment 156714 [details]
second monitor thumbnail not showing

second monitor thumbnail not showing
Comment 145 cappelikan 2023-02-25 16:56:08 UTC
Created attachment 156715 [details]
second monitor thumbnail not showing 2

second monitor thumbnail not showing  2
Comment 146 Nate Graham 2023-02-25 18:02:10 UTC
I suspect this has been fixed by the fix for Bug 462725.

Anybody who can reproduce the issue and build software from source: can you patch KWin with 1d237c29655c7e3fb15fb9b71e5f167bd207593f, reboot, enable the external screen, reboot or put the system to sleep and then wake it up, and see if the issue is fixed now?

Thanks!
Comment 147 me 2023-02-25 18:33:50 UTC
Yes, i would do this immediately but I can not find the patch anywhere.
Can you please point me to the repo which contains this patch?

Regards
voc

On 25.02.23 19:02, Nate Graham wrote:
> https://bugs.kde.org/show_bug.cgi?id=460341
>
> --- Comment #146 from Nate Graham <nate@kde.org> ---
> I suspect this has been fixed by the fix for Bug 462725.
>
> Anybody who can reproduce the issue and build software from source: can you
> patch KWin with 1d237c29655c7e3fb15fb9b71e5f167bd207593f, reboot, enable the
> external screen, reboot or put the system to sleep and then wake it up, and see
> if the issue is fixed now?
>
> Thanks!
>
Comment 148 Dmitrii Chermnykh 2023-02-25 18:46:16 UTC
(In reply to Nate Graham from comment #146)
> I suspect this has been fixed by the fix for Bug 462725.
> 
> Anybody who can reproduce the issue and build software from source: can you
> patch KWin with 1d237c29655c7e3fb15fb9b71e5f167bd207593f, reboot, enable the
> external screen, reboot or put the system to sleep and then wake it up, and
> see if the issue is fixed now?
> 
> Thanks!

Patched `libkscreen` archlinux package, still reproduces  after sleep-wakeup cycle
Comment 149 Dmitrii Chermnykh 2023-02-25 18:51:12 UTC
> Yes, i would do this immediately but I can not find the patch anywhere.
> Can you please point me to the repo which contains this patch?
> 

https://invent.kde.org/plasma/libkscreen/-/merge_requests/107/diffs.patch
Comment 150 me 2023-02-25 19:19:30 UTC
Created attachment 156724 [details]
attachment-2948777-0.html

Sorry for being noisy before. I have found the repo myself. Nevertheless 
thank you for the link!

And YES it seems the bug has really being fixed with the 
1d237c29655c7e3fb15fb9b71e5f167bd207593f commit!
At least my external monitor at home behaves as expected now. Reboot, 
disconnect, reconnect ... everything is fine (currently).

The next prove (two external monitors via display port, beamer(s) via 
HDMI) can only be done on monday at the university.

My steps have been:
     git clone https://invent.kde.org/plasma/libkscreen.git
     git checkout 1d237c29655c7e3fb15fb9b71e5f167bd207593f
     mkdir build
     cd build
     cmake ../libkscreen
     make
     sudo make install

Best regards
Volker


On 25.02.23 19:51, Dmitrii Chermnykh wrote:
> https://bugs.kde.org/show_bug.cgi?id=460341
>
> --- Comment #149 from Dmitrii Chermnykh<chermnykh2001@gmail.com>  ---
>> Yes, i would do this immediately but I can not find the patch anywhere.
>> Can you please point me to the repo which contains this patch?
>>
> https://invent.kde.org/plasma/libkscreen/-/merge_requests/107/diffs.patch
>
Comment 151 Steven Robbins 2023-02-25 21:26:45 UTC
(In reply to Nate Graham from comment #146)
> I suspect this has been fixed by the fix for Bug 462725.
> 
> Anybody who can reproduce the issue and build software from source: can you
> patch KWin with 1d237c29655c7e3fb15fb9b71e5f167bd207593f

Very happy to report that patch (applied to 5.27.0 libkscreen as delivered in Debian sid) fixes the symptoms I've been experiencing -- namely that hot disconnect / reconnect of a monitor failed to enable it.

Thank you to the KDE screen team!!
Comment 152 Richard 2023-02-26 11:23:53 UTC
Coming from #466035.
KDE NEON user 
I downloaded the sources via "apt-get source libkf5screen-bin", applied the patch, build the package and installed it.
Finally, the crash is resolved and both monitors get activated after (hard) power off/on.

But there is still a small problem, the secondary monitor is activated first and all icons are moved there under the widgets.
I have to manually drag them back to the primary monitor.
But I do not think that this is part of this bug.
Comment 153 Rainer Klier 2023-02-27 09:16:15 UTC
i am looking forward testing this new code.
but i was not able to build the code from source. (i tried it, but it didn't work)
so i have to wait until updated packages (for opensuse tumbleweed) are released.
does anybody know when this patch will be released under which kscreen version?
Comment 154 Nate Graham 2023-02-27 14:17:21 UTC
Argh my mistake, sorry. The commit hash I referenced is indeed in libkscreen, not KWin. Glad to hear it's fixed people's issues! The change will be released tomorrow as a part of Plasma 5.27.2.

If you find that you still have this issue after upgrading and rebooting, that means your issue is something subtly different. So please either submit a new bug report for it, or else re-open your duplicate report, in case it was marked as a duplicate of this one.

Thanks again!
Comment 155 Rainer Klier 2023-03-02 07:55:41 UTC
hi,
it really works!
it is fixed!
yesterday i installed KDE frameworks 5.27.2, and now the issue is gone!

thank you so much.

can anybody, in short words, describe, what the issue was about?
it must have been something which was introduced in KDE frameworks 5.26.
Comment 156 Dmitrii Chermnykh 2023-03-02 10:37:56 UTC
Just updated to 5.27.2 
The issue described in https://bugs.kde.org/show_bug.cgi?id=460341#c118 still reproduces for me
Comment 157 René Fritz 2023-03-02 10:49:19 UTC
KDE Neon 5.27.2

The bug is fixed for me.

- Login in with the monitors already connected: works
- connecting monitors after login: works

Many Thanks for fixing this bug!
Comment 158 Nate Graham 2023-03-02 14:22:47 UTC
(In reply to Dmitrii Chermnykh from comment #156)
> Just updated to 5.27.2 
> The issue described in https://bugs.kde.org/show_bug.cgi?id=460341#c118
> still reproduces for me
Darn. Let's re-open that bug report and we'll investigate it separately. Thanks for confirming.

Glad it seems to be fixed for everyone else!
Comment 159 Nate Graham 2023-03-02 14:23:41 UTC
Oh oops, that wasn't a separate bug report. Dmitrii, can you please submit a new bug report for your issue? Thanks!
Comment 160 Dmitrii Chermnykh 2023-03-02 16:42:04 UTC
(In reply to Nate Graham from comment #159)
> Oh oops, that wasn't a separate bug report. Dmitrii, can you please submit a
> new bug report for your issue? Thanks!

I've submitted it at https://bugs.kde.org/show_bug.cgi?id=466705

I thought I'd send a notification here if I mark it in "see also" field
Comment 161 Sebastian Turzański 2023-03-04 07:35:15 UTC
For me 5.27.2 still does not work as expected
at least I can reproduce 100% times the bug i reported https://bugs.kde.org/show_bug.cgi?id=466208 so It might be a separate one?
Maybe worth to reopen 466208?
Comment 162 yjcoshc 2023-03-17 09:04:01 UTC
I switch back from autorandr and can confirm that the problem has been fixed!
Comment 163 Amin Ya 2023-06-06 08:03:58 UTC
I had the same issue on KDE Neon 5.27.5. After hours of trying, I finally tried a set of commands and a certain version of Nvidia that fixed the issue. I have put them on my GitHub here:
https://github.com/aminya/AcuteLinux/blob/master/src/setup/setup-nvidia.bash

This uses the latest Nvidia graphics. I could only make this work on X11, and XWayland was very buggy and sluggish.

```
#!/usr/bin/bash
# -*- coding: utf-8 -*-
set -e
set -o pipefail

sudo add-apt-repository ppa:graphics-drivers/ppa

sudo apt update
sudo apt install -y nvidia-driver-535

# select nvidia
sudo prime-select nvidia

# set high-performance profile
sudo nvidia-smi -pm 1

echo "Please reboot your system and enroll the MOK key, then reboot again."
```
Comment 164 nikunjgoyal 2024-01-07 18:43:51 UTC
Hi,
I am facing the issue of not being able to turn on my external monitor once it goes into power saving. Infact if I connect my monitor and start the system it would be fine. But then when the session is going on if I turn the power of my monitor off and then turn it back on my os won't recognise the monitor. If I clear .local/share/kscreen and then log out and log in. Sometimes the external monitor turns back on and sometimes not. Please tell me if there's a fix for it.
I got a bit confused seeing all the stuff in this thread.
Comment 165 Dmitrii Chermnykh 2024-01-08 11:26:05 UTC
(In reply to nikunjgoyal from comment #164)
> Hi,
> I am facing the issue of not being able to turn on my external monitor once
> it goes into power saving. Infact if I connect my monitor and start the
> system it would be fine. But then when the session is going on if I turn the
> power of my monitor off and then turn it back on my os won't recognise the
> monitor. If I clear .local/share/kscreen and then log out and log in.
> Sometimes the external monitor turns back on and sometimes not. Please tell
> me if there's a fix for it.
> I got a bit confused seeing all the stuff in this thread.

Try https://download.nvidia.com/XFree86/Linux-x86_64/545.29.06/README/dynamicpowermanagement.html (Known Issues And Workarounds, p.4)