I am sorry for the monolog, but I have some further ideas and findings.
I see two promising options to make screensharing great again:
a. VM screensharing: It would share the screen of the current VM and nothing else. We need to get in-VM screenshots working for this. Or you can use a VNC loopback session with its drawbacks.
b. Full screensharing. This requires to pipe screen contents from dom0 to a specific domU. Maybe we need to stream it to some window that cover everything while being ignored by qubes-gui.
When considering the most common VMs in Qubes, none of those two variants currently works well. When I try to screenshot the main X11 of a PV domU, I get a solid white image. This is true for any screenscrapping technique I have tried. I am not sure what is the reason of white screenshot, but I've traced it a bit:
* The color is not related to xsetroot call in /usr/bin/qubes-session (i.e., you can change it to some other color in a StandaloneVM and reboot it, but you will still get white screenshot).
* It is not related to xorg.conf and/or the dummyqbs driver. First, changing “dummyqbs” to “dummy” does not help. Second, when I copy /etc/X11/xorg-qubes.conf to /etc/X11/xorg.conf run a second X11 session (as :1) and screenshot it (e.g., env DISPLAY=:1 scrot out.png && feh out.png), the screenshot works. (Maybe you will want to run something there to see it, e.g., env DISPLAY=:1 xterm&.)
* It is not related to window manager. When i run a WM (Openbox) in standard Qubes session, it does not help. I believe it is also true vice versa.
* It seems to be related to qubes-gui process. When I kill it, screenshots (and thus screensharing) starts working. But obviously, you cannot interact with the GUI.
You can see it on a simple experiment. I've used two sessions of a DVM started by command qvm-run '$dispvm' bash. This creates some inconvenient Bash session (e.g., you cannot see prompts and error messages), but it is good enough to run few commands as follows:
sudo apt install scrot # Install screenshoting app. Adjust this if you are not on Debian.
xterm& # run some app that will be seen on screenshot
# sudo killall qubes-gui # Run this in one VM only in order to see differences.
ps aux | grep qubes-gui # See if it is killed
(rm -f out.png && scrot out.png && cat out.png | qvm-run '$dispvm' 'feh -') 2>&1 # Look at the result. Since the VM might be incapable of showing some GUI, I start a new VM.
You might need to adjust the commands or your environment a bit (e.g., install feh if not installed), but it should be trivial and obvious.
I do not know why qubes-gui makes such difference. The source is at https://github.com/QubesOS/qubes-gui-agent-linux/blob/master/gui-agent/vmside.c
, but I still don't know why it behaves this way. There are two occurrences of “white” (case-insensitive), but I don't understand the code much. But I have found some interesting part: “/* pretend that GUI agent is window manager */”. So, it tries to look like some window manager. This is strange, as Openbox does not complain that some WM is already running when I run it within a Qubes session. But I don't understand X11 details much, which is probably the reason I don't understand the linked source code much.
No, I don't have a solution. I have few intermediate results that might be useful for someone to find something more.
Vít Šesták 'v6ak'