Some checks failed
Test / test (push) Has been cancelled
Co-authored-by: Cursor <cursoragent@cursor.com>
4.7 KiB
4.7 KiB
QEMU Guest Agent Setup Guide
Overview
QEMU Guest Agent provides better integration between Proxmox and VMs, enabling:
- Proper VM shutdown/reboot from Proxmox Web UI
- Automatic IP address detection in Proxmox
- Better VM status reporting (CPU, memory, disk usage)
- File system information and operations
- Time synchronization between host and guest
Prerequisites
- VMs must have Ubuntu installed and be reachable via SSH
- SSH key access configured
- VMs must be running
Quick Setup
Automated Setup (Recommended)
# Set SSH key (if different from default)
export SSH_KEY="~/.ssh/id_rsa"
export SSH_USER="ubuntu"
# Run setup script
./scripts/setup-guest-agent.sh
This script will:
- Install
qemu-guest-agenton each VM - Enable and start the service
- Enable agent in Proxmox VM configuration
- Verify agent is working
Manual Setup
Step 1: Install Guest Agent on VM
SSH to each VM and run:
sudo apt-get update
sudo apt-get install -y qemu-guest-agent
sudo systemctl enable qemu-guest-agent
sudo systemctl start qemu-guest-agent
sudo systemctl status qemu-guest-agent
Step 2: Enable Agent in Proxmox
For each VM in Proxmox Web UI:
- Stop the VM (if running)
- Go to: VM → Options tab
- Find: "QEMU Guest Agent"
- Click: "Edit"
- Enable: Check "Use QEMU Guest Agent"
- Click: "OK"
- Start the VM
Step 3: Verify Agent is Working
In Proxmox Web UI:
- Go to: VM → Monitor tab
- Look for: "QEMU Guest Agent" section
- Check: Agent status should show as active
Or via command line:
# Check agent status via Proxmox API
curl -k -s -H "Cookie: PVEAuthCookie=<ticket>" \
"https://192.168.1.206:8006/api2/json/nodes/pve/qemu/100/agent/get-fsinfo"
Troubleshooting
Agent Not Responding
Symptoms:
- Proxmox shows "Guest Agent not running"
- Cannot get VM IP address
- Cannot shutdown VM from Proxmox
Solution:
-
Check agent is installed:
ssh ubuntu@<VM_IP> sudo systemctl status qemu-guest-agent -
Restart agent:
sudo systemctl restart qemu-guest-agent -
Check logs:
sudo journalctl -u qemu-guest-agent -f -
Reinstall agent:
sudo apt-get install --reinstall qemu-guest-agent sudo systemctl restart qemu-guest-agent -
Use fix script:
./scripts/fix-guest-agent.sh
Agent Not Enabled in Proxmox
Symptoms:
- Agent installed on VM but not working
- Proxmox doesn't detect agent
Solution:
- Stop VM
- Enable agent in Proxmox:
- Options → QEMU Guest Agent → Enable
- Start VM
- Wait 1-2 minutes for agent to initialize
Agent Takes Time to Initialize
Note: After enabling the agent, it may take 1-2 minutes to fully initialize and start responding to Proxmox queries. This is normal.
Check status:
# On VM
sudo systemctl status qemu-guest-agent
# Should show: Active: active (running)
Verification
Check Agent Status on VM
ssh ubuntu@<VM_IP>
sudo systemctl status qemu-guest-agent
Expected output:
● qemu-guest-agent.service - QEMU Guest Agent
Loaded: loaded (/lib/systemd/system/qemu-guest-agent.service; enabled)
Active: active (running) since ...
Check Agent in Proxmox
Web UI:
- VM → Monitor → QEMU Guest Agent
- Should show agent information
API:
# Get filesystem info (requires authentication)
curl -k -s -H "Cookie: PVEAuthCookie=<ticket>" \
"https://192.168.1.206:8006/api2/json/nodes/pve/qemu/100/agent/get-fsinfo"
Benefits After Setup
Once guest agent is working:
-
VM Shutdown/Reboot:
- Can properly shutdown/reboot VMs from Proxmox
- No need to force stop
-
IP Address Detection:
- Proxmox automatically detects VM IP addresses
- Shows in VM summary
-
Resource Monitoring:
- Better CPU, memory, disk usage reporting
- More accurate VM statistics
-
File Operations:
- Can execute commands in VM from Proxmox
- File system information available
Scripts Reference
scripts/setup-guest-agent.sh- Install and configure guest agentscripts/fix-guest-agent.sh- Fix guest agent issues
When to Run
Run guest agent setup after:
- ✅ Ubuntu installation is complete on all VMs
- ✅ VMs are reachable via SSH
- ✅ Install scripts have been applied (optional, can run before)
Summary
- Install agent:
./scripts/setup-guest-agent.sh - Verify: Check Proxmox Web UI → VM → Monitor
- Fix if needed:
./scripts/fix-guest-agent.sh
Guest agent setup should be done after all VMs are installed and configured, as it requires SSH access to the VMs.