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
### <aid="offline-troubleshooting"></a> Reinstall GRUB and regenerate GRUB configuration file using Auto Repair (ALAR)
74
72
75
-
:::image type="content" source="./media/troubleshoot-vm-boot-error/grub-unknown-filesystem.png" alt-text="Screenshot of grub unknown file system error.":::
76
-
77
-
This error might be associated with one of the following issues:
78
-
79
-
* /boot file system corruption.
80
-
81
-
To resolve this issue, follow the steps in [Fix /boot file system corruption](#fix-boot-file-system-corruption).
82
-
83
-
* GRUB boot loader is pointing to an invalid disk or partition.
73
+
Azure Linux Auto Repair (ALAR) scripts are part of the VM repair extension described in [Use Azure Linux Auto Repair (ALAR) to fix a Linux VM](./repair-linux-vm-using-alar.md). ALAR covers the automation of multiple repair scenarios, including GRUB rescue issues.
84
74
85
-
To resolve this issue, [reinstall GRUB and regenerate GRUB configuration file](#reinstall-grub-regenerate-grub-configuration-file).
75
+
The ALAR scripts use the repair extension `repair-button` to fix GRUB issues by specifying `--button-command grubfix` for Generation 1 VMs, or `--button-command efifix` for Generation 2 VMs. This parameter triggers the automated recovery. Implement the following step to automate the fix of common GRUB errors that could be fixed by reinstalling GRUB and regenerating the corresponding configuration file:
86
76
87
-
*OS disk partition table issues caused by human error.
77
+
***Linux VMs without UEFI (BIOS based - Gen1):**
88
78
89
-
To resolve such issues, follow the steps in [Error: No such partition](#no-such-partition) with recommendations to re-create the /boot partition if missing or created incorrectly.
79
+
```azurecli-interactive
80
+
az vm repair repair-button --button-command 'grubfix' --verbose $RGNAME --name $VMNAME
81
+
```
90
82
91
-
### <aid="fix-boot-file-system-corruption"></a>Fix /boot file system corruption
83
+
***Linux VMs with UEFI (Gen2):**
92
84
93
-
1. Check whether a rescue/repair VM was created. If it wasn't created, follow step 1 in [Troubleshoot GRUB rescue issue offline](#offline-troubleshooting) to create the VM.
85
+
```azurecli-interactive
86
+
az vm repair repair-button --button-command 'efifix' --verbose $RGNAME --name $VMNAME
87
+
```
94
88
95
-
2. Refer to [Troubleshoot file system corruption errors in Azure Linux](linux-recovery-cannot-start-file-system-errors.md) to resolve the corruption issues in the corresponding /boot partition.
89
+
> [!IMPORTANT]
90
+
> Replace the resource group name `$RGNAME` and VM name `$VMNAME` accordingly.
96
91
97
-
3. Go to step 3 in [Troubleshoot GRUB rescue issue offline](#offline-troubleshooting) to swap the OS disk.
92
+
The repair VM script, in conjunction with the ALAR script, temporarily creates a resource group, a repair VM, and a copy of the affected VM's OS disk. It reinstalls GRUB and regenerates the corresponding GRUB configuration file and then it swaps the OS disk of the broken VM with the copied fixed disk. Finally, the `repair-button` script will automatically delete the resource group containing the temporary repair VM.
98
93
99
-
### <aid="reinstall-grub-regenerate-grub-configuration-file"></a>Reinstall GRUB and regenerate GRUB configuration file
94
+
### <aid="reinstall-grub-regenerate-grub-configuration-file"></a>Reinstall GRUB and regenerate GRUB configuration file manually
100
95
101
-
1. Check whether a rescue/repair VM was created. If it wasn't created, follow step 1 in [Troubleshoot GRUB rescue issue offline](#offline-troubleshooting) to create the VM. Mount all the required file systems, including / and /boot in the rescue/repair VM, and then enter the [chroot](chroot-environment-linux.md) environment.
96
+
1. Check whether a rescue/repair VM was created. If it wasn't created, follow step 1 in [Troubleshoot GRUB rescue issue offline](#offline-troubleshooting) to create the VM. Mount all the required file systems, including `/` and `/boot` in the rescue/repair VM, and then enter the [chroot](chroot-environment-linux.md) environment.
102
97
103
98
2. Reinstall GRUB and regenerate the corresponding GRUB configuration file by using one of the following commands:
104
99
@@ -129,7 +124,7 @@ This error might be associated with one of the following issues:
129
124
sed -i 's/hd2/hd0/g' /boot/grub2/grub.cfg
130
125
```
131
126
132
-
***Ubuntu 20.04/22.04/24.04**
127
+
***Ubuntu Gen1 and Gen2**
133
128
134
129
```bash
135
130
grub-install /dev/sdX
@@ -138,6 +133,34 @@ This error might be associated with one of the following issues:
138
133
139
134
3. Go to step 3 in [Troubleshoot GRUB rescue issue offline](#offline-troubleshooting) to swap the OS disk.
:::image type="content" source="./media/troubleshoot-vm-boot-error/grub-unknown-filesystem.png" alt-text="Screenshot of grub unknown file system error.":::
141
+
142
+
This error might be associated with one of the following issues:
143
+
144
+
*`/boot` file system corruption.
145
+
146
+
To resolve this issue, follow the steps in [Fix /boot file system corruption](#fix-boot-file-system-corruption).
147
+
148
+
* GRUB boot loader is pointing to an invalid disk or partition.
149
+
150
+
To resolve this issue, [reinstall GRUB and regenerate GRUB configuration file](#reinstall-grub-regenerate-grub-configuration-file).
151
+
152
+
* OS disk partition table issues caused by human error.
153
+
154
+
To resolve such issues, follow the steps in [Error: No such partition](#no-such-partition) with recommendations to re-create the `/boot` partition if missing or created incorrectly.
155
+
156
+
### <a id="fix-boot-file-system-corruption"></a>Fix /boot file system corruption
157
+
158
+
1. Check whether a rescue/repair VM was created. If it wasn't created, follow step 1 in [Troubleshoot GRUB rescue issue offline](#offline-troubleshooting) to create the VM.
159
+
160
+
2. Refer to [Troubleshoot file system corruption errors in Azure Linux](linux-recovery-cannot-start-file-system-errors.md) to resolve the corruption issues in the corresponding `/boot` partition.
161
+
162
+
3. Go to step 3 in [Troubleshoot GRUB rescue issue offline](#offline-troubleshooting) to swap the OS disk.
163
+
141
164
## <a id="error15"></a>Error 15: File not found
142
165
143
166
The following screenshot shows the error message:
@@ -146,13 +169,13 @@ The following screenshot shows the error message:
146
169
147
170
To resolve this issue, follow these steps:
148
171
149
-
1. Check whether a rescue/repair VM was created. If it wasn't created, follow step 1 in [Troubleshoot GRUB rescue issue offline](#offline-troubleshooting) to create the VM. Mount all the required file systems, including / and */boot* in the rescue/repair VM, and then enter the [chroot](chroot-environment-linux.md) environment.
172
+
1. Check whether a rescue/repair VM was created. If it wasn't created, follow step 1 in [Troubleshoot GRUB rescue issue offline](#offline-troubleshooting) to create the VM. Mount all the required file systems, including `/` and `/boot` in the rescue/repair VM, and then enter the [chroot](chroot-environment-linux.md) environment.
150
173
151
-
2. Inspect the /boot file system contents and determine what's missing.
174
+
2. Inspect the `/boot` file system contents and determine what's missing.
152
175
153
176
3. If the GRUB configuration file is missing, [reinstall GRUB and regenerate GRUB configuration file](#reinstall-grub-regenerate-grub-configuration-file).
154
177
155
-
4. Verify that the file permissions in the /boot file system are OK. You can compare the permissions by using another VM that's running the same Linux version.
178
+
4. Verify that the file permissions in the `/boot` file system are OK. You can compare the permissions by using another VM that's running the same Linux version.
156
179
157
180
5. If the entire /boot partition or other important contents are missing and can't be recovered, we recommend restoring the VM from a backup. For more information, see [How to restore Azure VM data in Azure portal](/azure/backup/backup-azure-arm-restore-vms).
158
181
@@ -166,9 +189,9 @@ The following screenshot shows the error message:
166
189
167
190
1. Check whether a rescue/repair VM was created. If it wasn't created, follow step 1 in [Troubleshoot GRUB rescue issue offline](#offline-troubleshooting) to create one. Mount all the required file systems, including / and /boot in the rescue/repair VM, and then enter the [chroot](chroot-environment-linux.md) environment.
168
191
169
-
2. If you're unable to mount the /boot file system due to a corruption error, [fix /boot file system corruption](#fix-boot-file-system-corruption).
192
+
2. If you're unable to mount the `/boot` file system due to a corruption error, [fix /boot file system corruption](#fix-boot-file-system-corruption).
170
193
171
-
3. When you're located inside chroot, verify the contents in the */boot/grub2/i386-pc* directory. If the contents are missing, copy the contents from */usr/lib/grub/i386-pc*. To do this, use the following commands:
194
+
3. When you're located inside chroot, verify the contents in the `/boot/grub2/i386-pc` directory. If the contents are missing, copy the contents from `/usr/lib/grub/i386-pc`. To do this, use the following commands:
172
195
173
196
```bash
174
197
ls -l /boot/grub2/i386-pc
@@ -194,7 +217,7 @@ The following screenshot shows the error message:
194
217
```bash
195
218
yum reinstall $(rpm -qa | grep -i kernel)
196
219
```
197
-
4. Create the *grub.cfg* file:
220
+
4. Create the `grub.cfg` file:
198
221
199
222
```bash
200
223
grub2-mkconfig -o /boot/grub2/grub.cfg
@@ -211,12 +234,12 @@ The following screenshot shows the error message:
211
234
212
235
This error occurs on a RHEL-based VM (Red Hat, Oracle Linux, CentOS) in one of the following scenarios:
213
236
214
-
* The /boot partition is deleted by mistake.
215
-
* The /boot partition is re-created by using the wrong start and end sectors.
237
+
* The `/boot` partition is deleted by mistake.
238
+
* The `/boot` partition is re-created by using the wrong start and end sectors.
216
239
217
240
### Solution: Re-create /boot partition
218
241
219
-
If the /boot partition is missing, re-create it by following these steps:
242
+
If the `/boot` partition is missing, re-create it by following these steps:
220
243
221
244
1. Check whether a rescue/repair VM was created. If it wasn't created, follow step 1 in [Troubleshoot GRUB rescue issue offline](#offline-troubleshooting) to create the VM.
222
245
@@ -242,7 +265,7 @@ If the /boot partition is missing, re-create it by following these steps:
242
265
243
266
#### <a id="re-create-boot-partition-in-dos-systems"></a>Re-create /boot partition in dos systems
244
267
245
-
1. Re-create the /boot partition by using the following command:
268
+
1. Re-create the /boot partition from a rescue/repair VM by using the following command:
246
269
247
270
```bash
248
271
sudo fdisk /dev/sdX
@@ -300,7 +323,7 @@ If the /boot partition is missing, re-create it by following these steps:
300
323
Calling ioctl() to re-read partition table.
301
324
```
302
325
303
-
2. After you re-create the missing /boot partition, check whether the /boot file system is detected. You should be able to see an entry for`/dev/sdX1` (the missing /boot partition).
326
+
2. After you re-create the missing `/boot` partition, check whether the `/boot` file system is detected. You should be able to see an entry for `/dev/sdX1` (the missing /boot partition).
304
327
305
328
```bash
306
329
sudo blkid /dev/sdX1
@@ -311,11 +334,11 @@ If the /boot partition is missing, re-create it by following these steps:
311
334
/dev/sdc1: UUID="<UUID>" TYPE="ext4"
312
335
```
313
336
314
-
3. If the /boot file system isn't visible in `blkid` after you re-create the partition, this means that the /boot data no longer exists. You have to re-create the /boot file system (by using the same UUID and file system format that's in the */etc/fstab* /boot entry), and then [restore its contents from a backup](/azure/backup/backup-azure-arm-restore-vms).
337
+
3. If the `/boot` file system isn't visible in`blkid` after you re-create the partition, this means that the /boot data no longer exists. You have to re-create the /boot file system (by using the same UUID and file system format that's in the `/etc/fstab` /boot entry), and then [restore its contents from a backup](/azure/backup/backup-azure-arm-restore-vms).
315
338
316
339
#### <a id="re-create-boot-partition-in-gpt-systems"></a>Re-create /boot partition in GPT systems
317
340
318
-
1. Re-create the /boot partition by using the following command:
341
+
1. Re-create the /boot partition by using the following command, from a rescue/repair VM:
319
342
320
343
```bash
321
344
sudo gdisk /dev/sdX
@@ -379,22 +402,22 @@ If the /boot partition is missing, re-create it by following these steps:
379
402
sudo blkid /dev/sdX1
380
403
```
381
404
382
-
You should be able to see an entry for`/dev/sdX1` (the missing /boot partition).
405
+
You should be able to see an entry for `/dev/sdX1` (the missing `/boot` partition).
3. If the /boot file system isn't visible after you re-create the partition, this means that the /boot data no longer exists. You have to re-create the /boot file system (by using the same UUID that's in the */etc/fstab*/boot entry), and then [restore its contents from a backup](/azure/backup/backup-azure-arm-restore-vms).
412
+
3. If the /boot file system isn't visible after you re-create the partition, this means that the /boot data no longer exists. You have to re-create the /boot file system (by using the same UUID that's in the `/etc/fstab` `/boot` entry), and then [restore its contents from a backup](/azure/backup/backup-azure-arm-restore-vms).
390
413
391
414
## <a id="grub_efi_get_secure_boot"></a>Error: symbol 'grub_efi_get_secure_boot' not found
392
415
393
416
The following screenshot shows the error message:
394
417
395
418
:::image type="content" source="./media/troubleshoot-vm-boot-error/grub-efi-get-secure-boot-not-found.jpg" alt-text="Screenshot of grub error 'grub_efi_get_secure_boot' not found.":::
396
419
397
-
Linux kernel version 4.12.14(that's used in SLES 12 SP5) doesn't support the [Secure Boot](/windows-hardware/design/device-experiences/oem-secure-boot) option. Therefore, if secure boot is enabled during the deployment of the VM (that is, the **Security type** field is set to [Trusted launch virtual machines](/azure/virtual-machines/trusted-launch)), the virtual machine generates the secure boot error through the console when you try to start by using this SUSE kernel version on a Gen2 VM image.
420
+
Linux kernel version `4.12.14`(that's used in SLES 12 SP5) doesn't support the [Secure Boot](/windows-hardware/design/device-experiences/oem-secure-boot) option. Therefore, if secure boot is enabled during the deployment of the VM (that is, the **Security type** field is set to [Trusted launch virtual machines](/azure/virtual-machines/trusted-launch)), the virtual machine generates the secure boot error through the console when you try to start by using this SUSE kernel version on a Gen2 VM image.
398
421
399
422
### Solution
400
423
@@ -428,9 +451,9 @@ This kind of error is triggered in one of the following scenarios:
428
451
429
452
To resolve this error, follow these steps:
430
453
431
-
1. Check whether a rescue/repair VM was created. If it wasn't created, follow step 1 in [Troubleshoot GRUB rescue issue offline](#offline-troubleshooting) to create the VM. Mount all the required file systems, including / and /boot, and then enter the [chroot](chroot-environment-linux.md) environment.
454
+
1. Check whether a rescue/repair VM was created. If it wasn't created, follow step 1 in [Troubleshoot GRUB rescue issue offline](#offline-troubleshooting) to create the VM. Mount all the required file systems, including `/` and `/boot`, and then enter the [chroot](chroot-environment-linux.md) environment.
432
455
433
-
2. Make sure that the */etc/default/grub* configuration file is configured. The [endorsed Azure Linux images](/azure/virtual-machines/linux/endorsed-distros) already have the required configurations. For more information, see the following articles:
456
+
2. Make sure that the `/etc/default/grub` configuration file is configured. The [endorsed Azure Linux images](/azure/virtual-machines/linux/endorsed-distros) already have the required configurations. For more information, see the following articles:
434
457
435
458
* [GRUB access in RHEL](serial-console-grub-single-user-mode.md#grub-access-in-rhel)
436
459
* [GRUB access in CentOS](serial-console-grub-single-user-mode.md#grub-access-in-centos)
@@ -441,9 +464,9 @@ To resolve this error, follow these steps:
441
464
3. [Reinstall GRUB and regenerate GRUB configuration file](#reinstall-grub-regenerate-grub-configuration-file).
442
465
443
466
> [!NOTE]
444
-
> If the missing file is */boot/grub/menu.lst*, this error is forolder OS versions (RHEL 6.x, Centos 6.x and Ubuntu 14.04). The commands will differ because GRUB version 1 is usedin those systems instead. GRUB version 1 isn't covered in this article.
467
+
> If the missing file is `/boot/grub/menu.lst`, this error is for older OS versions (RHEL 6.x, Centos 6.x and Ubuntu 14.04). The commands will differ because GRUB version 1 is used in those systems instead. GRUB version 1 isn't covered in this article.
445
468
446
-
4. If the entire /boot partition is missing, follow the steps in [Error: no such partition](#no-such-partition).
469
+
4. If the entire `/boot` partition is missing, follow the steps in [Error: no such partition](#no-such-partition).
447
470
448
471
5. After the issue is resolved, go to step 3 in [Troubleshoot GRUB rescue issue offline](#offline-troubleshooting) to swap the OS disk.
0 commit comments