Skip to content

virsh migrate: Unable to resolve address … service '49152'

Virtualizationtested on Ubuntu 24.04.5, QEMU 8.2.2, libvirt 10.0.0

Control runs over qemu+ssh, and SSH knows the name from ~/.ssh/config. But QEMU sends the memory directly over TCP to the target's hostname – and the system has to resolve that.

Symptom

error: Unable to resolve address 'kvm2' service '49152': Name or service not known

The message appears although ssh kvm2 hostname works.

Diagnosis

Check the SSH connection – it works through the entry in ~/.ssh/config.

ssh kvm2 hostname
kvm2

Causes

service '49152'Migration data does not go through SSH

During migration QEMU opens port 49152 and up on the target and sends the RAM straight there. That needs normal name resolution.

~/.ssh/configThe name only exists for SSH

A Host entry in ~/.ssh/config only applies to ssh, not to getaddrinfo in the rest of the system.

Fix

Add the names to /etc/hosts on both hosts, then migrate.
printf "172.16.0.182 kvm1\n172.16.0.123 kvm2\n" | sudo tee -a /etc/hosts
time virsh migrate --live --verbose wander qemu+ssh://kvm2/system
Migration: [ 3.05 %]Migration: [40.33 %]Migration: [100.00 %]

real	0m5.912s

Don't: Work around it with an IP in the qemu+ssh URL and leave name resolution broken – it bites again at the next migration.

▶
Break it yourself and find it – free
KVM hands-on, Day 12: live migration between two hosts with shared NFS storage.
Go to day 12 →

FAQ

How long does the migration take?

In the course six seconds for the whole migration, 186 milliseconds of downtime (virsh domjobinfo --completed).

Is the entry on the source host enough?

In the course the names go on both hosts so that migrating back works as well.

Related error patterns

More