replace nebula.exe -service install with New-Service

nebula's built-in Go service manager (-service install) is unreliable
on Windows — it reports "service already exists" when the SCM, registry,
and Get-Service all confirm no service is present. Use PowerShell's
New-Service cmdlet instead, which talks directly to the Windows SCM.
This commit is contained in:
unknown 2026-02-17 12:28:06 -05:00
parent 881664345e
commit 4cee8a0a35
2 changed files with 5 additions and 4 deletions

View File

@ -137,7 +137,7 @@ Get-WinEvent -FilterHashtable @{LogName='Application'; ProviderName='nebula'} -M
Common causes:
- **"found unknown escape character"** — Backslashes in `config.yml` paths. YAML interprets `\` as escape characters inside double quotes. Use forward slashes (`C:/Program Files/Nebula/ca.crt`).
- **"no config files found"** — The service was installed without `-config`. Reinstall using `install-nebula.ps1`.
- **"no config files found"** — The service binary path is missing the `-config` argument. Reinstall using `install-nebula.ps1`.
### Handshake timeouts after reboot
Nebula started before the physical network was ready. Verify the service is configured with auto start and NLA dependency:

View File

@ -209,9 +209,10 @@ if (-not (Test-Path (Join-Path $InstallDir "dist"))) {
# --- Install and configure service ---
Write-Host "Installing Nebula service..."
& "$InstallDir\nebula.exe" -service install -config "$ConfigPath"
if ($LASTEXITCODE -ne 0) {
Write-Error "Failed to install Nebula service."
try {
New-Service -Name "nebula" -BinaryPathName $ExpectedBinPath -StartupType Automatic -Description "Nebula Network Service" -ErrorAction Stop | Out-Null
} catch {
Write-Error "Failed to install Nebula service: $_"
exit 1
}