Azure VM won’t boot: Boot diagnostics and Serial Console
-
Phase 0: Before you start
-
Phase 1: The foundation
-
Phase 2: Day-to-day operations
-
Phase 3: Enterprise architecture
-
Phase 4: Troubleshooting step by step
-
Phase 5: Final project and career
When an Azure VM won’t boot, SSH and RDP don’t connect, Run Command doesn’t work, and the portal happily says “Running”. Azure Serial Console and boot diagnostics let you see what the VM is doing right then: the boot messages, the error, and a text console that works even with no networking.
Here you’ll deal with the most common Linux boot failure in Azure, an /etc/fstab entry for a disk that’s no longer there. You’ll spot it in the boot log, try the Serial Console, run into the locked root account, and then fix the disk with Azure’s repair tooling.
Windows works the same way. Boot diagnostics gives you the screenshot (a blue screen, or “Applying updates” stuck at 30 percent), and a repair VM lets you fix the disk offline.
| Time | You need | Cost | By the end you can |
|---|---|---|---|
| About 60 minutes | A free account, the CLI and PowerShell | Around 10 US cents: one small VM, a 4 GiB data disk and a temporary repair VM for less than an hour | Read boot diagnostics, use the Serial Console, and repair an unbootable Linux VM with az vm repair |
What it is, in one line
Azure Serial Console gives you a text console to your VM through Azure itself, so you can see and fix boot problems even when the network isn’t there.
In Simple Words
The car that won’t start
Your car won’t start, so you can’t drive it to the garage. Instead the mechanic plugs a cable into the dashboard port and reads the error codes, and that’s what boot diagnostics and the Serial Console do for a VM.
Sometimes the engine has to come out. The mechanic tows the car to the workshop, lifts the engine onto a bench, fixes it and puts it back in. A repair VM works like that: Azure copies your broken disk and attaches it to a healthy VM, you fix it there, and then it’s swapped back.
If someone had taped over the dashboard port, the mechanic couldn’t read anything at all, which is what it’s like when boot diagnostics is turned off.
Engineer's View
Your tools for a VM that won’t boot
- Boot diagnostics: records the serial log (Linux) and a screenshot (Windows and Linux). Managed storage is the simplest option. The Serial Console won’t work unless this is on.
- Serial Console: an interactive text console over the VM’s serial port, either in the portal or with az serial-console connect. You need a password-based account in the guest and Contributor rights on the VM.
- VM agent status: when the guest gets stuck before the agent starts, the instance view shows the agent as Not Ready, and Run Command and extensions are no use.
- Emergency mode: systemd waits 90 seconds for a missing fstab device and then drops into emergency mode. Root is locked on Azure Ubuntu images, so you can’t open the emergency shell.
- az vm repair: builds a repair VM, attaches a copy of the OS disk, runs fixes (including Azure Linux Auto Repair, ALAR, which has actions like fstab) and then swaps the fixed copy back in.
- Prevention: for every data disk in /etc/fstab, use UUIDs and the nofail option.
How it works, step by step
Here’s what happens when a VM boots with a bad fstab entry:
- The kernel comes up and systemd reads /etc/fstab.
- It sets up a mount job for /data and waits for the device with that UUID.
- Since the disk was detached, the device job times out after 90 seconds and “Dependency failed for /data” goes into the log.
- The entry has no nofail, so systemd treats it as essential and goes into emergency mode, and networking and the VM agent never start.
- The only window into what happened is the serial log that boot diagnostics captured.
From outside, the portal shows the VM as “Running”, which is why people burn time on NSGs and SSH keys.
The quickest giveaway is a VM agent that’s Not Ready plus a boot log ending in emergency mode. That’s a guest boot problem, not a network one.
Boot diagnostics, the Serial Console and a data disk
Before you run any command, double-check it
Read every command twice before you press Enter. Check the target: the system or account, the IDs, the names and the sizes. These commands are for learning and were tested in our lab, not on your system. At work, run the read-only list commands first, follow your change process, make sure a backup exists, and ask a second person to check anything that changes or deletes data. You run them at your own risk.
1A VM with boot diagnostics and a password for the console
Create the VM, switch on boot diagnostics with managed storage, and give azureuser a password so you can log in on the Serial Console:
$pw = 'Sv-' + (-join ((65..90) + (97..122) + (48..57) | Get-Random -Count 14 | ForEach-Object { [char]$_ })) + '9!'
az group create --name rg-saat-l60 --location centralindia --tags course=saatvedha-azure lesson=60 -o none
az vm create --resource-group rg-saat-l60 --name vm-boot --image Canonical:ubuntu-24_04-lts:server:latest --size Standard_B1s --public-ip-sku Standard --nsg-rule NONE --admin-username azureuser --generate-ssh-keys --tags course=saatvedha-azure lesson=60 -o none
az vm boot-diagnostics enable --resource-group rg-saat-l60 --name vm-boot -o none
az vm user update --resource-group rg-saat-l60 --name vm-boot --username azureuser --password $pw -o noneKeep $pw in this PowerShell window because you’ll need it at the console. In production, a break-glass password like this belongs in Key Vault.
2Add a data disk mounted through fstab
Attach a 4 GiB disk, then save this script as C:\azure-lab\boot\add-disk.sh and run it:
az vm disk attach --resource-group rg-saat-l60 --vm-name vm-boot --name data1 --new --size-gb 4 --lun 0 -o none#!/bin/bash
# Format the data disk at LUN 0 and mount it on /data through /etc/fstab
mkfs.ext4 -q /dev/disk/azure/scsi1/lun0
mkdir -p /data
UUID=$(blkid -s UUID -o value /dev/disk/azure/scsi1/lun0)
echo "UUID=$UUID /data ext4 defaults 0 2" >> /etc/fstab
mount -a
tail -1 /etc/fstab
df -h /data | tail -1az vm run-command invoke --resource-group rg-saat-l60 --name vm-boot --command-id RunShellScript --scripts '@C:\azure-lab\boot\add-disk.sh' --query "value[0].message" -o tsvYou should see something like this:
[stdout]
UUID=3f1c2a9e-5b7d-4c11-9e2f-8a6d4b0c7e15 /data ext4 defaults 0 2
/dev/sdc 3.9G 24K 3.7G 1% /dataLook at the entry: defaults and no nofail, which is how a lot of guides still write it.
3Read a healthy boot and open the Serial Console
Check the agent and the tail of the boot log, then connect to the console:
az vm get-instance-view --resource-group rg-saat-l60 --name vm-boot --query "instanceView.vmAgent.statuses[0].displayStatus" -o tsv
az vm boot-diagnostics get-boot-log --resource-group rg-saat-l60 --name vm-boot | Select-Object -Last 3
az serial-console connect --resource-group rg-saat-l60 --name vm-bootThe agent shows Ready. Press Enter in the console and you should see something like this:
Ubuntu 24.04.1 LTS vm-boot ttyS0
vm-boot login:Log in as azureuser with $pw, run uptime, and then exit with Ctrl+] followed by q.


✅ Checkpoint: vm-boot has boot diagnostics on and a data disk on /data, and you can log in through the Serial Console.
Break It, Then Fix It
Break 1 is short; break 2 is the real incident.
1Break it: no boot diagnostics when you need it
A hardening script switches boot diagnostics off “to save storage”, and then someone tries the console:
az vm boot-diagnostics disable --resource-group rg-saat-l60 --name vm-boot -o none
az serial-console connect --resource-group rg-saat-l60 --name vm-bootThe CLI stops with an error telling you the Serial Console needs boot diagnostics turned on.
The exact wording varies between CLI versions, but the point doesn’t change: with boot diagnostics off, you can’t see anything at the moment you most need to. That’s the reason Azure Policy ships built-in definitions that require it.
To fix it, turn it back on with managed storage:
az vm boot-diagnostics enable --resource-group rg-saat-l60 --name vm-boot -o none2Break it: the disk is gone, the VM won’t boot
The data disk gets detached so it can move to another VM, and the VM is restarted. Wait 3 minutes after the restart and then take a look:
az vm disk detach --resource-group rg-saat-l60 --vm-name vm-boot --name data1 -o none
az vm restart --resource-group rg-saat-l60 --name vm-boot -o none
az vm get-instance-view --resource-group rg-saat-l60 --name vm-boot --query "instanceView.vmAgent.statuses[0].displayStatus" -o tsv
az vm boot-diagnostics get-boot-log --resource-group rg-saat-l60 --name vm-boot | Select-String -Pattern 'emergency|Dependency failed|Timed out|root account' | Select-Object -Last 4You should see something like this:
Not Ready
[ TIME ] Timed out waiting for device dev-disk-by\x2duuid-3f1c2a9e....device - /dev/disk/by-uuid/3f1c2a9e-5b7d-4c11-9e2f-8a6d4b0c7e15.
[DEPEND] Dependency failed for data.mount - /data.
You are in emergency mode. After logging in, type "journalctl -xb" to view system logs,
Cannot open access to console, the root account is locked.The agent is Not Ready, so Run Command is out. The boot log spells out the problem: the device for /data is missing and the system is sitting in emergency mode. The console can’t save you either, because emergency mode asks for the root password and root is locked on Azure Ubuntu images.
To fix it, repair the OS disk on a repair VM using Azure Linux Auto Repair (around 15 minutes end to end):
az vm repair create --resource-group rg-saat-l60 --name vm-boot --repair-username repairadmin --repair-password $pw --verbose
az vm repair run --resource-group rg-saat-l60 --name vm-boot --run-id linux-alar2 --parameters fstab --run-on-repair --verbose
az vm repair restore --resource-group rg-saat-l60 --name vm-boot --verboseThen check the VM:
az vm get-instance-view --resource-group rg-saat-l60 --name vm-boot --query "instanceView.vmAgent.statuses[0].displayStatus" -o tsv
az vm run-command invoke --resource-group rg-saat-l60 --name vm-boot --command-id RunShellScript --scripts 'grep data /etc/fstab; ls /etc/fstab*' --query "value[0].message" -o tsvYou should see something like this:
Ready
[stdout]
UUID=3f1c2a9e-5b7d-4c11-9e2f-8a6d4b0c7e15 /data ext4 defaults,nofail 0 2
/etc/fstab /etc/fstab.copyALAR made a copy of the original file and added nofail, so a missing data disk won’t block boot any more. The VM is back, the agent is Ready, and you can reattach the disk whenever you like.

3Clean up
The repair tooling keeps the original OS disk in case you need it. Deleting the resource group removes everything:
az group delete --name rg-saat-l60 --yes
az group list --query "[?starts_with(name, 'repair-')].name" -o tsvThe second command shouldn’t print anything, and if a repair group is still hanging around, delete that too.
✅ Checkpoint: You turned boot diagnostics back on, read an emergency-mode boot log and repaired a VM that wouldn’t boot, all without SSH, Run Command or root.
This happened at work
The patch night that took down 40 Linux servers
It was a Saturday night patch window at a retailer, and 40 Linux VMs were patched and rebooted. Twelve of them didn’t come back: SSH timed out, Run Command hung, and the team, sure it was a network change, spent an hour going through NSGs.
The cause went back months. A migration had moved some data disks between servers, but the /etc/fstab entries stayed behind, and nobody noticed because those servers hadn’t rebooted since. The patch reboot hit the missing disks and every one of them stopped in emergency mode, and with boot diagnostics off on half of them, the team couldn’t even see the message at first.
What they changed: Azure Policy now requires boot diagnostics with managed storage, every image writes fstab entries with nofail, and a pre-patch script checks that each fstab device exists. The runbook for “VM not reachable after reboot” starts with the agent status and the boot log, and the NSG comes later.
Common mistakes and troubleshooting
| Mistake | What you see | What to do |
|---|---|---|
| fstab entry without nofail | Emergency mode when the disk is missing | Use UUID and nofail for data disks. |
| Boot diagnostics off | No log or screenshot, no Serial Console | Turn on managed boot diagnostics everywhere. |
| No password-based user | Serial Console login impossible | Keep a break-glass account with its password in Key Vault. |
| Chasing NSGs for an unbootable VM | Time lost on the network | Look at VM agent status and the boot log first. |
| Expecting Run Command to fix boot issues | Command never runs | When the agent is Not Ready, use a repair VM. |
| Forgetting repair leftovers | Extra disks and groups billed | Delete the repair resources once you’ve restored. |
Interview questions
Click a question to open it. Each one is phrased the way an interviewer would ask it, and underneath you’ll find why they ask it and one way you could answer in your own words.
Fresher level
1. What is boot diagnostics?
Why they ask this: The basic concept.
How you might answer: It captures the VM’s serial log and a screenshot while it boots, so you can see boot errors without any network access.
2. What does the Serial Console need?
Why they ask this: A setup check.
How you might answer: Boot diagnostics switched on, a password-based account inside the guest, and Contributor-level rights on the VM.
3. Why can’t you SSH into a VM stuck in emergency mode?
Why they ask this: Basic reasoning.
How you might answer: Because networking and SSH never started. The boot stopped before it got to those services.
2–5 years experience
4. A Linux VM is “Running” but unreachable after a reboot. What do you check?
Why they ask this: A real troubleshooting path.
How you might answer: I’d look at the VM agent status in the instance view, then the boot log and screenshot, then the Serial Console. If it turns out to be a guest boot issue, I’d fix fstab, GRUB or the kernel from the console or on a repair VM.
5. How do you fix a VM when root is locked in emergency mode?
Why they ask this: A practical answer.
How you might answer: I’d run az vm repair to fix the OS disk on a repair VM (ALAR fstab, for example), or interrupt GRUB from the Serial Console to boot into a shell and fix the file there.
6. What would you check for a Windows VM stuck at boot?
Why they ask this: Windows parity.
How you might answer: I’d start with the boot diagnostics screenshot (the blue screen code or update progress), then use the Serial Console with SAC and CMD if they’re enabled, or a repair VM to run chkdsk, roll back updates or fix the BCD.
Senior level
7. How do you prevent boot failures across a fleet?
Why they ask this: They want prevention at scale.
How you might answer: A policy for boot diagnostics, image standards like nofail and UUIDs, checks before every reboot, patching in stages, and alerts when the VM agent goes Not Ready after maintenance.
8. When would you rebuild instead of repair?
Why they ask this: Senior judgement.
How you might answer: If the VM is stateless or built from code, I’d rebuild from the image because it’s quicker and safer. I’d repair when the disk holds state that’s hard to recreate.
9. How do you give support teams console access safely?
Why they ask this: Security thinking.
How you might answer: I’d use custom roles for Serial Console and just-in-time elevation, keep break-glass passwords in Key Vault and rotate them, and audit every console session.
Quick quiz
Q1. What must be on for the Serial Console to work?
- Bastion
- Boot diagnostics
- NSG flow logs
- Backup
Show answer
B — The console relies on boot diagnostics.
Q2. VM agent Not Ready and boot log shows emergency mode. Cause?
- NSG
- Guest boot failure
- DNS
- Quota
Show answer
B — The guest stopped during boot.
Q3. Which fstab option lets boot continue without a disk?
- defaults
- nofail
- noatime
- ro
Show answer
B — nofail makes the mount non-essential.
Q4. Which tool swaps a repaired OS disk back?
- az vm restart
- az vm repair restore
- az disk update
- az vm redeploy
Show answer
B — restore swaps the fixed copy back.
Q5. Why does emergency mode not help on Azure Ubuntu?
- No keyboard
- Root account is locked
- No disk
- No network
Show answer
B — Emergency mode needs root’s password.
Quick recap
You can now look inside a VM that won’t boot and fix it with no network access.
- Boot diagnostics and the Serial Console are how you see into a dead VM.
- An agent that’s Not Ready plus emergency mode points to a guest boot problem.
- Data disks in fstab need nofail.
- az vm repair fixes the OS disk on a separate repair VM.
- Keep boot diagnostics on everywhere and enforce it with policy.
Next lesson
Lesson 61: Can’t RDP or SSH to an Azure VM → You work through RDP and SSH failures in order: NSG, guest firewall, service, credentials, and reset tools.
Further reading: Azure Serial Console
Want to go deeper into Azure Serial Console? See Microsoft’s Azure Serial Console for Linux and Use Azure Linux Auto Repair (ALAR). You can also see the full plan for this course on the Azure Cloud Administration course page.
