Skip to content

Commit f271a43

Browse files
Kabuki94claude
andcommitted
FIX(wsl2): resolve WSL2 boot failures, ordering cycle, and Windows bootstrap
Systemd fixes: - journald: add ReadKMsg=no + ForwardToSyslog=no to prevent WSL2 kernel 6.6+ crash - mios-role: remove Before=sysinit.target (cycled with After=network-online.target); move to After=sysinit.target, WantedBy=multi-user.target - dbus-daemon-wsl: remove --syslog-only (203/EXEC when /dev/log absent); add StandardError=journal+console - virtlxcd{,.service.d}: add ConditionVirtualization=!wsl to stop crash-loop (NOTCONFIGURED) - virtlxcd-{admin,ro}.socket.d: add ConditionVirtualization=!wsl - avahi-daemon.{service,socket}.d: add ConditionVirtualization=!wsl (no multicast in WSL2) - ollama.service.d: add ConditionVirtualization=!wsl + ConditionPathExists guard WSL2 runtime scripts: - wsl-firstboot: replace stub with real impl — reads install.env, creates user via sysusers + imperative fallback, sets sha512crypt hash, sets up home, marks done; all logger calls wrapped with || true (journald may not be up at exec time) - wsl-init: replace stub with runtime bridge — tmpfiles, WSLg X11 socket; same logger fix Docs/infra: - .gitignore: add *.socket.d/ whitelist alongside *.service.d/ - CLAUDE.md: fix stale lint claim; expand qcow2/vhdx/wsl2 into separate entries - README.md: add missing just targets (raw, qcow2, vhdx, wsl2, all-bootstrap) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent d551378 commit f271a43

14 files changed

Lines changed: 131 additions & 25 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,8 @@ usr/lib/systemd/system/*
243243
!/usr/lib/systemd/system/var-*.mount
244244
!/usr/lib/systemd/system/*.service.d/
245245
!/usr/lib/systemd/system/*.service.d/**
246+
!/usr/lib/systemd/system/*.socket.d/
247+
!/usr/lib/systemd/system/*.socket.d/**
246248
# Exclude system-owned service.d dirs that MiOS doesn't manage
247249
usr/lib/systemd/system/systemd-udev-trigger.service.d/
248250
usr/lib/systemd/system/user@.service.d/

CLAUDE.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,18 @@ just build-logged # Build with tee'd log under logs/
3939
just rechunk # bootc-base-imagectl rechunk for small Day-2 deltas
4040
just raw # 80 GiB RAW disk image via bootc-image-builder (BIB)
4141
just iso # Anaconda installer ISO via BIB
42-
just qcow2 / vhdx / wsl2 # Other disk formats (need MIOS_USER_PASSWORD_HASH)
42+
just qcow2 # QEMU qcow2 disk image (needs MIOS_USER_PASSWORD_HASH)
43+
just vhdx # Hyper-V VHDX disk image (needs MIOS_USER_PASSWORD_HASH)
44+
just wsl2 # WSL2 tar.gz for wsl --import
4345
just sbom # CycloneDX SBOM via syft
4446
just artifact # Refresh AI manifests, knowledge, wiki (automation/ai-bootstrap.sh)
4547
just init-user-space # Lay down ~/.config/mios/{env,images,build}.toml
4648
just show-env # Print loaded MIOS_* vars
4749
```
4850

49-
`just lint` is referenced in CONTRIBUTING.md but the `lint` target is not
50-
defined in the current Justfile — `bootc container lint` runs as the final
51-
`RUN` of `Containerfile`, so a successful `just build` is the lint gate.
51+
`just lint` re-runs `bootc container lint` against the locally built image on
52+
demand. `bootc container lint` also runs as the final `RUN` of `Containerfile`,
53+
so a successful `just build` is itself a lint gate.
5254

5355
There is no test suite. Validation gates: `automation/99-postcheck.sh` (run
5456
inside the image build), `bootc container lint` (last Containerfile RUN), and

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,13 @@ just preflight # System prereq check
4242
just build # OCI image
4343
just lint # bootc container lint (re-run on built image)
4444
just rechunk # Optimized Day-2 deltas
45+
just raw # 80 GiB RAW disk image
4546
just iso # Anaconda installer ISO
47+
just qcow2 # QEMU qcow2 disk image (needs MIOS_USER_PASSWORD_HASH)
48+
just vhdx # Hyper-V VHDX disk image (needs MIOS_USER_PASSWORD_HASH)
49+
just wsl2 # WSL2 tar.gz for wsl --import
4650
just sbom # CycloneDX SBOM
51+
just all-bootstrap # build + rechunk + log artifacts to bootstrap repo
4752
```
4853

4954
Windows: `.\preflight.ps1 ; .\mios-build-local.ps1`. See `SELF-BUILD.md`.
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[Journal]
2-
# Disable kernel audit forwarding to the journal.
3-
# systemd 259+ on WSL2 (which lacks the audit netlink socket) crashes
4-
# journald at start when Audit=yes (the default). Setting Audit=no here
5-
# prevents the crash on WSL2 while having no meaningful effect on bare
6-
# metal (auditd owns the audit socket there anyway).
2+
# Audit=yes crashes journald on WSL2 (no audit netlink socket).
73
Audit=no
4+
# ReadKMsg=yes crashes journald on WSL2 kernel 6.6+ (EPERM on /dev/kmsg).
5+
ReadKMsg=no
6+
# Avoid syslog socket dependency that races with journald startup in WSL2.
7+
ForwardToSyslog=no
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[Unit]
2+
ConditionVirtualization=!wsl
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[Unit]
2+
ConditionVirtualization=!wsl

usr/lib/systemd/system/dbus-daemon-wsl.service

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ After=dbus.socket
77
DefaultDependencies=no
88

99
[Service]
10-
ExecStart=/usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only
10+
ExecStart=/usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation
1111
ExecReload=/usr/bin/dbus-send --print-reply --system --type=method_call --dest=org.freedesktop.DBus / org.freedesktop.DBus.ReloadConfig
1212
OOMScoreAdjust=-900
13+
StandardError=journal+console
1314

1415
[Install]
1516
WantedBy=multi-user.target

usr/lib/systemd/system/mios-role.service

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22
Description=MiOS System Init & Role Engine
33
ConditionVirtualization=!container
44
Wants=network-online.target
5-
After=network-online.target local-fs.target
5+
After=network-online.target local-fs.target sysinit.target
66
DefaultDependencies=no
7-
Before=sysinit.target
87

98
[Service]
109
Type=oneshot
1110
ExecStart=/usr/libexec/mios/role-apply
1211
RemainAfterExit=yes
1312

1413
[Install]
15-
WantedBy=sysinit.target
14+
WantedBy=multi-user.target
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[Unit]
2+
# Skip ollama on WSL2: binary may not be present and CUDA is unavailable.
3+
ConditionVirtualization=!wsl
4+
ConditionPathExists=/usr/local/bin/ollama
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[Unit]
2+
ConditionVirtualization=!wsl

0 commit comments

Comments
 (0)