Bug#761063: changes to /etc/inittab are not respected on upgrade from sysvinit

Josh Triplett josh at joshtriplett.org
Wed Dec 10 20:43:16 GMT 2014


Control: retitle -1 Warn about modified /etc/inittab or init scripts

I'd written some code in 765803 about how to detect and warn about
changes to /etc/inittab or to init scripts, since systemd will not take
those changes into account.  However, that bug isn't the right place for
that code; it belongs in a systemd bug report instead, requesting the
inclusion of such code.

Here's the most recent version.  It still needs debconfery, and ideally
some mechanism to avoid warning about modified init scripts if those
init scripts aren't actually overridden by a systemd service, though the
latter isn't strictly required (since the admin might want to consider
such a situation regardless).  It also needs updating to include any
additional inittab lines that d-i can create, such as additional
consoles.  (However, such lines shouldn't simply be ignored, unless we
know systemd will actually provide the same consoles.)

inittab_unusual_lines="$(
    grep '^[^#]' /etc/inittab |
    while read line ; do
        case "$line" in
        'id:2:initdefault:') ;;
        'si::sysinit:/etc/init.d/rcS') ;;
        '~~:S:wait:/sbin/sulogin') ;;
        'l0:0:wait:/etc/init.d/rc 0') ;;
        'l1:1:wait:/etc/init.d/rc 1') ;;
        'l2:2:wait:/etc/init.d/rc 2') ;;
        'l3:3:wait:/etc/init.d/rc 3') ;;
        'l4:4:wait:/etc/init.d/rc 4') ;;
        'l5:5:wait:/etc/init.d/rc 5') ;;
        'l6:6:wait:/etc/init.d/rc 6') ;;
        'z6:6:respawn:/sbin/sulogin') ;;
        'ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now') ;;
        'pf::powerwait:/etc/init.d/powerfail start') ;;
        'pn::powerfailnow:/etc/init.d/powerfail now') ;;
        'po::powerokwait:/etc/init.d/powerfail stop') ;;
        '1:2345:respawn:/sbin/getty 38400 tty1') ;;
        '2:23:respawn:/sbin/getty 38400 tty2') ;;
        '3:23:respawn:/sbin/getty 38400 tty3') ;;
        '4:23:respawn:/sbin/getty 38400 tty4') ;;
        '5:23:respawn:/sbin/getty 38400 tty5') ;;
        '6:23:respawn:/sbin/getty 38400 tty6') ;;
        *) echo "$line" ;;
        esac
    done
)"

modified_initscripts="$(
    dpkg-query --show -f'${Conffiles}' |
    sed 's, /,\n/,g' |
    sed -n '/^\/etc\/init\.d\//s/^\([^ ]*\) \(.*\)$/\2 \1/p' |
    md5sum --quiet -c 2>/dev/null |
    cut -d: -f1
)"

if [ -n "$inittab_unusual_lines" ] || [ -n "$modified_initscripts" ]; then
    # Substitute these variables into a debconf template and display it
    cat <<EOF
/etc/inittab:
$inittab_unusual_lines

Modified init scripts:
$modified_initscripts
EOF
fi



More information about the Pkg-systemd-maintainers mailing list