Skip to content

Commit cbdea24

Browse files
Kabuki94claude
andcommitted
fix(wsl2): fix boot, logind loop, hostname, and wsl.conf path
Critical WSL2 fixes: 1. Move wsl.conf to /etc/wsl.conf — WSL2 reads /etc/wsl.conf only; /usr/lib/wsl.conf was silently ignored, meaning [user] default=mios and [boot] systemd=true were never applied (hostname = container ID, login defaulted to root). Update .gitignore to whitelist etc/wsl.conf. Leave usr/lib/wsl.conf as a reference-only stub. 2. systemd-logind WSL2 drop-in — logind crashes in WSL2 (no VT devices) and retried indefinitely. Add ConditionVirtualization=!wsl drop-in to prevent the restart loop visible in the boot log. 3. boot.mount + boot-complete.target drop-ins — CoreOS's dynamic /boot mount requires /dev/disk/by-label/boot which doesn't exist in WSL2. Mask both units in WSL2; their dependents already had drop-ins. 4. Fix hostname in wsl-firstboot — hostnamectl requires logind (now masked in WSL2). Write /etc/hostname and call hostname(1) directly instead, so the configured MIOS_HOSTNAME is applied unconditionally. 5. Drop-ins for qemu-guest-agent, cloud-init-local/network/config — mask these services in WSL2 to eliminate boot noise and failed-unit clutter. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 16f5353 commit cbdea24

11 files changed

Lines changed: 43 additions & 21 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ etc/containers/systemd/*
8181
!/etc/fapolicyd/
8282
etc/fapolicyd/*
8383
!/etc/fapolicyd/fapolicyd.rules
84+
!/etc/wsl.conf
8485

8586
# /etc/mios/ is BOOTSTRAP territory (mios-bootstrap.git). Not tracked here.
8687
# /home/ is BOOTSTRAP territory. Per-user templates and skel live in mios-bootstrap.

etc/wsl.conf

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# MiOS WSL2 configuration — read by WSL2 from /etc/wsl.conf on every boot.
2+
# /usr/lib/wsl.conf is a reference copy only; WSL2 ignores it.
3+
[boot]
4+
systemd=true
5+
6+
[user]
7+
default=mios
8+
9+
[interop]
10+
enabled=true
11+
appendWindowsPath=false
12+
13+
[automount]
14+
enabled=true
15+
options="metadata,umask=22,fmask=11"
16+
17+
[network]
18+
generateHosts=true
19+
generateResolvConf=true
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
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
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
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/wsl.conf

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,4 @@
1-
# MiOS WSL2 configuration. Ignored on non-WSL boots.
2-
[boot]
3-
systemd=true
4-
command="/usr/libexec/mios/wsl-firstboot"
5-
6-
[user]
7-
default=mios
8-
9-
[interop]
10-
enabled=true
11-
appendWindowsPath=false
12-
13-
[automount]
14-
enabled=true
15-
options="metadata,umask=22,fmask=11"
16-
17-
[network]
18-
generateHosts=true
19-
generateResolvConf=true
1+
# MiOS WSL2 — REFERENCE COPY ONLY.
2+
# WSL2 reads /etc/wsl.conf, NOT this file. The functional config is at
3+
# /etc/wsl.conf (tracked in mios.git as etc/wsl.conf).
4+
# This file is kept for documentation purposes only.

0 commit comments

Comments
 (0)