# Running a SteamOS VM in VirtualBox

## What is SteamOS?

> SteamOS is a Linux distribution developed by Valve. It is open source with some closed source components and is the primary operating system for Steam Machines and the Steam Deck. -https://en.wikipedia.org/wiki/SteamOS

## DISCLAIMER

You cannot game in this VM as it lacks graphics acceleration. It is, however, very handy for developers in need of a test version of SteamOS and for testing things in the desktop environment.

## Things You Will Need

- 7-Zip installed

## Preparing for Installation

1. Open a web browser and navigate to https://store.steampowered.com/steamos/download/?ver=steamdeck&snr=
2. Check the license agreement checkbox and click the Download SteamOS Deck Image button
3. Open File Explorer and navigate to the download location
4. Right click on the downloaded SteamOS recovery .bz2 archive > 7-Zip > Extract Here
5. Rename the extracted file steamos-recovery.img
6. While holding Shift, right click in the white space and select Open PowerShell window here
7. Execute the following commands in the PowerShell window
   # rename steamdeck recovery image
   mv .\steamdeck-recovery*.img .\steamdeck-recovery.img
   # convert the recovery .img to .vdi
   & "$ENV:ProgramFiles\Oracle\VirtualBox\VBoxManage.exe" convertfromraw --format VDI .\steamdeck-recovery.img .\steamdeck-recovery.vdi

## Creating the SteamOS VM

1. Launch the VirtualBox VM Manager
2. Create a New VM by selecting Machine > New

   Name: SteamOS
   Machine Folder: C:\VMs
   Type: Linux
   Version: Arch (64-bit)
   Memory Size: 4096 MB or more
   Hard disk:
   File size: 40 GB
   Hard disk file type: VDI
   Storage on physical hard disk: Dynamically Allocated

3. Click Create
4. Select the VM and Click Settings
5. Select System
6. Check the Enable EFI checkbox
7. On the Processor tab, give the VM at least 2 processors
8. Select Display
9. Slide the Video Memory to 128 MB
10. Select Network
11. Set the attached to dropdown to Bridged Adapter
12. Select Storage
13. Click on the Add Hard Disk button across from the SATA controller
14. Click Add > Browse to and select the steamdeck-recovery .vdi file created earlier > Click Choose
15. Click OK
16. Make sure the SteamOS VM is selected and click Start > Normal

## Installing SteamOS

1. Wait for the desktop environment to boot
2. Double click Terminal with repair tools on the desktop
3. Run the following commands in the terminal
   # list disks
   # note the device id for VBOX HARDDISK
   # should be /dev/sda
   sudo fdisk -l
   # edit the recovery installation script
   nano ./tools/repair_device.sh
4. Locate the DISK= line and edit the value to match the device ID of the VBOX HARDDISK noted earlier (ie /dev/sda)
5. Locate the DISKSUFFIX= line and delete the p to leave a blank value
6. Press CTRL+O, Enter, CTRL+X to write the changes
7. Continue with the following commands in the terminal
   sudo ./tools/repair_device.sh all
8. When prompted, click Proceed to confirm destroying data on /dev/sda
9. Once the installation completes, click Cancel
10. Continue with the following commands in the terminal
    # chroot to steamos install
    sudo steamos-chroot --disk /dev/sda --partset A
    # allow writing to steamos partition
    steamos-readonly disable
    # set a password
    passwd
    # enter and confirm a password
    # set steamos default to boot to desktop mode
    echo -e '[Autologin]\nSession=plasma.desktop' > /etc/sddm.conf.d/zz-steamos-desktopmode.conf
    # set steamos partition back to readonly
    steamos-readonly enable
    # exit chroot
    exit
    # chroot to steamos install
    sudo steamos-chroot --disk /dev/sda --partset B
    # allow writing to steamos partition
    steamos-readonly disable
    # set a password
    passwd
    # enter and confirm a password
    # set steamos default to boot to desktop mode
    echo -e '[Autologin]\nSession=plasma.desktop' > /etc/sddm.conf.d/zz-steamos-desktopmode.conf
    # set steamos partition back to readonly
    steamos-readonly enable
    # exit chroot
    exit
    # shutdown the VM
    sudo shutdown now
11. Make sure the SteamOS VM is selected and click Settings
12. Select Storage
13. Right click the steamdeck-recovery.img device > Remove attachment
14. Click OK
15. Make sure the SteamOS VM is selected and click Start > Normal
16. Welcome to SteamOS

## Install VirtualBox Guest Additions (Optional, but recommended)

1. Continue with the following commands in the terminal
   # verify password is set
   passwd
   # enter and confirm a password
   # allow writing to steamos partition
   steamos-readonly disable
   # remove pacman keys
   sudo rm /etc/pacman.d/gnupg -R
   # reinitialize pacman keys
   sudo pacman-key --init
   # add arch linux pacman keys
   sudo pacman-key --populate archlinux
   # edit the pacman config file
   sudo nano /etc/pacman.conf
2. Edit each repository name, adding -rel inside the square brackets

   [jupiter] => [jupiter-rel]
   [holo] => [holo-rel]
   [core] => [core-rel]
   [extra] => [extra-rel]
   [community] => [community-rel]
   [multilib] => [multilib-rel]

3. Press CTRL+O, Enter, CTRL+X to write the changes
4. Continue with the following steps in the terminal
   # update packages
   sudo pacman -Syu
5. From the VirtualBox menu, select Devices > Insert Guest Additions CD image...
6. Open the Dolphin file browser application > Select the Guest Additions Disc > Right click in the white space > Open Terminal
7. In the Terminal window run the following commands
   # install guest additions
   sudo ./VBoxLinuxAdditions.run
   # start guest additions
   sudo /sbin/rcvboxadd quicksetup all
   # reboot
   sudo reboot now
8. The VM will reboot
9. Upon rebooting, you can now full screen the VM and the internal resolution will automatically change to match the window size
10. Log back into SteamOS