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

GCP vm runs start up script before google_guest_agent creates sudoers file #340

Open
meytalzuta opened this issue Jan 4, 2024 · 1 comment

Comments

@meytalzuta
Copy link

Hi,

We have a test running a startup script on GCP VM (Debian GNU/Linux 10). As part of the startup script we call 'su ubuntu'. The start up script sometimes fails on 'user ubuntu doesn't exist.

google_guest_agent version: GCE Agent Started (version 20231115.00)

When looking at the VM startup logs we see that on successful runs, the google_guest_agent is creating the sudoers file and is creating the ubuntu user before running our startup script:

Jan  4 13:02:09 vm-1 google_guest_agent[479]: Created google sudoers file

Jan  4 13:02:09 vm-1 google_guest_agent[479]: Creating user ubuntu.

Jan  4 13:02:10 vm-1 google_guest_agent[479]: Updating keys for user ubuntu.

On failed runs, the last entries of google_guest_agent in the log are:

Jan  4 13:02:09 vm-1 google_guest_agent[479]: Starting the scheduler to run jobs

[  OK  ] Started OpenBSD Secure Shell server.

Jan  4 13:02:09 vm-1 systemd[1]: Started OpenBSD Secure Shell server.

Jan  4 13:02:09 vm-1 google_guest_agent[479]: Scheduling job: telemetryJobID

Jan  4 13:02:09 vm-11 google_guest_agent[479]: Scheduling job "telemetryJobID" to run at 24.000000 hr interval

Jan  4 13:02:09 vm-1 google_guest_agent[479]: Successfully scheduled job telemetryJobID

Jan  4 13:02:09 vm-1 google_guest_agent[479]: Invoking job "telemetryJobID"

Jan  4 13:02:09 vm-1 dhclient[841]: Internet Systems Consortium DHCP Client 4.4.1

Jan  4 13:02:09 vm-1 dhclient[841]: Copyright 2004-2018 Internet Systems Consortium.

Jan  4 13:02:09 vm-1 dhclient[841]: All rights reserved.

Jan  4 13:02:09 vm-1 dhclient[841]: For info, please visit [https://www.isc.org/software/dhcp/](https://www.google.com/url?q=https://www.isc.org/software/dhcp/&sa=D)

Jan  4 13:02:09 vm-1 dhclient[841]: 

Jan  4 13:02:09 vm-1 google_guest_agent[479]: Scheduler - added: [now 2024-01-04 13:02:09.592349485 +0000 UTC entry 1 next 2024-01-05 13:02:09 +0000 UTC]

Is there a way to make sure the google_guest_agent run has completed before starting our scripts?

@ChaitanyaKulkarni28
Copy link
Member

ChaitanyaKulkarni28 commented Feb 6, 2024

Hi @meytalzuta,

This looks like a timing issue.

Metadata script runner is already configured to run after Guest Agent has started. Agent executes minimum required setup steps before notifying systemd (systemd-notify --ready) its ready, and this startup process does not involve creating users/sudoers file.

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