Why booting into rescue mode menu doesn't do anything?

9,696

Solution 1

it still asking me for root password, root FS is not in read only mode

This is the norm for systemd's rescue mode and thus for systemd operating systems. For not (re-)mounting filesystems and a read-only / mount, you should look to emergency mode, which is not the same as rescue mode. Both emergency and rescue modes invoke sulogin on systemd operating systems. The differences between the twain lie in how much of the basic system is brought up, and what is mounted.

Note that single user mode was superseded by the split mechanisms of emergency mode and rescue mode in 1995, when van Smoorenburg init gained its -b option.

The other answer is talking about something else that is also confusingly called "rescue mode", as well as referencing the CentOS 5 doco for CentOS 7 even though CentOS 7 is a systemd operating system whereas CentOS 5 was not.

That "rescue mode" involves bootstrapping another operating system image from a CD-ROM, DVD-ROM, or USB storage device. This rescue mode and emergency mode involve what you are talking about in the question: entries on the GRUB menu and stuff that you can edit into the kernel command line from that very same GRUB menu.

Further reading

Solution 2

Ok tested it on a CentOS running on a Virtualbox. These is how you get there:

  1. Boot using one of the following:

    1. By booting the system from an installation boot CD-ROM.

    2. By booting the system from other installation boot media, such as USB flash devices.

  2. From option pick Troubleshooting --> Rescue a CentOS system

    • enter image description here
    • enter image description here
  3. Then you have 4 options:

    • enter image description here

      1. Continue: to mount your partitions automatically and they were mounted successfully, you are in single-user mode. Even if your file system is mounted, the default root partition while in rescue mode is a temporary root partition, not the root partition of the file system used during normal user mode (runlevel 3 or 5). If you selected to mount your file system and it mounted successfully, you can change the root partition of the rescue mode environment to the root partition of your file system by executing the following command:

        • chroot /mnt/sysimg

        • This is useful if you need to run commands such as rpm that require your root partition to be mounted as /. To exit the chroot environment, type exit to return to the prompt.

      2. Read-only mount: Mount in read-only mode

      3. Skip to shell: you can still try to mount a partition or LVM2 logical volume manually inside rescue mode by creating a directory such as /foo, and typing the following command:
        • mount -t ext3 /dev/mapper/VolGroup00-LogVol02/foo
        • In the above command, /foo is a directory that you have created and /dev/mapper/VolGroup00-LogVol02 is the LVM2 logical volume you want to mount. If the partition is of type ext2, replace ext3 with ext2.
        • If you do not know the names of all physical partitions, use the following command to list them:
        • fdisk -l
      4. Quit (reboot): Stop and return to normal boot

The other option I see is to boot into GRUB menu as follows:

  1. Select your kernel version and press e at the keyboard to edit the boot options.

    • enter image description here
  2. Use cursor to scroll down and look for line with linux 16, when there move till you see the ro option and modify that to be:

    rw init=/sysroot/bin/sh
    
    • enter image description here
  3. Now mount the root filesystem with:

    chroot /sysroot/
    
    • enter image description here
  4. When through reboot:

    reboot -f
    

UPDATES:

Based on references given by JDBp the way to get to either mode using systemd units would be:

  1. Emergency mode:

    • add systemd.unit=emergency.target to the boot command line then Ctrl+x.
    • Equivalent parameters, emergency and -b, can be passed to the kernel as well.
  2. Rescue mode:

    • add systemd.unit=rescue.target to the boot command line then Ctrl+x
    • Equivalent parameters, 1, s, and single, can be passed to the kernel as well.

Additional source an images:

https://www.tecmint.com/boot-into-single-user-mode-in-centos-7/

Share:
9,696

Related videos on Youtube

Pozinux
Author by

Pozinux

I though that a good way of learning was to participate to this very nice community as much as I can. Please pardon my rusty english because I'm French. ^^

Updated on September 18, 2022

Comments

  • Pozinux
    Pozinux over 1 year

    When I enter into grub menu, I get two entries :

    CentOS Linux (3.10.0-514.21.1.el7.x86_64) 7 (Core)
    CentOS Linux (0-rescue-e1ac24cbe9f94f2caa228d77e027be8b) 7 (Core)
    

    When I boot into the second line (the rescue one), I get a normal prompt like if I had boot into the first line. I was expecting someting like a rescue shell or something equivalent to single-user mode but it still asking me for root password, root FS is not in read only mode etc. Nothing seems different from multi-user mode.

    Can someone try on its distro to see if it has the same behavior? I'm pretty new to rescue, emergency, single-user modes so I might have missed someting.

    Here is my conf :

    [root@centos3 ~]# uname -a
    Linux centos3 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
    
    [root@centos3 ~]# cat /etc/redhat-release
    CentOS Linux release 7.3.1611 (Core)
    
    • George Udosen
      George Udosen over 6 years
      Not an ardent CentOS user but mine acted the same as yours ( on Ubuntu would be different as you said) but look at this: centos.org/docs/5/html/Installation_Guide-en-US/…
    • Alen Milakovic
      Alen Milakovic over 6 years
      Is the root filesystem supposed to be in read only mode in rescue mode? It's normal for rescue mode to ask for a root password - Debian does that too.
    • George Udosen
      George Udosen over 6 years
      Yes @FaheemMitha I did that and was presented with what OP said but using the method from the source I used booting from a livcd will get you into the single user mode which my answer shows. Note did this from a VM
    • George Udosen
      George Udosen over 6 years
      Ubuntu I use does it a bit differently no livecd needed to get there
  • JdeBP
    JdeBP over 6 years
    You are referencing the wrong manual for the wrong version of the operating system. The questioner is using CentOS 7 and you should be looking at the System Administrator's Guide.
  • George Udosen
    George Udosen over 6 years
    The steps there were done on CentOS 7 in my test case but I will update the reference
  • Jaeda
    Jaeda almost 6 years
    On CentOS7 Minimal I have no Rescue mode in Troubleshooting menu.