Skip to content

Instantly share code, notes, and snippets.

@stevenlafl
Last active October 29, 2024 02:14

Revisions

  1. stevenlafl revised this gist Sep 24, 2022. 1 changed file with 16 additions and 1 deletion.
    17 changes: 16 additions & 1 deletion virt-manager-steamos-install.md
    Original file line number Diff line number Diff line change
    @@ -32,7 +32,9 @@ create new VM
    <vmport state="off"/>
    <smm state="on"/>
    </features>
    <cpu mode="host-passthrough" check="none" migratable="on"/>
    <cpu mode="host-passthrough" check="none" migratable="on">
    <topology sockets="1" dies="1" cores="2" threads="2"/>
    </cpu>
    <clock offset="utc">
    <timer name="rtc" tickpolicy="catchup"/>
    <timer name="pit" tickpolicy="delay"/>
    @@ -239,4 +241,17 @@ $ sudo steamos-chroot --disk /dev/nvme0n1 --partset B
    # echo 'Session=plasma.desktop' >> /etc/sddm.conf.d/zz-steamos-autologin.conf
    # steamos-readonly enable
    # exit
    ```

    When you boot up, to get the vdagent (for guest/host copy&paste support):

    ```
    passwd
    # set password
    sudo pacman-key --init
    sudo pacman-key --populate
    sudo steamos-readonly disable
    sudo pacman -Sy spice-vdagent
    echo "spice-vdagent" > ~/.xprofile
    sudo steamos-readonly enable
    ```
  2. stevenlafl revised this gist Sep 23, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion virt-manager-steamos-install.md
    Original file line number Diff line number Diff line change
    @@ -19,7 +19,7 @@ create new VM
    </metadata>
    <memory unit="KiB">16777216</memory>
    <currentMemory unit="KiB">16777216</currentMemory>
    <vcpu placement="static" cpuset="1">8</vcpu>
    <vcpu placement="static" cpuset="1">4</vcpu>
    <os>
    <type arch="x86_64" machine="pc-q35-6.2">hvm</type>
    <loader readonly="yes" secure="yes" type="pflash">/usr/share/OVMF/OVMF_CODE_4M.fd</loader>
  3. stevenlafl revised this gist Sep 23, 2022. 1 changed file with 2 additions and 4 deletions.
    6 changes: 2 additions & 4 deletions virt-manager-steamos-install.md
    Original file line number Diff line number Diff line change
    @@ -19,7 +19,7 @@ create new VM
    </metadata>
    <memory unit="KiB">16777216</memory>
    <currentMemory unit="KiB">16777216</currentMemory>
    <vcpu placement="static" cpuset="1">4</vcpu>
    <vcpu placement="static" cpuset="1">8</vcpu>
    <os>
    <type arch="x86_64" machine="pc-q35-6.2">hvm</type>
    <loader readonly="yes" secure="yes" type="pflash">/usr/share/OVMF/OVMF_CODE_4M.fd</loader>
    @@ -32,9 +32,7 @@ create new VM
    <vmport state="off"/>
    <smm state="on"/>
    </features>
    <cpu mode="host-passthrough" check="none" migratable="on">
    <topology sockets="1" dies="1" cores="4" threads="1"/>
    </cpu>
    <cpu mode="host-passthrough" check="none" migratable="on"/>
    <clock offset="utc">
    <timer name="rtc" tickpolicy="catchup"/>
    <timer name="pit" tickpolicy="delay"/>
  4. stevenlafl revised this gist Sep 23, 2022. No changes.
  5. stevenlafl revised this gist Sep 23, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion virt-manager-steamos-install.md
    Original file line number Diff line number Diff line change
    @@ -19,7 +19,7 @@ create new VM
    </metadata>
    <memory unit="KiB">16777216</memory>
    <currentMemory unit="KiB">16777216</currentMemory>
    <vcpu placement="static" cpuset="1">16</vcpu>
    <vcpu placement="static" cpuset="1">4</vcpu>
    <os>
    <type arch="x86_64" machine="pc-q35-6.2">hvm</type>
    <loader readonly="yes" secure="yes" type="pflash">/usr/share/OVMF/OVMF_CODE_4M.fd</loader>
  6. stevenlafl revised this gist Sep 23, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion virt-manager-steamos-install.md
    Original file line number Diff line number Diff line change
    @@ -33,7 +33,7 @@ create new VM
    <smm state="on"/>
    </features>
    <cpu mode="host-passthrough" check="none" migratable="on">
    <topology sockets="1" dies="1" cores="16" threads="1"/>
    <topology sockets="1" dies="1" cores="4" threads="1"/>
    </cpu>
    <clock offset="utc">
    <timer name="rtc" tickpolicy="catchup"/>
  7. stevenlafl revised this gist Sep 23, 2022. 1 changed file with 5 additions and 4 deletions.
    9 changes: 5 additions & 4 deletions virt-manager-steamos-install.md
    Original file line number Diff line number Diff line change
    @@ -19,7 +19,7 @@ create new VM
    </metadata>
    <memory unit="KiB">16777216</memory>
    <currentMemory unit="KiB">16777216</currentMemory>
    <vcpu placement="static" cpuset="1">4</vcpu>
    <vcpu placement="static" cpuset="1">16</vcpu>
    <os>
    <type arch="x86_64" machine="pc-q35-6.2">hvm</type>
    <loader readonly="yes" secure="yes" type="pflash">/usr/share/OVMF/OVMF_CODE_4M.fd</loader>
    @@ -32,7 +32,9 @@ create new VM
    <vmport state="off"/>
    <smm state="on"/>
    </features>
    <cpu mode="host-passthrough" check="none" migratable="on"/>
    <cpu mode="host-passthrough" check="none" migratable="on">
    <topology sockets="1" dies="1" cores="16" threads="1"/>
    </cpu>
    <clock offset="utc">
    <timer name="rtc" tickpolicy="catchup"/>
    <timer name="pit" tickpolicy="delay"/>
    @@ -176,7 +178,7 @@ create new VM
    </sound>
    <audio id="1" type="spice"/>
    <video>
    <model type="vga" vram="16384" heads="1" primary="yes">
    <model type="virtio" heads="1" primary="yes">
    <resolution x="1280" y="800"/>
    </model>
    <address type="pci" domain="0x0000" bus="0x00" slot="0x01" function="0x0"/>
    @@ -202,7 +204,6 @@ create new VM
    <qemu:arg value="nvme,drive=NVME1,serial=nvme-1,bootindex=1"/>
    </qemu:commandline>
    </domain>
    ```

    in
  8. stevenlafl renamed this gist Sep 23, 2022. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  9. stevenlafl created this gist Sep 23, 2022.
    243 changes: 243 additions & 0 deletions steamos.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,243 @@

    Following: https://blogs.igalia.com/berto/2022/07/05/running-the-steam-decks-os-in-a-virtual-machine-using-qemu/#comment-3789

    install virt-manager package

    launch virt-manager

    create new qcow2 volume (ex `/var/lib/libvirt/images/steamos.qcow2`)

    create new VM
    ```
    <domain xmlns:qemu="http://libvirt.org/schemas/domain/qemu/1.0" type="kvm">
    <name>archlinux</name>
    <uuid>25ba81c6-dc70-4022-a85f-ba55d4a899a9</uuid>
    <metadata>
    <libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0">
    <libosinfo:os id="http://archlinux.org/archlinux/rolling"/>
    </libosinfo:libosinfo>
    </metadata>
    <memory unit="KiB">16777216</memory>
    <currentMemory unit="KiB">16777216</currentMemory>
    <vcpu placement="static" cpuset="1">4</vcpu>
    <os>
    <type arch="x86_64" machine="pc-q35-6.2">hvm</type>
    <loader readonly="yes" secure="yes" type="pflash">/usr/share/OVMF/OVMF_CODE_4M.fd</loader>
    <nvram>/var/lib/libvirt/qemu/nvram/archlinux_VARS.fd</nvram>
    <bootmenu enable="yes"/>
    </os>
    <features>
    <acpi/>
    <apic/>
    <vmport state="off"/>
    <smm state="on"/>
    </features>
    <cpu mode="host-passthrough" check="none" migratable="on"/>
    <clock offset="utc">
    <timer name="rtc" tickpolicy="catchup"/>
    <timer name="pit" tickpolicy="delay"/>
    <timer name="hpet" present="no"/>
    </clock>
    <on_poweroff>destroy</on_poweroff>
    <on_reboot>restart</on_reboot>
    <on_crash>destroy</on_crash>
    <pm>
    <suspend-to-mem enabled="no"/>
    <suspend-to-disk enabled="no"/>
    </pm>
    <devices>
    <emulator>/usr/bin/qemu-system-x86_64</emulator>
    <disk type="file" device="disk">
    <driver name="qemu" type="raw"/>
    <source file="/home/stevenlafl/Packages/steamdeck-recovery-4.img"/>
    <target dev="vda" bus="virtio"/>
    <boot order="2"/>
    <address type="pci" domain="0x0000" bus="0x05" slot="0x00" function="0x0"/>
    </disk>
    <controller type="usb" index="0" model="qemu-xhci" ports="15">
    <address type="pci" domain="0x0000" bus="0x02" slot="0x00" function="0x0"/>
    </controller>
    <controller type="pci" index="0" model="pcie-root"/>
    <controller type="pci" index="1" model="pcie-root-port">
    <model name="pcie-root-port"/>
    <target chassis="1" port="0x10"/>
    <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x0" multifunction="on"/>
    </controller>
    <controller type="pci" index="2" model="pcie-root-port">
    <model name="pcie-root-port"/>
    <target chassis="2" port="0x11"/>
    <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x1"/>
    </controller>
    <controller type="pci" index="3" model="pcie-root-port">
    <model name="pcie-root-port"/>
    <target chassis="3" port="0x12"/>
    <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x2"/>
    </controller>
    <controller type="pci" index="4" model="pcie-root-port">
    <model name="pcie-root-port"/>
    <target chassis="4" port="0x13"/>
    <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x3"/>
    </controller>
    <controller type="pci" index="5" model="pcie-root-port">
    <model name="pcie-root-port"/>
    <target chassis="5" port="0x14"/>
    <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x4"/>
    </controller>
    <controller type="pci" index="6" model="pcie-root-port">
    <model name="pcie-root-port"/>
    <target chassis="6" port="0x15"/>
    <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x5"/>
    </controller>
    <controller type="pci" index="7" model="pcie-root-port">
    <model name="pcie-root-port"/>
    <target chassis="7" port="0x16"/>
    <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x6"/>
    </controller>
    <controller type="pci" index="8" model="pcie-root-port">
    <model name="pcie-root-port"/>
    <target chassis="8" port="0x17"/>
    <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x7"/>
    </controller>
    <controller type="pci" index="9" model="pcie-root-port">
    <model name="pcie-root-port"/>
    <target chassis="9" port="0x18"/>
    <address type="pci" domain="0x0000" bus="0x00" slot="0x03" function="0x0" multifunction="on"/>
    </controller>
    <controller type="pci" index="10" model="pcie-root-port">
    <model name="pcie-root-port"/>
    <target chassis="10" port="0x19"/>
    <address type="pci" domain="0x0000" bus="0x00" slot="0x03" function="0x1"/>
    </controller>
    <controller type="pci" index="11" model="pcie-root-port">
    <model name="pcie-root-port"/>
    <target chassis="11" port="0x1a"/>
    <address type="pci" domain="0x0000" bus="0x00" slot="0x03" function="0x2"/>
    </controller>
    <controller type="pci" index="12" model="pcie-root-port">
    <model name="pcie-root-port"/>
    <target chassis="12" port="0x1b"/>
    <address type="pci" domain="0x0000" bus="0x00" slot="0x03" function="0x3"/>
    </controller>
    <controller type="pci" index="13" model="pcie-root-port">
    <model name="pcie-root-port"/>
    <target chassis="13" port="0x1c"/>
    <address type="pci" domain="0x0000" bus="0x00" slot="0x03" function="0x4"/>
    </controller>
    <controller type="pci" index="14" model="pcie-root-port">
    <model name="pcie-root-port"/>
    <target chassis="14" port="0x1d"/>
    <address type="pci" domain="0x0000" bus="0x00" slot="0x03" function="0x5"/>
    </controller>
    <controller type="scsi" index="0" model="virtio-scsi">
    <address type="pci" domain="0x0000" bus="0x03" slot="0x00" function="0x0"/>
    </controller>
    <controller type="sata" index="0">
    <address type="pci" domain="0x0000" bus="0x00" slot="0x1f" function="0x2"/>
    </controller>
    <controller type="virtio-serial" index="0">
    <address type="pci" domain="0x0000" bus="0x04" slot="0x00" function="0x0"/>
    </controller>
    <interface type="network">
    <mac address="52:54:00:e7:70:ee"/>
    <source network="default"/>
    <model type="virtio"/>
    <address type="pci" domain="0x0000" bus="0x01" slot="0x00" function="0x0"/>
    </interface>
    <serial type="pty">
    <target type="isa-serial" port="0">
    <model name="isa-serial"/>
    </target>
    </serial>
    <console type="pty">
    <target type="serial" port="0"/>
    </console>
    <channel type="unix">
    <target type="virtio" name="org.qemu.guest_agent.0"/>
    <address type="virtio-serial" controller="0" bus="0" port="1"/>
    </channel>
    <channel type="spicevmc">
    <target type="virtio" name="com.redhat.spice.0"/>
    <address type="virtio-serial" controller="0" bus="0" port="2"/>
    </channel>
    <input type="tablet" bus="usb">
    <address type="usb" bus="0" port="1"/>
    </input>
    <input type="mouse" bus="ps2"/>
    <input type="keyboard" bus="ps2"/>
    <tpm model="tpm-tis">
    <backend type="emulator" version="2.0"/>
    </tpm>
    <graphics type="spice" autoport="yes">
    <listen type="address"/>
    <image compression="off"/>
    </graphics>
    <sound model="ich9">
    <address type="pci" domain="0x0000" bus="0x00" slot="0x1b" function="0x0"/>
    </sound>
    <audio id="1" type="spice"/>
    <video>
    <model type="vga" vram="16384" heads="1" primary="yes">
    <resolution x="1280" y="800"/>
    </model>
    <address type="pci" domain="0x0000" bus="0x00" slot="0x01" function="0x0"/>
    </video>
    <redirdev bus="usb" type="spicevmc">
    <address type="usb" bus="0" port="2"/>
    </redirdev>
    <redirdev bus="usb" type="spicevmc">
    <address type="usb" bus="0" port="3"/>
    </redirdev>
    <memballoon model="virtio">
    <address type="pci" domain="0x0000" bus="0x07" slot="0x00" function="0x0"/>
    </memballoon>
    <rng model="virtio">
    <backend model="random">/dev/urandom</backend>
    <address type="pci" domain="0x0000" bus="0x08" slot="0x00" function="0x0"/>
    </rng>
    </devices>
    <qemu:commandline>
    <qemu:arg value="-drive"/>
    <qemu:arg value="file=/var/lib/libvirt/images/steamos.qcow2,format=qcow2,if=none,id=NVME1"/>
    <qemu:arg value="-device"/>
    <qemu:arg value="nvme,drive=NVME1,serial=nvme-1,bootindex=1"/>
    </qemu:commandline>
    </domain>
    ```

    in
    `/etc/apparmor.d/abstractions/libvirt-qemu`

    add:
    ```
    # required for qemu:commandline mounted qcow images
    /var/lib/libvirt/images/*.qcow2 rwk,
    ```

    restart apparmor
    ```
    systemctl restart apparmor.service
    ```

    Launch the VM

    hit "reimage steamdeck"

    wait for it. Cancel when asked to restart.

    Execute these commands (to autostart with plasma because game mode won't work):
    ```
    $ sudo steamos-chroot --disk /dev/nvme0n1 --partset A
    # 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 /dev/nvme0n1 --partset B
    # 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
    ```