To let the gravity of the but sink in, this is the pair of scripts
that I jammed in front of systemd that got it to somehow behave
itself:

/sbin/init:
#!/bin/sh

echo "INIT: rc init is in startup"

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

/etc/rc.earlyboot || PS1='init# ' PS2='init >' PS4='init +' exec /bin/sh -i

exec /lib/systemd/systemd

/etc/rc.earlyboot:
#!/bin/bash

exec 0<>/dev/tty1 1>&0 2>&1
chvt /dev/tty1

emergency()
{
        echo "The previos command failed. Starting shell to investigate."
        PS1='emergency# ' PS2='emergency> ' PS4='emergency+ ' /bin/bash
}

fsck -Asp
ERR=$?

if [ $((ERR & 2)) -ne 0 ]
then    echo "*** changed mounted filesystem, reboot requried ***"
        sleep 3
        reboot -f
fi

if [ $ERR -ne 0 ]
then    emergency
fi

mount / -o remount,rw || emergency
mount -a || emergency
swapon -a || emergency
exit 0

Reply via email to