Skip to content

[Bug]: stacyvm uninstall fails on Windows and leaves the binary, config, and DB behind #17

@Kaushik2003

Description

@Kaushik2003

What happened?

On Windows, stacyvm uninstall reports a failure and removes nothing. After
confirming the prompt, the config directory, database, and binary all remain,
and stacyvm still runs.

The binary is installed inside the config directory
(C:\Users\<user>\.stacyvm\bin\stacyvm.exe). The uninstaller calls
os.RemoveAll(<configDir>), which walks into the currently running .exe.
Windows holds a mandatory kernel lock on a running executable (unlike Unix,
which can unlink an open binary), so removal aborts with "Access is denied" and
leaves the rest of .stacyvm behind too.

Expected: uninstall removes config + DB immediately, and the locked binary
and its directory are removed once the process exits — identical end result on
Windows, macOS, and Linu

Reproduction steps

  1. Install StacyVM on Windows (binary ends up at %USERPROFILE%\.stacyvm\bin\stacyvm.exe)
  2. Run stacyvm uninstall and confirm with y
  3. Run stacyvm again
  4. Observe the binary still runs and %USERPROFILE%\.stacyvm still exists

Install mode

Single-node Docker/runc

Support evidence

  • stacyvm uninstall output:
⚠️ This will permanently delete all StacyVM configuration, database files, and clean up the application registry.
Are you sure you want to proceed? [y/N]: y
Removing configuration directory: C:\Users\kaush\.stacyvm...
⚠️ Failed to remove configuration directory: unlinkat C:\Users\kaush\.stacyvm\bin\stacyvm.exe: Access is denied.
Removing stacyvm binary at: C:\Users\kaush\.stacyvm\bin\stacyvm.exe...
Note: On Windows, the running binary is locked. Please manually delete this file: C:\Users\kaush\.stacyvm\bin\stacyvm.exe
✨ Uninstall completed.

Environment

  • OS: Windows 11 Home Single Language 10.0.26200
  • Arch: amd64
  • Shell: Windows PowerShell 5.1
  • StacyVM: built from source (main)
  • Provider: Docker (default local provider)
  • Install type: host install (not CI)

Logs

unlinkat C:\Users\kaush\.stacyvm\bin\stacyvm.exe: Access is denied.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions