[Software] Debian guest desktop not resizing in Spice viewer despite use of recommended configuration

Linux Kernel, Network, and Services configuration.
Post Reply
Message
Author
brainchild
Posts: 36
Joined: 2022-11-13 13:59
Been thanked: 2 times

[Software] Debian guest desktop not resizing in Spice viewer despite use of recommended configuration

#1 Post by brainchild »

I have provisioned a Debian 11 bullseye system as a QEMU/KVM guest on a Linux host. The guest runs XFCE, but the display is not scaling with the viewer window, provided by the Spice client in Virtual Machine Manager.

From experience, and from various resources, I have understood the process of configuring such support as follows:
  1. Ensure the following packages are installed:
    • qemu-guest-agent
    • spice-vdagent
    • xserver-xorg-video-qxl
  2. Ensure that the service is enabled in systemctl called spice-vdagent.
  3. Ensure that the spice client is configured for auto-scaling (in Virtual Machine Manager, View / Scale display / Auto resize VM with window)
However, even though I have completed these steps, the guest desktop will not resize according to the size of the display window.

I have rebooted the guest system several times, including completing a full power down, from the standpoint of the QEMU hypervisor.

What is left to try?

peer
Posts: 510
Joined: 2017-03-26 10:14
Has thanked: 10 times
Been thanked: 31 times

Re: [Software] Debian guest desktop not resizing in Spice viewer despite use of recommended configuration

#2 Post by peer »

I did have the same problem. I was able to resize the screen manually. So I created a script (with xrandr) to do this for me and start the script at boot. Here is my script:

Code: Select all

#!/bin/bash
count=0
while [[ count -le 100 ]]
do
  text=$(/usr/bin/xrandr | grep "current")
  if [[ $text == *"1920 x 916"* ]]
  then
      count=1000
  fi
  echo $count
  sleep .1
  /usr/bin/xrandr --output Virtual-1 --mode 1920x916
done   

brainchild
Posts: 36
Joined: 2022-11-13 13:59
Been thanked: 2 times

Re: [Software] Debian guest desktop not resizing in Spice viewer despite use of recommended configuration

#3 Post by brainchild »

peer wrote: 2022-11-13 14:46 I did have the same problem. I was able to resize the screen manually. So I created a script (with xrandr) to do this for me and start the script at boot.
Thank you for the information about your solution.

Do you have any idea what is the underlying problem, or whether it is a known issue?

brainchild
Posts: 36
Joined: 2022-11-13 13:59
Been thanked: 2 times

Re: [Software] Debian guest desktop not resizing in Spice viewer despite use of recommended configuration

#4 Post by brainchild »

By the way, the call to xrandr has only set the desktop to different preset dimensions, not to the dimensions of the window.

CwF
Global Moderator
Global Moderator
Posts: 3073
Joined: 2018-06-20 15:16
Location: Colorado
Has thanked: 63 times
Been thanked: 254 times

Re: [Software] Debian guest desktop not resizing in Spice viewer despite use of recommended configuration

#5 Post by CwF »

brainchild wrote: 2022-11-13 14:21 Virtual Machine Manager, View / Scale display / Auto resize VM with window
Do you want the guest to change its desktop resolution or do want it scaled within the host window?
'Always' setting will scale so that the entire guest desktop is displayed within host viewer.
Mottainai

brainchild
Posts: 36
Joined: 2022-11-13 13:59
Been thanked: 2 times

Re: [Software] Debian guest desktop not resizing in Spice viewer despite use of recommended configuration

#6 Post by brainchild »

CwF wrote: 2022-11-13 18:10 Do you want the guest to change its desktop resolution or do want it scaled within the host window?
'Always' setting will scale so that the entire guest desktop is displayed within host viewer.
I want the guest display to be unscaled, but its dimensions to assume those of the portal for the window given by the host viewer.

Such is the way I commonly use VMM, and is achieved by the combination Only when Fullscreen and Auto resize VM with window.

Because I am familiar with this usage for various guests in the same host environment, I believe I am experiencing some limitation on the Debian guest.

CwF
Global Moderator
Global Moderator
Posts: 3073
Joined: 2018-06-20 15:16
Location: Colorado
Has thanked: 63 times
Been thanked: 254 times

Re: [Software] Debian guest desktop not resizing in Spice viewer despite use of recommended configuration

#7 Post by CwF »

brainchild wrote: 2022-11-13 19:00 I believe I am experiencing some limitation on the Debian guest.
Is spice-vdagent installed in the guest?
Mottainai

brainchild
Posts: 36
Joined: 2022-11-13 13:59
Been thanked: 2 times

Re: [Software] Debian guest desktop not resizing in Spice viewer despite use of recommended configuration

#8 Post by brainchild »

CwF wrote: 2022-11-13 19:19 Is spice-vdagent installed in the guest?
Yes... as explained originally. Please see the question post for the complete set of steps already taken.

CwF
Global Moderator
Global Moderator
Posts: 3073
Joined: 2018-06-20 15:16
Location: Colorado
Has thanked: 63 times
Been thanked: 254 times

Re: [Software] Debian guest desktop not resizing in Spice viewer despite use of recommended configuration

#9 Post by CwF »

brainchild wrote: 2022-11-13 20:25 Yes... as explained originally
sorry, my bad
Mottainai

peer
Posts: 510
Joined: 2017-03-26 10:14
Has thanked: 10 times
Been thanked: 31 times

Re: [Software] Debian guest desktop not resizing in Spice viewer despite use of recommended configuration

#10 Post by peer »

brainchild wrote: 2022-11-13 15:06
peer wrote: 2022-11-13 14:46 I did have the same problem. I was able to resize the screen manually. So I created a script (with xrandr) to do this for me and start the script at boot.
Thank you for the information about your solution.

Do you have any idea what is the underlying problem, or whether it is a known issue?
I have installed debian several times in qemu/kvm. Sometimes resizing just works and sometimes it does not. I do not know why this happens.

debian-testing
Posts: 2
Joined: 2024-11-02 18:49

Re: [Software] Debian guest desktop not resizing in Spice viewer despite use of recommended configuration

#11 Post by debian-testing »

This is a known bug, same for XFCE, LXDE, etc, most others except for Gnome.

https://gitlab.xfce.org/xfce/xfce4-sett ... issues/142
https://bugzilla.redhat.com/show_bug.cgi?id=1290586
https://github.com/mate-desktop/marco/issues/338
https://stackoverflow.com/questions/419 ... ot-working
https://superuser.com/questions/1183834 ... rt-manager

Possible solutions:
https://gitlab.com/apteryks/x-resize
https://gist.github.com/3lpsy/4cc344ae0 ... 536cbd3275

Hopefully this will be integrated into Debian eventually. I haven't found the specific Debian bug opened for this issues, if anyone knows it, please reply with it. I will add this info.
Last edited by debian-testing on 2024-11-02 19:04, edited 2 times in total.

trinidad
Posts: 316
Joined: 2016-08-04 14:58
Been thanked: 17 times

Re: [Software] Debian guest desktop not resizing in Spice viewer despite use of recommended configuration

#12 Post by trinidad »

I have rebooted the guest system several times
Rebooting the guest OS will not resize the window with Spice because of RAM and boot sequence. After you are logged into the running fully booted guest system just logout of the guest and then log back in from its login screen. Do not reboot. Spice settings are lost with a reboot on most systems.

TC
You can't believe your eyes if your imagination is out of focus.

User avatar
pbear
Posts: 509
Joined: 2023-08-27 15:05
Location: San Francisco
Has thanked: 2 times
Been thanked: 81 times

Re: [Software] Debian guest desktop not resizing in Spice viewer despite use of recommended configuration

#13 Post by pbear »

brainchild wrote: 2022-11-13 14:21 What is left to try?
You could try this. Notice also CwF's alternate solution in the next post.

peer
Posts: 510
Joined: 2017-03-26 10:14
Has thanked: 10 times
Been thanked: 31 times

Re: [Software] Debian guest desktop not resizing in Spice viewer despite use of recommended configuration

#14 Post by peer »

I use the following workaround in grub:
I change the line: GRUB_CMDLINE_LINUX_DEFAULT=............0" to:

Code: Select all

GRUB_CMDLINE_LINUX_DEFAULT="video=Virtual-1:1920x916@60"
Virtual-1 is the name of display adapter
1920x916@60 is the wanted size on my pc
After updating grub I can select the new screensize in the guest os.
Unfortunately this does not always work. So I have a second workaround. This is a script for Xorg that I run directly after boot:

Code: Select all

#!/bin/bash

# screensize = 1920x916x60
# first create modeline
modeline=$(cvt 1920 916 60)
modeline=${modeline#*Modeline } # substring starting after modeline
modelineshort=$(echo $modeline| cut -d' ' -f 1) #first word in string


# get screenname
screenname=$(xrandr | grep " connected")
screenname=${screenname%connected*}
screenname=$(echo $screenname| cut -d' ' -f 1) #first word in string

newmode=$modeline
addmode=$screenname" ""$modelineshort"
output=$screenname" --mode "$modelineshort
echo $newmode
echo $addmode
echo $output

# add mode to set
echo "1"
xrandr --newmode $newmode
echo "2"
# add mode to screenname
xrandr --addmode $addmode
# choose  mode
xrandr --output $output

User avatar
blackbird
Posts: 90
Joined: 2023-08-17 04:42
Has thanked: 3 times
Been thanked: 19 times

Re: [Software] Debian guest desktop not resizing in Spice viewer despite use of recommended configuration

#15 Post by blackbird »

I have a Debian 12 with KDE VM running on VirtManager and had the same problem. For me it helped to switch to X11, run "xrandr --output Virtual-1 --auto". After that resizing to the window size worked, also after switching back to Wayland.
My not so qualified opinion on this is that it's necessary to remove any manually set resolution so the automatic resizing works. Earlier I had similar problems with VMs in VirtualBox when I set manually a resolution.

Post Reply