You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: support/azure/virtual-machines/linux/serial-console-grub-single-user-mode.md
+5-22Lines changed: 5 additions & 22 deletions
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,7 @@ ms.author: genli
22
22
23
23
[!INCLUDE [CentOS End Of Life](../../../includes/centos-end-of-life-note.md)]
24
24
25
-
GRand Unified Bootloader (GRUB) is likely the first thing you see when you boot a virtual machine (VM). Because it's displayed before the operating system has started, GRUB isn't accessible via SSH. In GRUB, you can modify your boot configuration to boot into single-user mode, among other things.
25
+
Grand Unified Bootloader (GRUB) operates at an early stage in a Linux virtual machine (VM) boot process. It operates before the Linux kernel is loaded and before any system services (such as networking or SSH) are started, so GRUB isn't accessible via SSH. You must use the Serial Console to access GRUB. In GRUB, you can modify your boot configuration to boot into single-user mode, among other things.
26
26
27
27
Single-user mode is a minimal environment with minimal functionality. It can be useful for investigating boot issues, file system issues, or network issues. Fewer services can run in the background and, depending on the runlevel, a file system might not even be automatically mounted.
28
28
@@ -31,7 +31,7 @@ Single-user mode is also useful in situations where your VM might be configured
31
31
> [!NOTE]
32
32
> The Serial Console service allows only users with *contributor* level or higher permissions to access the serial console of a VM.
33
33
34
-
To enter single-user mode, enter GRUB when your VM is booting, and modify the boot configuration in GRUB. See detailed instructions for entering GRUB in the next section. In general, if your VM has been configured to display GRUB, you can use the restart button within your VM's serial console to restart the VM and display GRUB.
34
+
To enter single-user mode, enter GRUB when your VM is booting, and modify the boot configuration in GRUB. See detailed instructions for entering GRUB in the next section. If your VM is set up to display GRUB, you can use the restart button within your VM's serial console to restart the VM and display GRUB.
35
35
36
36
:::image type="content" source="media/serial-console-grub-single-user-mode/restart-vm-button.png" alt-text="Screenshot of the Restart VM button displayed in the tool bar." border="false":::
37
37
@@ -51,7 +51,7 @@ You can also restart your VM by running a SysRq "b" command if [SysRq](./serial-
51
51
52
52
## General single-user mode access
53
53
54
-
You might need manual access to single-user mode when you haven't configured an account with password authentication. Modify the GRUB configuration to manually enter single-user mode. After you've done this, see the "Use single-user mode to reset or add a password" section for further instructions.
54
+
You might need manual access to single-user mode when you haven't configured an account with password authentication. Modify the GRUB configuration to manually enter single-user mode. After doing this, see the "Use single-user mode to reset or add a password" section for further instructions.
55
55
56
56
If the VM is unable to boot, distributions often automatically drop you into single-user mode or emergency mode. Other distributions, however, require additional setup, such as setting up a root password, before they can drop you into single-user or emergency mode automatically.
57
57
@@ -63,10 +63,6 @@ After you're in single-user mode, add a new user with sudo privileges by doing t
63
63
1. Run `sudo usermod -a -G sudo <username>` to grant the new user root privileges.
64
64
1. Use `passwd <username>` to set the password for the new user. You can then sign in as the new user.
65
65
66
-
## Access for Red Hat Enterprise Linux (RHEL)
67
-
68
-
If RHEL can't boot normally, it drops you into single-user mode automatically. However, if you haven't set up root access for single-user mode, you don't have a root password and can't sign in. There is a workaround (see the "Manually enter single-user mode in RHEL" section), but we suggest that you set up root access initially.
69
-
70
66
### GRUB access in RHEL
71
67
72
68
RHEL comes with GRUB enabled out of the box. To enter GRUB, reboot your VM by running `sudo reboot`, and then press any key. The GRUB pane should be displayed. If it isn't, ensure that the following lines are present in your GRUB file (`/etc/default/grub`):
> Red Hat also provides documentation for booting into Rescue Mode, Emergency Mode, or Debug Mode, and for resetting the root password. For instructions, see [Terminal menu editing during boot](https://aka.ms/rhel7grubterminal).
95
91
96
-
### Set up root access for single-user mode in RHEL
97
-
98
-
The root user is disabled by default. Single-user mode in RHEL requires the root user to be enabled. If you need to enable single-user mode, use the following instructions:
99
-
100
-
1. Sign in to the Red Hat system via SSH.
101
-
1. Switch to root.
102
-
1. Enable the password for the root user by doing the following:
103
-
* Run `passwd root` (set a strong root password).
104
-
1. Ensure that the root user can sign in only via ttyS0 by doing the following:
105
-
a. Run `vi /etc/ssh/sshd_config`, and ensure that PermitRootLogIn is set to `no`.
106
-
b. Run `vi /etc/securetty file` to allow sign-in only via ttyS0.
107
-
108
-
Now, if the system boots into single-user mode, you can sign in with the root password.
92
+
### Single-User mode in RHEL 6.9+ and 7.4+
109
93
110
-
Alternatively, for RHEL 7.4+ or 6.9+, to enable single-user mode in the GRUB prompts, see [Booting into single-user mode](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/5/html/installation_guide/s1-rescuemode-booting-single).
94
+
For RHEL 7.4+ or 6.9+, to enable single-user mode in the GRUB prompts, see [Booting into single-user mode](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/5/html/installation_guide/s1-rescuemode-booting-single).
111
95
112
96
### Manually enter single-user mode in RHEL
113
97
@@ -274,7 +258,6 @@ To enable single-user mode in Oracle Linux, follow the earlier instructions for
274
258
To learn more about Serial Console, see:
275
259
276
260
*[Linux Serial Console documentation](serial-console-linux.md)
277
-
*[Use Serial Console to enable GRUB in various distributions](https://linuxonazure.azurewebsites.net/why-proactively-ensuring-you-have-access-to-grub-and-sysrq-in-your-linux-vm-could-save-you-lots-of-down-time/)
278
261
*[Use Serial Console for NMI and SysRq calls](serial-console-nmi-sysrq.md)
279
262
*[Serial Console for Windows VMs](../windows/serial-console-windows.md)
0 commit comments