create: reject username equal to the VM name for Windows guests (#87)#103
Open
n0dai wants to merge 1 commit into
Open
create: reject username equal to the VM name for Windows guests (#87)#103n0dai wants to merge 1 commit into
n0dai wants to merge 1 commit into
Conversation
The VM name becomes the guest ComputerName (asb_provision_unattend). When the admin username is identical to it, the unattend UserAccounts pass creates the account but fails to add it to any local group: LookupAccountName on a machine named like the user resolves the computer/domain object first, so NetLocalGroupAddMembers fails with ERROR_NO_SUCH_MEMBER (0x8007056b in UnattendGC\setupact.log). The account ends up group-less, msoobe considers no usable account exists, creates and autologs defaultuser0 instead, FirstLogonCommands never run, so setup.cmd / appsandbox-agent.exe --install never execute and the VM sits on "Installing Windows" forever (agent never online, no input). Reject the collision at creation time in the three input validators: - web/app.js validateUsername (GUI, both hosts) + revalidate the username when the VM name field changes - src/app_win/headless.c validate_create (Windows daemon) - src/app_mac/headless.m validate_create_mac (macOS daemon, Windows guests only) Likely the root cause of the Windows reports in jamesstringer90#87.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Creating a Windows VM whose admin username is identical to the VM name (e.g. VM
test, usertest) always ends up stuck on "Installing Windows" with the agent never coming online (and therefore no mouse/keyboard in the display).Root cause chain, diagnosed by mounting the guest VHDX and reading
C:\Windows\Panther\UnattendGC\setupact.log:ComputerName(asb_provision_unattend).UserAccountspass, the account is created, but adding it to local groups fails:LookupAccountNameon a machine named like the user resolves the computer/domain object first, soNetLocalGroupAddMembersfails withERROR_NO_SUCH_MEMBER:defaultuser0and autologs that instead (Creating a new default account/Not setting autologon for new local user).FirstLogonCommandstied to the created user never run →setup.cmd→appsandbox-agent.exe --installnever execute → the agent never connects andinstall_completestays false forever.Meanwhile
SetupComplete.cmddoes run (as SYSTEM), so the VDD comes up and the display opens — "display works, agent never online" is the signature of this failure. This is very likely the root cause of the Windows reports in #87.Fix
Reject the collision at creation time, in the three places input is validated:
web/app.jsvalidateUsername(GUI, both hosts) — Windows guests only, case-insensitive; also revalidate the username live when the VM name field changes.src/app_win/headless.cvalidate_create(Windows daemon) — same rule in the Windows-account branch.src/app_mac/headless.mvalidate_create_mac(macOS daemon) — Windows guests only.Error message in all three:
Username cannot be the same as the VM name.Testing
test/ usertest(Win11 25H2 guest): agent never installs, guest log shows the0x8007056bgroup-add failures above.testuser: install completes, agent comes online, everything works.src/app_win/headless.ccompiles cleanly with the change (MSBuild, Release x64).Likely fixes the Windows cases of #87