Booting into Linux Single User Mode

Last updated: 2021-05-13 10:45:01

    Overview

    For operations like password management, SSHD fixing and maintenance before disk mounting, Linux users need to enter the single user mode. This document describes how to boot into this mode in mainstream Linux distributions.

    Directions

    1. On the CVM console, choose VNC to log in to a CVM. For detailed directions, see Logging into Linux Instances via VNC.
    2. In the VNC login window, select Send CtrlAltDel in the upper-left corner, press Ctrl-Alt-Delete, and click OK in the prompt box.
    3. When a connection failure message appears, press Up or Down arrow to refresh the page and hovers the cursor over the grub menu, as shown below.
    4. Press c to enter the grub rescue mode.
    5. Perform the steps that suit your operating system version.

      CentOS 6.x

    6. Select a kernel in the grub mode, as shown below.
    7. Press e to enter the kernel edit page, choose the kernel line using Up or Down arrow, and press e again, as shown below.
    8. Enter single at the end of line, as shown below.
    9. Press Enter, and then press b to boot the selected command line and enter single user mode, as shown below.

      The following figure indicates that the system boots into single user mode.

      Note:

      You can run the exec /sbin/init command to exit the single user mode.

    CentOS 7.x

    1. Select a kernel in the grub mode, as shown below.
    2. Press e to enter the kernel edit page. Locate the line started with “linux16” using Up or Down arrow and replace ro with rw init=/bin/bash or /usr/bin/bash, as shown below.
    3. Press Ctrl+X to boot into the single user mode, as shown below:
      The following figure indicates that the system boots into the single user mode.

      Note:

      You can run the exec /sbin/init command to exit the single user mode.

    CentOS 8.0

    1. Select a kernel in the grub mode, as shown below.
    2. Press e to enter the kernel edit page. Locate the line started with “linux” using Up or Down arrow and replace ro with rw init=/sysroot/bin/bash, as shown below.
    3. Press Ctrl+X to boot into the single user mode, as shown below:
      The following figure indicates that the system boots into the single user mode.

    Ubuntu or Debian

    1. Select a kernel in the grub mode, as shown below.
    2. Press e to enter the kernel edit page. Locate the line started with “linux” using Up or Down arrow and append quiet splash rw init=/bin/bash to the end of the line, as shown below.
    3. Press Ctrl+X to boot into the single user mode, as shown below:
      The following figure indicates that the system boots into single user mode.

    SUSE

    1. Select a kernel in the grub mode, as shown below.
    2. Press e to enter the kernel edit page. Locate the line started with “linux” using Up or Down arrow, add rw to the beginning and 1 to the end of the splash parameter, as shown below.
    3. Press Ctrl+X to boot into the single user mode, as shown below:

    Tlinux

    1. Select a kernel in the grub mode, as shown below.
    2. Press e to enter the kernel edit page, choose the kernel line using Up or Down arrow, and press e again, as shown below.
    3. Add a space and 1 to the end of the line (namely after 256M), as shown below.
    4. Press Enter to enter the single user mode.