Fix inittab syntax for traditional SysV init compatibility

- Replace agetty --autologin with traditional getty -a root syntax
- Remove bash expansion {2..6} and use explicit tty entries
- Remove linux parameter that may not be supported in older systems
- Use standard 38400 baud rate format
- Ensure compatibility with traditional SysV init systems

Traditional SysV inittab entries now:
1:23:respawn:/sbin/getty -a root 38400 tty1  # Autologin
2:23:respawn:/sbin/getty 38400 tty2          # Normal login
3:23:respawn:/sbin/getty 38400 tty3          # Normal login
...etc
parent 383121b6
......@@ -32,24 +32,18 @@ grep -v "^[1-6]:" /etc/inittab | grep -v "^#.*tty" | grep -v "^#.*getty" > /etc/
# Add only properly formatted TTY entries
echo "Adding clean TTY entries..." | tee -a "$LOG_FILE"
# Add tty1 with autologin (ID: "1" - 1 character)
if command -v agetty >/dev/null 2>&1; then
echo "1:23:respawn:/sbin/agetty --autologin root --noclear tty1 linux" >> /etc/inittab.clean
echo "Added agetty autologin entry for tty1" | tee -a "$LOG_FILE"
else
echo "1:23:respawn:/sbin/getty -a root 38400 tty1" >> /etc/inittab.clean
echo "Added getty autologin entry for tty1" | tee -a "$LOG_FILE"
fi
# Add tty2-6 with normal login (IDs: "2", "3", "4", "5", "6" - 1 character each)
for tty_num in {2..6}; do
if command -v agetty >/dev/null 2>&1; then
echo "${tty_num}:23:respawn:/sbin/agetty --noclear tty${tty_num} linux" >> /etc/inittab.clean
else
echo "${tty_num}:23:respawn:/sbin/getty 38400 tty${tty_num}" >> /etc/inittab.clean
fi
echo "Added normal login entry for tty${tty_num}" | tee -a "$LOG_FILE"
done
# Add tty1 with traditional SysV autologin (ID: "1" - 1 character)
echo "1:23:respawn:/sbin/getty -a root 38400 tty1" >> /etc/inittab.clean
echo "Added traditional getty autologin entry for tty1" | tee -a "$LOG_FILE"
# Add tty2-6 with normal login (explicit entries for SysV compatibility)
echo "2:23:respawn:/sbin/getty 38400 tty2" >> /etc/inittab.clean
echo "3:23:respawn:/sbin/getty 38400 tty3" >> /etc/inittab.clean
echo "4:23:respawn:/sbin/getty 38400 tty4" >> /etc/inittab.clean
echo "5:23:respawn:/sbin/getty 38400 tty5" >> /etc/inittab.clean
echo "6:23:respawn:/sbin/getty 38400 tty6" >> /etc/inittab.clean
echo "Added all traditional SysV getty entries" | tee -a "$LOG_FILE"
# Replace the original inittab with clean version
mv /etc/inittab.clean /etc/inittab
......
......@@ -186,13 +186,13 @@ pf::powerwait:/etc/init.d/powerfail start
pn::powerfailnow:/etc/init.d/powerfail now
po::powerokwait:/etc/init.d/powerfail stop
# TTY entries with autologin for tty1, normal login for others
1:23:respawn:/sbin/agetty --autologin root --noclear tty1 linux
2:23:respawn:/sbin/agetty --noclear tty2 linux
3:23:respawn:/sbin/agetty --noclear tty3 linux
4:23:respawn:/sbin/agetty --noclear tty4 linux
5:23:respawn:/sbin/agetty --noclear tty5 linux
6:23:respawn:/sbin/agetty --noclear tty6 linux
# TTY entries with traditional SysV autologin
1:23:respawn:/sbin/getty -a root 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
EOF
# Validate the new inittab format
......
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