WebGen Linux Manual

Run your existing OS as a VM — from the live USB, with zero risk to your disk

WebGen Linux is a KVM hypervisor first. Boot it live — it runs entirely in RAM and touches nothing on disk — then boot your real Windows or Ubuntu install in place as a virtual machine. No reboot to switch. No partitioning to try. This is the pitch, made runnable.

Live = RAM-only hostsnapshot=on = read-only-safe KVM = near-native speedCopy · paste · run

Everything below is meant to be pasted straight into a WebGen terminal on a machine you booted from the live USB. Two safety layers make it non-destructive to try:

Read-Only safe trial

QEMU's snapshot=on sends every guest write to a throwaway overlay in RAM. Your real partition is preserved byte-for-byte. Power off → nothing happened. Use this to answer "does my OS even boot as a VM?"

Read-Write daily use

Drop snapshot=on and the guest's changes persist to the real filesystem — this is how you'd actually use Ubuntu as a build host. Give the VM only that OS's partition, never the whole disk, so it can't touch your other systems.

Before you start

1 · Find your disk and partitions

Run this first and note the device names — you'll substitute them below.

lsblk -f -o NAME,FSTYPE,LABEL,SIZE,MOUNTPOINT

Typically you'll see something like nvme0n1 (the disk) with an EFI partition (vfat), a big ntfs (Windows), and an ext4 (Ubuntu). Adjust the paths in the commands to match.


Ubuntu as a VM works today

Ubuntu's generic kernel already has virtio drivers, so it boots as a guest cleanly. Start with the read-only trial.

  1. Read-only trial — does it boot? safe

    Gives the VM the whole disk but with snapshot=on, so nothing is written back. The guest's own boot menu appears — pick Ubuntu.

    # writable copy of the UEFI variables (the guest needs somewhere to store boot vars)
    cp /usr/share/qemu/edk2-i386-vars.fd /tmp/ovmf-vars.fd
    
    # SNAPSHOT=ON → read-only-safe. Change /dev/nvme0n1 to your disk from `lsblk`.
    sudo qemu-system-x86_64 -enable-kvm -cpu host -m 8G -smp 4 -machine q35 \
      -drive if=pflash,format=raw,readonly=on,file=/usr/share/qemu/edk2-x86_64-code.fd \
      -drive if=pflash,format=raw,file=/tmp/ovmf-vars.fd \
      -drive file=/dev/nvme0n1,snapshot=on,format=raw,if=virtio \
      -device virtio-vga -vnc :0 \
      -netdev user,id=n0 -device virtio-net-pci,netdev=n0

    The guest runs on QEMU's built-in VNC server (port 5900). Connect its screen with wlvncc (see Connecting to the guest desktop below — one wgpkg install away). If Ubuntu reaches its login, the concept is proven — on your real hardware, with your disk untouched.

  2. Read-write — use Ubuntu as a build host persists

    For real use, give the VM only the Ubuntu partition (not the whole disk) and drop snapshot=on so your work persists. Because a bare root partition has no bootloader, the clean way is to boot Ubuntu's kernel directly.

    One rule: never have the Ubuntu filesystem mounted on the host and attached to a running VM at the same time — that double-mounts it and corrupts it. The VM gets it exclusively.
    # grab Ubuntu's kernel + initrd (mount its /boot read-only just to copy them out)
    sudo mkdir -p /mnt/ub && sudo mount -o ro /dev/nvme0n1p3 /mnt/ub   # ← Ubuntu ROOT partition
    cp /mnt/ub/boot/vmlinuz /tmp/ub-vmlinuz ; cp /mnt/ub/boot/initrd.img /tmp/ub-initrd
    sudo umount /mnt/ub                                                # unmount BEFORE starting the VM
    
    # boot that kernel, rooting on the SAME partition handed to the VM as /dev/vda (READ-WRITE)
    sudo qemu-system-x86_64 -enable-kvm -cpu host -m 16G -smp 6 \
      -kernel /tmp/ub-vmlinuz -initrd /tmp/ub-initrd \
      -append "root=/dev/vda rw" \
      -drive file=/dev/nvme0n1p3,format=raw,if=virtio \
      -device virtio-vga -vnc :0 \
      -netdev user,id=n0 -device virtio-net-pci,netdev=n0
    A friendlier webgen-vm wrapper that does the partition isolation, the snapshot toggle and the kernel/UEFI plumbing for you is TBA — for now the commands above are the manual path.

Windows 11 as a VM partly TBA

Same idea, but Windows is a pickier guest. The read-only trial is still safe to attempt; a fully clean Windows 11 guest needs one piece we haven't shipped yet.

What differs from Linux

Read-only trial safe

Uses the Secure-Boot UEFI firmware and an emulated SATA controller. snapshot=on keeps it harmless even if it fails.

cp /usr/share/qemu/edk2-i386-vars.fd /tmp/win-vars.fd

# whole disk, snapshot=on (read-only-safe), SATA (ahci) so Windows sees its boot disk
sudo qemu-system-x86_64 -enable-kvm -cpu host -m 8G -smp 4 -machine q35 \
  -drive if=pflash,format=raw,readonly=on,file=/usr/share/qemu/edk2-x86_64-secure-code.fd \
  -drive if=pflash,format=raw,file=/tmp/win-vars.fd \
  -device ahci,id=ahci \
  -drive file=/dev/nvme0n1,snapshot=on,format=raw,if=none,id=d0 \
  -device ide-hd,drive=d0,bus=ahci.0 \
  -device virtio-vga -vnc :0 \
  -netdev user,id=n0 -device e1000,netdev=n0
# TBA: add   -tpmdev emulator,id=tpm0,chardev=chr  -chardev socket,id=chr,path=/tmp/swtpm.sock  -device tpm-crb,tpmdev=tpm0
#      once the swtpm package lands, for a fully clean Windows 11 vTPM.
Read-write Windows (persisting to the real partition) is TBA pending swtpm + the webgen-vm wrapper, and is best done against Windows with BitLocker off. The read-only trial above is the safe way to see how far your install gets today.

Connecting to the guest desktop

WebGen's QEMU is built lean — no gtk/SDL window backend (the image ships neither toolkit for QEMU). Every guest therefore runs on QEMU's built-in VNC server (the -vnc :0 in the commands above), and you attach its screen with a VNC client. This is exactly what the bundled webgen-vm app does under the hood.

On the WebGen desktop — wlvncc the ready path

wlvncc is the Wayland-native VNC client. It lives in the remote group, so it's one install away (not baked into the base image):

# once, to get the client (needs network):
wgpkg install --group remote

# then, with a VM running with  -vnc :0  (port 5900):
wlvncc localhost:0

From another machine — any VNC viewer headless host

Bind the VNC server to all interfaces instead of localhost, then connect from your laptop:

# on the WebGen host, use  -vnc 0.0.0.0:0  in place of  -vnc :0
# then from your laptop:
vncviewer <webgen-host-ip>:5900
0.0.0.0:0 exposes the console with no password on your LAN. Keep it to a trusted network, or tunnel it over SSH (ssh -L 5900:localhost:5900 webgen@host) and connect to localhost:5900.

A native window / SPICE TBA

A gtk/SDL window (-display gtk) and SPICE both need backends WebGen's QEMU isn't built with yet, and virtio-vga-gl needs virglrenderer (not packaged). If a future QEMU build enables gtk, webgen-vm already probes for it and will upgrade automatically. Until then, VNC is the path.


The bigger picture

Prove it read-only from the live USB, and the daily-driver shape follows: install a thin WebGen host (a small partition — or a USB / second SSD, leaving your internal disk completely untouched), and run your existing Ubuntu — and eventually Windows — as KVM guests with most of the machine's cores and RAM. One lean hypervisor, your other systems as guests, no reboot to switch. That's WebGen.

Roadmap items still marked TBA above — swtpm, the webgen-vm physical-disk wrapper, a SPICE client, and an install-alongside partitioner — are on the build list. This page is the destination; the platform is catching up to it.

← WebGen Linux