From 88414eed6f45f738ae765d9f72d67c6dc5a51950 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 17 Jan 2020 15:02:13 +0100 Subject: [PATCH 1/2] core: never allow perpetual units to be masked Fixes: #14550 --- src/core/load-fragment.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c index c5ba7b1046..0de9adb6e5 100644 --- a/src/core/load-fragment.c +++ b/src/core/load-fragment.c @@ -4703,7 +4703,9 @@ int unit_load_fragment(Unit *u) { return r; if (null_or_empty(&st)) { - u->load_state = UNIT_MASKED; + /* Unit file is masked */ + + u->load_state = u->perpetual ? UNIT_LOADED : UNIT_MASKED; /* don't allow perpetual units to ever be masked */ u->fragment_mtime = 0; } else { u->load_state = UNIT_LOADED; From 0879fbd6fedc2f813aebcb1a4eba005a99525bde Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 17 Jan 2020 15:09:01 +0100 Subject: [PATCH 2/2] mount: make checks on perpetual mount units more lax We don#t really care where perpetual mounts are mounted from, since they have to exist since before we run anyway. --- src/core/mount.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/core/mount.c b/src/core/mount.c index 12b2e512e8..668c4d7e89 100644 --- a/src/core/mount.c +++ b/src/core/mount.c @@ -537,10 +537,9 @@ static int mount_verify(Mount *m) { } p = get_mount_parameters_fragment(m); - if (p && !p->what) { - log_unit_error(UNIT(m), "What= setting is missing. Refusing."); - return -ENOEXEC; - } + if (p && !p->what && !UNIT(m)->perpetual) + return log_unit_error_errno(UNIT(m), SYNTHETIC_ERRNO(ENOEXEC), + "What= setting is missing. Refusing."); if (m->exec_context.pam_name && m->kill_context.kill_mode != KILL_CONTROL_GROUP) { log_unit_error(UNIT(m), "Unit has PAM enabled. Kill mode must be set to control-group'. Refusing.");