initrd: set a default carrier timeout of 10 seconds in initrd

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
This commit is contained in:
Beniamino Galvani 2022-05-27 10:53:48 +02:00
parent 8d12cc8152
commit 2504a72ec0

View file

@ -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),