|
| 1 | +--- |
| 2 | +title: Recover Azure Linux VM from kernel panic due to missing initramfs |
| 3 | +description: Provides solutions to an issue in which a Linux virtual machine (VM) can't boot after applying kernel changes. |
| 4 | +author: divargas-msft |
| 5 | +ms.author: divargas |
| 6 | +ms.date: 02/25/2025 |
| 7 | +ms.reviewer: jofrance |
| 8 | +ms.service: azure-virtual-machines |
| 9 | +ms.custom: sap:Cannot start or stop my VM, devx-track-azurecli, mode-api, innovation-engine, linux-related-content |
| 10 | +ms.workload: infrastructure-services |
| 11 | +ms.tgt_pltfrm: vm-linux |
| 12 | +ms.collection: linux |
| 13 | +ms.topic: troubleshooting |
| 14 | +--- |
| 15 | + |
| 16 | +# Azure Linux virtual machine fails to boot after applying kernel changes |
| 17 | + |
| 18 | +**Applies to:** :heavy_check_mark: Linux VMs |
| 19 | + |
| 20 | +<!-- Commenting out these entries as this information should be selected by the user along with the corresponding subscription and region |
| 21 | +
|
| 22 | +The First step in this tutorial is to define environment variables, and install the corresponding package, if necessary. |
| 23 | +
|
| 24 | +```azurecli-interactive |
| 25 | +export MY_RESOURCE_GROUP_NAME="myVMResourceGroup89f292" |
| 26 | +export MY_VM_NAME="myVM89f292" |
| 27 | +``` |
| 28 | +--> |
| 29 | + |
| 30 | + |
| 31 | +## Prerequisites |
| 32 | + |
| 33 | +Make sure the [serial console](serial-console-linux.md) is enabled and functional in the Linux VM. |
| 34 | + |
| 35 | +## <a id="missing-initramfs"></a>Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0) |
| 36 | + |
| 37 | +This error occurs because of a recent system update (kernel). It's most commonly seen in RHEL-based distributions. |
| 38 | +You can [identify this issue from the Azure serial console](#identify-kernel-boot-issue). You'll see any of the following error messages: |
| 39 | + |
| 40 | +1. "Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)" |
| 41 | + |
| 42 | + ```output |
| 43 | + [ 301.026129] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0) |
| 44 | + [ 301.027122] CPU: 0 PID: 1 Comm: swapper/0 Tainted: G ------------ T 3.10.0-1160.36.2.el7.x86_64 #1 |
| 45 | + [ 301.027122] Hardware name: Microsoft Corporation Virtual Machine/Virtual Machine, BIOS 090008 12/07/2018 |
| 46 | + [ 301.027122] Call Trace: |
| 47 | + [ 301.027122] [<ffffffff82383559>] dump_stack+0x19/0x1b |
| 48 | + [ 301.027122] [<ffffffff8237d261>] panic+0xe8/0x21f |
| 49 | + [ 301.027122] [<ffffffff8298b794>] mount_block_root+0x291/0x2a0 |
| 50 | + [ 301.027122] [<ffffffff8298b7f6>] mount_root+0x53/0x56 |
| 51 | + [ 301.027122] [<ffffffff8298b935>] prepare_namespace+0x13c/0x174 |
| 52 | + [ 301.027122] [<ffffffff8298b412>] kernel_init_freeable+0x222/0x249 |
| 53 | + [ 301.027122] [<ffffffff8298ab28>] ? initcall_blcklist+0xb0/0xb0 |
| 54 | + [ 301.027122] [<ffffffff82372350>] ? rest_init+0x80/0x80 |
| 55 | + [ 301.027122] [<ffffffff8237235e>] kernel_init+0xe/0x100 |
| 56 | + [ 301.027122] [<ffffffff82395df7>] ret_from_fork_nospec_begin+0x21/0x21 |
| 57 | + [ 301.027122] [<ffffffff82372350>] ? rest_init+0x80/0x80 |
| 58 | + [ 301.027122] Kernel Offset: 0xc00000 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffffbfffffff) |
| 59 | + ``` |
| 60 | +
|
| 61 | +2. "error: file '/initramfs-*.img' not found" |
| 62 | +
|
| 63 | + > error: file '/initramfs-3.10.0-1160.36.2.el7.x86_64.img' not found. |
| 64 | +
|
| 65 | +This kind of error indicates that the initramfs file isn't generated, the GRUB configuration file has the initrd entry missing after a patching process, or a GRUB manual misconfiguration. |
| 66 | +
|
| 67 | +### <a id="missing-initramfs-alar"></a>Regenerate missing initramfs by using Azure Repair VM ALAR scripts |
| 68 | +
|
| 69 | +1. Create a repair VM by running the following Bash command line with [Azure Cloud Shell](/azure/cloud-shell/overview). For more information, see [Use Azure Linux Auto Repair (ALAR) to fix a Linux VM - initrd option](repair-linux-vm-using-ALAR.md#initrd). This command will regenerate the initrd/initramfs image, regenerate the GRUB configuration file if it has the initrd entry missing, and swap the OS disk |
| 70 | +
|
| 71 | +```azurecli-interactive |
| 72 | +output=$(az extension add -n vm-repair; az extension update -n vm-repair; az vm repair repair-button --button-command 'initrd' --verbose --resource-group $MY_RESOURCE_GROUP_NAME --name $MY_VM_NAME) |
| 73 | +value=$(echo "$output" | jq -r '.message') |
| 74 | +extracted=$(echo $value) |
| 75 | +echo "$extracted" |
| 76 | +``` |
| 77 | + |
| 78 | +2. Once the repair VM command has been executed, restart the original VM and validate that it's able to boot up. |
| 79 | + |
| 80 | +## Next steps |
| 81 | + |
| 82 | +If the specific boot error isn't a kernel related boot issue, see [Troubleshoot Azure Linux Virtual Machines boot errors](./boot-error-troubleshoot-linux.md) for further troubleshooting options. |
| 83 | + |
| 84 | +[!INCLUDE [Azure Help Support](../../../includes/azure-help-support.md)] |
0 commit comments