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

2.25.0 is broken on Windows due to ExecutionPolicy requirement; recommended to use 2.24 for now #3812

Closed
jeffmaury opened this issue Aug 30, 2023 · 10 comments · Fixed by #3814
Labels
kind/bug Something isn't working os/windows

Comments

@jeffmaury
Copy link

General information

  • OS: Windows
  • Hypervisor: Hyper-V
  • Did you run crc setup before starting it (Yes/No)?Yes
  • Running CRC on: Laptop

CRC version

CRC version: 2.25.0+97705a
OpenShift version: 4.13.6
Podman version: 4.4.4

CRC status

DEBU CRC version: 2.25.0+97705a
DEBU OpenShift version: 4.13.6
DEBU Podman version: 4.4.4
DEBU Running 'crc status'
crc does not seem to be setup correctly, have you run 'crc setup'?

CRC config

- preset                                : microshift

Host Operating System

Nom de l'hôte:                              DESKTOP-JEFF
Nom du système d'exploitation:              Microsoft Windows 11 Professionnel
Version du système:                         10.0.22621 N/A build 22621
Fabricant du système d'exploitation:        Microsoft Corporation
Configuration du système d'exploitation:    Station de travail autonome
Type de build du système d'exploitation:    Multiprocessor Free
Propriétaire enregistré:                    Jeff MAURY
Organisation enregistrée:                   
Identificateur de produit:                  00330-80819-37372-AA576
Date d'installation originale:              09/11/2022, 16:39:06
Heure de démarrage du système:              30/08/2023, 10:55:31
Fabricant du système:                       LENOVO
Modèle du système:                          20TJS2F43N
Type du système:                            x64-based PC
Processeur(s):                              1 processeur(s) installé(s).
                                            [01] : Intel64 Family 6 Model 165 Stepping 2 GenuineIntel ~2310 MHz
Version du BIOS:                            LENOVO N2VET29W (1.14 ), 15/03/2021
Répertoire Windows:                         C:\Windows
Répertoire système:                         C:\Windows\system32
Périphérique d'amorçage:                    \Device\HarddiskVolume1
Option régionale du système:                fr;Français (France)
Paramètres régionaux d'entrée:              fr;Français (France)
Fuseau horaire:                             (UTC+01:00) Bruxelles, Copenhague, Madrid, Paris
Mémoire physique totale:                    32 525 Mo
Mémoire physique disponible:                14 954 Mo
Mémoire virtuelle : taille maximale:        65 051 Mo
Mémoire virtuelle : disponible:             47 967 Mo
Mémoire virtuelle : en cours d'utilisation: 17 084 Mo
Emplacements des fichiers d'échange:        C:\pagefile.sys
Domaine:                                    WORKGROUP
Serveur d'ouverture de session:             \\DESKTOP-JEFF
Correctif(s):                               4 Corrections installées.
                                            [01]: KB5028948
                                            [02]: KB5012170
                                            [03]: KB5029263
                                            [04]: KB5028756
Carte(s) réseau:                            5 carte(s) réseau installée(s).
                                            [01]: Intel(R) Wi-Fi 6 AX201 160MHz
                                                  Nom de la connexion : Wi-Fi
                                                  DHCP activé :         Oui
                                                  Serveur DHCP :        192.168.1.254
                                                  Adresse(s) IP
                                                  [01]: 192.168.1.187
                                                  [02]: fe80::5102:6cd:7e09:85b2
                                                  [03]: 2a01:e34:ec7e:3020:5d11:476f:8292:f465
                                                  [04]: 2a01:e34:ec7e:3020:5116:66ca:8d7a:292a
                                            [02]: Bluetooth Device (Personal Area Network)
                                                  Nom de la connexion : Connexion réseau Bluetooth
                                                  État :                Support déconnecté
                                            [03]: Wintun Userspace Tunnel
                                                  Nom de la connexion : OpenVPN Wintun
                                                  État :                Support déconnecté
                                            [04]: TAP-Windows Adapter V9
                                                  Nom de la connexion : OpenVPN TAP-Windows6
                                                  État :                Support déconnecté
                                            [05]: OpenVPN Data Channel Offload
                                                  Nom de la connexion : OpenVPN Data Channel Offload
                                                  État :                Support déconnecté
Configuration requise pour Hyper-V:         Un hyperviseur a été détecté. Les fonctionnalités nécessaires à Hyper-V ne seront pas affichées.

Steps to reproduce

  1. Install 2.25.0
  2. run crc setup

Expected

Daemon should start

Actual

Daemon does not start

Logs

crc.log

Please consider posting the output of crc start --log-level debug on http://gist.github.com/ and post the link in the issue.

@anjannath
Copy link
Member

anjannath commented Aug 30, 2023

@jeffmaury does running crc cleanup then crc setup help?

i tried to reproduce by upgrading CRC from 2.24.1 to 2.25.0 and did not face any issues with crc setup, daemon was successfully started (installed MSI then ran crc setup)

PS C:\Users\anath> crc.exe setup --log-level debug
DEBU CRC version: 2.25.0+97705a
DEBU OpenShift version: 4.13.6
DEBU Podman version: 4.4.4
DEBU Running 'crc setup'
INFO Using bundle path C:\Users\anath\.crc\cache\crc_podman_hyperv_4.4.4_amd64.crcbundle
INFO Checking minimum RAM requirements
DEBU Total memory of system is 34248990720 bytes
INFO Checking if current user is in crc-users and Hyper-V admins group
DEBU Running '(Get-LocalGroupMember -Group 'crc-users').Name'
DEBU Checking current user is in the 'crc-user' group
DEBU group members: DESKTOP-J8H86J0\anath
DEBU Running '(Get-LocalGroupMember -SID 'S-1-5-32-578').Name'
DEBU Checking current user is in the 'Hyper-v Administrators' group
DEBU group members: DESKTOP-J8H86J0\anath
INFO Checking if CRC bundle is extracted in '$HOME/.crc'
INFO Checking if C:\Users\anath\.crc\cache\crc_podman_hyperv_4.4.4_amd64.crcbundle exists
DEBU C:\Users\anath\.crc\cache\crc_podman_hyperv_4.4.4_amd64.crcbundle exists
INFO Checking if the daemon task powershell script is present
INFO Checking if the daemon task is installed
DEBU Running 'Get-ScheduledTask -TaskName crcDaemon'
DEBU Running '(Get-ScheduledTask -TaskName "crcDaemon").Version'
DEBU expected crcDaemon task to be on version '2.25.0' but got '2.24.1
'
INFO Installing the daemon task
DEBU Running 'Get-ScheduledTask -TaskName crcDaemon'
DEBU Running '(Get-ScheduledTask -TaskName "crcDaemon").State'
DEBU Running 'Get-ScheduledTask -TaskName crcDaemon'
DEBU Running '(Get-ScheduledTask -TaskName "crcDaemon").Version'
DEBU Running 'Unregister-ScheduledTask -TaskName crcDaemon -Confirm:$false'
DEBU Running 'Register-ScheduledTask -Xml '<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.3" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
  <RegistrationInfo>
    <Description>Run crc daemon as a task</Description>
    <Version>2.25.0</Version>
  </RegistrationInfo>
  <Settings>
    <DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
    <StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>
    <Hidden>true</Hidden>
    <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
    <IdleSettings>
      <Duration>PT10M</Duration>
      <WaitTimeout>PT1H</WaitTimeout>
      <StopOnIdleEnd>true</StopOnIdleEnd>
      <RestartOnIdle>false</RestartOnIdle>
    </IdleSettings>
    <UseUnifiedSchedulingEngine>true</UseUnifiedSchedulingEngine>
    <ExecutionTimeLimit>PT0S</ExecutionTimeLimit>
  </Settings>
  <Triggers>
    <LogonTrigger>
      <UserId>DESKTOP-J8H86J0\anath</UserId>
    </LogonTrigger>
  </Triggers>
  <Actions Context="Author">
    <Exec>
      <Command>powershell.exe</Command>
      <Arguments>-WindowStyle Hidden -Command &amp; &#39;C:\Users\anath\.crc\bin\hidden_daemon.ps1&#39;</Arguments>
    </Exec>
  </Actions>
</Task>
' -TaskName crcDaemon'
INFO Checking if the daemon task is running
DEBU Running '(Get-ScheduledTask -TaskName "crcDaemon").State'
DEBU expected crcDaemon task to be in 'Running' but got 'Ready
'
INFO Running the daemon task
DEBU Running 'Start-ScheduledTask -TaskName crcDaemon'
DEBU retry loop: attempt 0
DEBU error: Temporary error: daemon is not running yet - sleeping 2s
DEBU retry loop: attempt 1
INFO Checking admin helper service is running
DEBU Running '(Get-Service crcAdminHelper).Status'
Your system is correctly setup for using CRC. Use 'crc start' to start the instance

PS C:\Users\anath> Get-ScheduledTask -TaskName 'crcDaemon'

TaskPath                                       TaskName                          State
--------                                       --------                          -----
\                                              crcDaemon                         Running

@jeffmaury
Copy link
Author

Check the timestamp the file is huge i'm a long time user of CRC ! 🥲

@jeffmaury
Copy link
Author

jeffmaury commented Aug 30, 2023

Please note that it has also been reported by a Podman Desktop user on Discord: https://discord.com/channels/852634929845239818/1085121643782873118/threads/1145952685464485938

@anjannath
Copy link
Member

anjannath commented Aug 31, 2023

A crc cleanup did not help? I only face this issue, when there's another instance of the daemon running. Make sure there are no stray crc processes, if there are please kill those from the task manager and then try to run crc setup again.

I went through the discord thread, it seems that user tried to start the daemon manually and then run crc setup which will not work, there can be only one instance of the daemon running, so the scheduled task will just start and end immidiately, and the state will be "Ready" instead of "Running"

PS C:\Users\anath> crc.exe daemon --log-level debug
DEBU CRC version: 2.25.0+97705a
DEBU OpenShift version: 4.13.6
DEBU Podman version: 4.4.4
DEBU Running 'crc daemon'
daemon is already running

@jeffmaury can you please also share the content of ~\.crc\bin\hidden_daemon.ps1

@jeffmaury
Copy link
Author

crc cleanup did not help:

image

@anjannath
Copy link
Member

anjannath commented Aug 31, 2023

So after debugging with @jeffmaury we found the cause to be the ExecutionPolicy which was set to Restricted.

To fix the issue we ran Set-ExecutionPolicy -ExecutionPolicy RemoteSigned and then crc setup successfully started the daemon process

@gbraad maybe we need to add a preflight check or custom action in the MSI to set the execution policy to allow to run posh scripts?

@slemeur
Copy link

slemeur commented Aug 31, 2023

Why was it setup to "restricted"? shouldn't be an error message explaining the error too?

@jeffmaury
Copy link
Author

This is the default on Windows

anjannath added a commit to anjannath/crc that referenced this issue Aug 31, 2023
the default effective policy is Restricted which prevents the hidden_daemon.ps1
script from running when started from the scheduled task

this fixes crc-org#3812
anjannath added a commit to anjannath/crc that referenced this issue Aug 31, 2023
the default effective policy is Restricted which prevents the hidden_daemon.ps1
script from running which is started from the scheduled task to run the  daemon

this fixes crc-org#3812
@gbraad
Copy link
Contributor

gbraad commented Aug 31, 2023

yep; this is the default... and most likely why I can not repeat the issue: I have changed this policy :-/

@gbraad
Copy link
Contributor

gbraad commented Aug 31, 2023

perhaps a GUI wrapper to handle this case might be cleaner (changing the policy might not be something that everybody can do).

@gbraad gbraad pinned this issue Aug 31, 2023
@gbraad gbraad changed the title 2.25.0 is broken on Windows 2.25.0 is broken on Windows due to ExecutionPolicy requirement; recommended to use 2.24 for now Aug 31, 2023
openshift-merge-robot pushed a commit that referenced this issue Sep 1, 2023
the default effective policy is Restricted which prevents the hidden_daemon.ps1
script from running which is started from the scheduled task to run the  daemon

this fixes #3812
@anjannath anjannath unpinned this issue Jan 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working os/windows
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants