When working in Linux single-user mode (runlevel 1), you typically only get one active TTY session (usually on tty1). This becomes particularly challenging during extended recovery operations like RAID reconstruction, where you might need:
- Primary terminal for long-running recovery commands
- Secondary terminal for configuration edits
- Tertiary terminal for log monitoring
Here's the most straightforward method to spawn a new shell on another virtual terminal:
# On tty1 (your current single-user session)
sudo /sbin/agetty -n -l /bin/bash 38400 tty2 &
Key parameters explained:
-n
: Disables prompt for username-l /bin/bash
: Specifies the shell to launch38400
: Baud rate (legacy parameter, still required)tty2
: Target terminal (use tty3-tty6 for more sessions)
For systems using systemd (most modern distributions):
# Start getty on tty3
systemctl start getty@tty3.service
# Or more permanently:
systemctl enable --now getty@tty3.service
During my recent RAID recovery, I used this sequence:
# Terminal 1 - Running RAID check
mdadm --detail /dev/md0
# Terminal 2 - Monitoring progress
watch -n 5 cat /proc/mdstat
# Terminal 3 - Editing configs
vim /etc/mdadm/mdadm.conf
- Some minimal recovery environments may not have agetty installed
- Certain distributions may require different service names (e.g., mingetty)
- Remember to background (&) the process or use screen/tmux if terminal multiplexing is preferred
During extended single-user mode operations like RAID reconstruction, system administrators often require concurrent shell access. While the primary TTY (usually tty1) runs critical recovery processes, additional terminals become essential for:
- Monitoring log files in real-time (
tail -f /var/log/messages
) - Editing configuration files (
vi /etc/mdadm.conf
) - Running diagnostic commands (
mdadm --detail /dev/md0
)
The most straightforward approach leverages existing virtual terminals:
# Spawn a new shell on tty2
sudo /sbin/agetty -n -l /bin/bash 38400 tty2 &
This command:
- Bypasses login prompt with
-n
- Specifies bash as the shell with
-l
- Sets baud rate (irrelevant for virtual terminals but required)
When TTY access isn't available, consider terminal multiplexers:
# For systems with screen installed
screen -S recovery_session
# Create new window: Ctrl+a c
# Switch windows: Ctrl+a n/p
For multi-day recovery operations, create a more robust solution:
# In /etc/inittab (SysV) or equivalent:
tty2::respawn:/sbin/agetty -n -l /bin/bash 38400 tty2
Permission denied errors: Ensure you're root in single-user mode. If encountering agetty
limitations:
# Alternative using openvt
openvt -f -c 2 -- /bin/bash
Missing terminal switching: If Alt-Fn keys don't work, verify kernel VT support with:
dmesg | grep -i virtual