Why booting into rescue mode menu doesn't do anything?
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
- Jonathan de Boyne Pollard (2016). The gen on emergency and rescue mode bootstrap. Frequently Given Answers.
- Lennart Poettering et al..
bootup
. systemd manual pages. Freedesktop.org. - Lennart Poettering et al.. "
emergency.target
".systemd.special
. systemd manual pages. Freedesktop.org. - Lennart Poettering et al.. "
rescue.target
".systemd.special
. systemd manual pages. Freedesktop.org. - "Booting into Emergency Mode". Red Hat Enterprise Linux 7 System Administrator's Guide. RedHat.
- "Booting into Rescue Mode". Red Hat Enterprise Linux 7 System Administrator's Guide. RedHat.
- Lingeshwaran Rangasamy (2015). Redhat Enterprise Linux 7 — systemd targets. Unix Arena.
- Working with systemd targets. Red Hat Enterprise Linux 7 System Administrator's Guide. RedHat.
- How to permanently disable root-password prompt for recovery mode, RHEL7
Solution 2
Ok tested it on a CentOS running on a Virtualbox. These is how you get there:
-
Boot using one of the following:
By booting the system from an installation boot CD-ROM.
By booting the system from other installation boot media, such as USB flash devices.
-
From option pick
Troubleshooting
-->Rescue a CentOS system
-
Then you have
4 options
:-
-
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.
Read-only mount: Mount in read-only mode
- 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 theLVM2
logical volume you want to mount. If the partition is of typeext2
, replaceext3
withext2
. - If you do not know the names of all physical partitions, use the following command to list them:
fdisk -l
- Quit (reboot): Stop and return to normal boot
-
-
The other option I see is to boot into GRUB menu as follows:
-
Select your kernel version and press e at the keyboard to edit the boot options.
-
Use cursor to scroll down and look for line with
linux 16
, when there move till you see thero
option and modify that to be:rw init=/sysroot/bin/sh
-
Now mount the root filesystem with:
chroot /sysroot/
-
When through reboot:
reboot -f
UPDATES:
Based on references given by JDBp the way to get to either mode using systemd
units would be:
-
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.
- add
-
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.
- add
Additional source an images:
https://www.tecmint.com/boot-into-single-user-mode-in-centos-7/
Related videos on Youtube
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, 2022Comments
-
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 over 6 yearsNot 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 over 6 yearsIs 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 over 6 yearsYes @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 over 6 yearsUbuntu I use does it a bit differently no
livecd
needed to get there
-
-
JdeBP over 6 yearsYou 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 over 6 yearsThe steps there were done on CentOS 7 in my test case but I will update the reference
-
Jaeda almost 6 yearsOn CentOS7 Minimal I have no Rescue mode in Troubleshooting menu.