Debian HVM - small screen resolution

Based on this topic on adding a virtual network interface:

We can try adding a virtual display:

In dom0:

sudo mkdir /etc/libvirt/hooks/
sudo nano /etc/libvirt/hooks/libxl

Paste this script inside:

#!/bin/bash
guest_name="$1"
libvirt_operation="$2"
timeout=60

if [ "$guest_name" = "myvmname" ] && [ "$libvirt_operation" = "started" ]; then
    (
        exec 0</dev/null
        exec 1>/dev/null
        exec 2>/dev/null
        for i in $(seq 1 $timeout);
        do
            if qvm-ls --running $guest_name | grep -q Running; then
                xl vdispl-attach $guest_name Connectors='id0:1920x1080;id1:800x600;id2:640x480'
                break
            fi
            sleep 1
        done
    ) & disown
fi

Then add execute permission command:

sudo chmod +x /etc/libvirt/hooks/libxl

Reboot.

The syntax for adding a virtual display is described in more detail in the documentation:
https://xenbits.xen.org/docs/unstable/man/xl.1.html#VDISPL-DEVICES

Problem is that the virtual is running, so it can’t attach and use.

But it can’t do it while powered off either.

What do you add your display to? Is it a Qubes Template? Or is it one you have installed yourself that is an HVM, for example, Devuan?

This is the script that I have on my machine to make it easier to apply a resolution when doing things. This way I can make sure everything is right before I apply the resolution.

It first does all the settings, so I can go and check in xrandr and all to see if the settings are all there appropriately. After that I can just tell it to apply the resolution.

You may also notice that I remove the hsync and vsync from the Modeline, as it often causes issues having it there.

wid=$1
hei=$2
maxset=2096688
val=$(($wid*$hei))
if [ $maxset -lt $val ]; then
  echo "WARNING! Number of pixels may be more than can be handled. $val > $maxset ";
fi
 echo $val " pixels in this resolution "
 modeline=`cvt $wid $hei | grep "Modeline" | sed "s/Modeline //" | sed "s/-hsync +vsync//"`
 widthheight=`cvt $wid $hei $ref | awk -F[\"] '{print $2}' | tr -d [:space:]`


 echo "xrandr --newmode $modeline"
 echo "xrandr --addmode Virtual-1 \"$widthheight\""
 echo "xrandr --output Virtual-1 --mode \"$widthheight\""


read -r -p 'Apply this resolution?' choice
case "$choice" in
  n|N) break;;
  y|Y) xrandr --newmode $modeline ; xrandr --addmode Virtual-1 "$widthheight";  xrandr --output Virtual-1 --mode "$widthheight"; break;;
  *) echo 'no response';
esac

Also, have you tried adding such a high resolution? 2560x1440 ?

I tried the code… It fails dismally…

I run the following…

xl vdispl-attach ScreenSizer-1 Connectors='id0:2560x1440;id1:2560x1080;id2:800x600'

I get the message…

Unknown string "Connectors=id0:2560x1440;id1:2560x1080;id2:800x600" in vdispl spec

So this is very confusing… It isn’t working…

And yes I have got my menu system for hooks/libxl running, so I know that it’s working properly and executing correctly.
This command I’m running manually on the guest to see what the error was, and that’s what the error is.

I installed 3 HVM operating systems:

devuan_beowulf_3.1.1_amd64_desktop

devuan_chimaera_4.0.0_amd64_desktop

devuan_daedalus_5.0.1_amd64_desktop

I added different screen resolutions to each virtual machine (Devuan HVM) using xrandr.
2560x800, 2560x900, 2560x1000, 2560x1200, 2560x1300, 2560x1440, 2560x1600.

Test results with these operating systems:

devuan_beowulf_3.1.1_amd64_desktop : Maximum screen resolution 2560x1300

devuan_chimaera_4.0.0_amd64_desktop : Maximum screen resolution 2560x800

devuan_daedalus_5.0.1_amd64_desktop : Maximum screen resolution 2560x800

Yes, I tried absolutely everything, I re-read the forum, I re-read Google, I tried everything you suggested, I tried everything that people suggested in other topics on the forum, I tried praying to God, all that remains is to go to church and light a candle, I tried the rest and it didn’t give any results.
I don’t know what else I can try, I can get the screen resolution to 2560x1600 in Windows HVM, without installing Qubes Tools. This is not possible in Linux, and it is very strange.

I took this part of the code from the documentation, a Google search did not yield any results.

Thank you very much for trying to help, it’s very rare to see such an attitude on this forum, I really appreciate it.
But I think that our efforts will not yield results, apparently this is a problem with the Qubes OS, and you and I are powerless here =(

Ok, I was able to fix the issue with resolution by increasing the qube’s video ram in Xen config.
You can test whatever this will fix it for you as well by running these commands in dom0:

sudo mkdir -p /etc/qubes/templates/libvirt/xen/by-name/
cat << 'EOF' | sudo tee /etc/qubes/templates/libvirt/xen/by-name/YourQubeName.xml
<!-- import default template-->
{% extends 'libvirt/xen.xml' %}
<!-- we wanna alter the devices block -->
{% block devices %}
    <!-- import default device block -->
    {{ super() }}
    <!-- manual video config -->
    <video>
      <model type='vga' vram='32768' heads='1' primary='yes'/>
    </video>
{% endblock %}
EOF

Change YourQubeName to your qube name.

3 Likes

Yahuuuuuuuuuuuuuuuuuuuuuuuu!
It works, I just can’t believe it, you’re just a magician =)
Thank you.

And so, I promised a monetary reward for a working method, please send me a Bitcoin wallet in private messages if this payment method is acceptable to you.
Thanks again.

As always App, nicely done!

Brilliant fix.

So why didn’t setting the VRAM the normal way work?

You can donate to Qubes OS instead:

I’ve checked a little and it seems that the gui-videoram-min and gui-videoram-overhead features only work for qubes with Qubes OS GUI agent installed. It’s not changing the assigned video ram in Xen config but the dom0 is passing the VRAM configuration using QubesDB.
If you change the gui-videoram-min or gui-videoram-overhead features and start a qube with Qubes OS GUI agent installed then you can check that the VRAM configuration was passed to it:

qubesdb-read /qubes-gui-videoram-overhead
32768
3 Likes

Well fair enough… So it doesn’t do what the option says it should do…

I think that they need to fix that. Now I need to find out how to report a bug… Because that is a BIG BUG.

Thanks for the fix for that issue. Greatly appreciated as always.

Done. Thanks again.

4 Likes

hello
i see this but wonder can set heads?
if set heads how to set monitors there?
that will create new gui windows to use as more monitors?

What does “can set heads” mean?

I never presume to speak for the Qubes team.
When I comment in the Forum I speak for myself.

I think the Qubes OS currently only supports one virtual monitor for a VM. I’m not sure if it’s a Qubes tools or stubdom restriction: