Stop your KVM guests from stealing your host entropy

Virtualization (KVM/QEMU/Libvirt)

Stop your KVM guests from stealing your host entropy

Technical Briefing | 11/25/2026

You probably noticed your production web server feeling sluggish during high load, but the host CPU usage is fine and I/O wait is low. It usually comes down to entropy. Your guest VMs are starving for random numbers, and by default, they might be aggressively draining the host’s entropy pool, which stalls everything waiting on /dev/random.

The virtio-rng fix nobody talks about

Most default VM templates don’t include a hardware random number generator. Instead, they try to pull randomness from the host, which is a recipe for contention. Adding a virtio-rng device passes the host’s entropy pool to the guest cleanly, or better yet, lets you map the host’s hardware RNG directly to the guest. It’s the difference between a system that waits for interrupts and one that just works.

virsh edit my-vm-name
<rng model='virtio'>
<backend model='random'>/dev/urandom</backend>
</rng>

  • Check your host entropy level with cat /proc/sys/kernel/random/entropy_avail before adding this
  • Always use /dev/urandom for the backend unless you have a specific requirement for blocking randomness
  • Verify the device shows up inside the guest with lsmod | grep virtio_rng

If you have a massive number of VMs, mapping them all to /dev/random will choke your host kernel instantly. Stick to /dev/urandom, which is perfectly safe for almost every cryptographic application you’ll run in a container or VM. Once you make this change, you’ll see those weird, sporadic latency spikes in your application logs simply vanish.

Linux Admin Automation  |  © www.ngelinux.com  |  11/25/2026

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted