Skip to content

fix(packer): one-shot AutoLogon so Windows 11 clones finish OOBE (#1092) - #1093

Merged
Gerrrt merged 4 commits into
mainfrom
gerrrt/win11-oobe-autologon
Oct 9, 2026
Merged

Gerrrt merged 4 commits into
mainfrom
gerrrt/win11-oobe-autologon

Conversation

@Gerrrt

@Gerrrt Gerrrt commented Oct 8, 2026 •

Copy link
Copy Markdown
Owner

Draft — needs a 911 rebuild to verify (see #1092)

Addresses the Windows 11 OOBE stall diagnosed in #1092: cloned Win11 endpoints (carbuncle, siren) park on the "set up a user account" page forever, while Server 2025 clones don't.

The change

packer/windows/unattend-oobe.xml.pkrtpl gains a one-shot <AutoLogon> for Administrator (LogonCount 1) in the oobeSystem pass, plus FirstLogonCommands that:

  1. set AutoAdminLogon = 0, and
  2. delete the plaintext DefaultPassword Setup writes to Winlogon.

So the clone logs in once to finish OOBE, lands at a normal logon screen, and leaves nothing behind. The generalised image still never autologins — sysprep.ps1 is unchanged and still strips the build's autologon; this only re-adds it to the clone's single OOBE pass. It mirrors the build-time autounattend.xml, whose AutoLogon is why the build completes OOBE cleanly.

Why it's needed

On Windows 11 client, HideLocalAccountScreen=true + the enabled built-in Administrator does not finish the OOBE account page without an AutoLogon or a created user — OOBE idles as defaultuser0. Server 2025 proceeds to the logon screen regardless, which is why only the 911-based guests stalled. Full evidence in #1092 (on the parked carbuncle: OOBEInProgress=0, agent + sshd running, domain-joined, defaultuser0 on the console).

Scope / safety

Verification (owner: lab-pipeline flow)

Draft until someone:

  1. rebuilds template 911 (packer build, ADR-0074),
  2. clones/rebuilds a Win11 guest from it, and
  3. confirms it lands at the logon screen (no defaultuser0 OOBE parking; quser shows no stuck session), domain-joins and passes verify.yml as before.

Then flip this out of draft; #1092 is done at that point.

Refs #1092.

🤖 Generated with Claude Code

A cloned Win11 endpoint (carbuncle, siren from template 911) parks on the
OOBE "create a user account" page and never reaches a logon screen. The
clone's answer file had HideLocalAccountScreen=true and the built-in
Administrator but no AutoLogon, which sysprep.ps1 strips from the
generalised image. On client SKUs that is not enough to finish the account
page, so OOBE idles as defaultuser0; Server 2025 (912) is unaffected, which
is why only the Win11 guests stall. The rest of Setup completes - the guests
domain-join, run sshd and the agent, and verify.yml passes - so this is a
cosmetic stall that only blocks an interactive console session.

unattend-oobe.xml.pkrtpl now carries a one-shot AutoLogon (Administrator,
LogonCount 1) with FirstLogonCommands that turn autologon off and delete the
plaintext DefaultPassword Setup writes to Winlogon. The template itself still
never autologins; only the clone's single OOBE pass does, then disables
itself, mirroring the build's autounattend.xml.

Needs a 911 rebuild to take effect, so this stays a draft until a rebuilt
clone is seen landing at a normal logon screen.

Refs #1092

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Gerrrt

Gerrrt commented Oct 8, 2026

Copy link
Copy Markdown
Owner Author

Verified on a scratch build, 2026-10-08: the fix works, but Administrator is left signed in at the console

I built this branch (c5c1cf4) as a throwaway template 919 (tpl-win11-1093-test) rather than rebuilding 911 from an unmerged branch, so 911 is unchanged. Only the VMID and name were edited, in a phoenix worktree, and nothing was committed. Garrett chose this route after the Ansible-pipeline session asked for it. I then made a full clone of 919. Both 919 and the clone are destroyed.

Build: packer build -only=windows.proxmox-iso.win11-pro succeeded in 1h16m. packer-smoke.sh 919 --keep passed: the agent reported an address, the hostname was sysprep's random one, and phoenix's key opened Administrator.

On the clone, about 5 minutes after first boot:

Check Result
Console Went past OOBE by itself and finished at the desktop, not the account page ✅
HKLM\SYSTEM\Setup OOBEInProgress=0, SystemSetupInProgress=0 ✅
Winlogon AutoAdminLogon 0 ✅
Winlogon DefaultPassword gone ✅ (AutoLogonCount=1 remains, which is inert with AutoAdminLogon=0)
defaultuser0 no longer in Administrators ✅. The account still exists, disabled, and its profile remains
packer-close-winrm.log left: 0 on both runs, and no packer certificate in LocalMachine\My ✅ (#1031 holds)
quser administrator console Active ⚠️

The gap: the one-shot autologon leaves Administrator logged on at an unlocked desktop on the console, for as long as the guest runs. Anyone who opens the Proxmox console gets an admin session with no password. I'd add a third FirstLogonCommands entry so the session ends once the first two have run:

<SynchronousCommand wcm:action="add">
  <Order>3</Order>
  <Description>End the one-shot session, so the console rests at the sign-in screen</Description>
  <CommandLine>shutdown /l /f</CommandLine>
</SynchronousCommand>

logoff would also work. The console would then show the sign-in screen, which is what #1092 expects.

A separate, pre-existing finding, not caused by this PR: C:\Windows\Panther\unattend-original.xml is written during the build and baked into the image. It holds the build's AdministratorPassword and its autologon <Password> in plaintext, and its ACL grants BUILTIN\Users read access. That is true on clones of today's 911 as well (checked on dot-windows). Any standard user on a 911 clone can read the template build password. I'm raising it as its own task.

…#1092)

Review on #1093 (verified on a scratch 911 clone) found the one-shot
AutoLogon completes OOBE but leaves Administrator at an unlocked desktop.
A third FirstLogonCommand, shutdown /l /f, logs that session off after the
first two disable autologon and clear the stored credential, so the clone
lands at the lock screen.

Refs #1092

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Gerrrt added a commit that referenced this pull request Oct 9, 2026
…es (#1099) (#1103)

* fix(packer): scrub the plaintext Panther answer files on Windows clones (#1099)

Setup copies the specialize/oobe answer files into C:\Windows\Panther as
unattend.xml and unattend-original.xml; they carry the build password (and,
since #1093, the AutoLogon password) in plaintext and are readable by
BUILTIN\Users. SetupComplete.cmd already deletes unattend-oobe.xml; it now
also deletes those two, before any user can log on.

The ansible base role already rotates the local Administrator away from the
build password on domain members, so the leak was stale there; this removes
the artifact itself, for every future 911/912 clone (incl. the dotfiles
Windows VM, which is not base-role-managed). Needs a template rebuild to take
effect.

Closes #1099

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* fix(packer): make the Panther scrub a readiness invariant, not best-effort (#1099)

Review on #1103: the del was best-effort — a failed delete would still start
QEMU-GA and pass smoke, silently shipping the plaintext credential. Now:
- SetupComplete.cmd refuses to start QEMU-GA (the readiness signal
  packer-smoke.sh waits on) if either Panther answer file survived the
  scrub, so a failed rebuild fails loudly instead of shipping the leak;
- packer-smoke.sh asserts both files are absent over SSH before declaring
  the template usable.

Refs #1099

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
@Gerrrt
Gerrrt marked this pull request as ready for review October 9, 2026 18:09
Copilot AI balanced review requested due to automatic review settings October 9, 2026 18:09
@Gerrrt

Gerrrt commented Oct 9, 2026

Copy link
Copy Markdown
Owner Author

Taking this over (no other session is on it). The logoff step (d05e255, shutdown /l /f) is the only part the 919 scratch build didn't cover. Garrett chose to verify it on the real 911 rebuild instead of a second scratch build: merge on green, rebuild 911, and check the console rests at sign-in on the dot-windows re-clone that #1108 needs anyway. Merged main in (36f0841); no conflicts.

🤖 Generated with Claude Code

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Concurrent first-logon commands can race the forced logoff, leaving autologon credentials configured.

1 open finding
What changed in this PR

Adds one-shot Administrator autologon so Windows 11 clones complete OOBE.

Changes:

  • Adds clone-time autologon.
  • Attempts credential cleanup and immediate logoff.
File Description
packer/​windows/​unattend-oobe.xml.pkrtpl Configures OOBE autologon and cleanup commands.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread packer/windows/unattend-oobe.xml.pkrtpl Resolved
…ast (#1092)

Windows 10 and 11 start FirstLogonCommands without waiting for the one
before, so the separate logoff could end the session before AutoAdminLogon
was cleared and DefaultPassword deleted. One cmd /c chain fixes the order.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Gerrrt
Gerrrt merged commit ba39b65 into main Oct 9, 2026
8 checks passed
@Gerrrt
Gerrrt deleted the gerrrt/win11-oobe-autologon branch October 9, 2026 18:26
Gerrrt added a commit that referenced this pull request Oct 9, 2026
…ws (#1108) (#1111)

* docs(dotfiles): bake the Windows layer's prerequisites into dot-windows (#1108)

At the console, tester is a standard user, so each machine-wide install
in the layer's configuration.dsc.yaml asked for the Administrator
password. §3 now installs those packages before `clean` is taken:
PowerShell 7, Git, WSL and Wireshark, each checked against its
publisher's SHA-256. It also turns on Developer Mode and `winget
configure`. §4 drops the steps those cover, and the OOBE workaround that
#1093 made unnecessary. Done on 198 today; the as-run table and the
changelog record it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(dotfiles): the bake runs as SYSTEM through the guest agent, not over SSH (#1108)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Gerrrt added a commit that referenced this pull request Oct 9, 2026
…dows (#1108) (#1112)

* docs(dotfiles): bake the Windows layer's prerequisites into dot-windows (#1108)

At the console, tester is a standard user, so each machine-wide install
in the layer's configuration.dsc.yaml asked for the Administrator
password. §3 now installs those packages before `clean` is taken:
PowerShell 7, Git, WSL and Wireshark, each checked against its
publisher's SHA-256. It also turns on Developer Mode and `winget
configure`. §4 drops the steps those cover, and the OOBE workaround that
#1093 made unnecessary. Done on 198 today; the as-run table and the
changelog record it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(dotfiles): the bake runs as SYSTEM through the guest agent, not over SSH (#1108)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(dotfiles): the bake fails when winget configure --enable does (#1108)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* wip

* wip2

* feat(tofu,dotfiles): VirtIO GPU and a baked first sign-in for dot-windows (#1108)

Two things made dot-windows slow, and neither was Saruman. Proxmox's
default VGA has no Windows driver, so the guest drew every frame on the
CPU as the Basic Display Adapter. The guest module gains a `vga` input,
null by default, and dot-windows sets "virtio"; viogpudo is already in
911. And tester's first sign-in ran the CPU at 30-100% for 3.5-7.5
minutes, so §3 now signs it in once before `clean`, after which a
sign-in settles in about 2 minutes. Both are applied to 198, and the
as-run table and changelog record the measurements.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants