Validation rules
vz checks a lab file in two stages before it creates anything. First it loads the file: YAML syntax, the known keys, and the type and format of each value. Then it validates the lab: names, ranges, references between sections, link ends, subnets, DHCP reservations, port forwarding, vmnet limits, and each node's platform. This page lists every problem each stage reports and how to fix it.
How problems are reported
vz validate # text
vz validate --json # a ValidationReport, see the CLI reference- Location. Each problem has a path into the file, such as
nodes[2].interfaces[1].attachorswitches.mgmt.ipv4Subnet. List positions start at 0. - Severity. An error stops
validate,upandnode resetwith exit code 1. A warning is printed but does not stop anything. - All at once. Validation collects every problem, so you see all of them in one run. Loading stops at the first problem, because the rest of the file cannot be read reliably after it. Fix load errors first.
- Output. One problem is printed as a single alert. Several are printed as a table with severity, location and message.
| Command | Loads | Validates |
|---|---|---|
validate | yes | yes, errors and warnings shown |
up, node reset | yes | yes; warnings shown, errors stop the command |
down, destroy, topology, node ..., link, port, media, usb | yes | no |
TIP
Run vz validate after every edit. It is fast, needs no running lab and changes nothing.
Load errors
These come from reading and decoding the file. The location is the key where decoding stopped.
| Message | Cause | Fix |
|---|---|---|
cannot read <path>: no such file | The lab file does not exist. | Run from the lab's folder or pass -f <file>. |
cannot read <path>: <reason> | The file exists but cannot be read. | Check permissions and encoding (UTF-8). |
YAML syntax error: ... | Malformed YAML. | Fix indentation, quotes or brackets at the line shown. |
missing required key '<key>' | A required key is absent. | Add it. Required: schemaVersion, name, nodes; per node name, disks; per share tag, path; per display width, height; per interface name; per USB device vendorId, productId; per reservation mac, ipv4; per forwarding rule protocol, hostPort, address, guestPort; per storage path. |
unknown key '<key>' (allowed: ...) | A key vz does not know, often a typo. | Use one of the allowed keys listed in the message. |
expected a string, expected true or false, expected a number, expected a list, expected a mapping | The value has the wrong type. | Write the value in the expected form. Quote MAC addresses. |
expected ..., found null | A key with no value (memory:). | Give it a value or remove the key. |
'<value>' is not an allowed value | An enum key such as bus, caching, sync, protocol or family has another value. | See the allowed values in the lab file reference. |
'<value>' is not a size; use a number with B, KiB, MiB, GiB or TiB, e.g. 2GiB | Bad size. | Use whole numbers and binary units, for example 512MiB. 2GB and 1.5GiB are not accepted. |
'<value>' is not a valid attach value, expected switch/<name> or link/<name> | Bad attach. | Use switch/<name> or link/<name>. |
'<value>' is not a MAC address, expected e.g. 52:54:00:0a:00:01 | Bad MAC. | Six two-digit hex pairs separated by :. |
'<value>' is not an IPv4 address | Bad ipv4 in a reservation. | Dotted quad, for example 10.30.0.11. |
'<value>' is not an IPv4 subnet, expected e.g. 10.0.1.0/24 | Bad ipv4Subnet. | CIDR notation. |
'<value>' is not an IPv6 prefix, expected e.g. fd00:10:1::/64 | Bad ipv6Prefix. | An IPv6 address, /, and 0 to 128. |
'<value>' is not a USB id, expected e.g. 0x0403 | A USB id string that is not 0x and four hex digits. | Write 0x0403 (a YAML number) or "0x0403". |
USB id <n> is out of range 0...0xffff | A USB id number that does not fit 16 bits. | Use the id from the device. |
Validation errors and warnings
Top level
| Location | Severity | Message | Fix |
|---|---|---|---|
schemaVersion | error | unsupported schemaVersion N, this vz reads version 27 | Set schemaVersion: 27, or update vz. |
name | error | invalid lab name | Lowercase letters, digits and -, starting with a letter, up to 63 characters. |
state | error | must not be empty | Remove the key or give a path. |
state | error | ... cannot be the state directory: vz destroy deletes it, and it holds the lab file or your files | Give the state its own folder, for example state: ./.vz-state. Also checked for --state. |
state | error | the state directory path is too long for its control socket (N of 103 bytes) | Use a shorter state: path or lab name, or a shorter VZ_HOME. |
nodes | warning | the lab has no nodes | Add a node. |
Storages
| Location | Severity | Message | Fix |
|---|---|---|---|
storages.<name> | error | invalid storage name | Follow the name rules. |
storages.<name>.path | error | must not be empty | Give a file path. |
storages.<name>.path | error | unknown disk format: use .asif, .raw, .img, .iso or .ipsw | Use one of those extensions. |
storages.<name>.size | error | an ISO image cannot be created; remove size | Remove size. |
storages.<name>.size | error | a restore image cannot be created; remove size | Remove size. |
storages.<name>.size | error | must be larger than 0 | Give a real size. |
storages.<name> | warning | writable storage is used by 'a', 'b'; do not run them at the same time | Use readOnly: true or overlay: true on all but one, or do not start them together. |
Nodes
| Location | Severity | Message | Fix |
|---|---|---|---|
nodes[i].name | error | invalid node name | Follow the name rules. |
nodes[i].name | error | duplicate node name, already used by nodes[k] | Rename one. |
nodes[i].cpus | error | must be at least 1 | Use 1 or more. |
nodes[i].memory | error | must be a non-zero multiple of 1MiB | For example 1GiB or 1536MiB. |
nodes[i].nestedVirtualization | warning | this Mac does not support nested virtualization (needs M3 or newer) | Remove it, or run on an M3 or newer Mac. vz up fails on this Mac. |
nodes[i].init | error | must not be empty | Remove the key or give a path. |
nodes[i].displays[j].width | error | must be in 320...8192 | |
nodes[i].displays[j].height | error | must be in 200...8192 | |
nodes[i].clipboard | error | clipboard needs at least one display | Add a display or remove clipboard. |
nodes[i].sound | warning | both output and input are false; remove sound or enable one | |
nodes[i].usb[j] | warning | device ... is listed twice | Remove the duplicate. |
Platforms
Each node's platform adds its own rules. The platform table checks the name and the host limits; the rest comes from that platform.
| Location | Severity | Message | Fix |
|---|---|---|---|
nodes[i].platform | error | unknown platform '...'; use apple or generic | Use a known platform, or remove the key for generic. |
nodes | error | N apple nodes (...); one Mac runs at most 2 at a time | Apple's license allows two macOS VMs per Mac. |
nodes[i].disks[j] | error | a .ipsw restore image installs macOS; it needs platform: apple | generic: remove the .ipsw, or set platform: apple. |
nodes[i].platform | warning | macOS guests are experimental: the install has not been tested end to end yet | apple: shown for every macOS node. |
nodes[i].rosetta | error | the Rosetta share is for Linux guests; macOS has Rosetta built in | apple: remove rosetta. |
nodes[i].nestedVirtualization | error | nested virtualization needs platform: generic | apple: remove it. |
nodes[i].secureBoot | error | secureBoot is a UEFI setting; macOS boots with Apple's own secure boot | apple: remove it. |
nodes[i].clipboard | error | clipboard sharing needs a SPICE agent in the guest, and macOS has none | apple: remove it. |
nodes[i].displays | error | macOS needs a display for its installer and login window | apple: remove displays: []. |
nodes[i].consoleLog | warning | macOS writes nothing to vz's serial console | apple: remove consoleLog; use vz node display. |
nodes[i].disks | error | list one restore image (.ipsw), not N | apple: keep one .ipsw. |
nodes[i].disks | error | macOS needs a disk to install onto: add a writable disk with a size, for example | apple: add that disk. |
nodes[i].disks[j] | error | macOS installs onto the first disk that is not a .ipsw: make it writable, without overlay, for example | apple: remove overlay and readOnly from that disk, or put another disk first. |
nodes[i].init | error | for platform apple, init must be a #cloud-config file / not valid YAML / the first user under users needs a name / macOS needs a password for user ...: set plain_text_passwd / cannot read ... | apple: fix the user-data file. See init. |
nodes[i].init | warning | macOS uses only users and ssh_pwauth from init; ignored: ... | apple: other cloud-config keys do nothing on macOS. |
nodes[i].init | warning | macOS creates only the first user, ... / macOS ignores these keys of user ...: ... / ssh_pwauth needs a user under users; without one, Setup Assistant runs | apple: informational. |
Disks
| Location | Severity | Message | Fix |
|---|---|---|---|
nodes[i].disks | error | a node needs at least one disk | Add a disk. |
nodes[i].disks[j] | error | set either path or storage | Add one of them. |
nodes[i].disks[j] | error | set either path or storage, not both | Remove one. |
nodes[i].disks[j].path | error | must not be empty / unknown disk format | Use .asif, .raw, .img, .iso or .ipsw. |
nodes[i].disks[j].size | error | an ISO image cannot be created; remove size | |
nodes[i].disks[j].size | error | a restore image cannot be created; remove size | |
nodes[i].disks[j].overlay | error | a restore image is installer media; remove overlay and cache | A .ipsw is read by the macOS installer, never layered. |
nodes[i].disks[j].size | error | must be larger than 0 | |
nodes[i].disks[j].size | warning | size only creates missing files or grows overlays, but the disk is read-only | Remove size or readOnly. |
nodes[i].disks[j].size | error | size belongs to the storage definition, not to the disk | Move size to the storage. |
nodes[i].disks[j].storage | error | unknown storage | Define it under storages. |
nodes[i].disks[j].readOnly | warning | ISO images are always attached read-only; add readOnly: true | Add readOnly: true. |
nodes[i].disks[j].cache | error | cache needs overlay: true | Add overlay: true or remove cache. |
nodes[i].disks[j].connected | error | only USB disks can be connected or disconnected | Use bus: usb or remove connected. |
nodes | warning | '<file>' is written by 'a' and also used by 'a', 'b'; do not run them at the same time | A writable disk file (no readOnly, no overlay) is shared. Use an overlay, make it read-only, or do not start the nodes together. |
Shares
| Location | Severity | Message | Fix |
|---|---|---|---|
nodes[i].shares[j].tag | error | invalid tag: use letters, digits, '.', '_' and '-' (max 36) | Must start with a letter or digit. |
nodes[i].shares[j].tag | error | tag 'rosetta' is reserved | Pick another tag. Use rosetta: true for Rosetta. |
nodes[i].shares[j].tag | error | duplicate tag, already used by shares[k] | Tags are unique per node. |
nodes[i].shares[j].path | error | must not be empty |
Interfaces
| Location | Severity | Message | Fix |
|---|---|---|---|
nodes[i].interfaces[j].name | error | invalid interface name | A letter, then letters, digits, ., _, -; up to 15 characters. |
nodes[i].interfaces[j].name | error | duplicate interface name | Names are unique per node. |
nodes[i].interfaces[j].mac | error | ... is a multicast address; the first byte must be even | Use a unicast MAC, for example 52:54:00:.... |
nodes[i].interfaces[j].mac | error | MAC ... is already used by node/interface | Every written MAC must be unique in the lab. |
nodes[i].interfaces[j].connected | error | a free interface (no attach) cannot be connected or disconnected | Add attach or remove connected. |
nodes[i].interfaces[j].attach | error | unknown switch '...' / unknown link '...' | Define it under switches or links, or fix the name. |
nodes[i].interfaces | warning | N interfaces on switches; vmnet documents a limit of 4 per VM, links are not limited | Use links, or fewer switch NICs, if the node fails to start. |
switches | warning | N interfaces on switches in total; vmnet documents a limit of 32 | Same. |
Links
| Location | Severity | Message | Fix |
|---|---|---|---|
links.<name> | error | invalid link name | Follow the name rules. |
links.<name>.mtu | error | must be in 1280...65535 | |
links.<name>.buffer | warning | unusual buffer size; 1MiB to 256MiB is expected | Remove buffer to use the default. |
links.<name> | warning | link is not used by any interface | Attach two NICs, or remove it. |
links.<name> | error | link has only one end; a cable needs exactly two | Attach a second NIC on another node. |
links.<name> | error | both ends are on node '...'; a cable must join two different nodes | Move one end to another node. |
links.<name> | error | link has N ends; a cable joins exactly two, use a switch for more | Use a switch. |
links.<name> | warning | ends disagree: ... starts connected, ... starts disconnected | Set the same connected on both ends. |
Switches
| Location | Severity | Message | Fix |
|---|---|---|---|
switches.<name> | error | invalid switch name | Follow the name rules. |
switches.<name>.mtu | error | must be in 1280...65535 | |
switches.<name>.ipv4Subnet | error | /N is too small; use /30 or larger | Use a shorter prefix, such as /24. |
switches.<name>.ipv4Subnet | warning | ... has host bits set; ... will be used | Write the network address, for example 10.30.0.0/24. |
switches.<second>.ipv4Subnet | error | ... overlaps ... of switch '<first>' | Give each switch its own range. |
switches.<name> | warning | switch has no interfaces attached | Attach a NIC, or remove the switch. |
DHCP reservations
| Location | Severity | Message | Fix |
|---|---|---|---|
switches.<name>.dhcpReservations | error | reservations need dhcp: true | Remove dhcp: false or the reservations. |
switches.<name>.dhcpReservations[k].mac | error | no interface on switch '...' has MAC ...; set the same mac on the interface | Write the same mac on the interface that attaches to this switch. |
switches.<name>.dhcpReservations[k].mac | error | MAC ... is already reserved by dhcpReservations[m] | One reservation per MAC. |
switches.<name>.dhcpReservations[k].ipv4 | error | ... is already reserved by dhcpReservations[m] | One reservation per address. |
switches.<name>.dhcpReservations[k].ipv4 | error | ... is outside <subnet> | Use an address inside ipv4Subnet. |
switches.<name>.dhcpReservations[k].ipv4 | error | ... is the network or broadcast address | Use a host address. |
switches.<name>.dhcpReservations[k].ipv4 | error | ... is the Mac's address on this switch | The first host (.1 in a /24) belongs to the Mac. |
Port forwarding
| Location | Severity | Message | Fix |
|---|---|---|---|
switches.<name>.portForwarding | error | port forwarding needs NAT; set nat4 or nat6 to true | |
switches.<name>.portForwarding[k].hostPort | error | must be in 1...65535 | |
switches.<name>.portForwarding[k].guestPort | error | must be in 1...65535 | |
switches.<name>.portForwarding[k].hostPort | error | tcp port N on the Mac is already forwarded by ... | Each protocol, family and host port only once, across all switches. |
switches.<name>.portForwarding[k].address | error | '...' is not an IPv4 address / not an IPv6 address | Fix the address, or set family. |
switches.<name>.portForwarding[k].family | error | IPv4 forwarding needs nat4: true / IPv6 forwarding needs nat6: true | Turn on NAT for that family. |
switches.<name>.portForwarding[k].address | error | ... is outside <subnet> | Use the guest's address on this switch. |
switches.<name>.portForwarding[k].address | warning | ... has no DHCP reservation, so no node is guaranteed to have it | Add a reservation for that address. |
Problems found only at start
Some problems can only be seen on the Mac at vz up, when vz builds the VMs. They are reported as errors of up (and in <state>/lab.log), not by validate:
- a disk file,
initpath or share folder that does not exist, or aninitfolder withoutuser-data apple: a missing or unreadable.ipsw(no macOS restore image at ...), no.ipswwhile macOS is not installed yet, a restore image this Mac cannot run, or fewer CPUs or less memory than that macOS needs- an overlay
sizesmaller than the base image, or smaller than the existing overlay (disks never shrink) cpusabove what this Mac allows, nested virtualization on a Mac older than M3, Rosetta not installed- a USB device that is not plugged in, or a binary that cannot claim USB accessories
- a binary without the virtualization entitlement, and vmnet errors such as a subnet already used by another running lab
See Troubleshooting for each of these.