generators: change TimeoutSec=0 to TimeoutSec=infinity

With these settings we intend to turn off timeouts for possibly
interactive/slow commands. The officially documented way to turn off the
time-outs is to setting them to infinity. So far we set them to zero
here though.

This lead to some confusiong, for example #18224. Let's fix this by
uniformly spelling out TimeoutSec=infinity.

This doesn't change behaviour. It just makes our generated files match
what we document, without relying on historic compat support.

Fixes: #18224
This commit is contained in:
Lennart Poettering 2023-06-06 09:29:51 +02:00 committed by Luca Boccassi
parent 6f814d4f5d
commit a9b837aa34
14 changed files with 19 additions and 17 deletions

View file

@ -562,7 +562,8 @@ static int create_disk(
if (!noauto && !nofail) {
r = write_drop_in(arg_dest, dmname, 40, "device-timeout",
"# Automatically generated by systemd-cryptsetup-generator\n\n"
"[Unit]\nJobTimeoutSec=0");
"[Unit]\n"
"JobTimeoutSec=infinity\n");
if (r < 0)
log_warning_errno(r, "Failed to write device timeout drop-in: %m");
}

View file

@ -142,7 +142,7 @@ static int add_cryptsetup(
r = write_drop_in_format(arg_dest, dmname, 50, "job-timeout",
"# Automatically generated by systemd-gpt-auto-generator\n\n"
"[Unit]\n"
"JobTimeoutSec=0"); /* the binary handles timeouts anyway */
"JobTimeoutSec=infinity"); /* the binary handles timeouts anyway */
if (r < 0)
log_warning_errno(r, "Failed to write device timeout drop-in, ignoring: %m");

View file

@ -95,7 +95,8 @@ static int process_resume(void) {
r = write_drop_in(arg_dest, device_unit, 40, "device-timeout",
"# Automatically generated by systemd-hibernate-resume-generator\n\n"
"[Unit]\nJobTimeoutSec=0");
"[Unit]\n"
"JobTimeoutSec=infinity\n");
if (r < 0)
log_warning_errno(r, "Failed to write device timeout drop-in: %m");

View file

@ -100,7 +100,7 @@ static int create_disk(
"[Service]\n"
"Type=oneshot\n"
"RemainAfterExit=yes\n"
"TimeoutSec=0\n"
"TimeoutSec=infinity\n"
"ExecStart=" ROOTLIBEXECDIR "/systemd-integritysetup attach '%s' '%s' '%s' '%s'\n"
"ExecStop=" ROOTLIBEXECDIR "/systemd-integritysetup detach '%s'\n",
name_escaped, device, empty_to_dash(key_file_escaped), empty_to_dash(options),

View file

@ -235,7 +235,7 @@ static int write_fsck_sysroot_service(
"Type=oneshot\n"
"RemainAfterExit=yes\n"
"ExecStart=" SYSTEMD_FSCK_PATH " %7$s\n"
"TimeoutSec=0\n",
"TimeoutSec=infinity\n",
program_invocation_short_name,
escaped,
unit,
@ -530,7 +530,7 @@ int generator_hook_up_mkswap(
"Type=oneshot\n"
"RemainAfterExit=yes\n"
"ExecStart="SYSTEMD_MAKEFS_PATH " swap %s\n"
"TimeoutSec=0\n",
"TimeoutSec=infinity\n",
program_invocation_short_name,
where_unit,
escaped);
@ -619,7 +619,7 @@ int generator_hook_up_mkfs(
"Type=oneshot\n"
"RemainAfterExit=yes\n"
"ExecStart="SYSTEMD_MAKEFS_PATH " %s %s\n"
"TimeoutSec=0\n",
"TimeoutSec=infinity\n",
program_invocation_short_name,
fsck_unit,
where_unit,
@ -801,7 +801,7 @@ int generator_write_cryptsetup_service_section(
"[Service]\n"
"Type=oneshot\n"
"RemainAfterExit=yes\n"
"TimeoutSec=0\n" /* The binary handles timeouts on its own */
"TimeoutSec=infinity\n" /* The binary handles timeouts on its own */
"KeyringMode=shared\n" /* Make sure we can share cached keys among instances */
"OOMScoreAdjust=500\n" /* Unlocking can allocate a lot of memory if Argon2 is used */
"ExecStart=" SYSTEMD_CRYPTSETUP_PATH " attach '%s' '%s' '%s' '%s'\n"

View file

@ -14,4 +14,4 @@ Before=shutdown.target
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/lib/systemd/systemd-fsck /dev/sdx1
TimeoutSec=0
TimeoutSec=infinity

View file

@ -14,4 +14,4 @@ Before=shutdown.target
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/lib/systemd/systemd-fsck /dev/disk/by-label/Root
TimeoutSec=0
TimeoutSec=infinity

View file

@ -14,4 +14,4 @@ Before=shutdown.target
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/lib/systemd/systemd-fsck /dev/disk/by-uuid/3f5ad593-4546-4a94-a374-bcfb68aa11f7
TimeoutSec=0
TimeoutSec=infinity

View file

@ -14,4 +14,4 @@ Before=shutdown.target
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/lib/systemd/systemd-fsck /dev/disk/by-partuuid/3f5ad593-4546-4a94-a374-bcfb68aa11f7
TimeoutSec=0
TimeoutSec=infinity

View file

@ -14,4 +14,4 @@ Before=shutdown.target
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/lib/systemd/systemd-fsck /dev/sdx1
TimeoutSec=0
TimeoutSec=infinity

View file

@ -14,4 +14,4 @@ Before=shutdown.target
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/lib/systemd/systemd-fsck /dev/sdx1
TimeoutSec=0
TimeoutSec=infinity

View file

@ -15,4 +15,4 @@ Before=shutdown.target
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/lib/systemd/systemd-makefs ext4 /dev/sdx12
TimeoutSec=0
TimeoutSec=infinity

View file

@ -15,4 +15,4 @@ Before=shutdown.target
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/lib/systemd/systemd-makefs swap /dev/sdy2
TimeoutSec=0
TimeoutSec=infinity

View file

@ -15,4 +15,4 @@ Before=shutdown.target
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/lib/systemd/systemd-makefs swap /dev/sdy3
TimeoutSec=0
TimeoutSec=infinity