How to Boot into Single User Mode / Emergency Mode in CentOS 7, AlmaLinux, and Rocky Linux Print

  • linux, centos-7, maintenance-mode, grub, rescue-mode, grub2, server-administration, emergency-mode, rhel, selinux, almalinux, single-user-mode, fsck, rd.break, vps, chroot, root-password-reset, rocky-linux
  • 91

This guide explains how to access Linux recovery environments on CentOS 7, AlmaLinux 8/9, Rocky Linux 8/9, and RHEL 8/9. It covers early boot recovery using rd.break and alternative systemd rescue and emergency targets. These environments differ in available services, filesystem mounts, and authentication requirements. Recovery typically requires access to the GRUB bootloader through a physical or out-of-band console.

Need a Linux server to practice recovery procedures safely? Owned Networks KVM VPS plans give you full console access and snapshot support. See our dedicated server plans or KVM VPS locations.

What is Single User Mode?

Traditional single-user mode corresponds broadly to a minimal maintenance environment. On systemd-based Linux distributions, rescue.target provides a similar recovery mode, while emergency.target starts an even more restricted environment. The rd.break parameter instead interrupts boot in the initramfs stage. These methods are not interchangeable: authentication, filesystem mounts, and available services differ. Common recovery tasks include:

  • Resetting a forgotten or lost root password
  • Diagnosing filesystem corruption and arranging offline repair with the affected filesystem unmounted
  • Fixing a misconfigured /etc/fstab that prevents normal boot
  • Recovering from a failed package update or broken dependency
  • Editing system configuration files when the system cannot boot normally
  • Diagnosing services that crash immediately at boot

Before You Start

  • You need physical or console access to the server — this cannot be done over SSH because the process requires interacting with GRUB before the network is available
  • On VPS platforms, use the VNC console or out-of-band console provided by your hosting panel
  • Confirm your distribution, version, boot configuration, and recovery method before proceeding. GRUB command names and recovery behavior may vary by platform
  • Changes made to a writable installed filesystem persist after reboot. Create and verify a backup or storage snapshot before recovery whenever possible
  • If SELinux is enabled and recovery changes affect security contexts, an SELinux relabel may be required before normal operation resumes

Method 1: CentOS 7 / RHEL 7

Step 1: Reboot and Access the GRUB Menu

Restart the server. When the GRUB bootloader screen appears, press any key (spacebar is reliable) to stop the automatic boot countdown:

CentOS 7 GRUB bootloader menu

Step 2: Edit the Kernel Boot Entry

Use the arrow keys to highlight the kernel entry you want to boot into. Press e to enter edit mode for that entry.

Use the down arrow key to find the line beginning with linux16. This is the kernel command line. Locate the kernel parameters and append the following option:

rd.break

The edited line should look similar to this:

Editing CentOS 7 GRUB kernel parameters

Step 3: Boot into the Dracut Recovery Shell

Press Ctrl+X or F10 to boot with the modified parameters. The boot process will stop in the dracut initramfs recovery shell:

CentOS 7 emergency recovery shell

Step 4: Mount the Root Filesystem

Verify that the installed root filesystem is available at /sysroot. On a typical installation, it is mounted read-only at this stage. Remount it read-write, then enter the installed system using chroot:

mount -o remount,rw /sysroot
chroot /sysroot

You now have a full root shell with access to the entire file system. Perform your recovery tasks from here.

Step 5: Complete Recovery and Resume Boot

If recovery operations may have affected SELinux security contexts, review whether relabeling is necessary. For example, after resetting the root password with SELinux enabled, creating /.autorelabel inside the chroot may be appropriate. Complete recovery operations, flush pending writes, exit the chroot, and then exit the dracut shell. The system should resume boot processing; monitor the server console for the resulting boot state.

sync
exit
exit

Method 2: AlmaLinux 8/9 / Rocky Linux 8/9 / RHEL 8/9

On AlmaLinux, Rocky Linux, and RHEL 8/9, the rd.break kernel parameter can interrupt boot in the dracut initramfs stage. Locate the kernel command line in GRUB and append the parameter. Depending on the boot configuration, the GRUB command may appear as linux, linuxefi, or another platform-specific variant. The installed root filesystem is typically available at /sysroot after the required storage devices have been activated.

Step 1: Reboot and Access the GRUB Menu

Restart the server. When the GRUB screen appears, press any key to stop the countdown and highlight the kernel entry you want to boot into.

Step 2: Edit the Kernel Boot Entry

Press e to edit the selected entry. Use the arrow keys to find the line beginning with linux. Navigate to the end of that line and append the following parameter:

rd.break

You can optionally also remove rhgb quiet from the same line to see verbose boot output, which is useful for diagnosing boot failures.

Step 3: Boot into Emergency Shell

Press Ctrl+X or F10 to boot. The system will start and stop in the dracut initramfs shell. On a typical unencrypted installation, the root filesystem is available at /sysroot and mounted read-only. Verify that it is available before proceeding. Encrypted disks or storage failures may require additional recovery steps.

Step 4: Remount Root Read-Write and Chroot

Remount /sysroot with read-write permissions, then chroot into it:

mount -o remount,rw /sysroot
chroot /sysroot

You now have a full root shell. Perform your recovery tasks.

Step 5: Review SELinux Relabeling Requirements

If SELinux is enabled and recovery operations may have changed security contexts, relabeling may be necessary. This is particularly relevant after resetting the root password from an initramfs chroot. A full relabel can take considerable time and is not required after every routine configuration change.

touch /.autorelabel

Step 6: Exit and Reboot

Exit the chroot environment, then exit the initramfs shell. Depending on the recovery environment, boot processing may continue or the system may require a manual reboot. Verify the resulting boot state through the server console:

exit
exit

If touch /.autorelabel was used, the system will perform an SELinux relabel on the next boot — this can take several minutes on large systems before the normal login prompt appears.

Common Recovery Tasks

Reset a Lost Root Password

Once inside the chroot shell on either method, use passwd to set a new root password:

passwd root

Diagnose and Repair a Damaged Filesystem

Before attempting filesystem repair, identify the correct block device, filesystem type, and mount status. Never assume that the affected device is /dev/vda1. Start with these read-only inspection commands:

lsblk -f
blkid
findmnt

Filesystem repair safety: Do not run repair utilities against a mounted filesystem. If the root filesystem is damaged, use an external rescue environment and keep the affected filesystem unmounted. For ext2/ext3/ext4, use the appropriate e2fsck procedure. For XFS, use filesystem-specific tools such as xfs_repair. Review diagnostic results and preserve a backup or storage snapshot whenever possible before attempting repairs.

Fix a Broken /etc/fstab

If the system cannot boot due to a bad fstab entry, edit the file directly in single user mode:

vi /etc/fstab

Alternative: Rescue Mode via systemd Target (EL7, EL8, EL9)

An alternative to the above methods is to boot into rescue.target or emergency.target using systemd. This boots a slightly higher level of the system than the initramfs shell. Append one of the following to the kernel line in GRUB:

# Rescue mode: minimal systemd recovery environment
systemd.unit=rescue.target

# Emergency mode: more restricted systemd recovery environment
systemd.unit=emergency.target

Authentication: Both rescue.target and emergency.target normally use recovery services that invoke sulogin. Root authentication may therefore be required. Neither target should be treated as a guaranteed passwordless recovery method.

When the root password is unavailable, authorized administrators may need the distribution-specific initramfs recovery procedure or an external rescue environment. GRUB authentication, disk encryption, and other security controls may impose additional requirements.

Related Solution

Need a Linux server with console access for recovery practice?

Owned Networks KVM VPS and dedicated server plans include out-of-band VNC console access, snapshot support, and full root access. Deploy a clean AlmaLinux, Rocky Linux, or CentOS instance in minutes and practice recovery procedures safely without risk to production systems.

  • Deploy in NYC, Miami, Dallas, LA, Seattle, London, or Amsterdam
  • AlmaLinux, Rocky Linux, CentOS, Ubuntu, and Debian available
  • KVM virtualization — VNC console, snapshots, full root access

Compare VPS Locations and Pricing

Frequently Asked Questions

What is the difference between single user mode, rescue mode, and emergency mode?

These terms describe related but distinct recovery environments. Single-user mode traditionally refers to runlevel 1. Rescue mode (rescue.target) is the modern systemd equivalent of traditional single-user mode and starts a minimal recovery environment. Emergency mode (emergency.target) starts an even more restricted environment. Both commonly require root authentication through sulogin. Available mounts depend on the system configuration and boot state. The rd.break method described in this guide can provide an early initramfs recovery shell without the normal operating-system login process on appropriately configured systems. GRUB authentication, disk encryption, and other security controls may still restrict access.

Does the procedure differ between AlmaLinux and Rocky Linux?

The rd.break recovery approach is broadly similar on AlmaLinux 8/9 and Rocky Linux 8/9 because both use the Enterprise Linux boot infrastructure. However, GRUB command names, storage configuration, encryption, and recovery behavior can vary between installations.

Why is the SELinux relabel step necessary?

SELinux uses security contexts to control access to files and processes. Some recovery operations, including password resets performed from an initramfs chroot, can leave files with unexpected security labels. When a full relabel is appropriate, touch /.autorelabel requests relabeling during the next normal boot. This operation may take significant time and should be used when required by the recovery procedure.

Can I do this on a VPS without physical access?

Yes, if your VPS provider offers an out-of-band console such as VNC or IPMI. Owned Networks KVM VPS plans include VNC console access from the hosting panel. This gives you the same view as a physical monitor connected to the server, allowing GRUB interaction before the OS boots.

What if GRUB is password protected?

If GRUB is configured with a password, you will be prompted for it before being allowed to edit kernel parameters. If you do not have the GRUB password, the options are to boot from an external rescue ISO or to contact your hosting provider for console-level assistance.

Will changes made in single user mode persist after rebooting?

Yes. Single user mode is not a live or temporary environment — changes made to the filesystem are permanent. Password changes, configuration file edits, and file system repairs all persist after rebooting. This is intentional, as the purpose of single user mode is system recovery.


Was this answer helpful?

KVM VPS & Dedicated Servers

Deploy a Linux VPS in under 2 minutes — AlmaLinux, Rocky Linux, Ubuntu, Debian. Full root access, KVM virtualization, US and EU locations.

« Back