Add resolutions in OpenBSD VM (libvirt/qemu)

Wanted to test OpenBSD as a desktop, I spun up a VM using virt-manager (libvirt) and walked through the install process. After getting all setup, I found I could only set a few different resolutions, none of which where all that high. This is due to the fact that by default (unless you passed through a GPU into the VM) you’ll be using the vesa driver. This is fine for what I’m doing, I just want to expose more resolution options.

To fix this, you need to manually configure Xorg with the snippet below.

First, create the xorg.conf directory. Note, these commands need to be done as the root user

mkdir /etc/X11/xorg.conf.d

Then copy/paste the below into your terminal.

cat > /etc/X11/xorg.conf.d/10-virtual.conf <<EOF
Section "Device"
  Identifier   "Virtual-Card"
  Driver       "vesa"
  VendorName   "InnoTek"
  BoardName    "Virtual Graphics Adapter"
EndSection
Section "Monitor"
  Identifier   "Virtual-Monitor"
  VendorName   "InnoTek"
  ModelName    "Virtual Screen"
  HorizSync    1.0 - 1000.0
  VertRefresh  1.0 - 1000.0
EndSection
Section "Screen"
  Identifier   "Virtual-Screen"
  Device       "Virtual-Card"
  Monitor      "Virtual-Monitor"
  DefaultDepth 24
  SubSection "Display"
    Viewport   0 0
    Depth      24
    Modes "1600x900" "1368x768" "1360x768" "1280x800"
  EndSubSection
EndSection
EOF

Finally, just restart xenodm

rcctl restart xenodm

Posted

in

by

Comments

Leave a Reply