# VIRIDIS

**V**ersatile **I**SO **R**eader & **I**nstallation **D**rive **I**njection **S**ystem

A GTK4 application for Linux that writes a Windows installer to a USB stick and
patches it so Windows installs on hardware the official checks reject.

## The other side of the coin

Rufus is the head of this coin. Viridis is the tail — the same job approached
from the opposite direction.

Rufus is a Windows program; viridis is a Linux one. Rufus's name is an acronym
built backwards from a word; viridis is a Latin word fronting an acronym, and
*viridis* means green where *rufus* means red. One is the obverse, the other the
reverse. Neither is a port of the other: viridis is an independent
implementation and shares no code with Rufus.

## What it does

1. Validates the ISO — refuses anything without `sources/install.wim` or
   `install.esd` and a bootable EFI or BIOS loader.
2. Partitions the target as MBR with a single active FAT32 ESP, formats it, and
   lays the ISO's files onto it. Images over the 4 GB FAT32 ceiling are split
   into `.swm` parts, which Setup reads natively.
3. Writes `autounattend.xml` to the volume root, which sets the
   `LabConfig\Bypass*` keys during the `windowsPE` pass — before the
   compatibility scan — sets `OOBE\BypassNRO` during `specialize`, hides every
   OOBE screen, and optionally pre-creates a local administrator.
4. Zeroes `sources/appraiserres.dll` so the hardware gate cannot load at all,
   keeping the original beside it as `appraiserres.dll.orig`.

The result boots UEFI, installs on a TPM-less, CPU-unsupported, 2 GB machine,
skips OOBE entirely, creates your account, and lands on the desktop.

## Requirements

`gtk4`, `python3-gi`, `pkexec`, `parted`, `dosfstools`, `ntfs-3g`,
`wimlib-imagex`, `hivexregedit`.

Debian/Ubuntu:

    sudo apt install gtk4 python3-gi policykit-1 parted dosfstools ntfs-3g wimtools libhivex-bin

Fedora:

    sudo dnf install gtk4 python3-gobject polkit parted dosfstools ntfs-3g wimlib-utils hivex

Optional: `ms-sys` for BIOS boot code (UEFI works without it), `wimboot` from
github.com/ipxe/wimboot releases for the WTG WIM-boot mode.

## Install

From the package:

    sudo dpkg -i viridis_1.0.0_amd64.deb

From source:

    tar xzf viridis-src.tar.gz
    cd viridis
    sudo ./install.sh

Then run `viridis`.

Remove with `sudo dpkg -r viridis` or `sudo ./uninstall.sh`.

## Use

1. **Choose ISO** — a Windows 10 or 11 image.
2. Pick the target device. Anything under 1 GB is filtered out; the system disk
   is flagged but not blocked.
3. Leave **Mode** on *Installer*.
4. Set the local account name and optional password.
5. Write, then authenticate at the polkit prompt.

Everything on the target is destroyed. The confirm dialog says so before it
starts.

Boot the finished stick with **Secure Boot disabled**, choosing the UEFI entry
from the one-time boot menu rather than reordering boot priority.

### Windows To Go

*Mode → Windows To Go* produces a live system rather than an installer. Two boot
methods:

| | Boot from WIM | Extract + compress |
|---|---|---|
| Footprint | ~the WIM | ~half the image |
| Minimum stick | 8 GB | 16 GB |
| Updates | slow, WIM grows | normal |

WTG is UEFI only and less tested than installer mode.

## Build logs

Every run writes JSONL to `/var/log/viridis/build-<timestamp>.jsonl`, opening
with a header carrying the ISO path, size, sha256, device model and serial, and
the options used. Override the destination with `--log PATH`.

    sudo /usr/libexec/viridis/viridis-helper \
        --iso /path/to.iso --dev /dev/sdX --dry-run

## Verify a finished stick

    sudo fdisk -l /dev/sdX                       # one partition, type ef
    sudo mount -o ro /dev/sdX1 /mnt/chk
    ls /mnt/chk/efi/boot/bootx64.efi             # must exist
    sudo ls -l /mnt/chk/sources/appraiserres.dll # must be 0 bytes
    sudo grep -c BypassTPMCheck /mnt/chk/autounattend.xml   # must be 1
    sudo umount /mnt/chk

At the disk-selection screen, `Shift+F10` then
`reg query HKLM\SYSTEM\Setup\LabConfig` should list six `Bypass*` values at
`0x1`. That proves the answer file was consumed.

## Troubleshooting

- **`pkexec` returns 126** — polkit didn't load the action. `systemctl restart polkit`.
- **`no partitions found`** — the kernel lagged the write. `sudo partprobe /dev/sdX`.
- **Stick boots to firmware menu only** — Secure Boot still on, or the non-UEFI
  entry was chosen.
- **`ms-sys absent - UEFI boot only`** — expected; BIOS machines need `ms-sys`.

## Known limits

- UEFI only. No BIOS boot code without `ms-sys`.
- Windows 10 and 11 only.
- `install.esd` over 4 GB is split, which is slow.
- WTG is implemented but less exercised than installer mode.

## License

GPL-3.0-or-later. Named for the opposite of red.
