Skip to content

Prevent starting and stopping legacy hyperv machines when not elevated #27615

@l0rd

Description

@l0rd

Issue Description

Legacy Hyper-v machines are podman VMs machines that have been created before this. Stopping and restarting such a VM requires to be executed from a privileged terminal or the VM will become unusable.

Steps to reproduce the issue

Steps to reproduce the issue

  1. Open an admin terminal and
    1. Configure hyperv as the provider $env:CONTAINERS_MACHINE_PROVIDER="hyperv"
    2. Create a v5.7 hyperv machine (from an admin terminal): podman-5.7.exe machine init --now
  2. Open a normal, non-admin, terminal and:
    1. Configure hyperv as the provider $env:CONTAINERS_MACHINE_PROVIDER="hyperv"
    2. Stop the machine with a v6.0 client: podman-6.0.exe machine stop
    3. Restart the machine with a v6.0 client: podman-6.0.exe machine start

Describe the results you received

The machine fail to start and cannot be restarted, even from an admin terminal:

> .\bin\windows\podman-6.0.exe machine stop
Machine "podman-machine-default" stopped successfully
> .\bin\windows\podman-6.0.exe machine start
Starting machine "podman-machine-default"
time="2025-11-26T19:30:10+01:00" level=warning msg="detected port conflict on machine ssh port [57653], reassigning"
Error: could not start api proxy since expected pipe is not available: podman-machine-default

Describe the results you expected

Older machines (the ones associated to machine-specific registry entries) should not be stopped/started from a normal terminal: we should display an error suggesting to run the command in an admin terminal.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.windowsissue/bug on Windows

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions