fix(host): bring up VMware host stack at boot via native systemd units

Build VMs stopped starting after a reboot into a new kernel: vmmon/vmnet
were left unloaded and vmnet1/vmnet8 (DHCP/NAT) never came up, so
vmware-vmx died (status=237/KEYRING) and clones got no IP. Root cause:
the LSB->systemd sysv-generated vmware.service intermittently fails to
generate at early boot ("systemd-sysv-generator: Cannot find unit
vmware.service"), and the existing module-rebuild guard only builds the
modules -- it never loads them or starts vmnet networking.

Add a native vmware-host.service that runs `/etc/init.d/vmware start`
(loads vmmon/vmci + brings up vmnet), ordered after the rebuild guard,
and mask the flaky sysv vmware.service so the native unit is the sole
owner. Provisioned by scripts/install-vmware-host-services.sh and wired
into setup-host-linux.sh (new step 8/9). VMware ships no native unit and
no kernel postinst hook, so this native wrapper around VMware's own
tools is the reliable boot path.

Verified: linked clone boots and gets a vmnet8 DHCP IP.
This commit is contained in:
2026-07-19 19:47:16 +02:00
parent 92bea69f19
commit 19186981a5
7 changed files with 234 additions and 14 deletions
+47
View File
@@ -84,3 +84,50 @@ sudo systemctl daemon-reload
A questo punto il fallback è ri-attivare i task su Windows con
`scripts/Register-CIScheduledTasks.ps1`.
---
## Servizi VMware host (prerequisito avvio VM)
Distinti dai timer periodici sopra: due unit **native** che portano su lo stack
host di VMware Workstation a ogni boot. Servono perché VMware su Linux **non**
fornisce unit systemd native, **non** registra `vmmon`/`vmnet` con DKMS e **non**
installa hook di post-install del kernel.
| unit | ruolo |
| ---- | ----- |
| `vmware-modules-rebuild.service` | ricostruisce `vmmon`/`vmnet` via `vmware-modconfig` se il `.ko` per il kernel in esecuzione manca (guard *build-if-missing*). Ordinata `Before=vmware-host.service`. Script: `/usr/local/sbin/vmware-modules-rebuild.sh`. |
| `vmware-host.service` | esegue `/etc/init.d/vmware start` → carica `vmmon`/`vmci` e avvia la rete `vmnet1`/`vmnet8` (DHCP/NAT). Ordinata `After=vmware-modules-rebuild.service`. |
Il sysv `vmware.service` (LSB) viene **mascherato**: si è dimostrato inaffidabile
da generare al boot (`systemd-sysv-generator: Cannot find unit vmware.service`),
lasciando `vmmon` non caricato e la rete VM giù → le build VM non partono.
`vmware-host.service` ne diventa l'unico owner.
### Installazione
```bash
sudo ./scripts/install-vmware-host-services.sh # installa + enable + start (idempotente)
```
Installato anche automaticamente da `setup-host-linux.sh` (Step 8/9).
### Verifica
```bash
systemctl is-enabled vmware-host.service vmware-modules-rebuild.service
lsmod | grep -E 'vmmon|vmnet'
ip -o link show | grep vmnet # attese: vmnet1, vmnet8
```
### Recovery (stack giù, VM non partono)
```bash
sudo systemctl start vmware-host.service
```
### Rollback
```bash
sudo ./scripts/install-vmware-host-services.sh --uninstall
```