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-proactive-configuration.md
+69-68Lines changed: 69 additions & 68 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,67 +24,67 @@ You can improve the recovery times of your IaaS Linux virtual machine (VM) in mo
24
24
You might have to perform a VM recovery for any of the following reasons:
25
25
26
26
- Corrupted file system, kernel, or MBR (Master Boot Record)
27
+
- Corrupted SSHD configurations files
27
28
- Failed kernel upgrades
28
29
- Incorrect GRUB kernel parameters
29
30
- Incorrect fstab configuration
30
-
- Firewall configuration
31
31
- Lost password
32
-
-Mangled sshd configurations files
32
+
-Firewall configuration
33
33
- Networking configuration
34
34
35
-
Many other scenarios as detailed [here](./serial-console-linux.md#common-scenarios-for-accessing-the-serial-console).
35
+
Many other scenarios are also possible, as detailed in the "Common scenarios for accessing the Serial Console" section of [Azure Serial Console for Linux](./serial-console-linux.md#common-scenarios-for-accessing-the-serial-console). Refer to this article for more help if you're a new user of the Serial Console.
36
36
37
37
Verify that you can access GRUB and the Serial Console on your VMs that are deployed in Azure.
38
38
39
-
If you're a new user of the Serial Console, refer to [this article](./serial-console-linux.md).
40
-
41
39
> [!TIP]
42
40
> Back up your files before you make changes.
43
41
44
42
The following video demonstrates how you can quickly recover your Linux VM after you have access to GRUB.
45
43
46
44
[Recover Linux VM Video](https://youtu.be/KevOc3d_SG4)
47
45
48
-
There are several methods to improve recovery of Linux VMs. In a Cloud environment, this process has been challenging. We're continually updating our tooling and program features to improving the recovery time for services.
46
+
## Recovery methods
47
+
48
+
There are several methods to improve recovery of Linux VMs. In a Cloud environment, this process has been challenging. We're continually updating our tooling and program features to improve recovery time for services.
49
49
50
50
By using the Azure Serial Console, you can interact with your Linux VM as if you were at a system's console. You can manipulate many configuration files and processes, including how the kernel starts up.
51
51
52
-
The more experienced Linux or Unix sysstem admins will appreciate the **single user** and **emergency** modes that are accessible through the Azure Serial Console. These features make Disk Swap and VM deletion operations redundant for many recovery scenarios.
52
+
More experienced Linux or Unix system administrators can appreciate the Single User and Emergency modes that are accessible through the Azure Serial Console. These features make Disk Swap and VM deletion operations redundant for many recovery scenarios.
53
53
54
54
The method of recovery depends on the problem that you experience. For example, a lost or misplaced password can be reset through Azure portal options by using **Reset Password**. The **Reset Password** feature is known as an *extension*. The feature communicates with the Linux Guest agent.
55
55
56
-
Other extensions, such as Custom Script, are available. However, these options require that the Linux **waagent** is running and in a healthy state.
56
+
Other extensions, such as Custom Script, are available. However, these options require that the Azure Linux VM Agent (waagent) is running and in a healthy state.
57
57
58
58
:::image type="content" source="media/serial-console-grub-proactive-configuration/agent-status.png" alt-text="Screenshot of the Agent status in the Properties page in Azure portal.":::
59
59
60
60
If you have access to the Azure Serial Console and GRUB, you can manage a password change or fix an incorrect configuration in minutes instead of hours. In the scenario in which your primary kernel becomes corrupted, you could even force the VM to start from an alternative kernel, if you have multiple kernels on the disk.
61
61
62
-
:::image type="content" source="media/serial-console-grub-proactive-configuration/more-kernel.png" alt-text="Screenshot of the selected OS startup screen in GRUB showing multiple kernels that can be chosen.":::
62
+
:::image type="content" source="media/serial-console-grub-proactive-configuration/more-kernel.png" alt-text="Screenshot of the selected OS startup screen in GRUB showing multiple kernels that you can choose.":::
If you don't have access to GRUB, watch [this video](https://youtu.be/m5t0GZ5oGAc) to see how you can easily automate the disk swap procedure to recover your VM.
75
75
76
-
## Challenges
76
+
## Configuration methods and challenges
77
77
78
78
By default, not all Linux Azure VMs are configured for GRUB access or to be interrupted by the SysRq commands. Some older distros, such as LES 11, aren't configured to display a sign-in prompt in the Azure Serial Console. The following sections review various Linux distributions and discuss configurations that make GRUB available.
79
79
80
-
## How to configure Linux VM to accept SysRq keys
80
+
###How to configure Linux VM to accept SysRq keys
81
81
82
82
By default, the SysRq key is enabled on some newer Linux distros. On other distros, it might be configured for accepting values only for certain SysRq functions.
83
83
On older distros, it might be disabled completely.
84
84
85
-
The SysRq feature is useful for rebooting a crashed or non-responding VM directly from the Azure Serial Console. It's also helpful to gain access to the GRUB menu. Aalternatively restarting a VM from another portal window or SSH session might drop your current console connection and end GRUB time-outs that used to display the GRUB menu.
85
+
The SysRq feature is useful for restarting a non-responding VM directly from the Azure Serial Console. It's also helpful to gain access to the GRUB menu. Aalternatively, restarting a VM from another portal window or SSH session might drop your current console connection and end GRUB timeouts that previously displayed the GRUB menu.
86
86
87
-
The VM must be configured to accept a value of **1** for the kernel parameter. This setting enables all functions of SysRq or 128, which enables restart and power off processes.
87
+
The VM must be configured to accept a value of **1** for the kernel parameter. This setting enables all functions of SysRq or 128 for restart and power off processes.
@@ -116,7 +116,7 @@ The system should log a reset message that resembles the message in the followin
116
116
117
117
:::image type="content" source="media/serial-console-grub-proactive-configuration/retting-log.png" alt-text="Screenshot of the reset message log in the command-line interface.":::
118
118
119
-
## Ubuntu GRUB configuration
119
+
###Ubuntu GRUB configuration
120
120
121
121
By default, you should be able to access GRUB by holding the **Esc** key during the VM restart. If the GRUB menu doesn't appear, you can force the GRUB menu to appear and stay on screen in the Azure Serial Console by using one of the following options.
122
122
@@ -144,7 +144,7 @@ Then, add the following line:
144
144
GRUB_TIMEOUT_STYLE=countdown
145
145
```
146
146
147
-
## Ubuntu 12\.04
147
+
####Ubuntu 12\.04
148
148
149
149
Ubuntu 12.04 allows access to the serial console but doesn't offer the ability to interact. A **login:** prompt isn't displayed.
150
150
@@ -172,7 +172,7 @@ For Ubuntu 12.04 to obtain a **login:** prompt, follow these steps:
172
172
173
173
For the required settings that you need to configure the serial console for Ubuntu versions, see the [SerialConsoleHowto](https://help.ubuntu.com/community/SerialConsoleHowto) Ubuntu documentation.
174
174
175
-
## Ubuntu Recovery mode
175
+
#### Ubuntu Recovery mode
176
176
177
177
Additional recovery and clean-up options are available for Ubuntu through GRUB. However, these settings are accessible only if you configure kernel parameters accordingly.
178
178
If you don't configure the kernel boot parameter, the Recovery menu is automatically sent to the Azure Diagnostics component and not to the Azure Serial Console. To get access to the Ubuntu Recovery menu, follow these steps:
@@ -205,9 +205,9 @@ If all goes well, the Recovery menu now displays additional options that can hel
205
205
206
206
:::image type="content" source="media/serial-console-grub-proactive-configuration/additional-recovery-options-ubuntu.png" alt-text="Screenshot that shows the Serial console at the Recovery menu that offers additional recovery options.":::
207
207
208
-
## Red Hat GRUB configuration
208
+
###Red Hat GRUB configuration
209
209
210
-
### Red Hat 7\.4\+ GRUB configuration
210
+
####Red Hat 7\.4\+ GRUB configuration
211
211
212
212
The default /etc/default/grub configuration on these versions is adequately configured
Alternatively, you can configure GRUB and SysRq by using a single line, either in the shell or through the Run Command. Back up your files before you run this command:
The file to modify is /boot/grub/grub.conf. The `timeout` value will determine how long GRUB is shown for.
293
+
The file to modify is /boot/grub/grub.conf. The `timeout` value will determine how long GRUB is dispplayed.
296
294
297
295
```console
298
-
#boot=/dev/vda
296
+
#boot=/dev/vda1
299
297
default=0
300
298
timeout=15
301
299
splashimage=(hd0,0)/grub/splash.xpm.gz
@@ -305,53 +303,55 @@ terminal serial
305
303
terminal --timeout=5 serial console
306
304
```
307
305
308
-
The last line *terminal –-timeout=5 serial console* will further increase **GRUB** timeout by adding a prompt of 5 seconds displaying **Press any key to continue.**
306
+
The last line, *terminal –-timeout=5 serial console*, further increases the **GRUB** timeout value by adding a prompt of five seconds duration that displays the message, **Press any key to continue.**
307
+
308
+
:::image type="content" source="media/serial-console-grub-proactive-configuration/press-any-key-to-continue.png" alt-text="Screenshot that shows console output.":::
309
309
310
-
:::image type="content" source="media/serial-console-grub-proactive-configuration/press-any-key-to-continue.png" alt-text="Screenshot shows a console with output.":::
310
+
The GRUB menu should appear on-screen for the configured value of **timeout=15** without having to press Esc. Select the console in the browser to make the menu active, and then select the required kernel.
311
311
312
-
GRUB menu should appear on-screen for the configured timeout=15 without the need to press Esc. Make sure to click in the Console in the Browser to make active the menu and select the required kernel.
312
+
:::image type="content" source="media/serial-console-grub-proactive-configuration/select-kernel.png" alt-text="Screenshot that shows a console that contains two Linux options.":::
313
313
314
-
:::image type="content" source="media/serial-console-grub-proactive-configuration/select-kernel.png" alt-text="Screenshot shows a console with two Linux options.":::
314
+
### SuSE GRUB configuration
315
315
316
-
##SuSE
316
+
#### SLES 12 SP1
317
317
318
-
### SLES 12 sp1
318
+
Use either of the following methods:
319
319
320
-
Either use YaST bootloader as per the official [docs](./serial-console-grub-single-user-mode.md#grub-access-in-suse-sles)
320
+
- Use the YaST bootloader per the steps in [Use Serial Console to access GRUB and single-user mode](./serial-console-grub-single-user-mode.md#general-single-user-mode-access).
321
321
322
-
Or add/change to /etc/default/grub the following parameters:
322
+
- Modify the /etc/default/grub file by specifying the following parameters:
This configuration will enable the message **Press any key to continue** to appear on the console for 5 seconds
366
+
This configuration triggers a prompt of five seconds duration on the console that displays the message, **Press any key to continue.**
367
+
368
+
It then displays the GRUB menu for an additional five seconds. Press the down arrow to interrupt the counter, and then select a kernel that you want to start. You can make either of the following changes:
367
369
368
-
It will then display the GRUB menu for an additional 5 seconds - by pressing the down arrow you will interrupt the counter and select a kernel you want to boot either append the keyword **single** for single user mode that requires root password to be set.
370
+
- Append the command **init=/bin/bash** to load the kernel and also make sure that the init program is replaced by a bash shell. In this manner, you gain access to a shell without having to enter a password. You can then update the password for Linux accounts or make other configuration changes.
369
371
370
-
Appending the command**init=/bin/bash**will load the kernel but ensures that the init program is replaced by a bash shell.
372
+
- Append the keyword**single**to force Single User mode. This mode requires that you set a root password.
371
373
372
-
You will gain access to a shell without having to enter a password. You can then proceed to update password for Linux accounts or make other configuration changes.
374
+
#### Force the kernel to a bash prompt
373
375
374
-
## Force the kernel to a bash prompt
376
+
Having access to GRUB allows you to interrupt the initialization process. This interaction is useful for many recovery procedures. If you don't have a root password (as required by Single User mode), you can start the kernel by replacing the init program with a bash prompt.
375
377
376
-
Having access to GRUB allows you to interrupt the initialization process this interaction is useful for many recovery procedures.
377
-
If you don't have root password and single user requires you to have a root password, you can boot the kernel replacing the init program with a bash prompt – this interrupt can be achieved by appending init=/bin/bash to the kernel boot line
378
+
1. To trigger the interruption, append `init=/bin/bash` to the kernel boot line.
378
379
379
-
:::image type="content" source="media/serial-console-grub-proactive-configuration/bash-kernel-boot.png" alt-text="Screenshot shows a console with the updated boot line.":::
380
+
:::image type="content" source="media/serial-console-grub-proactive-configuration/bash-kernel-boot.png" alt-text="Screenshot that shows a console that contains the updated boot line.":::
380
381
381
-
Remount your / (root) file system RW using the command
382
+
1.Remount your / (root) file system RW by running the following command:
382
383
383
384
`mount -o remount,rw /`
384
385
385
-
:::image type="content" source="media/serial-console-grub-proactive-configuration/bash-remount.png" alt-text="Screenshot shows a console with a re-mount action.":::
386
+
:::image type="content" source="media/serial-console-grub-proactive-configuration/bash-remount.png" alt-text="Screenshot that shows a console that contains a remount action.":::
386
387
387
-
Now you can perform a root password change or other Linux configuration change.
388
+
1. Perform a root password change or other Linux configuration change.
388
389
389
-
:::image type="content" source="media/serial-console-grub-proactive-configuration/bash-change-password.png" alt-text="Screenshot shows a console where you can change root password and other configuration.":::
390
+
:::image type="content" source="media/serial-console-grub-proactive-configuration/bash-change-password.png" alt-text="Screenshot that shows a console in which you can change the root password or make other configurations.":::
390
391
391
-
Restart the VM by running the following command:
392
+
1.Restart the VM by running the following command:
392
393
393
394
`/sbin/reboot -f`
394
395
395
-
## Single User mode
396
+
#### Force Single User mode
396
397
397
-
Alternatively, you might have to access the VM in Single User or Emergency mode. Select the kernel that you want to start or interrupt by using the arrow keys. Enter the desired mode by appending the keyword **single** or **1** to the kernel boot line. On RHEL systems, you can also append **rd.break**.
398
+
You might have to access the VM in Single User or Emergency mode. Select the kernel that you want to start or interrupt by using the arrow keys. Enter the desired mode by appending the keyword **single** or **1** to the kernel boot line. On RHEL systems, you can also append **rd.break**.
398
399
399
400
For more information about how to access Single User mode, see [Use Serial Console to access GRUB and single-user mode](./serial-console-grub-single-user-mode.md#general-single-user-mode-access)
0 commit comments