Grub
Grub
Single-user mode vs Multi-user mode
multi-user mode just starts more systemd services that lets other users login like:
- sshd - allow ssh remotely
- getty - daemon that puts login prompt
- NetworkManager - networking
single-user mode systemd doesn’t start these services
- just a root shell
these are stored as .targets
Commands
# symlinks to all the units that need to be run to reach the target
ls /usr/lib/systemd/system/multi-user.target.wants/
# single user doesn't have a directry of services, its contained in the service file
cat /usr/lib/systemd/system/rescue.target
# the actual target files
cat /usr/lib/systemd/system/multi-user.target
cat /usr/lib/systemd/system/rescue.target
Booting into each mode with Grub
# highlight kernel, press 'e' to edit, append to the linux line, Control-X to boot
linux /boot/vmlinuz-6.1.0 root=/dev/sda1 ro quiet splash # normal
linux /boot/vmlinuz-6.1.0 root=/dev/sda1 ro systemd.unit=rescue.target # rescue (single-user)
linux /boot/vmlinuz-6.1.0 root=/dev/sda1 ro systemd.unit=emergency.target # emergency
linux /boot/vmlinuz-6.1.0 root=/dev/sda1 ro init=/bin/bash # bypass systemd entirely