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