Package: initscripts Severity: wishlist Followup-For: Bug #923478
[ Moving discussion to separate bug ] [ Please, drop #923478 on reply ] [2019-04-29 02:44] Chris Hofstaedtler <z...@debian.org> > part text/plain 517 > * Dmitry Bogatov <kact...@debian.org> [190429 01:14]: > > [2019-04-26 13:17] Chris Hofstaedtler <z...@debian.org> > > > > According my experiments, it will. Even if I remove this code, something > > > > (login/getty, maybe?) still creates /var/run/utmp, root:root. > > > > > > Which init was used in your experiments? > > > > sysvinit-core. > > https://sources.debian.org/src/sysvinit/2.93-8/src/init.c/?hl=2797#L2797 > > Note that the comment citing the preconditions is not telling the > entire story on modern systems. Thank you very much, Chris. I should have found it myself. Then creating /var/run/utmp is needed, since "runit-init" would not create it itself: it relies on initscripts. Based on patch of Christian, I propose following patch. Dear sysvinit folks, opinions? From ce3417109303bafbc771f40428579e6691a436df Mon Sep 17 00:00:00 2001 From: Dmitry Bogatov <kact...@debian.org> Date: Wed, 1 May 2019 23:43:13 +0000 Subject: [PATCH] Error handle redirection used to truncate /var/run/wtmp Signed-off-by: Cristian Ionescu-Idbohrn <c...@axis.com> Signed-off-by: Dmitry Bogatov <kact...@debian.org> --- debian/src/initscripts/etc/init.d/bootmisc.sh | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/debian/src/initscripts/etc/init.d/bootmisc.sh b/debian/src/initscripts/etc/init.d/bootmisc.sh index 06facc2f..461b7472 100755 --- a/debian/src/initscripts/etc/init.d/bootmisc.sh +++ b/debian/src/initscripts/etc/init.d/bootmisc.sh @@ -12,6 +12,7 @@ PATH=/sbin:/usr/sbin:/bin:/usr/bin [ "$DELAYLOGIN" ] || DELAYLOGIN=yes +. /lib/lsb/init-functions . /lib/init/vars.sh do_start () { @@ -25,18 +26,20 @@ do_start () { ;; esac - # Create /var/run/utmp so we can login. - true > /var/run/utmp - if grep -q ^utmp: /etc/group - then - chmod 664 /var/run/utmp - chgrp utmp /var/run/utmp - fi - # Remove bootclean's flag files. # Don't run bootclean again after this! rm -f /tmp/.clean /run/.clean /run/lock/.clean rm -f /tmp/.tmpfs /run/.tmpfs /run/lock/.tmpfs + + readonly utmp='/var/run/utmp' + if > "${utmp}" ; then + chmod 644 "${utmp}" || log_warning_msg "failed to chmod ${utmp}" + chgrp utmp "${utmp}" || log_warning_msg "failed to chgrp ${utmp}" + return 0 + else + log_failure_msg "failed to truncate ${utmp}" + return 1 + fi } case "$1" in -- Note, that I send and fetch email in batch, once every 24 hours. If matter is urgent, try https://t.me/kaction --