# VM Boot Issue Fix

## Problem
All VMs were showing guest agent enabled in Proxmox configuration, but were stuck in a restart loop with "Nothing to boot" error. This occurred because the VM disks were created but were empty - no OS image was installed on them.

## Root Cause
The VMs were created with empty disks. The disk volumes existed (`vm-XXX-disk-0`) but contained no bootable OS, causing the VMs to fail to boot and restart continuously.

## Solution
Import the Ubuntu 22.04 cloud image into each VM's disk. The process involves:

1. **Stop the VM** (if running)
2. **Import the OS image** using `qm importdisk` which creates a new disk with the OS
3. **Copy the imported disk** to the main disk using `dd`
4. **Ensure boot order** is set to `scsi0`
5. **Start the VM**

## Script
A script has been created at `scripts/fix-all-vm-boot.sh` that automates this process for all VMs.

### Usage
```bash
./scripts/fix-all-vm-boot.sh
```

The script:
- Checks if each VM's disk already has data (skips if already fixed)
- Stops the VM if running
- Imports the Ubuntu 22.04 cloud image
- Copies the imported image to the main disk
- Sets boot order
- Starts the VM

## Manual Process (if needed)

For a single VM:

```bash
# 1. Stop VM
qm stop <vmid>

# 2. Import image (creates vm-XXX-disk-1)
qm importdisk <vmid> /var/lib/vz/template/iso/ubuntu-22.04-cloud.img local-lvm --format raw

# 3. Copy to main disk
dd if=/dev/pve/vm-<vmid>-disk-1 of=/dev/pve/vm-<vmid>-disk-0 bs=4M

# 4. Ensure boot order
qm set <vmid> --boot order=scsi0

# 5. Start VM
qm start <vmid>
```

## Status
- VM 136: Fixed and running
- Other VMs: Script in progress (can be run again to complete)

## Next Steps
1. Complete the boot fix for all VMs using the script
2. Wait for VMs to boot and complete cloud-init
3. Verify guest agent is running: `./scripts/verify-guest-agent-complete.sh`
4. Check VM IP addresses: `./scripts/check-all-vm-ips.sh`

## Notes
- The import process can take several minutes per VM
- The `dd` copy operation copies ~2.4GB of data
- VMs will need time to boot and complete cloud-init after the fix
- Guest agent service will start automatically via cloud-init

