sm: remove /run/nologin when leaving runlevel S

On a system with systemd's tmpfiles.d files installed, only root can
log in after boot.  The files have a boot-only entry:

    f+! /run/nologin 0644 - - - "System is booting up. ..."

On systemd the file is removed by systemd-user-sessions when boot is
done.  Finit runs the entry, but only removes /etc/nologin, so
pam_nologin keeps refusing everyone but root.

Remove /run/nologin too when leaving runlevel S.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2026-11-21 17:13:52 +01:00
1 parent a4a518d970
commit 64e299bedc
3 files changed
+21

No files matched your search

+5
View File
@@ -327,11 +327,16 @@ static char sm_rl2ch(int lvl)
*/
static void nologin(void)
{
/* From systemd's tmpfiles.d, where systemd-user-sessions removes it */
if (prevlevel == INIT_LEVEL)
erase("/run/nologin");
if (runlevel == 1 || IS_RESERVED_RUNLEVEL(runlevel))
touch(FINIT_NOLOGIN_PATH);
if (prevlevel == 1 || IS_RESERVED_RUNLEVEL(prevlevel))
erase(FINIT_NOLOGIN_PATH);
}
void sm_init(void)