podman icon indicating copy to clipboard operation
podman copied to clipboard

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

Open jailohani opened this issue 1 year ago • 5 comments

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

jailohani avatar Apr 26 '24 05:04 jailohani

Does the pipeline user have permissions to use WSL?

ashley-cui avatar May 15 '24 21:05 ashley-cui

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?

jailohani avatar May 16 '24 03:05 jailohani

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

pik-256 avatar Jun 24 '24 19:06 pik-256

i have the sane issue

frontmatec-rws avatar Jul 01 '24 08:07 frontmatec-rws

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

NappySprout avatar Jul 23 '24 05:07 NappySprout

I have same issue too...

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

image

kekyo avatar Aug 20 '24 01:08 kekyo