0

I'm running Ubuntu 18.04 as a guest in VirtualBox 5.2.8 on Windows 10. I have the default settings on VirtualBox on the host.

On the guest, I started with a command-prompt install, then installed sudo apt-get install lubuntu-desktop. This appears to install the lightdm login screen which runs upon boot. After logging into Lubuntu, I can go to Preferences > Monitor Settings, and choose among some predefined monitor sizes, which take effect immediately by clicking "Apply". Unfortunately the choices are limited and none are close to the size I want. (I want approximately 1800 x 950.)

So I installed Guest Additions using sudo apt-get install virtualbox-guest-dkms. Now when the lightdm login screen first loads at boot time, it automatically sizes to match the VM window. However, it doesn't change with further resizing of the VM window. But I can go to Preferences > Monitor Settings and select the new choice called "Auto" and at the moment I click Apply, it resizes to match the VM window. (Edit: Looks like it also resizes by running xrandr --output VGA-1 --auto, which avoids the problems mentioned below.)

So far so good, but now "sometimes" when I go to Preferences > Monitor Settings, it shows VGA Monitor with "Turn on" unchecked and disabled, and clicking Apply gives an error message that you cannot remove all monitors. Another time, after logging in at the lightdm login screen, it would go to a black screen and wouldn't do anything, although fortunately I was able to get to a console by pressing Ctrl+Alt+F1. Finally I found the file ~/.config/autostart/lxrandr-autostart.desktop which for some reason was set as follows, apparently to turn off the monitor:

[Desktop Entry]
Type=Application
Name=LXRandR autostart
Comment=Start xrandr with settings done in LXRandR
Exec=sh -c 'xrandr --output VGA-1 --off'                         <-- suspected problem
OnlyShowIn=LXDE

Deleting this file solved the black screen problem and I was able to log in again.

My questions (answers to any question will be appreciated):

  1. Is this really the preferred way to resize the monitor in a VM? Is there a better way?
  2. Is there a way to make it resize immediately whenever I resize the VM window?
  3. Are monitor settings mainly controlled by lxrandr wrapping around xrandr or are other tools involved?
  4. How are the monitor settings controlled for the lightdm login screen?
  5. Why does lxrandr sometimes try to remove the only monitor (ie, "Turn on" unchecked and disabled)?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.