containers / podman

Podman: A tool for managing OCI containers and pods.
https://podman.io
Apache License 2.0
23.79k stars 2.42k forks source link

"podman machine start" fails to run in ADO Pipeline Job on Windows Self-Hosted Agent #22513

Open jailohani opened 6 months ago

jailohani commented 6 months ago

Issue Description

Need to run a CI Pipeline on a windows self-hosted agent where Podman is installed. At the start of the pipeline, need to start the Podman machine using the command "podman machine start", so that the subsequent build and push commands can be run.

The command works without issue when run manually, but fails when run by the pipeline.

Error Message- Error: fork/exec C:\Users\myuser\AppData\Local\Microsoft\WindowsApps\wsl.exe: The file cannot be accessed by the system.

The agent runs as a service with the username myuser for log on. Tried giving permissions to myuser for that folder using the following but was unsuccessful in resolving the issue:

icacls "C:\Users\myuser\AppData\Local\Microsoft\WindowsApps\wsl.exe" /grant myuser:F /T

Steps to reproduce the issue

Steps to reproduce the issue

  1. Install Podman
  2. Run podman init machine_name
  3. Run podman machine start machine_name from a script or powershell task in an agent job.

Describe the results you received

Error: fork/exec C:\Users\myuser\AppData\Local\Microsoft\WindowsApps\wsl.exe: The file cannot be accessed by the system

Describe the results you expected

Podman machine should start successfully.

podman info output

IOS: windows/amd64
provider: wsl
version: 5.0.2

Podman in a container

No

Privileged Or Rootless

None

Upstream Latest Release

Yes

Additional environment details

Windows Self Hosted Agent Specs:

Edition Windows Server 2022 Datacenter Version 21H2 Installed on ‎3/‎3/‎2023 OS build 20348.2402

Additional information

Additional information like issue happens only occasionally or issue happens with a particular architecture or on a particular setting

ashley-cui commented 6 months ago

Does the pipeline user have permissions to use WSL?

jailohani commented 6 months ago

Yes, when we login as the same user, both WSL and podman commands work. Could there be an issue in the commands being run as a background service?

pik-256 commented 4 months ago

Same here. Cannot autostart podman at boot: Error: fork/exec C:\Users\user\AppData\Local\Microsoft\WindowsApps\wsl.exe: The file cannot be accessed by the system. It runs correctly in normal session but cannot run when started via TaskScheduler or as a service. I tried to start it with nssm.exe as adviced to autorun a docker. When I run two commands:

wsl --exec whoami >log
podman machine start >>log

then I can see that wsl runs correctly (output: user.) but "podman machine start" fails. WSL version: WSL: 2.2.4.0 Windows Server 2022

frontmatec-rws commented 4 months ago

i have the sane issue

NappySprout commented 3 months ago

I face the same issue trying to run podman machine init using ansible, I also received an error like this Error: fork/exec C:\Users\myuser\AppData\Local\Microsoft\WindowsApps\wsl.exe: The file cannot be accessed by the system

However the path doesn't exist on the remote windows instance when I rdp into it and check.

The weird thing is RDPing into the machine and running podman machine init manually does not throw an error :P

kekyo commented 2 months ago

I have same issue too...

The file is available on error message path and access check is valid on the windows service account:

image