How to Virtualize SteamOS: Test Its Power Within QEMU/KVM

How to Virtualize SteamOS: Test Its Power Within QEMU/KVM





Hi all, welcome to my blog, MusaBase!. In this article, I`ll walk you through installing SteamOS on a Virtual Machine using QEMU/KVM (Kernel-based Virtual Machine) in Linux. This ultimate guide will show you how to insatll SteamOS on QEMU and test its virtual machine capabilities. I`m using Arch Linux btw! but you can follow this guide on any linux distribution.







Prerequisites

To run SteamOS on a virtual machine we need a fully-installed QEMU for near-native performance.While it`s possible to use QEMU on Windows, managing Kernel-based Virtual Machine (KVM) on Windows can be cumbersome. Therefore, Linux is the recommended platform. If you haven`t installed QEMU yet or need guidance, check out my walkthrough on installing and configuring QEMU on Linux. Additionally, for installing a Linux Operating System, read my article on Arch Linux installtion. System Specifications:

  • Processor: Intel or AMD 64-bit capable and should support Hardware-assisted Virtualization.
  • RAM: 4GB or more.
  • Hard-Drive: For OS alone 16GB for further testing and gaming 200GB.
  • Operating System: Any recent Linux distribution 32-bit or 64-bit although i`m using 64-bit.
  • Virtual Tool: QEMU.



Step 1: Acquire SteamOS Image

We can download the SteamOS image from Steam`s official SteamOS page. Note that the SteamOS recovery image is provided in BZIP2 format. After downloading, simply extract the archive to obatin the .img file.




Step 2: Setting up the Environment for SteamOS Vritualization

This step is optional, you can skip this step and proceed directly to the installation if you wish. However, I recommend creating an empty folder to store your SteamOS image, virutal hard drive, and the necessary ovmf files for UEFI. (SteamOS recommends using UEFI firmware).

2.1. Creating a Virtual Drive with QEMU

I am going to create a virtual drive in QCOW2 format. (Feel free to use your preferred format if desired).

  • To create a virutal drive with QEMU, open your terminal and type:
qemu-img create -f qcow2 steamOSDrive.qcow2 16G
I have four files inside my VirtualSteamOS folder.
  • OVMF.fd: This file contains the actual UEFI Firmware code. It essentially acts as the virtual machine`s "motherboard firmware". It is the equivalent of a computer bios,or uefi chip.
  • OVMF_VARS.fd: This file stores UEFI variables. UEFI variables are settings that the firmware and the operating system use to store configuration information. It is the equivalent of the cmos battery backed storage of a computer bios/uefi.
  • SteamOS.img: This is the .img file of our SteamOS.
  • steamOSDrive.qcow2: The virtual drive in which the OS is going to be installed.

Note: The OVMF files are usually located in /usr/share/ovmf/x64/. If you cannot find these files in /usr/share/ or a similar directory, run the following command:
sudo find / -name OVMF-VARS.fd
#OR
sudo find / -name OVMF_CODE.fd

Now, our folder should contain the following four files:




Step 3: Installing SteamOS on QEMU

I have gathered all my files in a dedicated folder. Open your terminal in you SteamOS folder and run QEMU with the following command:


  qemu-system-x86_64 \
> -cpu host -enable-kvm -smp 2 -m 8G \
> -drive if=pflash,format=raw,unit=0,file=OVMF.fd,readonly=on \
> -drive if=pflash,format=raw,unit=1,file=OVMF_VARS.fd \
> -drive file=SteamOS.img,format=raw \
> -drive if=none,id=nvme0,file=steamOSDrive.qcow2 \
> -device nvme,drive=nvme0,serial=badbeef \
> -display "gtk,gl=on" \
> -device usb-tablet -usb
  • qemu-system-x86_64: Launches QEMU for the x86-64 architecture, starting the virtual machine emulator.
  • -cpu host: Instructs QEMU to emulate the same CPU model as your host machine. This helps the guest OS take advantage of all the features and performance optimization of your actual CPU.
  • -enable-kvm: Enables Kernel-based Virtual Machine (KVM) acceleration. This hardware-assisted virtualization feature improves performance by allowing the guest OS to run directly on the host`s CPU.
  • -smp 2: Allocates 2 virtual CPU cores to the guest. This is independent of the CPU model being emulated, it sets how many cores the guest OS can user. Please adjust this value as need.
  • -m 8G: Allocate 8 gigabytes of RAM to the virutal machine. Please adjust this value as needed.
  • -drive if=pflash,format=raw,unit=0,file=OVMF.fd,readonly=on: This file contains the UEFI Firmware needed for booting. readonly=on parameter ensures that the firmware should not be modified during normal VM operation to maintin its integrity and security.
  • -drive if=pflash,format=raw,unit=0,file=OVMF_VARS.fd: Adds a second pfalsh drive for UEFI variable (non-volatile settings).
  • -drive file=SteamOS.img,format=raw: Attaches a disk image, name SteamOS.img in raw format. Replace the name with your img file`s name.
  • -drive if=none,id=nvme0,file=steamOSDrive.qcow2: Specifies a drive without immediately binding it to an interface (using if=none) and assigns it an identifier nvme0. The file steamOSDrive.qcow2 is the virtual drive we created earlier. Replace virtual drive name if your file name differs.
  • -device nvme,drive=nvme0,serial=badbeef: Creates a virtual NVMe device that uses the previously defined drive (nvme0). The device is given a serial number (badbeef), which is useful for identifaction within the guest. This flag is crucial becuase SteamOS expecting an nvme drive for installation.
  • -display "gtk,gl=on": Sets up the display using GTK with OpenGL support enabled. This provides graphical output for the VM with hardware-accelerated rendering.
  • -device usb-tablet -usb: Adds a USB tablet device to the VM. This input device improves mouse pointer precision, especially in full-screen or high-DPI setups. The -usb flag ensures that USB support is activated.

After running the above command, QEMU will launch with all specified flags and load the SteamOS recovery image. Within a few seconds, you will see the SteamOS Desktop Screen, where you can proceed to install SteamOS.
On the desktop, you should see four options:

  • Clear local user data
  • Reimage Steam Deck
  • Reinstall SteamOS
  • Terminal with repair tools

To begin installing SteamOS on QEMU, open Reimage Steam Deck and click Proceed.

Note: After the installation is complete, the system will prompt you to reboot to finalize the process. Click the button instead. This is because the reboot would normally try to launch into Gaming Mode, which won`t work, so we would need to change the default desktop session.


Bypassing the Gaming Mode Boot

Fortunately, we can use the Recovery Image`s KDE Plamsa Session to enter a chroot environment.

  • Inside QEMU press Ctrl + Alt + G to grab or return the input focus.
  • Press Ctrl + Alt + T to open terminal inside SteamOS.
  • In the steamOS terminal, run the following commands consecutively:
cd /dev
sudo steamos-chroot --disk nvme0n1 --partset A --no-overlay
steamos-readonly disable
echo '[Autologin]' > /etc/sddm.conf.d//zz-steamos-autologin.conf
echo 'Session=plasma.desktop' >> /etc/sddm.conf.d//zz-steamos.autologin.conf
steamos-readonly enable
exit

sudo steamos-chroot --disk nvme0n1 --partset B --no-overlay
steamos-readonly disable
echo '[Autologin]' > /etc/sddm.conf.d//zz-steamos-autologin.conf
echo 'Session=plasma.desktop' >> /etc/sddm.conf.d//zz-steamos-autologin.conf
steamos-readonly disable
exit
  • cd /dev: Changes directory to /dev.
  • sudo steamos-chroot --disk nvme0n1 A/B --no-overlay: Enters the chroot environment for the specified partition set (A or B) on the target disk (nvme0n1), bypassing any overlay filesystem.
  • steamos-readonly disable: Temporarily disables the read-only mode, allowing us to modify files.
  • echo '[Autologin]' > /etc/sddm.conf.d//zz-steamos-autologin.conf: Creates/overwrites the SDDM configuration file with the autologin header.
  • echo 'Session=plasma.desktop' >> /etc/sddm.conf.d//zz-steamos-autologin.conf: Appends the session configuration for KDE Plasma.
  • steamos-readonly enable: Re-enables read-only mode for safety.
  • exit: Exits the chroot enviornment.



Step 4: Boot into SteamOS

Now that the installation is complete, we can remove the SteamOS-Recovery.img flag from the QEMU run command since it is no longer needed. Run QEMU again with the updated command for booting into SteamOS:

qemu-system-x86_64 \
-cpu host -enable-kvm -smp 2 -m 8G \
-drive if=pflash,format=raw,unit=0,file=OVMF.fd,readonly=on \
-drive if=pflash,format=raw,unit=1,file=OVMF_VARS.fd \
-drive if=none,id=nvme0,file=steamOSDrive.qcow2 \
-device nvme,drive=nvme0,serial=badbeef \
-display "gtk,gl=on" \
-device usb-tablet -usb



Afterwards

Now that you have successfully installed SteamOS on QEMU, you can take your setup even further by enabling GPU passthrough and hardware acceleration for improved gaming performance. Before you do so, make sure your PC supports IOMMU. Since SteamOS is an Arch-based distribution, it uses pacman as its default package manager. This allows you to install and update packages easily. But first, you need to set a root password for your SteamOS.


Setting the Root Password
  • Open a terminal in the Virtual Machine and run:
passwd

When prompted, enter and re-enter your new root password. With the root password set, you can now download and manage packages.


Package Signing and Signature Verification

To ensure that every package you install is authentic, you need to establish a secure keyring for pacman.

  • To establish a secure keyring, run these commands consecutively:
sudo pacman-key --init
sudo pacman-key --populate archlinux
sudo pacman-key --populate holo
  • sudo pacman-key --init: Initializes the pacman keyring by creating the necessary GnuPG directories and generating a local master key.
  • sudo pacman-key --populate archlinux: Imports and locally signs the official Arch Linux Keys, enabling pacman to verify packages from the Arch repositories.
  • sudo pacman-key --init holo: Imports keys from the Holo repository (used on systems like SteamOS/Holo), so packages signed by these keys can alos be trusted by pacman.

Disable SteamOS Read-Only Mode

SteamOS is set to read-only mode by default (to support Gaming Mode). To install or update packages, you need to disable this mode.

  • To disable read-only mode, run:
sudo steamos-readonly disable

Updating System Packages

Finally we can now update and install system packages with pacman. now run:

sudo pacman -Syu

Update SteamOS

The recovery image provides SteamOS version 3.5. To update your system to the latest version, run:

steamos-update
Note: Don`t reboot the system right after updates.
Note: After updating, you must reboot the virtual machine to apply the updates. However, if you reboot immediately, SteamOS may boot into Gaming Mode, which does not work inside QEMU and my result in a blank or black screen. To prevent this, make sure that the new updates boot into Plasma session instead.

Applying updates and Setting the Default Desktop Session

After updating, the system may revert to GameScope Mode by default. To ensure that KDE Plasma is your default desktop session, you have tow methods:

  • Partset Others
  • Partset A/B
Partset Other Method
  • Open terminal and run the following commands consecutively:
sudo steamos-chroot --partset other
mount -o remount,rw /
steamos-readonly disable
echo '[Autologin]' > /etc/sddm.conf.d//zz-steamos-autologin.conf
echo 'Session=plasma.desktop' >> /etc/sddm.conf.d//zz-steamos-autologin.conf
steamos-readonly enable
exit
reboot
  • --partset other: SteamOS often uses multiple partition sets (commonly "A" and "B") for system redundancy and updates. The option --partset other indicates that we want to work with the partition set labeled "other".
  • mount -o remount,rw /: This comman remounts the root filesystem (/) in read-write (rw) mode.

Partset A/B Method
  • Open terminal inside VM and type these commands consecutively:
cd /dev
sudo steamos-chroot --disk nvme0n1 --partset A --no-overlay
mount -o remount,rw /
steamos-readonly disable
echo '[Autologin]' > /etc/sddm.conf.d//zz-steamos-autologin.conf
echo 'Session=plasma.desktop' >> /etc/sddm.conf.d//zz-steamos-autologin.conf
steamos-readonly enable
exit

sudo steamos-chroot --disk nvme0n1 --partset B --no-overlay
mount -o remount,rw /
steamos-readonly disable
echo '[Autologin]' > /etc/sddm.conf.d//zz-steamos-autologin.conf
echo 'Session=plasma.desktop' >> /etc/sddm.conf.d//zz-steamos-autologin.conf
steamos-readonly enable
exit
reboot
Note: You may need to make the KDE Plasma session the deafult session using the any one of the two methods explained above after every update.

After rebooting, your system should now boot into the latest version of SteamOS with KDE Plasma as the default desktop session.

With your updated system, you can explore GPU passthrough options in QEMU and other advanced configurations to enhace your gaming experience.
1O1 out, i will see you around.




FIN!!!

Load comments