# Proxmox automation (CT 101 Samba) Two PVE-side scripts for CT 101 (`10.0.0.9`, Samba file server, GNAI-017/GNAI-018): the in-place dist-upgrade of the productive, adopted LXC to Debian 13 (adoption, step 1) and the provisioning of a fresh CT 101 for the documented fresh-state rebuild. Both scripts run as root on the Proxmox host, contain no password, no private key and no SMB secret, and never destroy or replace an existing CT 101. ## `upgrade-ct101-to-debian13.sh` (adoption, step 1) Upgrades the productive CT 101 from Debian 12 (bookworm) to Debian 13 (trixie) in place. The existing LXC is preserved; the Samba passdb and the productive `smb.conf` survive the upgrade (`--force-confold` keeps the productive `smb.conf`). Sequence: 1. Preflight: CT 101 is running, is unprivileged (GNAI-015), all six media mounts carry `backup=no` (otherwise `vzdump` would archive the media library), and in the guest Debian 12, `ssh`/`smbd`/`nmbd` are active and the IPv4 matches. 2. `vzdump 101 --mode stop` as a safety net (storage and dump directory are configurable). 3. No `lxc.seccomp.profile` change is needed anymore: that exception existed only for the Ganesha NFS container inside CT 101. Since 2026-10-30 the NFS export runs on the PVE host (see `proxmox/pve-host/ansible/` (Rolle `pve_nfs_export`)); if the empty line is still present from the earlier Ganesha setup, the script removes it again (the NFS export can no longer run in an unprivileged LXC: `open_by_handle_at` needs CAP_DAC_READ_SEARCH in the init user namespace). 4. In the guest: `bookworm` → `trixie` in the apt sources (deb822 and one-line style), `apt-get update`, `dist-upgrade` with `Dpkg::Options::=--force-confold`, `autoremove`, then the known dangling `wtmpdb-rotate.timer` cleanup rule from `ghostnet-lxc-baseline.sh`. 5. Reboot and post-verify: Debian 13, `ssh`/`smbd`/`nmbd` active, no failed units, listeners 22/139/445, anonymous `smbclient -L` query successful, unprivileged uid_map intact, all six media mounts mounted. Before the run, all media mounts in the productive `pct config 101` must carry the `backup=no` option. Installation and invocation: ```bash install -o root -g root -m 0700 \ upgrade-ct101-to-debian13.sh \ /usr/local/sbin/upgrade-ct101-to-debian13.sh GHOSTNET_CT101_UPGRADE_CONFIRMATION=DIST-UPGRADE_CT101_TO_DEBIAN_13 \ /usr/local/sbin/upgrade-ct101-to-debian13.sh ``` Environment variables: `GHOSTNET_BACKUP_STORAGE` (default `local`), `GHOSTNET_BACKUP_DUMP_DIR` (default `/var/lib/vz/dump`, only needed for non-local backup storage). The confirmed downtime affects only the file-server service; the host key is unchanged, so the workstation does not have to replace a known host key. The reviewed repository copy has SHA-256 `7671722cbd5107b0453ec5d016d8ffed82f36ec34d959f50507c21dc953c00a4`. ## `provision-ct101-samba.sh` (fresh-state rebuild) Creates a fresh CT 101 from a Debian 13 template with the recorded profile, attaches the six media mounts and then runs the reviewed baseline hook with the recorded account UIDs (no seccomp change — see above). After the hook it masks `sys-kernel-config.mount` (configfs is unavailable in unprivileged LXC; CT 100/102/103 convention) and clears a stale failed state, so the fresh CT passes the no-failed-units gate of `playbooks/preflight.yml`. The script refuses to run when CT 101 already exists, and it names every material setting explicitly. | Setting | Value | | --- | --- | | CT ID / hostname | `101` / `Samba` (overridable via `GHOSTNET_CT101_HOSTNAME`) | | OS | Debian 13, amd64 (newest `debian-13-*amd64*` template in the local cache, otherwise `GHOSTNET_OS_TEMPLATE`) | | Container type | unprivileged LXC with `nesting=1,keyctl=1` | | CPU / RAM / swap | 1 core / 2048 MiB / 2048 MiB (recorded profile, adjustable via env) | | Rootfs | 4 GiB on `local-lvm` (recorded profile, adjustable via env) | | Network | `vmbr0`, `10.0.0.9/24`, gateway `10.0.0.1`, DNS `10.0.0.14`, no IPv6 | | Boot / timezone | `onboot: 1`, `Europe/Berlin` | | Media mounts | `mp0`–`mp5` → `/media/daten1`, `/media/daten2`, `/media/daten3`, `/media/datenhdd1`, `/media/datenhdd2/extern`, `/media/datenhdd3`, each with `backup=no` | | Baseline hook | `/usr/local/sbin/ghostnet-lxc-baseline.sh` (SHA-256 pinned) | The resource defaults are the recorded productive profile (captured 2026-10-27 inside the guest via lxcfs/cgroup and `findmnt`); override them via the env variables only deliberately. Mandatory environment variables (the recorded values from the Ansible inventory or the productive `pct config 101`): | Variable | Meaning | | --- | --- | | `GHOSTNET_AGENT_UID` | UID of `ghost-agent` (must match `samba_access_agent_uid`) | | `GHOSTNET_ADMIN_UID` | UID of `ghost` (must match `samba_access_admin_uid`) | | `GHOSTNET_MP0_HOST` … `GHOSTNET_MP5_HOST` | Host paths of the six media mounts (must exist) | Optional variables: `GHOSTNET_CT101_HOSTNAME`, `GHOSTNET_CT101_CORES`, `GHOSTNET_CT101_MEMORY_MB`, `GHOSTNET_CT101_ROOTFS_GB`, `GHOSTNET_CT101_SWAP_MB`, `GHOSTNET_OS_TEMPLATE`, `GHOSTNET_BASELINE_HOOK`. Installation and invocation: ```bash install -o root -g root -m 0700 \ provision-ct101-samba.sh \ /usr/local/sbin/provision-ct101-samba.sh GHOSTNET_AGENT_UID= GHOSTNET_ADMIN_UID= \ GHOSTNET_MP0_HOST=/path/daten1 GHOSTNET_MP1_HOST=/path/daten2 \ GHOSTNET_MP2_HOST=/path/daten3 GHOSTNET_MP3_HOST=/path/datenhdd1 \ GHOSTNET_MP4_HOST=/path/datenhdd2-extern GHOSTNET_MP5_HOST=/path/datenhdd3 \ /usr/local/sbin/provision-ct101-samba.sh ``` The script sets neither passwords nor keys and configures neither Samba nor the firewall — the Ansible roles do that. The final output lists the operator steps (set the ghost password, install the public keys from `ansible/files/ssh/`, configure the workstation SSH, fill the inventory placeholders, rebuild sequence from `ansible/README.md`). The reviewed repository copy has SHA-256 `74447ae18ab294fae08845490a214959e8e2a629c6aaf798351b0669e2f91823`. ## NFS-Export auf dem PVE-Host Der Kernel-NFS-Export von `/media/datenhdd3/Encoding` läuft nicht mehr als manuelles Script, sondern deklarativ über das Host-Projekt [`proxmox/pve-host/ansible/`](../../../pve-host/README.md) (Rolle `pve_nfs_export`, Playbook `site.yml` auf dem PVE-Host via `ansible-deploy`). Siehe dort für Account-Prep und Runbook. ## `ghostnet-lxc-baseline.sh` The versioned source lives under `../../../shared/scripts/ghostnet-lxc-baseline.sh`. Both CT 101 scripts call this reviewed baseline (adoption: manually after the upgrade; fresh rebuild: automatically via `provision-ct101-samba.sh`). Installation on the Proxmox host: ```bash install -o root -g root -m 0750 \ ghostnet-lxc-baseline.sh \ /usr/local/sbin/ghostnet-lxc-baseline.sh ``` The pinned SHA-256 of the repository copy is `111f1b70e47e3a2f6a1bcce22cb0ec50aacd8fbcff37d87fbcf853a318381b10`; the scripts verify the host copy before executing it. The baseline creates `ghost-agent` and `ghost` with the passed UIDs (or validates existing accounts), prepares the `.ssh` directories, adds `ghost` to `sudo` and ensures classic `ssh.service` operation. It installs no keys and sets no passwords.