KDE on dom0, all guest windows disappearing on some random vms, upon suspend/resume

Hi,

I have been using KDE since Qubes 4.1 but I was having this issue and switched to Xfce. After the release of 4.2, I have installed KDE and I am very happy about the rich desktop experience. However, there is this issue, let’s say you have a vm running with multiple gui applications. This is fine, however at some point when the laptop is resumed from suspend, with my guess that an external screen being involved as well, after unlocking the screen, a minimize animation appears and all the vm’s windows disappear. But the qube remains running and its console is accessible through qube manager.

However, it is not possible to start a new window unless the qube is restarted. This has a negative impact on productivity, as you have to remember what was going on, which applications were running, etc. I mean, there is a motivation to fix this.

Also, I was able to look at the guest’s journal, dom0 /var/log/qubes/guid..log{,old} without any clues. During that case I tried to start a terminal, but no error or anything suspicious was added to the journal, nor the dom0 qube log.

I would like to be able to continue using KDE. Any suggestions?

Thanks!

Sorry, only suggestion I have is - do it like me: Turn off suspend mode. I turned off all - suspend, hibernation, screensaver. The only thing I have turned on, is turning off display, when I close the lid.

This only happens on KDE. XFCE is fine with suspend/resume; no windows disappear on XFCE after resuming from suspend.

I suspend regularly , and havent encountered this.
I’d see if this is related to your graphics card, and use of external
screen. Are you using the second monitor as well as the laptop, or
instead?
If it’s the latter then you could add a suspend hook to remove the
external screen on suspend, but then you will have to move windows to
the second screen as needed.

I am typically using the external monitor only. (In this case, the laptop screen appears as a disabled screen in KDE display settings, as expected.)

The laptop is on the move most of the time. There are four different cases when the connectivity is considered.

(i) The external screen is being attached when the laptop is suspended and not yet resumed,
(ii) The external screen is being attached when the laptop is already running
(iii) The external screen remains attached to the laptop, while the laptop is suspending and then resuming.
(iv) Same as (iii) but external screen is disconnected when resuming

I don’t know how KDE differs from XFCE in this context, but it makes sense to me.
I will check if it helps.

Thanks!

I’ve added this hook:

$ cat /etc/systemd/system/suspend\@.service 
[Unit]
Description=User suspend actions for KDE
Before=sleep.target

[Service]
User=%I
Type=simple
Environment=DISPLAY=:0
#ExecStart=/usr/bin/xrandr --output DP-5 --off
ExecStart=/home/myuser/remove-external-screens.sh

[Install]
WantedBy=sleep.target

remove-external-screens.sh:

$ cat remove-external-screens.sh 
#!/bin/sh
#
SCREENS=`/usr/bin/xrandr|grep -w connected|cut -f 1 -d ' '`

for i in $SCREENS; do /usr/bin/xrandr --output $i --off;  done

Will update on the results

I was able to reproduce it once, plugged in a displayport monitor, which triggered a screen layout propagation. The journal indicated that this happened 4 times. Among those logs, something was worth noting:

Mar 20 21:21:55 dom0 qvm-start-daemon[7363]: myvm1: Sending monitor layout
Mar 20 21:21:55 dom0 qvm-start-daemon[7363]: asyncio: Task exception was never retrieved
Mar 20 21:21:55 dom0 qvm-start-daemon[7363]: future: <Task finished name='Task-1684' coro=<DAEMONLauncher.send_monitor_layout() done, defined at /usr/lib/python3.11/site-packages/qubesadmin/tools/qvm_start_daemon.py:341> exception=ProcessLookupError(3, 'No such process')>
Mar 20 21:21:55 dom0 qvm-start-daemon[7363]: Traceback (most recent call last):
Mar 20 21:21:55 dom0 qvm-start-daemon[7363]:   File "/usr/lib/python3.11/site-packages/qubesadmin/tools/qvm_start_daemon.py", line 366, in send_monitor_layout
Mar 20 21:21:55 dom0 qvm-start-daemon[7363]:     os.kill(pid, signal.SIGHUP)
Mar 20 21:21:55 dom0 qvm-start-daemon[7363]: ProcessLookupError: [Errno 3] No such process
Mar 20 21:21:55 dom0 qvm-start-daemon[7363]: gpg-backend: Sending monitor layout
Mar 20 21:21:55 dom0 qvm-start-daemon[7363]: myvm2: Sending monitor layout
Mar 20 21:21:55 dom0 qvm-start-daemon[7363]: myvm3: Sending monitor layout
Mar 20 21:21:55 dom0 qvm-start-daemon[7363]: asyncio: Task exception was never retrieved
Mar 20 21:21:55 dom0 qvm-start-daemon[7363]: future: <Task finished name='Task-1687' coro=<DAEMONLauncher.send_monitor_layout() done, defined at /usr/lib/python3.11/site-packages/qubesadmin/tools/qvm_start_daemon.py:341> exception=ProcessLookupError(3, 'No such process')>
Mar 20 21:21:55 dom0 qvm-start-daemon[7363]: Traceback (most recent call last):
Mar 20 21:21:55 dom0 qvm-start-daemon[7363]:   File "/usr/lib/python3.11/site-packages/qubesadmin/tools/qvm_start_daemon.py", line 366, in send_monitor_layout
Mar 20 21:21:55 dom0 qvm-start-daemon[7363]:     os.kill(pid, signal.SIGHUP)
Mar 20 21:21:55 dom0 qvm-start-daemon[7363]: ProcessLookupError: [Errno 3] No such process
Mar 20 21:21:55 dom0 qvm-start-daemon[7363]: myvm4: Sending monitor layout
Mar 20 21:21:55 dom0 qvm-start-daemon[7363]: myvm5: Sending monitor layout
Mar 20 21:21:55 dom0 qvm-start-daemon[7363]: myvm6: Sending monitor layout
Mar 20 21:21:55 dom0 qvm-start-daemon[7363]: myvm7: Sending monitor layout
Mar 20 21:21:55 dom0 qvm-start-daemon[7363]: myvm8: Sending monitor layout
Mar 20 21:21:55 dom0 qvm-start-daemon[7363]: myvm9: Sending monitor layout

Only myvm1 and myvm3 windows disappeared. Might that be related to the error log following the respective lines of below the vms? Namely the send_monitor_layout, failing, but why could that happen, and how can this situation be diagnosed further?