Skip to content

Instantly share code, notes, and snippets.

@pojntfx
Last active January 10, 2022 22:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pojntfx/43de2df2cfa0db699b50e87724e75a4e to your computer and use it in GitHub Desktop.
Save pojntfx/43de2df2cfa0db699b50e87724e75a4e to your computer and use it in GitHub Desktop.
Install OpenBSD with DWM, XFCE or GNOME in QEMU
# Create and start the VM
qemu-img create -f qcow2 disk.qcow2 64G
qemu-system-x86_64 -enable-kvm -m 4096 -smp $(nproc) -cpu host -device ac97 -audiodev alsa,id=snd0,out.buffer-length=500000,out.period-length=726 -usb -device usb-tablet -device virtio-keyboard-pci -net nic -net user -vga virtio -display spice-app,gl=on -drive file=disk.qcow2,index=0,media=disk -drive file=distro.img,index=1,media=disk -bios /usr/share/edk2/ovmf/OVMF_CODE.fd
# Upgrade the system
syspatch
reboot
pkg_add -u
# Enable doas
usermod -G wheel pojntfx
echo 'permit persist keepenv :wheel' >/etc/doas.conf
# For DWM and Netsurf
pkg_add dwm netsurf
# If you're on a low-end machine, also check out Lagrange, a Gemini client: `pkg_add lagrange`
su pojntfx -c "echo 'exec /usr/local/bin/dwm' > ~/.xsession"
rcctl enable xenodm
reboot
# For XFCE4 and Firefox
pkg_add dbus avahi consolekit2 xfce xfce-extras firefox
su pojntfx -c "echo 'exec /usr/local/bin/ck-launch-session /usr/local/bin/startxfce4' > ~/.xsession"
rcctl enable xenodm multicast messagebus avahi_daemon
reboot
# For GNOME and GNOME Web
pkg_add dbus avahi consolekit2 gnome gnome-extras epiphany
cat <<'EOF' >>/etc/login.conf
gnome:\
:datasize-cur=1024M:\
:tc=default:
EOF
usermod -L gnome pojntfx
su pojntfx -c "echo 'exec /usr/local/bin/ck-launch-session /usr/local/bin/gnome-session --disable-acceleration-check' > ~/.xsession"
rcctl disable gdm
rcctl enable xenodm multicast messagebus avahi_daemon
# For some reason, login fails for normal users in QEMU (Xorg segfaults). You can however start GNOME as root by executing `cp /pojntfx/home/.xsession /root/.xinirtc && startx`
reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment