Skip to content

create: reject username equal to the VM name for Windows guests (#87)#103

Open
n0dai wants to merge 1 commit into
jamesstringer90:mainfrom
n0dai:fix/username-vm-name-collision
Open

create: reject username equal to the VM name for Windows guests (#87)#103
n0dai wants to merge 1 commit into
jamesstringer90:mainfrom
n0dai:fix/username-vm-name-collision

Conversation

@n0dai

@n0dai n0dai commented Jul 18, 2026

Copy link
Copy Markdown

Problem

Creating a Windows VM whose admin username is identical to the VM name (e.g. VM test, user test) 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:

  1. The VM name becomes the guest ComputerName (asb_provision_unattend).
  2. During the unattend UserAccounts pass, the account is created, but adding it to local groups fails: LookupAccountName on a machine named like the user resolves the computer/domain object first, so NetLocalGroupAddMembers fails with ERROR_NO_SUCH_MEMBER:
    [Shell Unattend] UserAccounts: created account 'test'
    [Shell Unattend] UserAccounts: failed to add 'test' to group 'Utilisateurs' (0x8007056b)
    [Shell Unattend] UserAccounts: failed to add 'test' to group 'Administrateurs' (0x8007056b)
    
  3. The account ends up in no group at all, so msoobe decides no usable local account exists, creates defaultuser0 and autologs that instead (Creating a new default account / Not setting autologon for new local user).
  4. FirstLogonCommands tied to the created user never run → setup.cmdappsandbox-agent.exe --install never execute → the agent never connects and install_complete stays false forever.

Meanwhile SetupComplete.cmd does 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.js validateUsername (GUI, both hosts) — Windows guests only, case-insensitive; also revalidate the username live when the VM name field changes.
  • src/app_win/headless.c validate_create (Windows daemon) — same rule in the Windows-account branch.
  • src/app_mac/headless.m validate_create_mac (macOS daemon) — Windows guests only.

Error message in all three: Username cannot be the same as the VM name.

Testing

  • Reproduced the failure with VM test / user test (Win11 25H2 guest): agent never installs, guest log shows the 0x8007056b group-add failures above.
  • Recreated the same VM with user testuser: install completes, agent comes online, everything works.
  • src/app_win/headless.c compiles cleanly with the change (MSBuild, Release x64).

Likely fixes the Windows cases of #87

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.
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.

1 participant