[Bug 301156] bhyve: VM Generation ID is regenerated on every bhyve start, triggering AD virtualization safeguards on every boot of Windows domain controllers
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 26 Nov 2026 17:38:51 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=301156
Bug ID: 301156
Summary: bhyve: VM Generation ID is regenerated on every bhyve
start, triggering AD virtualization safeguards on
every boot of Windows domain controllers
Product: Base System
Version: 14.4-RELEASE
Hardware: amd64
OS: Any
Status: New
Severity: Affects Only Me
Priority: ---
Component: bhyve
Assignee: virtualization@FreeBSD.org
Reporter: m77@libero.it
bhyve(8) exposes a VM Generation Counter ACPI device (vmgenc.c,
Bhyve_V_Gen_Counter_V1),
but vmgenc_init() fills the GUID with getentropy() every time the bhyve process
starts:
/*
* It is basically harmless to always generate a random ID when
* starting a VM.
*/
error = getentropy(region, sizeof(struct uuid));
With vm-bhyve (and any wrapper that restarts bhyve on guest reboot) this means
a new Generation ID on every guest boot, including a plain reboot from inside
the guest.
This is not harmless for Windows Server domain controllers. Since Windows
Server 2012, AD DS stores the Generation ID (msDS-GenerationId) and treats a
change as a snapshot restore or clone, applying the "virtualization
safeguards":
- the database invocationID is reset (Directory Service event 1109),
- the current RID pool is discarded (SAM 16651, dcdiag RidManager failure),
- SYSVOL (DFSR) is reinitialized non-authoritatively and waits to replicate
from a partner (DFSR 4612, dfsrreplicatedfolderinfo State 2).
On bhyve this happens on every boot. The registry value
HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Parameters\DSA Previous Restore
Count
increments by one at each start, and events 2168/2170/1109 are logged each
time.
With two or more DCs that start at the same time (host reboot, power loss,
first boot
after a migration), every DC waits to sync SYSVOL from another DC that is
itself
waiting, and SYSVOL stays stuck: GPOs and logon scripts stop replicating until
a
manual authoritative SYSVOL restore is done.
Environment:
FreeBSD 14.4-RELEASE-p9 amd64, vm-bhyve 1.7.5, edk2-bhyve g202508 (UEFI)
Guest: Windows Server 2019 domain controller, migrated from VMware ESXi
vmgenc.c is unchanged in stable/14 and main.
How to reproduce:
1. Run a Windows Server 2012+ domain controller under bhyve with ACPI tables
(default).
2. Reboot the guest (or restart the bhyve process) a few times.
3. Check 'DSA Previous Restore Count' and the Directory Service log
(events 2168, 2170, 1109): the counter grows and the events repeat at
every boot.
Expected behaviour:
The Generation ID should stay constant across shutdown/restart/reboot and
change only when the VM is restored from a snapshot, cloned or imported, as
described by
Microsoft's Virtual Machine Generation ID specification and the UAPI VMGenID
spec, and as implemented by Hyper-V, VMware and QEMU/Proxmox (vmgenid=<guid>
stored in the VM configuration).
Current workaround (guest side):
On domain controllers only, disable the guest driver:
HKLM\SYSTEM\CurrentControlSet\Services\gencounter Start = 4 (was 3)
After the next boot the counter stops growing and events 2168/2170/1109 and new
DFSR 4612 no longer appear (tested over 3 reboots, each with a new bhyve
process).
The downside is that the DC loses its automatic rollback protection.
The only host-side switch is acpi_tables=false, which removes all ACPI tables
and is not usable for UEFI/Windows guests.
Suggested fix:
An optional configuration variable, e.g. vmgenc.guid=<uuid>: when set,
vmgenc_init() copies it into the region instead of calling getentropy(); when
unset, behaviour is unchanged. Management tools (vm-bhyve, etc.) can then
generate the GUID once at VM creation, keep it across restarts, and regenerate
it on clone or snapshot rollback, like QEMU's -device vmgenid,guid=...
Optionally, vmgenc.enable=false to omit only this device (vmgenc_init() and
vmgenc_write_dsdt()).
Open point: the byte order Windows expects for the 16 bytes. The 64-bit value
logged in Directory Service event 2168 matches the first 8 bytes read as
little-endian, which is also how msDS-GenerationId is stored.
This concern was already raised in a 2021 comment on the original review D23165
(Windows Server uses the VM-Generation-ID for USN rollback protection; Proxmox
stores
it in the VM configuration).
References:
https://reviews.freebsd.org/D23165
https://learn.microsoft.com/en-us/windows-server/identity/ad-ds/get-started/virtual-dc/virtualized-domain-controller-architecture
https://learn.microsoft.com/en-us/windows-server/identity/ad-ds/manage/virtual-dc/virtualized-domain-controller-troubleshooting
https://uapi-group.org/specifications/specs/vmgenid/
--
You are receiving this mail because:
You are the assignee for the bug.