Skip to content

Commit 3c7e365

Browse files
Kabuki94claude
andcommitted
fix: MOTD login resolution + cloud-final/greenboot-success WSL skip
* usr/libexec/mios/mios-dashboard.sh: MIOS_LINUX_USER resolution order was MIOS_LINUX_USER="${USER:-mios}" set BEFORE sourcing install.env, so when mios-dashboard-issue.service runs as root the dashboard rendered `Cockpit https://localhost:9090/ login: root / mios`. install.env now sources first; resolution preference is install.env-staged MIOS_USER (canonical) > legacy MIOS_LINUX_USER alias > $USER (only as last-ditch when both above are unset, for dev hand-runs) > literal 'mios'. * usr/lib/systemd/system/cloud-final.service.d/10-mios-wsl2.conf: ConditionVirtualization=!wsl. cloud-final runs `nc /run/cloud-init/ share/final.sock` to signal a hypervisor; WSL has no such socket and the call fails at every boot with `nc: /run/cloud-init/share/ final.sock: No such file or directory` -- the trailing red line in `wsl -d MiOS` console output. Mirrors the existing skip for cloud-init-local / cloud-init-network / cloud-config siblings. * usr/lib/systemd/system/greenboot-success.target.d/10-mios-wsl2.conf: ConditionVirtualization=!wsl. greenboot-success.target was missed in the original cascade-skip pass -- it chains through greenboot-healthcheck -> boot-complete -> boot.mount which needs /dev/disk/by-label/boot (unsupported in WSL). With the existing greenboot-healthcheck.service drop-in in place, this sibling target was the last leg of the cascade still surfacing as failed at boot. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 7bec206 commit 3c7e365

3 files changed

Lines changed: 35 additions & 1 deletion

File tree

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Skip cloud-init's final stage in WSL.
2+
#
3+
# cloud-final.service runs `nc /run/cloud-init/share/final.sock` to
4+
# signal completion to a hypervisor / cloud platform. WSL2 isn't a
5+
# cloud platform; the socket is never created and the nc call fails
6+
# with `nc: /run/cloud-init/share/final.sock: No such file or directory`
7+
# at every boot, surfacing as the trailing error in the operator's
8+
# `wsl -d MiOS` console output. Matches the existing skip pattern for
9+
# cloud-init-local / cloud-init-network / cloud-config in the same
10+
# directory neighbors.
11+
[Unit]
12+
ConditionVirtualization=!wsl
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Skip greenboot-success.target on WSL.
2+
#
3+
# greenboot-success.target chains into greenboot-healthcheck.service
4+
# which depends on boot-complete.target which depends on boot.mount
5+
# which requires /dev/disk/by-label/boot -- a block device WSL doesn't
6+
# have. The cascade leaves greenboot-success.target stuck in 'failed
7+
# (dependency)' on every WSL boot. greenboot's purpose (auto-rollback
8+
# after 3 failed boots) is also moot in WSL: there's no bootloader to
9+
# count against.
10+
#
11+
# Mirrors the existing greenboot-healthcheck.service.d/10-mios-wsl2.conf
12+
# skip; this target sibling was missed in the original cascade pass.
13+
[Unit]
14+
ConditionVirtualization=!wsl

usr/libexec/mios/mios-dashboard.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,21 @@ WIDTH=80
8484
INNER=$((WIDTH - 4))
8585

8686
# Identity from install.env (written by mios-bootstrap at install time).
87+
# install.env is sourced FIRST so MIOS_USER lands in env, then we fall
88+
# back to $USER only when install.env didn't supply a value. The previous
89+
# order (`MIOS_LINUX_USER="${USER:-mios}"` set BEFORE sourcing) made the
90+
# MOTD render `login: root / mios` because mios-dashboard-issue.service
91+
# runs as root -- $USER == 'root' wins over the unset MIOS_LINUX_USER.
8792
MIOS_VERSION=""
8893
MIOS_AI_MODEL=""
89-
MIOS_LINUX_USER="${USER:-mios}"
9094
if [[ -r /etc/mios/install.env ]]; then
9195
# shellcheck disable=SC1091
9296
set -a; source /etc/mios/install.env 2>/dev/null || true; set +a
9397
fi
98+
# Resolution order: install.env-staged MIOS_USER (canonical) > MIOS_LINUX_USER
99+
# (legacy alias if some env path set it) > running-process $USER (only when
100+
# both above are unset, e.g. running mios-dashboard.sh by hand) > literal 'mios'.
101+
MIOS_LINUX_USER="${MIOS_USER:-${MIOS_LINUX_USER:-${USER:-mios}}}"
94102
[[ -z "${MIOS_VERSION:-}" ]] && MIOS_VERSION="$(cat /usr/share/mios/VERSION 2>/dev/null || cat /etc/mios/VERSION 2>/dev/null || echo "0.2.4")"
95103
MIOS_AI_MODEL="${MIOS_AI_MODEL:-qwen2.5-coder:7b}"
96104

0 commit comments

Comments
 (0)