mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-29 11:52:50 +01:00
docs(repo): trying komorebi in a virtual machine
The guide for the one command: docs/trying-it.md says what a machine needs to run the demo guest, with the lines of .wslconfig and of the NixOS-WSL configuration for Windows 11, how to check it with `run-kde --doctor`, what the command does and shows, the key bindings to try, how the GPU path is chosen, how to open Windows' own RDP client, how long the first run takes (measured on a machine with 32 cores and an empty store, by number of cores, with an estimate for a WSL 2 machine and its caveats), how to start again, how to work on komorebi in the guest, and what to do when something is wrong, by symptom. It ends with what was run and what was not: nothing has been run on WSL 2 yet. The README has a section and a link, and the user guide index a line. DESIGN.md has four entries. Two record what I decided and want: the QEMU window first and RDP second, and the GPU wherever the host has one. Two say that a reason was not written down, for QEMU with KVM and not Hyper-V and for sharing the password by a directory, and what is known that bears on each; the password entry also says why a password is made for each user. PLATFORM.md has a section for WSL 2 with what the command expects, a table of the probe results still to be recorded (KVM, display, GPU, RDP, resources, virtiofs), and what is known of virtiofsd without WSL 2.
This commit is contained in:
1 parent
0e8e25957c
commit
1ee2405e44
10 files changed
+366
-7
No files matched your search
@@ -63,6 +63,19 @@ use. With [direnv](https://direnv.net), the [`.envrc`](.envrc) does it on
|
||||
`cd`. On Linux, `nix run .#komorebi -- --version` builds and runs the daemon
|
||||
without a checkout of the toolchain.
|
||||
|
||||
## Trying it in a virtual machine
|
||||
|
||||
On a Linux machine with KVM, which includes NixOS in WSL 2 on Windows 11, one command starts a
|
||||
Plasma guest in which komorebi tiles a few windows, in a window of your desktop:
|
||||
|
||||
```sh
|
||||
nix run .#run-kde
|
||||
```
|
||||
|
||||
`run-kde --doctor` checks the machine and says how to fix what is missing.
|
||||
[`docs/trying-it.md`](docs/trying-it.md) says what you need, what you see, the key bindings to try
|
||||
and what to do when it does not start.
|
||||
|
||||
## Binaries
|
||||
|
||||
The [releases](https://github.com/LGUG2Z/komorebi-for-kde/releases) of this
|
||||
@@ -369,6 +382,7 @@ and the unit starts the daemon with the file.
|
||||
## Documentation
|
||||
|
||||
The user guide starts at [`docs/index.md`](docs/index.md),
|
||||
[`docs/trying-it.md`](docs/trying-it.md) starts a guest in which komorebi tiles a few windows,
|
||||
[`docs/installation.md`](docs/installation.md) says how to install komorebi,
|
||||
[`docs/usage/configuration.md`](docs/usage/configuration.md) explains `komorebi.json`,
|
||||
[`docs/example-configurations.md`](docs/example-configurations.md) has an example of it,
|
||||
|
||||
@@ -834,6 +834,58 @@ a Linux builder that is itself a virtual machine on the Mac, as `darwin.linux-bu
|
||||
nested KVM. `nixos-install` is a plain program, in a guest that runs at the speed of the Mac's own
|
||||
virtualization.
|
||||
|
||||
## Why does `run-kde` start the guest in QEMU with KVM, and not in Hyper-V?
|
||||
|
||||
The guest is started from a NixOS machine in WSL 2 that has this repository checked out: that is the
|
||||
machine I named (Windows 11, an AMD CPU, the latest NixOS-WSL, x86_64), and the command is meant to
|
||||
need nothing else set up. The flake already builds the Plasma guests as a QEMU runner that boots
|
||||
the system from the host's Nix store, and the VM tests boot the same guests under QEMU with KVM,
|
||||
so the command starts what CI boots. KVM is what WSL 2 offers inside its own virtual machine when
|
||||
nested virtualization is on. The command needs it, and refuses to start without it, since Plasma
|
||||
under software emulation is too slow to try anything; `--tcg` allows it anyway.
|
||||
|
||||
Why not Hyper-V, whose virtual machines Windows itself runs? Nobody wrote down a reason, and this
|
||||
entry does not make one up. What is known is that a Hyper-V guest would be another artifact, a disk
|
||||
image that Windows' hypervisor boots, and that the repository builds none. The reason for
|
||||
choosing QEMU over it still needs to be written down.
|
||||
|
||||
## Why is the QEMU window the first way to see the guest, and RDP the second?
|
||||
|
||||
I decided that the primary view is the QEMU window through WSLg, and that RDP from
|
||||
Windows (`mstsc`) comes second. The reason was not written down. What bears on it is known: the
|
||||
guest's RDP server, KRDP, sends H.264 video only, encoded in software on the guest's CPUs when there
|
||||
is no VAAPI device, FreeRDP built with OpenH264 shows nothing of it, and nobody has tried Windows'
|
||||
client against it ([PLATFORM.md](PLATFORM.md#rdp-into-the-session)). A window of QEMU has no video
|
||||
encoder between the guest and the screen. How fast the window is through WSLg has not been
|
||||
measured: the plan has the probe's number decide which is the default.
|
||||
|
||||
## Why does the guest use the GPU wherever the host has one?
|
||||
|
||||
Because I want GPU accel where it's available on the host. So the GPU path is part of the design and
|
||||
not an opt-in: `run-kde` looks for it (`/dev/dxg` on WSL 2, a render node elsewhere, and a host
|
||||
OpenGL that is not llvmpipe) and starts the guest with `virtio-vga-gl` and QEMU's GTK window with
|
||||
OpenGL, which gives KWin in the guest real OpenGL through VirGL. When the host has none, it starts the
|
||||
guest with a software `virtio-vga` and says why. `--gpu auto|on|off` overrides the choice, and KVM is
|
||||
needed either way.
|
||||
|
||||
The display device is not part of the guest. The runner of nixpkgs would fix it when the guest is
|
||||
built, so the demo guest leaves it out, and `run-kde` gives the runner the device when it starts
|
||||
the guest: one closure and one disk serve both paths.
|
||||
|
||||
## Why is the password made for each user, and shared by a directory?
|
||||
|
||||
A guest's closure is in the Nix store of whoever builds it, which every user of that machine can
|
||||
read, so a password or a key in it would be known to all of them, and would be the same for everyone
|
||||
who runs the demo. The Plasma guests carry no key and no password already
|
||||
([utm.md](utm.md)). `run-kde` makes a random RDP password and an ssh key pair when it makes the state
|
||||
directory, in files that only the user can read, and shares that directory with the guest, which
|
||||
takes the two files when it boots. Why a shared directory and not another way to hand the guest a
|
||||
secret was not written down; the guests already get the repository that way.
|
||||
|
||||
The guest copies the files as root, and does not read them where they are, because the user of the
|
||||
host who owns the directory need not be the guest's user: with another owner, and the mode of 0700 the
|
||||
directory has, the guest's user cannot read it.
|
||||
|
||||
## Why are binaries published only by this repository?
|
||||
|
||||
The Komorebi License allows anyone to distribute the source code, with changes, but not
|
||||
|
||||
@@ -850,6 +850,40 @@ and KRDP 6.8.1 and FreeRDP 3.32.2:
|
||||
the session would send each key back to itself. Whether a key pressed in an RDP client reaches a
|
||||
global shortcut is therefore not known; no check from a real client has been recorded.
|
||||
|
||||
## WSL 2
|
||||
|
||||
`run-kde` is written for NixOS in WSL 2 on Windows 11 with an AMD CPU and an x86_64 guest, and
|
||||
nothing in this section has been measured on that machine yet. The table says what the command
|
||||
expects and what is still to be recorded, as dated facts, from the probe
|
||||
(`scripts/wsl2-probe.sh`) when somebody runs it there. The facts that were measured on a Linux machine
|
||||
with KVM and no WSL, window or GPU are in [Rendering in virtual machines and over
|
||||
RDP](#rendering-in-virtual-machines-and-over-rdp).
|
||||
|
||||
| Probe | What the command expects | Result |
|
||||
|---|---|---|
|
||||
| KVM | `/dev/kvm` is there with `nestedVirtualization=true` in `.wslconfig`, the CPU flags show `svm`, and the user is in the group `kvm` | to be recorded |
|
||||
| KVM | QEMU with `-accel kvm` boots a kernel; how fast a CPU loop runs in the guest against WSL | to be recorded |
|
||||
| Display | `WAYLAND_DISPLAY` or `DISPLAY` is set by WSLg, and QEMU's GTK window opens | to be recorded |
|
||||
| Display | the keyboard and the pointer work in the window, and Ctrl + Alt + g grabs and releases them; the frame rate of a moving window | to be recorded |
|
||||
| GPU | `/dev/dxg` is there, `wsl.useWindowsDriver = true` is in effect, and the host's OpenGL renderer string is d3d12 and not llvmpipe | to be recorded |
|
||||
| GPU | `-device virtio-vga-gl -display gtk,gl=on` starts, and the guest's renderer is virgl; the frame rate with and without it | to be recorded |
|
||||
| RDP | `localhost:3389` in Windows reaches the guest; Windows' client shows a picture of KRDP's H.264; keyboard layouts survive | to be recorded |
|
||||
| Resources | free memory and disk in WSL, the values of `.wslconfig`, the time to build the guest, the size of its closure | to be recorded |
|
||||
| virtiofs | `virtiofsd` starts as the user and serves `/nix/store` and a directory; the guest mounts both through virtio-fs devices, with its memory in a shared memfd, reads the store, and reads and writes the directory | to be recorded |
|
||||
|
||||
What is known of virtiofs without WSL 2 (nixpkgs' runner mounts the host's `/nix/store` and the
|
||||
shared directories by virtiofs on a Linux host), at time of writing (2026-10-28): the chain that
|
||||
the probe's P6 builds, `virtiofsd` 1.14.0 started as an ordinary user with the runner's options, and
|
||||
a guest that mounts the host's `/nix/store` read-only and a directory read-write, passes on an
|
||||
`x86_64` machine with KVM, on an `aarch64` machine and under TCG. `virtiofsd` prints two warnings
|
||||
as an ordinary user (it cannot raise the limit of open files, and it cannot use file handles) and
|
||||
never opens `/dev/fuse`. A file owned by the host user shows up in the guest with the same numeric
|
||||
uid. The kernel configuration of WSL 2 (`linux-msft-wsl-6.6.y`, read, not run) has
|
||||
`CONFIG_FUSE_FS=y`, `CONFIG_MEMFD_CREATE=y`, `CONFIG_USER_NS=y` and `CONFIG_KVM_AMD=m`.
|
||||
|
||||
One thing that the command depends on is not in the probe, and is not known either: whether
|
||||
Windows or WSLg takes any of the Alt combinations of the key bindings before the window sees them.
|
||||
|
||||
## What was not measured
|
||||
|
||||
At time of writing (2026-10-28) these are gaps, not findings. Nothing on this page says that
|
||||
|
||||
+4
-2
@@ -135,7 +135,8 @@ what a person's run needs comes from the environment of the runner:
|
||||
| `QEMU_OPTS` | the display device: `-vga none -device virtio-vga,xres=1280,yres=800`, or `-display gtk,gl=on -vga none -device virtio-vga-gl,xres=1280,yres=800` for a GPU |
|
||||
| `NIX_DISK_IMAGE` | the disk image, which the runner makes when it is not there |
|
||||
|
||||
[`run-kde`](#the-command) sets them; to start the guest by hand, on a Linux machine:
|
||||
[`run-kde`](#the-command) sets them ([the guide](../trying-it.md) says what a person sees and does);
|
||||
to start the guest by hand, on a Linux machine:
|
||||
|
||||
```sh
|
||||
nix build .#nixosConfigurations.run-kde-x86_64.config.system.build.vm -o .vm/result-run-kde
|
||||
@@ -190,7 +191,8 @@ In order, it:
|
||||
to try anything.
|
||||
2. Builds the guest when its runner is not in the store, with `nix build` of the checkout's flake and
|
||||
the build log shown. There is no binary cache: the first run builds komorebi and downloads about
|
||||
4 GB of Plasma, which are 11 GB in the Nix store.
|
||||
4 GB of Plasma, which are 11 GB in the Nix store. [The first run](../trying-it.md#the-first-run)
|
||||
says how long that took where it was measured.
|
||||
3. Makes the state directory, `$XDG_STATE_HOME/komorebi-run-kde` (`~/.local/state/komorebi-run-kde`),
|
||||
when it is not there: the guest's disk (20 GB, or `--size`, sparse), a random RDP password and an
|
||||
ed25519 key for ssh, all of mode 0600 in a directory of mode 0700. `--reset` deletes it. Nothing
|
||||
|
||||
@@ -30,6 +30,8 @@ key bindings --------> komorebic <------> komorebi
|
||||
|
||||
## Getting started
|
||||
|
||||
[Trying komorebi in a virtual machine](trying-it.md) starts a Plasma guest in which komorebi tiles a
|
||||
few windows, with one command, and says what to do when it does not start.
|
||||
[Installing komorebi](installation.md) explains how to install the two programs: on NixOS with
|
||||
the flake's module, which also starts komorebi with every Plasma session, and from source
|
||||
anywhere else. [Running komorebi](usage/running-komorebi.md) explains how to start and stop the
|
||||
|
||||
@@ -0,0 +1,254 @@
|
||||
# Trying komorebi in a virtual machine
|
||||
|
||||
This page is for someone who wants to see komorebi tile windows in a Plasma session without setting
|
||||
up a machine for it. One command starts a NixOS virtual machine with Plasma, komorebi and a few
|
||||
windows that komorebi tiles, in a window of your own desktop, and you try the key bindings by hand.
|
||||
It is for a Linux machine with KVM, and the steps below are for NixOS in WSL 2 on Windows 11, which
|
||||
is the machine it was written for. Nothing on this page has been run on WSL 2 yet: what was run, and
|
||||
what was not, is [at the end](#what-is-known).
|
||||
|
||||
The virtual machine is the demo guest of [`nix/dev/run-kde.nix`](../nix/dev/run-kde.nix), and the
|
||||
command that starts it is [`scripts/run-kde`](../scripts/run-kde). [Plasma guests to develop
|
||||
in](dev/utm.md) says how they are made.
|
||||
|
||||
## What you need
|
||||
|
||||
- A checkout of this repository. The repository is private, so the command runs from a checkout and
|
||||
not from `github:`.
|
||||
- Nix with flakes.
|
||||
- KVM, which on WSL 2 is nested virtualization: the guest is a virtual machine inside WSL's own.
|
||||
- About 16 GB free in the Nix store for the first run, and room for the guest's disk, which is 20 GB
|
||||
at most and grows as the guest writes to it.
|
||||
- At least 4 GB of memory for the guest, and 8 GB if you can: WSL gets half of the machine's memory
|
||||
unless you say otherwise.
|
||||
|
||||
There is no binary cache. The first run builds komorebi from source and downloads about 4 GB of
|
||||
Plasma and the rest of the guest, which are 11 GB in the Nix store, and the command says so before
|
||||
it starts. [The first run](#the-first-run) says how long that took where it was measured.
|
||||
|
||||
### NixOS-WSL
|
||||
|
||||
In `%UserProfile%\.wslconfig` on the Windows side, under `[wsl2]`:
|
||||
|
||||
```ini
|
||||
[wsl2]
|
||||
memory=12GB
|
||||
nestedVirtualization=true
|
||||
```
|
||||
|
||||
`nestedVirtualization=true` is what gives WSL a `/dev/kvm`, and on an AMD machine it needs SVM turned
|
||||
on in the firmware setup. Then run `wsl --shutdown` in PowerShell, so that WSL starts again with the
|
||||
new file.
|
||||
|
||||
In the NixOS configuration of the WSL machine:
|
||||
|
||||
```nix
|
||||
{
|
||||
# the Windows GPU driver, for OpenGL in WSL (the GPU, below)
|
||||
wsl.useWindowsDriver = true;
|
||||
# /dev/kvm belongs to this group
|
||||
users.users.<you>.extraGroups = [ "kvm" ];
|
||||
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
||||
}
|
||||
```
|
||||
|
||||
`<you>` is your user. Switch to it with `sudo nixos-rebuild switch` and open a new shell. WSLg, which
|
||||
shows the guest's window, comes with WSL 2 on Windows 11: `wsl --update` in PowerShell brings it up
|
||||
to date.
|
||||
|
||||
### Checking
|
||||
|
||||
```sh
|
||||
nix run .#run-kde -- --doctor
|
||||
```
|
||||
|
||||
`--doctor` prints each prerequisite as a tick, a cross or a `!`, with the exact fix under every cross
|
||||
and every `!`, and exits with 1 if there is a cross. A missing KVM is a cross, and so is a
|
||||
`virtiofsd` that does not start: the guest mounts its `/nix/store` through one. A `!` is something
|
||||
that makes the guest worse and does not stop it: less memory than is comfortable, no GPU, no way to
|
||||
open Windows' RDP client.
|
||||
|
||||
If it does not say why the guest cannot start, `nix run .#wsl2-probe` boots a tiny guest with and
|
||||
without KVM, opens a window, and mounts a directory by virtiofs, which is what the guest does with
|
||||
its store; it prints the fix for each thing that is wrong, and what to paste back
|
||||
([Probing a NixOS-WSL2 machine](dev/wsl2-probe.md)).
|
||||
|
||||
## The command
|
||||
|
||||
```sh
|
||||
nix run .#run-kde
|
||||
```
|
||||
|
||||
or `just run-kde`, from the checkout. It checks the machine as `--doctor` does, builds the guest when
|
||||
it is not in the store, makes the state directory, prints a banner and starts the guest. The banner
|
||||
says what you will see, the RDP address and password, the ssh command, how to quit, and which
|
||||
graphics mode it chose and why.
|
||||
|
||||
The terminal you ran it in becomes the guest's console, logged in as `komorebi`, who can use `sudo`
|
||||
with no password. To quit, run `sudo poweroff` there, or press Ctrl-a x in the terminal to stop QEMU
|
||||
at once.
|
||||
|
||||
The options that matter:
|
||||
|
||||
| Option | What it does |
|
||||
|---|---|
|
||||
| `--doctor` | checks the machine and stops |
|
||||
| `--dry-run` | prints what would be started, and starts nothing |
|
||||
| `--gpu auto\|on\|off` | whether the guest renders on the host's GPU (default: auto) |
|
||||
| `--display gtk\|rdp\|vnc\|none` | a window, or no window (default: a window when there is one) |
|
||||
| `--rdp` | on WSL 2, opens Windows' own RDP client when the guest is up |
|
||||
| `--memory MB`, `--cores N`, `--size GB` | the sizes of the guest, which default to what the machine has |
|
||||
| `--reset` | deletes the guest's disk, password and key |
|
||||
| `--tcg` | allows software emulation when there is no KVM, which is too slow to try anything |
|
||||
|
||||
`run-kde --help` has the rest.
|
||||
|
||||
## The first run
|
||||
|
||||
The first run is the long one, and only the first. komorebi is built from source, because there is
|
||||
no binary cache for it, and Plasma and the rest of the guest come from `cache.nixos.org`: 1944 paths,
|
||||
3.9 GiB to download and 11.3 GiB in the Nix store, with the sources and derivations that Nix keeps
|
||||
about 16 GB in all.
|
||||
|
||||
At time of writing (2026-10-28), on a server with 32 cores and a connection of about 3 Gbit/s, from
|
||||
a Nix store with nothing in it and only `cache.nixos.org` as a source, building the guest took 209
|
||||
seconds (3 min 29 s): the download took about 2 minutes of that, and the build of komorebi's
|
||||
dependencies and of komorebi finished at 175 and 201 seconds. The same two builds, repeated on the
|
||||
first N cores of that machine:
|
||||
|
||||
| Cores | komorebi's dependencies | komorebi |
|
||||
|---|---|---|
|
||||
| 32 | 77 s | 26 s |
|
||||
| 16 | 64 s | 26 s |
|
||||
| 8 | 106 s | 27 s |
|
||||
| 4 | 199 s | 33 s |
|
||||
|
||||
The dependencies are the same for every commit and are built once; komorebi itself takes about half
|
||||
a minute whatever the number of cores, and is built again for each commit. With Plasma already in the
|
||||
store, `run-kde --build-only` on a new commit took 50 s on that machine, of which komorebi was 26 s,
|
||||
and the guest was then ready to start. A run that has nothing new to build starts the guest at once.
|
||||
|
||||
What a first run takes on a WSL 2 machine is an estimate, from these numbers. The download is the
|
||||
part that no number of cores helps: 3.9 GiB takes about a minute at 500 Mbit/s, 5 minutes at 100
|
||||
Mbit/s and 10 minutes at 50 Mbit/s. Add 2 to 4 minutes for the dependencies on 8 to 4 cores, a
|
||||
minute for komorebi and for Nix to evaluate the guest, and the time that Nix needs to write 11.3 GiB
|
||||
into WSL's virtual disk. That is about 6 to 8 minutes on a fast connection and 8 or more cores, and
|
||||
15 minutes or more on a slow one. Three things make it less certain: the machine measured has a
|
||||
server's cores and an NVMe disk, WSL's disk is a virtual disk on the Windows drive, which a virus
|
||||
scanner on the Windows side can slow down, and a NixOS-WSL that is in use has some of the paths
|
||||
already, so fewer than 1944 are fetched. None of it has been measured on WSL 2.
|
||||
|
||||
## What you see
|
||||
|
||||
A window of QEMU opens with a Plasma session in it, 1280x800. At time of writing, on a machine with
|
||||
KVM and no GPU (with `--display none`, so that a screenshot could be taken over QEMU's monitor), the
|
||||
guest answered ssh 12 seconds after the command started, and komorebi had tiled four windows after
|
||||
28 seconds: two terminals, Kate and Dolphin, with a border around each. Nested virtualization is
|
||||
slower than that machine's KVM, and how much slower is not measured. A fifth window, the cheat sheet,
|
||||
floats in the middle: komorebi leaves it alone. It has the key bindings, `komorebic` commands to try,
|
||||
what KWin draws with, and the output of `komorebic check`. Press `q` to close it, and run
|
||||
`run-kde-cheat-sheet` in a terminal to open it again.
|
||||
|
||||
The repository is mounted in the guest at `/repo`, and the guest's disk keeps what you do in it
|
||||
between runs, in the state directory.
|
||||
|
||||
### The key bindings
|
||||
|
||||
komorebi reads the bindings of [`docs/skhdrc.sample`](skhdrc.sample), in the module's default mode,
|
||||
where the daemon handles every binding. Alt is either Alt key. The ones to start with:
|
||||
|
||||
| Keys | What they do |
|
||||
|---|---|
|
||||
| Alt + h, j, k, l | focus the window to the left, below, above, right |
|
||||
| Alt + Shift + h, j, k, l | move the window that way |
|
||||
| Alt + Shift + Return | promote the window to the biggest tile |
|
||||
| Alt + t | take the window out of the tiles, and back in |
|
||||
| Alt + Shift + f | toggle monocle: the window fills the screen |
|
||||
| Alt + 1 to 9 | show workspace 1 to 9, which each have a layout of their own |
|
||||
| Alt + Shift + 1 to 9 | move the window to that workspace |
|
||||
| Alt + x, Alt + y | flip the layout horizontally, vertically |
|
||||
|
||||
[Key bindings](usage/keybindings.md) says how komorebi reads a file like this one. Whether Windows
|
||||
or WSLg takes any of these combinations before the QEMU window sees them is not known. QEMU's window
|
||||
grabs the keyboard and the pointer with Ctrl + Alt + g.
|
||||
|
||||
## The GPU
|
||||
|
||||
KWin in the guest draws with the CPU (llvmpipe) unless the host's GPU does the work for it. With
|
||||
`--gpu auto`, which is the default, the command uses the GPU when the display is a window, the host
|
||||
has a GPU device (`/dev/dxg` on WSL 2) and the host's OpenGL is not llvmpipe. Then the guest has a
|
||||
`virtio-vga-gl` device and the window is QEMU's GTK with OpenGL, and the guest renders through
|
||||
VirGL on the host's GPU. When it does not, it says why in the banner and starts with a software
|
||||
`virtio-vga`.
|
||||
|
||||
`--gpu on` and `--gpu off` override the choice, and `--gpu off` is the way back if the GPU path gives
|
||||
a black window or a guest that does not start. The guest says which it got, in the cheat sheet and
|
||||
on the console: `GPU (virgl)` or `software (llvmpipe)`. That is the guest's driver, not the host's:
|
||||
the guest cannot tell a GPU from a host that draws in software.
|
||||
|
||||
## RDP
|
||||
|
||||
The guest also runs an RDP server, which is the way in when there is no window. The banner has its
|
||||
address, `127.0.0.1:3389`, the user, `komorebi`, and a password that was made for this state
|
||||
directory. On WSL 2, `--rdp` opens Windows' own client, `mstsc`, once the guest has a session, with
|
||||
the password stored for the run and deleted when it ends. If Windows' own Remote Desktop service
|
||||
uses port 3389, give the guest another with `--rdp-port 3390`.
|
||||
|
||||
KRDP sends H.264 video only. FreeRDP built with OpenH264 shows nothing of it
|
||||
([PLATFORM.md](dev/PLATFORM.md#rdp-into-the-session)), and nobody has tried Windows' client yet, so
|
||||
the window of QEMU is the first way to look at the guest and RDP the second.
|
||||
|
||||
## Starting again
|
||||
|
||||
`run-kde --reset` deletes the state directory, `~/.local/state/komorebi-run-kde`: the disk, the RDP
|
||||
password and the ssh key. The next run makes new ones, and the guest starts as it was built.
|
||||
|
||||
## Working on komorebi in the guest
|
||||
|
||||
`/repo` is the checkout, and `CARGO_TARGET_DIR` is in the guest's home, since a target directory on
|
||||
a shared directory is slow. The guest has `rustc`, `cargo`, a C compiler and `git`. To run the
|
||||
daemon you built in place of the one the module started:
|
||||
|
||||
```sh
|
||||
systemctl --user stop komorebi
|
||||
cd /repo
|
||||
cargo run --bin komorebi --locked -- --log-level debug
|
||||
```
|
||||
|
||||
The module's unit starts again with the next login. Building komorebi in this guest has not been
|
||||
tried.
|
||||
|
||||
## When something is wrong
|
||||
|
||||
| What you see | What it is | What to do |
|
||||
|---|---|---|
|
||||
| `run-kde` says KVM does not exist | WSL has no nested virtualization, or SVM is off | `nestedVirtualization=true` in `.wslconfig`, SVM in the firmware setup, then `wsl --shutdown` |
|
||||
| `run-kde` says KVM cannot be opened | the user is not in the group `kvm` | `users.users.<you>.extraGroups = [ "kvm" ];`, switch, open a new shell |
|
||||
| `run-kde` says virtiofsd does not start | `virtiofsd` could not serve a directory as this user; the lines it printed say why | a long `$TMPDIR` makes a socket path of more than 107 bytes: `TMPDIR=/tmp nix run .#run-kde`; otherwise `nix run .#wsl2-probe` and paste what it prints |
|
||||
| `run-kde` says `/dev/fuse` is missing or closed (a `!`) | the kernel has no FUSE, or the user cannot open its device; `virtiofsd` does not use it | nothing is needed for the guest; the fix it prints is for other FUSE programs |
|
||||
| No window opens | WSLg is not there | `wsl --update` in PowerShell; or `--display rdp` |
|
||||
| The window is black, or the guest never shows a desktop | the GPU path | `--gpu off`; wait a minute first, the first start is slow |
|
||||
| Everything is slow | the guest draws with the CPU, or has too little memory | `run-kde --doctor`; `memory=` in `.wslconfig` |
|
||||
| The guest stops with no memory | WSL has less than the guest | `--memory 4096`, or `memory=` in `.wslconfig` |
|
||||
| `nix` runs out of space | the closure is about 11 GB, and the first run needs 16 GB | `nix-collect-garbage -d`, or give the WSL disk more room |
|
||||
| `mstsc` cannot connect | something else has port 3389, or WSL forwards no localhost ports | `--rdp-port 3390`; remove `networkingMode=mirrored` from `.wslconfig` |
|
||||
| `ssh` asks for a password | the guest takes the key of the state directory and no password | `ssh -i ~/.local/state/komorebi-run-kde/ssh_key -p 2223 komorebi@127.0.0.1` |
|
||||
| The windows are not tiled | komorebi has not found the panel yet | wait; `komorebic retile` in a terminal |
|
||||
|
||||
## What is known
|
||||
|
||||
At time of writing (2026-10-28), the demo guest was started under KVM on an x86_64 machine that has
|
||||
no WSL, no window and no GPU, from a fresh clone of the repository: `--doctor`, `--dry-run` and
|
||||
`--build-only` worked, and a start with `--display none` made the state directory (files of mode
|
||||
0600), booted the guest, let ssh in with the generated key, tiled the four windows, and showed the
|
||||
cheat sheet. A screenshot taken over QEMU's monitor shows the Plasma desktop with the four tiles and
|
||||
the cheat sheet on top, `komorebic check` in the guest reported no error and no warning, and `sudo
|
||||
poweroff` ended `run-kde`. The VM suite `run-kde` boots the same module in CI. The GPU path was
|
||||
started on that machine in a QEMU window on an X server whose OpenGL is Mesa's llvmpipe, and the
|
||||
guest drew with VirGL. What is not known is
|
||||
everything that is particular to WSL 2: whether `/dev/kvm` is there with nested virtualization
|
||||
on an AMD machine, whether QEMU's window opens through WSLg and how fast it is, whether the
|
||||
Windows GPU reaches OpenGL in the host so that the GPU path renders on it, whether `virtiofsd` and
|
||||
QEMU's shared memory work under WSL 2 (the guest mounts the repository and the host's Nix store with
|
||||
them; on the machines without WSL that the chain was tried on, a guest mounted both), and what
|
||||
Windows' RDP client shows of KRDP. [PLATFORM.md](dev/PLATFORM.md#wsl-2) lists them.
|
||||
@@ -160,7 +160,7 @@
|
||||
inherit pkgs;
|
||||
rev = "nix-check";
|
||||
};
|
||||
# `run-kde` starts the demo guest of the host's architecture (docs/dev/utm.md). The guest's
|
||||
# `run-kde` starts the demo guest of the host's architecture (docs/trying-it.md). The guest's
|
||||
# runner is named in the program, not depended on: the command works out what is missing
|
||||
# and builds it, with its progress shown, instead of `nix run` fetching 4 GB first.
|
||||
runKde =
|
||||
|
||||
@@ -70,7 +70,7 @@ docgen:
|
||||
rm -f docs/cli/*.md
|
||||
cargo run --package komorebic --locked -- docgen --output docs/cli
|
||||
|
||||
# the demo guest in a virtual machine, with komorebi tiling a few windows (docs/dev/utm.md);
|
||||
# the demo guest in a virtual machine, with komorebi tiling a few windows (docs/trying-it.md);
|
||||
# `just run-kde --doctor` says what this machine is missing
|
||||
run-kde *args:
|
||||
nix run .#run-kde -- {{ args }}
|
||||
|
||||
+2
-2
@@ -12,8 +12,8 @@
|
||||
#
|
||||
# and the guest takes them at boot (`run-kde-credentials`). What a person's own run needs at start
|
||||
# up, the memory, the ports, the display device and the repository, comes from the environment of
|
||||
# the runner, which `run-kde` sets (docs/dev/utm.md). The guest shows a window through QEMU or is
|
||||
# reached over RDP, and the terminal of whoever starts it is its console.
|
||||
# the runner, which `run-kde` sets (docs/dev/utm.md, docs/trying-it.md). The guest shows a window
|
||||
# through QEMU or is reached over RDP, and the terminal of whoever starts it is its console.
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
|
||||
+2
-1
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
# run-kde: start the komorebi demo guest (nix/dev/run-kde.nix) in a virtual machine, so that anyone
|
||||
# can try tiling by hand. docs/dev/utm.md says what the guest takes from it; this is the program.
|
||||
# can try tiling by hand. docs/trying-it.md is the guide, docs/dev/utm.md says what the guest takes
|
||||
# from its runner; this is the program.
|
||||
#
|
||||
# nix run .#run-kde -- [options] or just run-kde [options]
|
||||
#
|
||||
|
||||
Reference in new issue
Block a user