CRITICAL FIX: Override live-config sysvinit script causing autologin failure

Root Cause Identified:
- live-config script /usr/lib/live/config/0160-sysvinit was overwriting inittab at runtime
- Script was replacing all getty entries with '/bin/login -f user' instead of root
- This happened AFTER our inittab modifications during boot process

Solution:
- Created override-live-config-sysvinit.hook.chroot to replace the problematic script
- New script forces LIVE_USERNAME=root instead of default 'user'
- Uses proper traditional getty -a syntax: /sbin/getty -a root 38400 tty1
- Maintains tty2-6 as normal login shells for debugging

This should finally resolve the autologin issue by preventing live-config from
overwriting our carefully crafted inittab entries during boot.
parent b3d33fd6
#!/bin/sh
set -e
echo "Overriding live-config sysvinit script to use root instead of user..."
# Create a replacement for the problematic live-config script
LIVE_CONFIG_SYSVINIT="/usr/lib/live/config/0160-sysvinit"
if [ -f "$LIVE_CONFIG_SYSVINIT" ]; then
# Backup original
cp "$LIVE_CONFIG_SYSVINIT" "${LIVE_CONFIG_SYSVINIT}.original"
# Replace the script with our version that uses root instead of user
cat > "$LIVE_CONFIG_SYSVINIT" << 'EOF'
#!/bin/sh
. /lib/live/config.sh
## live-config(7) - System Configuration Components
## Modified for root autologin instead of user
#set -e
Cmdline ()
{
# Reading kernel command line
for _PARAMETER in ${LIVE_CONFIG_CMDLINE}
do
case "${_PARAMETER}" in
live-config.noautologin|noautologin)
LIVE_CONFIG_NOAUTOLOGIN="true"
;;
live-config.nottyautologin|nottyautologin)
LIVE_CONFIG_NOTTYAUTOLOGIN="true"
;;
live-config.username=*|username=*)
# FORCE root username instead of user
LIVE_USERNAME="root"
;;
esac
done
# Default to root if no username specified
LIVE_USERNAME="${LIVE_USERNAME:-root}"
}
Init ()
{
# Disables both console and graphical autologin.
case "${LIVE_CONFIG_NOAUTOLOGIN}" in
true)
exit 0
;;
esac
# Disables console autologin, no matter what mechanism
case "${LIVE_CONFIG_NOTTYAUTOLOGIN}" in
true)
exit 0
;;
esac
# Checking if package is installed or already configured
if ! pkg_is_installed "sysvinit" || \
component_was_executed "sysvinit"
then
exit 0
fi
echo -n " sysvinit (modified for root autologin)"
}
Config ()
{
# Configure autologin for root using traditional getty
echo "Configuring autologin for root user..."
# Use traditional getty -a syntax instead of /bin/login -f
sed -i '/^[1-6]:/d' /etc/inittab
# Add proper getty entries
echo "1:23:respawn:/sbin/getty -a root 38400 tty1" >> /etc/inittab
echo "2:23:respawn:/sbin/getty 38400 tty2" >> /etc/inittab
echo "3:23:respawn:/sbin/getty 38400 tty3" >> /etc/inittab
echo "4:23:respawn:/sbin/getty 38400 tty4" >> /etc/inittab
echo "5:23:respawn:/sbin/getty 38400 tty5" >> /etc/inittab
echo "6:23:respawn:/sbin/getty 38400 tty6" >> /etc/inittab
init q
# Creating state file
touch /var/lib/live/config/sysvinit
}
Cmdline
Init
Config
EOF
chmod +x "$LIVE_CONFIG_SYSVINIT"
echo "Replaced live-config sysvinit script to use root autologin"
else
echo "Warning: live-config sysvinit script not found at $LIVE_CONFIG_SYSVINIT"
fi
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment