Skip to content

Commit 294eace

Browse files
committed
core: disable "update" units in the initramfs
Initially I wanted to add ConditionPathExists=!/etc/initrd-release in various units (ldconfig.service, systemd-sysusers.service, systemd-hwdb-update.service, systemd-journal-catalog-update, systemd-update-done.service), but I think it's better to just disable the mechanism in the initrd altogether. Initrd images are put together in a very particular way, and there is not need to do post-update steps on them. If a unit from some other package winds up in the initrd, we wouldn't want to invoke it either. Also, any modifications are ephemeral, so any update would happen on every use. And finally, initrd images are all about speed, and we shouldn't invoke any unneeded services.
1 parent dc16846 commit 294eace

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/shared/condition.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,11 @@ static int condition_test_needs_update(Condition *c, char **env) {
675675
if (r > 0)
676676
return b;
677677

678+
if (in_initrd()) {
679+
log_debug("We are in an initrd, not doing any updates.");
680+
return false;
681+
}
682+
678683
if (!path_is_absolute(c->parameter)) {
679684
log_debug("Specified condition parameter '%s' is not absolute, assuming an update is needed.", c->parameter);
680685
return true;

0 commit comments

Comments
 (0)