Creating an instance from machine-image does not run windows-startup-script-ps1
lmayorga1980 opened this issue · comments
Created a machine-image in google compute and removed the instance-metadata before saving the machine-image
gcloud compute instances remove-metadata my-instance-name --all"]
When trying to create an instance the windows-startup-script-ps1
does not run
Found this in the Event Viewer
2024/03/12 16:26:09 GCEGuestAgent: Failed to schedule job MTLS_MDS_Credential_Boostrapper with error: ShouldEnable() returned false, cannot schedule job MTLS_MDS_Credential_Boostrapper
When running gcloud compute instances get-serial-port-output myinstance --zone us-east4-b
SeaBIOS (version 1.8.2-google)
Total RAM Size = 0x0000000600000000 = 24576 MiB
CPUs found: 8 Max CPUs supported: 8
found virtio-scsi at 0:3
virtio-scsi vendor='Google' product='PersistentDisk' rev='1' type=0 removable=0
virtio-scsi blksize=512 sectors=125829120 = 61440 MiB
virtio-scsi vendor='Google' product='PersistentDisk' rev='1' type=0 removable=0
virtio-scsi blksize=512 sectors=20971520 = 10240 MiB
drive 0x000f2a80: PCHS=0/0/0 translation=lba LCHS=1024/255/63 s=125829120
drive 0x000f2a40: PCHS=0/0/0 translation=lba LCHS=1024/255/63 s=20971520
Sending Seabios boot VM event.
Booting from Hard Disk 0...
2024/03/12 14:36:48 GCEGuestAgent: GCE Agent Started (version 20240109.00)
2024-03-12T14:36:48.3591Z OSConfigAgent Info: OSConfig Agent (version 20201214.00.0+win@1) started.
2024/03/12 14:36:48 GCEGuestAgent: Could not set default route to metadata: could not find default route
2024/03/12 14:36:49 GCEGuestAgent: Could not set default route to metadata: could not find default route
2024/03/12 14:36:50 GCEGuestAgent: Starting the scheduler to run jobs
2024/03/12 14:36:51 GCEGuestAgent: Scheduler - start: []
2024/03/12 14:36:51 GCEGuestAgent: Starting the scheduler to run jobs
2024/03/12 14:36:51 GCEGuestAgent: Scheduling job: telemetryJobID
2024/03/12 14:36:51 GCEGuestAgent: Scheduling job "telemetryJobID" to run at 24.000000 hr interval
2024/03/12 14:36:51 GCEGuestAgent: Successfully scheduled job telemetryJobID
2024/03/12 16:24:55 GCEGuestAgent: Error watching metadata: context canceled
2024/03/12 16:24:55 GCEGuestAgent: GCE Agent Stopped
I tried the same with a base windows image from windows
project
2024/03/14 15:51:34 GCEGuestAgent: GCE Agent Started (version 20240109.00)
2024/03/14 15:51:35 GCEGuestAgent: Starting the scheduler to run jobs
2024/03/14 15:51:35 GCEGuestAgent: Scheduler - start: []
2024/03/14 15:51:35 GCEGuestAgent: Skipping scheduling credential generation job, failed to reach client credentials endpoint(instance/credentials/certs) with error: error connecting to metadata server, status code: 404
2024/03/14 15:51:35 GCEGuestAgent: Failed to schedule job MTLS_MDS_Credential_Boostrapper with error: ShouldEnable() returned false, cannot schedule job MTLS_MDS_Credential_Boostrapper
2024/03/14 15:51:36 GCEGuestAgent: Starting the scheduler to run jobs
2024/03/14 15:51:36 GCEGuestAgent: Scheduling job: telemetryJobID
2024/03/14 15:51:36 GCEGuestAgent: Scheduling job "telemetryJobID" to run at 24.000000 hr interval
2024/03/14 15:51:36 GCEGuestAgent: Successfully scheduled job telemetryJobID
2024-03-14T15:51:36.5601Z OSConfigAgent Info: OSConfig Agent (version 20231207.01.0+win@1) started.
2024/03/14 15:52:18 GCEInstanceSetup: Enable google_osconfig_agent during the specialize configuration pass.
2024/03/14 15:52:22 GCEInstanceSetup: Starting sysprep specialize phase.
2024/03/14 15:52:23 GCEInstanceSetup: All networks set to DHCP.
2024/03/14 15:52:23 GCEInstanceSetup: VirtIO network adapter detected.
2024/03/14 15:52:25 GCEInstanceSetup: MTU set to 1460 for IPv4 and IPv6 using PowerShell for interface 3 - Google VirtIO Ethernet Adapter. Build 17763
2024/03/14 15:52:25 GCEInstanceSetup: Running 'route' with arguments '/p add 169.254.169.254 mask 255.255.255.255 0.0.0.0 if 3 metric 1'
2024/03/14 15:52:25 GCEInstanceSetup: Added persistent route to metadata netblock to netkvm adapter.
2024/03/14 15:52:25 GCEInstanceSetup: Getting hostname from metadata server.
2024/03/14 15:52:25 GCEInstanceSetup: Renamed from winmi2 to myinstance1.
2024/03/14 15:52:25 GCEInstanceSetup: Configuring WinRM...
2024/03/14 15:52:26 GCEInstanceSetup: Running 'C:\Program Files\Google\Compute Engine\tools\certgen.exe' with arguments '-outDir C:\Windows\TEMP\cert -hostname myinstance1'
2024/03/14 15:52:26 GCEInstanceSetup: --> written C:\Windows\TEMP\cert\cert.p12
2024/03/14 15:52:26 GCEInstanceSetup: Waiting for WinRM to be running...
2024/03/14 15:52:48 GCEInstanceSetup: Setup of WinRM complete.
2024/03/14 15:52:50 C:\Program Files\Google\Compute Engine\metadata_scripts\GCEMetadataScripts.exe: Starting specialize scripts (version dev).
2024/03/14 15:52:50 C:\Program Files\Google\Compute Engine\metadata_scripts\GCEMetadataScripts.exe: No specialize scripts to run.
2024/03/14 15:52:50 GCEInstanceSetup: Finished with sysprep specialize phase, restarting...
2024-03-14T15:52:50.7891Z OSConfigAgent Info: OSConfig Agent (version 20231207.01.0+win@1) shutting down.
2024/03/14 15:52:50 GCEGuestAgent: Error watching metadata: context canceled
2024/03/14 15:52:50 GCEGuestAgent: GCE Agent Stopped
Hi @lmayorga1980, based on the logs you pasted it looks like you're referring to initial boot. windows-startup-script-ps1
is executed on each boot only after the initial boot.
Please refer this doc describing in details the order of script execution.
About this log - Failed to schedule job MTLS_MDS_Credential_Boostrapper with error: ShouldEnable() returned false, cannot schedule job MTLS_MDS_Credential_Boostrapper
you can safely ignore it. Feature is unsupported so ShouldEnable()
returned false
and ignored the job.