How to run Volumio in a virtual box

Dear Volumionouts,

VirtualBox VM Resolution Configuration for Volumio

Important

This guide uses 1280x720 as an example resolution throughout. Replace with your desired resolution where applicable.

Disclaimer

Changes made with this guide are unsupported and may require a full factory reset or reinstall if something goes wrong. Use at your own discretion.


Overview

This guide covers forcing screen resolution for a Volumio 4 x64 VM running in VirtualBox without Guest Additions.

Three components need configuration:

  1. VirtualBox host settings (external to VM)
  2. GRUB bootloader (early boot)
  3. Xorg (X11 session)

Part 1: VirtualBox Host Configuration

Step 1: Find VM Name

Shut down the VM first.

Linux/Mac:

VBoxManage list vms

Windows (Command Prompt):

"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" list vms

Windows (PowerShell):

& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" list vms

Output example:

"Volumio Bookworm" {809c7cdb-2092-49b7-987a-6ca77ebf5ea8}
"Ubuntu Server" {12345678-1234-1234-1234-123456789abc}

Step 2: Set Variables

Set both VM name and desired resolution.

Linux/Mac (bash):

export VM_NAME="Volumio Bookworm"
export RES="1280x720"

Windows (Command Prompt):

set VM_NAME=Volumio Bookworm
set RES=1280x720

Windows (PowerShell):

$VM_NAME = "Volumio Bookworm"
$RES = "1280x720"

Common resolutions: 1280x720, 1920x1080, 1600x900, 1366x768

Step 3: Configure VM

Linux/Mac:

VBoxManage setextradata "$VM_NAME" "CustomVideoMode1" "${RES}x32"
VBoxManage modifyvm "$VM_NAME" --vram 128
VBoxManage modifyvm "$VM_NAME" --graphicscontroller vmsvga

Windows (Command Prompt):

"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" setextradata "%VM_NAME%" "CustomVideoMode1" "%RES%x32"
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "%VM_NAME%" --vram 128
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "%VM_NAME%" --graphicscontroller vmsvga

Windows (PowerShell):

& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" setextradata $VM_NAME "CustomVideoMode1" "${RES}x32"
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm $VM_NAME --vram 128
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm $VM_NAME --graphicscontroller vmsvga

Step 4: Verify Settings

Linux/Mac:

VBoxManage getextradata "$VM_NAME" "CustomVideoMode1"
VBoxManage showvminfo "$VM_NAME" | grep -E "VRAM|Graphics"

Windows (Command Prompt):

"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" getextradata "%VM_NAME%" "CustomVideoMode1"
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" showvminfo "%VM_NAME%" | findstr /I "VRAM Graphics"

Windows (PowerShell):

& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" getextradata $VM_NAME "CustomVideoMode1"
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" showvminfo $VM_NAME | Select-String "VRAM|Graphics"

Alternative: VirtualBox GUI

  1. Shut down VM
  2. Select VM in VirtualBox Manager
  3. Settings > Display
  4. Set Video Memory: 128 MB
  5. Graphics Controller: VMSVGA (or try VBoxVGA/VBoxSVGA if issues)

Alternative: Edit .vbox File Directly

File locations:

  • Linux: ~/VirtualBox VMs/VM_NAME/VM_NAME.vbox
  • Windows: C:\Users\USERNAME\VirtualBox VMs\VM_NAME\VM_NAME.vbox
  • macOS: ~/VirtualBox VMs/VM_NAME/VM_NAME.vbox

Shut down VM, then edit the .vbox file.

Find or add ExtraData section (substitute your resolution):

<ExtraData>
  <ExtraDataItem name="CustomVideoMode1" value="WIDTHxHEIGHTx32"/>
  <ExtraDataItem name="GUI/AutoresizeGuest" value="false"/>
</ExtraData>

Example for 1280x720:

<ExtraDataItem name="CustomVideoMode1" value="1280x720x32"/>

Find Display section and set:

<Display controller="VMSVGA" VRAMSize="128"/>

Graphics controller options: VMSVGA, VBoxVGA, VBoxSVGA


Part 2: Guest Configuration Script

Save as set-resolution.sh inside the Volumio VM.

#!/bin/bash

set -e

# Usage: sudo ./set-resolution.sh 1280x720
if [ -z "$1" ]; then
    echo "Usage: $0 <resolution>"
    echo "Example: $0 1280x720"
    exit 1
fi

RES="$1"
CHANGED=0

# Validate format
if ! echo "$RES" | grep -qE '^[0-9]+x[0-9]+$'; then
    echo "Error: Invalid resolution format. Use WIDTHxHEIGHT (e.g. 1280x720)"
    exit 1
fi

echo "Setting resolution to: $RES"
echo ""

# --- xorg.conf ---
XORG_FILE="/etc/X11/xorg.conf.d/10-resolution.conf"
if [ -f "$XORG_FILE" ] && grep -q "Modes \"$RES\"" "$XORG_FILE"; then
    echo "xorg.conf: already configured"
else
    mkdir -p /etc/X11/xorg.conf.d
    cat > "$XORG_FILE" << EOF
Section "Monitor"
    Identifier "Monitor0"
    HorizSync 30-80
    VertRefresh 50-75
EndSection

Section "Screen"
    Identifier "Screen0"
    Monitor "Monitor0"
    DefaultDepth 24
    SubSection "Display"
        Depth 24
        Modes "$RES"
    EndSubSection
EndSection
EOF
    echo "xorg.conf: created"
    CHANGED=1
fi

# --- grub gfxmode ---
GRUB_FILE="/boot/efi/BOOT/grub.cfg"
if grep -q "set gfxmode=$RES" "$GRUB_FILE"; then
    echo "grub gfxmode: already configured"
else
    sed -i "s/set gfxmode=[0-9]*x[0-9]*/set gfxmode=$RES\n  set gfxpayload=keep/" "$GRUB_FILE"
    echo "grub gfxmode: updated"
    CHANGED=1
fi

# --- kernel video parameter ---
if grep -q "video=$RES" "$GRUB_FILE"; then
    echo "kernel video param: already configured"
else
    if grep -q 'video=[0-9]*x[0-9]*' "$GRUB_FILE"; then
        sed -i "s/video=[0-9]*x[0-9]*@[0-9]*/video=$RES@60/" "$GRUB_FILE"
        echo "kernel video param: updated"
    else
        sed -i "s/\(linux.*vmlinuz.*\)/\1 video=$RES@60/" "$GRUB_FILE"
        echo "kernel video param: added"
    fi
    CHANGED=1
fi

echo ""
if [ $CHANGED -eq 1 ]; then
    echo "Changes made. Reboot to apply."
else
    echo "No changes needed."
fi

Usage:

chmod +x set-resolution.sh
sudo ./set-resolution.sh 1280x720
sudo reboot

Part 3: Manual xrandr (Temporary)

For immediate change without reboot (resets on reboot):

DISPLAY=:0 xrandr --output default --mode WIDTHxHEIGHT

Example for 1280x720:

DISPLAY=:0 xrandr --output default --mode 1280x720

To verify current resolution:

DISPLAY=:0 xrandr

The active mode shows an asterisk (*).


Troubleshooting

xrandr shows “Can’t open display”

Use: DISPLAY=:0 xrandr

Mode not available

Check available modes with DISPLAY=:0 xrandr and choose one listed.

Resolution resets after Volumio update

Re-run the guest script - Volumio may regenerate grub.cfg during updates.

Try different graphics controller

If resolution doesn’t stick, try changing controller in VirtualBox:

  • VMSVGA (default, needs Guest Additions for best results)
  • VBoxVGA (legacy, often works better without Guest Additions)
  • VBoxSVGA (hybrid)

Notes

  • Guest Additions cannot be installed on Volumio due to custom kernel without headers
  • VRAM of 128 MB is sufficient for resolutions up to 4K
  • grub.cfg is generated by Volumio build scripts - direct edits may be overwritten on system updates

Kind Regards,

1 Like