Getting older, not necessarily wiser!
Have you ever spun up a Virtual Machine (VM) in Virtualbox and the resolution was 800 x 600? While this is okay for text displays, it kind of sucks for a Graphical User Interface (GUI)! I am going to spin up a VM and fix the GUI display so it comes up at the correct resolution.
Virtualbox tends to adjust its display size to match what your Operating System (OS) is calling for. The problem is that the Virtualbox display is a window and not a monitor, so there is no real default resolution for your OS to latch onto. So we end up with the old SVGA 800 x 600 resolution.
Per my usual, I am listing my setup. This way you can compare to what you have to see if this might answer a question or problem you are having.
I am using VirtualBox (at the time of this writing version 7.0.2). I am spinning up an Arch Linux VM that will be using Xorg, JWM, and LxDM (part of the LxQT desktop). I am targeting a working resolution of 1920×1080.
One way to fix this is to use the xrandr program. Once the Xserver is started, simply running xrandr with no options will bring up available resolutions. Running it with the -s option will allow you to set your resolution to one of the available ones. For example;
xrandr -s 1920x1080
You can add this as a startup command in the JWM configuration file. This fixes the window manager GUI. However the Display Manager, LxDM, will still be displayed at 800 x 600.
For what I am doing I need another solution.
Note you should be root to do this, though it can be done using sudo.
My first step is to copy all my available resolutions to a text file, so I can review them at my leisure without rerunning xrandr.
xrandr > res.txt
Next I want to create a skeleton xorg.conf file. To do this I run the following command.
Xorg :9 -configure
The number used is irrelevant as long as it is not the same as a currently existing display. So avoid 0 or 1, and if you are running dual monitors avoid 2 also. The number 9 should be high enough that I won’t get an error about an existing display.
This command will create a file in the root home directory called “xrog.conf.new”. If you want you can make a backup copy of this file before editing.
Open the file in your favorite text editor. Scroll down to Section “Screen”. You are going to have several SubSection “Display” entries, each for a different color depth. With the exception of the one containing Depth 24, I deleted the rest of them.
In the remaining SubSection “Display” I added a new line with the text; modes “1920×1080”. I then save the file.
Now I copy the file I just edited to the configuration directory for X11, changing its name in the process.
cp /root/xorg.conf.new /etc/X11/xorg.conf.d/xorg.conf
Now I simply restart my VM, and it comes up in the 1920×1080 resolution.
This was a quick fix to a specif issue that many people experience with VirtualBox, in that the VM comes up at a low resolution.
Two possible solutions were presented in this post.