diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2022-05-27 10:53:48 +0200 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2022-07-11 15:47:40 +0200 |
commit | 2504a72ec0d07a4624fa3e6cd559b34a131f9b42 (patch) | |
tree | f123d774087f3bedb8c36988cc0f68f4608a59d3 | |
parent | 8d12cc8152a83821eabaed86823faea313eb2433 (diff) | |
download | NetworkManager-bg/initrd-carrier-timeout.tar.gz |
initrd: set a default carrier timeout of 10 seconds in initrdbg/initrd-carrier-timeout
In initrd, a too short carrier timeout means that the machine will
possibly fail to boot. On the other hand, increasing the value doesn't
have side effects, except for a bit longer delay on some machines.
Increase the value to 10 seconds. Note that the default value is not
propagated to the real root.
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1239
-rw-r--r-- | src/nm-initrd-generator/nm-initrd-generator.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/nm-initrd-generator/nm-initrd-generator.c b/src/nm-initrd-generator/nm-initrd-generator.c index ef7047941d..09f8baf21a 100644 --- a/src/nm-initrd-generator/nm-initrd-generator.c +++ b/src/nm-initrd-generator/nm-initrd-generator.c @@ -198,7 +198,7 @@ main(int argc, char *argv[]) confs = g_array_new(FALSE, FALSE, sizeof(NMUtilsNamedValue)); g_array_set_clear_func(confs, (GDestroyNotify) nm_utils_named_value_clear_with_g_free); - if (carrier_timeout_sec != 0) { + { nm_auto_unref_keyfile GKeyFile *keyfile = NULL; NMUtilsNamedValue v; @@ -212,9 +212,19 @@ main(int argc, char *argv[]) g_key_file_set_int64(keyfile, NM_CONFIG_KEYFILE_GROUPPREFIX_DEVICE "-15-carrier-timeout", NM_CONFIG_KEYFILE_KEY_DEVICE_CARRIER_WAIT_TIMEOUT, - carrier_timeout_sec * 1000); - if (!dump_to_stdout) - add_keyfile_comment(keyfile, "from \"rd.net.timeout.carrier\""); + (carrier_timeout_sec != 0 ? carrier_timeout_sec : 10) * 1000); + if (carrier_timeout_sec == 0) { + g_key_file_set_value(keyfile, + NM_CONFIG_KEYFILE_GROUP_CONFIG, + NM_CONFIG_KEYFILE_KEY_CONFIG_ENABLE, + "env:initrd"); + } + + if (!dump_to_stdout) { + add_keyfile_comment(keyfile, + carrier_timeout_sec == 0 ? "default initrd carrier timeout" + : "from \"rd.net.timeout.carrier\""); + } v = (NMUtilsNamedValue){ .name = g_strdup_printf("%s/15-carrier-timeout.conf", run_config_dir), |