Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error running action on self-hosted windows 11 runner #43

Closed
ssbarnea opened this issue Dec 23, 2022 · 5 comments
Closed

Error running action on self-hosted windows 11 runner #43

ssbarnea opened this issue Dec 23, 2022 · 5 comments
Milestone

Comments

@ssbarnea
Copy link

2022-12-23T12:13:53.9455463Z ##[group]Run Vampire/setup-wsl@v1.3.4
2022-12-23T12:13:53.9456069Z with:
2022-12-23T12:13:53.9456472Z   set-as-default: true
2022-12-23T12:13:53.9456959Z   wsl-shell-command: bash -euo pipefail
2022-12-23T12:13:53.9457872Z   wsl-conf: [automount]
enabled = true
root = /
options = "metadata,umask=077"
[interop]
enabled = false
appendWindowsPath = false
[network]
hostname = wsl

2022-12-23T12:13:53.9458777Z   additional-packages: curl git make python3-dev python3-pip python3-venv qemu-user-static xvfb
2022-12-23T12:13:53.9459588Z   distribution: Debian
2022-12-23T12:13:53.9460210Z   use-cache: true | false
2022-12-23T12:13:53.9460875Z   update: false
2022-12-23T12:13:53.9461477Z env:
2022-12-23T12:13:53.9462049Z   FORCE_COLOR: 1
2022-12-23T12:13:53.9462450Z ##[endgroup]
2022-12-23T12:13:56.2638308Z ##[group]Verify Windows Environment
2022-12-23T12:13:57.2631640Z ##[endgroup]
2022-12-23T12:13:57.2632584Z ##[group]Install Distribution
2022-12-23T12:13:57.2636452Z [command]C:\Windows\system32\wsl.exe --set-default-version 1
2022-12-23T12:13:57.2638014Z T�h�e� �o�p�e�r�a�t�i�o�n� �c�o�m�p�l�e�t�e�d� �s�u�c�c�e�s�s�f�u�l�l�y�.�
2022-12-23T12:13:57.2638885Z �
2022-12-23T12:13:57.2639430Z �
2022-12-23T12:13:57.2670633Z �::debug::isExplicit: 1.0.0
2022-12-23T12:14:03.3153367Z [command]C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command "$ErrorActionPreference = 'Stop' ; try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ; if ((Get-Command -Name Expand-Archive -Module Microsoft.PowerShell.Archive -ErrorAction Ignore)) { Expand-Archive -LiteralPath 'C:\actions-runner\_work\_temp\2db4332d-3ca5-4ceb-b380-82e52b32250d' -DestinationPath 'C:\actions-runner\_work\_temp\872b8560-a398-43f1-87cf-9831bafac869' -Force } else {[System.IO.Compression.ZipFile]::ExtractToDirectory('C:\actions-runner\_work\_temp\2db4332d-3ca5-4ceb-b380-82e52b32250d', 'C:\actions-runner\_work\_temp\872b8560-a398-43f1-87cf-9831bafac869', $true) }"
2022-12-23T12:14:04.8639005Z Expand-Archive :  is not a supported archive file format. .zip is the only supported archive file format.
2022-12-23T12:14:04.8835771Z At line:1 char:210
2022-12-23T12:14:04.8871048Z + ...  Ignore)) { Expand-Archive -LiteralPath 'C:\actions-runner\_work\_tem ...
2022-12-23T12:14:04.9001852Z +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2022-12-23T12:14:04.9024477Z     + CategoryInfo          : InvalidArgument: (:String) [Expand-Archive], IOException
2022-12-23T12:14:04.9027686Z     + FullyQualifiedErrorId : NotSupportedArchiveFileExtension,Expand-Archive
2022-12-23T12:14:04.9028573Z  
2022-12-23T12:14:04.9106813Z ##[endgroup]
2022-12-23T12:14:05.8776771Z ##[error]The process 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe' failed with exit code 1
@Vampire
Copy link
Owner

Vampire commented Dec 23, 2022

Can you update the installed PowerShell version?
On the GitHub hosted runners there is PowerShell 7.2.7 / 7.2.8 installed.
I guess you have an older version like 5.1.

With the version on the GitHub hosted runners extracting files where the filename does not end in .zip works without problem.
On a local Windows where PowerShell 5.1 is installed I get the same error, so I guess this is a change in the Expand-Archive PowerShell cmdlet that is used to extract the archive files.

Maybe I'll add some code to rename the files that are tried to be extracted so they end in .zip and thus work with those older PowerShell versions, but as a quick work-around upgrading your PowerShell version should hopefully work.

@ssbarnea
Copy link
Author

Your are right, even if this is a Windows 11 with all updates, running $PSVersionTable from inside pwsh reports 5.1. For the sake of automation, I am now trying to find the commands to upgrade it... as I do not fancy "manul web store operations.". The more I did on what happens on Windows ecosystem I realise that instead of learning from others (linux, macos), they managed to mess everything... at least from the automation point of view.

@ssbarnea
Copy link
Author

ssbarnea commented Dec 23, 2022

Based on https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows?WT.mc_id=THOMASMAURER-blog-thmaure&view=powershell-7.3&viewFallbackFrom=powershell-7 running winget install --id Microsoft.Powershell --source winget should upgrade it and at least reported as successful. Still version reported is the same, even after exiting the session and starting a new one. Basically it did install it but not sure where... as it did not replace the older one. I will now try a reboot... reboot did not sort it.

@ssbarnea
Copy link
Author

So if I run pwsh, it starts v7, but app links from taskbar start the old v5 one. One dilemma sorted.

Now the real issue is that when I installed the self-hosted github-runner, I installed it using default options, which is to run as a service using the NT AUTHORITY\NETWORK SERVICE instead of the local user I also have on that machine.

While I do have working WSL2 installation under my username, the service account is not able to see it, and wsl reports "Windows Subsystem for Linux has no installed distributions.". Even worse, the attempt to install Ubuntu fails with:

wsl --install --distribution Ubuntu-20.04   && exit 0 
Installing: Ubuntu 20.04 LTS

An error occurred during installation. Distribution Name: 'Ubuntu 20.04 LTS' Error Code: 0x803fb008

Full log at https://github.com/ansible/vscode-ansible/actions/runs/3768139630/jobs/6406318147#step:3:115

Not sure what else to try, maybe to uninstall the runner and attempt to configure it to run under my user account. At least for that one I was able to install wsl2 manually. As NT AUTHORITY\NETWORK SERVICE is a special account, if I remember well I have no chance to login as it and probably that account does not even have access to Windows GUI, so I kinda doubt I would be able to run my test suite under it.

@Vampire Vampire added this to the v1.3.5 milestone Jan 24, 2023
@Vampire
Copy link
Owner

Vampire commented Jan 24, 2023

The original issue with PowerShell 5 should now be fixed hopefully.
Could you maybe test again whether it indeed works now without PowerShell 7 available?
Don't for get for this test to remove the caches or to disable caching, or the extraction is not even tried.

Regarding the question of how to run or install a custom runner, I fear I cannot tell you much, sorry.
I never worked with self-hosted runners.

@Vampire Vampire closed this as completed Jan 24, 2023
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

No branches or pull requests

2 participants