fix(deploy): keep existing manual TUN passthrough on reused CTs (#6)

create-ct.sh only recognised devN passthrough and added dev0 on top of a
manual lxc.mount.entry for /dev/net/tun (left by earlier Tailscale setups),
so the CT failed to start in the autodev hook (EEXIST). Detection now lives
in ct-config.sh with a regression test.
This commit is contained in:
Florian Schmidt
2026-11-16 09:35:19 +01:00
parent c3ef790d9d
commit df489fa147
4 changed files with 32 additions and 2 deletions
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env bash
set -euo pipefail
# shellcheck source=deploy/proxmox/ct-config.sh
source "$(dirname "${BASH_SOURCE[0]}")/../proxmox/ct-config.sh"
base='arch: amd64
features: nesting=1
unprivileged: 1'
has_tun_passthrough <<< "$base
dev0: /dev/net/tun"
has_tun_passthrough <<< "$base
dev1: path=/dev/net/tun,mode=0666"
# Manual Tailscale-style setup: adding dev0 on top makes the CT fail to start (EEXIST).
has_tun_passthrough <<< "$base
lxc.cgroup2.devices.allow: c 10:200 rwm
lxc.mount.entry: /dev/net/tun dev/net/tun none bind,create=file"
if has_tun_passthrough <<< "$base"; then exit 1; fi
if has_tun_passthrough <<< "$base
dev0: /dev/net/tunnel"; then exit 1; fi
printf '5 CT config checks passed\n'