[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#765803: Status of prompting / notification on upgrade for init system switch?



On Sat, 18 Oct 2014 20:59:54 -0700 Russ Allbery <rra@debian.org> wrote:
> When one of you has a chance, could you update this bug with the current
> thinking around how to handle upgrades, around the ordering of
> dependencies in libpam-systemd, and some of the other ideas (such as
> attempting to detect systems with /etc/inittab configuration or init
> scripts that don't follow systemd's assumptions) raised in those threads?

Not speaking for the systemd maintainers, but I just wrote and tested
the following shell code to detect sysvinit-specific configuration
(modified /etc/inittab or modified init scripts) that may indicate a
need for manual sysadmin action (and thus a prompt).  This needs a bit
of work to add potential serial console getty lines generated by
finish-install to the list of "expected" lines, as well as any other
lines generated by older versions of finish-install.

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="$(
    grep -lE '^/etc/init\.d/' /var/lib/dpkg/info/*.conffiles |
    xargs basename -s '.conffiles' |
    xargs dpkg -V |
    grep '^..5...... c /etc/init\.d/' |
    cut -d' ' -f3
)"

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


Reply to: