-
Notifications
You must be signed in to change notification settings - Fork 256
Description
After CRC is installed, user has to perform crc setup instead of opening the guided flow, otherwise setup with the guided flow will seem to succeed when it actually it failed. User flow should be
- Install CRC
- run
crc setupmanually - Start the electron application which starts the tray (keep using it)
Why it happened:
Recently we made changes to run the crc daemon using Windows task scheduler. One of CRC's preflight checks is making sure the task is present https://github.com/code-ready/crc/blob/main/pkg/crc/preflight/preflight_daemon_task_check_windows.go#L63-L73 .
In cli scenarios, the daemon process is always going to be handled as a scheduled task, but the tray has code which runs crc daemon before running the crc setup and because of that https://github.com/code-ready/crc/blob/main/pkg/crc/preflight/preflight_daemon_task_check_windows.go#L77-L79 is going to return an error. As part of the removal of the crc daemon task, we first check if the daemon process is running and if it is, then we assume it is run a a scheduled task and try to stop the task https://github.com/code-ready/crc/blob/main/pkg/crc/preflight/preflight_daemon_task_check_windows.go#L103-L109 which fails because there is no task present.
Reproducer
<= on one terminal =>
$ crc daemon
<= on another terminal =>
$ crc setup
INFO Checking if daemon task is installed
DEBU Running 'Get-ScheduledTask -TaskName crcDaemon'
DEBU Command failed: exit status 1
DEBU stdout:
DEBU stderr: Get-ScheduledTask : No MSFT_ScheduledTask objects found with property 'TaskName' equal to 'crcDaemon'. Verify the value of the property and retry.
At line:1 char:43
+ ... reference = 'SilentlyContinue'; Get-ScheduledTask -TaskName crcDaemon
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (crcDaemon:String) [Get-ScheduledTask], CimJobException
+ FullyQualifiedErrorId : CmdletizationQuery_NotFound_TaskName,Get-ScheduledTask
DEBU crcDaemon task is not installed: exit status 1 : Get-ScheduledTask : No MSFT_ScheduledTask objects found with property 'TaskName' equal to 'crcDaemon'. Verify the value of the property and retry.
At line:1 char:43
+ ... reference = 'SilentlyContinue'; Get-ScheduledTask -TaskName crcDaemon
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (crcDaemon:String) [Get-ScheduledTask], CimJobException
+ FullyQualifiedErrorId : CmdletizationQuery_NotFound_TaskName,Get-ScheduledTask
DEBU exit status 1
INFO Installing the daemon task
DEBU Running 'Stop-ScheduledTask -TaskName crcDaemon'
DEBU Command failed: exit status 1
DEBU stdout:
DEBU stderr: Stop-ScheduledTask : The system cannot find the file specified.
At line:1 char:43
+ ... eference = 'SilentlyContinue'; Stop-ScheduledTask -TaskName crcDaemon
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (PS_ScheduledTask:Root/Microsoft/...S_ScheduledTask) [Stop-ScheduledTask], CimException
+ FullyQualifiedErrorId : HRESULT 0x80070002,Stop-ScheduledTask
DEBU unable to stop the crcDaemon task: exit status 1 : Stop-ScheduledTask : The system cannot find the file specified.
At line:1 char:43
+ ... eference = 'SilentlyContinue'; Stop-ScheduledTask -TaskName crcDaemon
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (PS_ScheduledTask:Root/Microsoft/...S_ScheduledTask) [Stop-ScheduledTask], CimException
+ FullyQualifiedErrorId : HRESULT 0x80070002,Stop-ScheduledTask
exit status 1