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.
jamesstringer90 added a commit that referenced this pull request Sep 10, 2026
App Sandbox 0.1.5

### Added

- Choose where VM disks are stored when creating a sandbox on Windows or macOS, including on another drive. Requested in [#12](#12), [#24](#24), [#38](#38), [#68](#68), and [#71](#71).
- Automatic mouse capture for games and 3D applications in Windows and Ubuntu VMs.
- Keyboard shortcut capture and audio mute controls in the Windows VM viewer's title bar menu on macOS.

### Fixed

- Improved international keyboard input and fixed keyboard layout setup in newly created Ubuntu VMs. [#76](#76)
- Fixed host input methods intercepting typing and language-switching shortcuts when keyboard shortcut capture is enabled on Windows. [#116](#116)
- Fixed incorrect mouse positioning when changing display scaling inside Windows VMs. [#111](#111)
- Fixed distorted text cursors in the Windows viewer at high DPI scaling settings.
- Fixed copying text from Ubuntu Terminal to the host clipboard.
- Fixed NVIDIA driver-profile errors preventing games such as Counter-Strike 2 from starting. Addresses the NVIDIA profile error in [#73](#73).
- Fixed Windows installation images being incorrectly detected as English on non-English hosts. [#84](#84)
- Fixed NAT internet connectivity in Windows VMs with localized network adapter names. [#79](#79), [#84](#84)
- Fixed external networking failing after saving adapter names containing non-English characters. [#94](#94)
- Fixed saved NAT addresses being lost when VMs shut down.
- Fixed Windows VMs created from templates using the template's disk size instead of the size selected during creation.
- Fixed saved snapshots being modified when starting a VM after deleting a branch.
- Fixed snapshot controls remaining visible after all snapshots and branches were deleted.
- Fixed Windows installation getting stuck when the username matches the VM name. [#103](#103)
- Improved VM creation checks for invalid usernames and missing passwords.
- Fixed VM table columns shifting when switching operating systems in the creation window.
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