-
Notifications
You must be signed in to change notification settings - Fork 20
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
Add exponential back-off waiting until /etc/machine-id is populated #193
Conversation
Fixes kairos-io/kairos#3038 Signed-off-by: Dimitris Karakasilis <[email protected]>
@@ -28,9 +27,21 @@ func Hostname(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) er | |||
|
|||
// Template the input string with random generated strings and UUID. | |||
// Those can be used to e.g. generate random node names based on patterns "foo-{{.UUID}}" | |||
rand.Seed(time.Now().UnixNano()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Deprecated: As of Go 1.20 there is no reason to call Seed with
// a random value. Programs that call Seed with a known value to get
// a specific sequence of results should use New(NewSource(seed)) to
// obtain a local random generator.
// Systemd might take a while before it populates /etc/machine-id. | ||
var id string | ||
var err error | ||
for i := 0; i < 4; i++ { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what is a sane timeout here 🤷 .
We discussed that in Slack and decided we should create a machine-id ourselves as early as possible (initramfs stage) if one doesn't exist (e.g. with |
the comand to create would be https://www.freedesktop.org/software/systemd/man/latest/systemd-machine-id-setup.html Also we can disable the service |
Fixes kairos-io/kairos#3038 Deprecates mudler/yip#193 Signed-off-by: Dimitris Karakasilis <[email protected]>
opted for this one instead: kairos-io/packages#1178 |
…#1178) * Make sure /etc/machine-id is generate as early as possible in systemd Fixes kairos-io/kairos#3038 Deprecates mudler/yip#193 Signed-off-by: Dimitris Karakasilis <[email protected]> * Mask in rootfs (earlier) as per the PR comment #1178 (comment) Signed-off-by: Dimitris Karakasilis <[email protected]> * Bump version Signed-off-by: Dimitris Karakasilis <[email protected]> --------- Signed-off-by: Dimitris Karakasilis <[email protected]>
Fixes kairos-io/kairos#3038