IMVEEDev Portal

Troubleshooting


Terraform Errors

"domain already exists"

libvirt reports that a domain with that name already exists, even though it is not in the Terraform state (e.g. after manually deleting the state or an incomplete terraform destroy).

Option A — Terraform import:

cd terraform
terraform import libvirt_domain.ubuntu ubuntu-server

Option B — Delete domain manually:

:::warn [Destructive action] The following operation deletes the VM irreversibly. Make sure no data will be lost. :::

virsh destroy ubuntu-server    # stop VM (if running)
virsh undefine ubuntu-server   # remove domain

Then run terraform apply again.


Storage pool does not exist

Terraform fails because the libvirt storage pool cannot be found. Cause: make setup was not run or ran incompletely, or the mount under /mnt/data/ is missing.

# Re-run host setup
make setup

This step creates the directories under /mnt/data/simulationlab/ and registers the storage pool with libvirt.


libvirt memory unit warning (KiB instead of MiB)

The memory parameter in libvirt_domain is passed directly as KiB to libvirt — not as MiB as with other providers.

:::warn [Wrong unit leads to wrong VM size] Correct values:

RAMValue
2 GiB2097152
4 GiB4194304
:::

VM Gets No IP

  1. Networks active?

    virsh net-list

    The simlab-wan and simlab-lan networks must show as active.

  2. VM actually started?

    virsh domstate ubuntu-server
  3. Cloud-Init network config correct?

    The ubuntu-network.yaml Cloud-Init configuration uses an en* match for the network interface. If the VM has a different interface, the config does not apply.

  4. Check the static IP (there is no DHCP in the lab):

    # Test reachability from the host
    ping -c 2 10.50.1.30
    
    # Static netplan config on the VM
    ssh ubuntu@10.50.1.30 "cat /etc/netplan/50-cloud-init.yaml"

SSH Errors

Connection fails / timeout

VM not fully started — wait briefly and try again:

ssh -v ubuntu@10.50.1.30

Host key error (known_hosts)

After VM recreation the host key changes:

ssh-keygen -R 10.50.1.30

Wrong password

Linux VMs use password authentication (user ubuntu, on Kali kali). The password lives in Infisical (simlab-linux-password); the local copy .secrets/linux_password must be refreshed after a rotation.


Cloud-Init Did Not Run / Run Incompletely

Cloud-Init only runs on the first boot of a VM. It is not re-run on subsequent reboots.

Check status

ssh ubuntu@10.50.1.30 "cloud-init status"

Check logs

ssh ubuntu@10.50.1.30 \
  "sudo cat /var/log/cloud-init-output.log | tail -30"

Recreate VM

If Cloud-Init needs to run again (e.g. after a key change), the VM must be completely recreated:

:::warn [Destructive action] This step deletes all data on the VM disk. :::

cd terraform
terraform apply \
  -replace=libvirt_domain.ubuntu \
  -replace=libvirt_cloudinit_disk.ubuntu_init \
  -replace=libvirt_volume.ubuntu_cloudinit \
  -replace=libvirt_volume.ubuntu_disk

virsh start ubuntu-server

Ansible Fails

VM unreachable

# Test reachability
ansible linux -i ansible/inventory.ini -m ping

If ping fails: check the IP in ansible/inventory.ini (auto-generated — regenerate if out of sync):

# Regenerate inventory from Terraform outputs
bash scripts/generate-inventory.sh

SSH password wrong or not set

ansible/inventory.ini contains the SSH password (ansible_ssh_pass) — it is taken from Infisical (simlab-linux-password) at generation time:

ubuntu-server  ansible_host=10.50.1.30  ansible_user=ubuntu  ansible_ssh_pass=<Infisical value>

Inventory group wrong

make configure-linux only runs Ansible on the linux group. Make sure the Ubuntu VM is listed under [linux] in inventory.ini.


Agent Update on Running VM

make configure-linux

Ansible is idempotent — the satellite-linux role reinstalls the agent if a new binary or enrollment token is present.

:::warn [Renew enrollment token] The enrollment token is short-lived. Get a fresh token (SOCSuite UI or scripts/gen-enrollment-token.sh) and pass it as ENROLLMENT_TOKEN env var or extra var satellite_enrollment_token before re-running. :::

Option B: Manually via SSH

ssh ubuntu@10.50.1.30

# Read agent token from k8s secret
GITLAB_TOKEN=$(kubectl get secret agent-tokens -n imvee-dev \
  -o jsonpath='{.data.AGENT_TOKEN_SIMULATIONLAB}' | base64 -d)

# Replace binary from GitLab Package Registry
sudo curl -fsSL \
  -H "PRIVATE-TOKEN: $GITLAB_TOKEN" \
  "https://gitlab.com/api/v4/projects/83793647/packages/generic/satellite/<VERSION>/imvee-satellite-agent-linux-amd64" \
  -o /usr/local/imvee-satellite/imvee-satellite

sudo chmod 0755 /usr/local/imvee-satellite/imvee-satellite
sudo systemctl restart imvee-satellite
systemctl status imvee-satellite

Installation paths on the VM:

PathContent
/usr/local/imvee-satellite/Binary + agent.env
/var/lib/imvee-satellite/agent.id, agent.key, queue.jsonl
/var/log/imvee-satellite/Log files

Satellite Agent — Backend Connectivity

TLS: x509: certificate signed by unknown authority

The agent cannot verify the TLS certificate from Traefik. Traefik uses the SOCSuite Internal Root CA (CN = SOCsuite Internal Root CA), not the IMVEE Internal CA.

Extract and deploy the correct CA:

# Extract CA from k8s secret
kubectl get secret -n imvee-dev socsuite-root-ca-secret \
  -o jsonpath='{.data.ca\.crt}' | base64 -d > /opt/socsuite-ca.crt

# Verify (should output "OK")
openssl verify -CAfile /opt/socsuite-ca.crt /opt/socsuite-ca.crt

# make configure-linux deploys the CA automatically to VMs

The Ansible role satellite-linux deploys /opt/socsuite-ca.crt to /usr/local/share/ca-certificates/socsuite-ca.crt and runs update-ca-certificates.


Agent: register failed: 403 CSRF_TOKEN_MISSING

The API_URL in agent.env points to the wrong path. The backend router blocks CSRF only for paths outside /api/v1/ingest/*.

Correct value in ansible/group_vars/all/main.yml:

socsuite_api_url: "https://socsuite.dev.imvee.de/api/v1"

Agent: Invalid or expired token after enrollment

After the first enrollment the agent writes the actual API key to /var/lib/imvee-satellite/agent.key. If IMVEE_API_KEY in the env still contains the enrollment token, the file now takes priority.

Problem: older agent binary preferred env over file.

Fix: Update binary to the current version (make configure-linux). From v0.1.0 onwards agent.key is preferred when an ak- token is stored in it.


WebSocket: bad handshake (status 401)

Two possible causes:

A) Wrong host — the WebSocket runs on the same host as the API (socsuite.dev.imvee.de); IMVEE_WS_BASE_URL is derived by the agent from API_URL (no separate configuration needed). DNS for socsuite.dev.imvee.de → 192.168.178.99 is provided by the firewall (dnsmasq).

B) Wrong auth header — backend WS handler expects X-API-Key, not Authorization: Bearer. From v0.1.0 the agent sets both headers.

# Check DNS resolution on the VM
ssh ubuntu@10.50.1.30 "getent hosts socsuite.dev.imvee.de"

# Expected output:
# 192.168.178.99 socsuite.dev.imvee.de

DB schema: column ak.needs_hash_migration does not exist

After a fresh DB installation this column is missing. One-time migration:

kubectl exec -n imvee-dev postgres-0 -- psql -U socsuite_dbadmin -d secdb_local -c \
  "ALTER TABLE agent_api_keys ADD COLUMN IF NOT EXISTS needs_hash_migration BOOLEAN DEFAULT false;"

Check agent status

# On ubuntu-server
ssh ubuntu@10.50.1.30

sudo systemctl status imvee-satellite
sudo tail -f /var/log/imvee-satellite/satellite-error.log

# Successful connection looks like:
# WebSocket: connected successfully
# INFO: Heartbeat sent successfully

Known Limitations

LimitationDetailsWorkaround
Windows ISOs must be provided manuallyWindows install media must be placed in images/ (check: make check-prerequisites)Place ISOs in images/, then make apply
IPs are staticNo DHCP in LAN — inventory is auto-generatedNo action needed, inventory.ini is generated via generate-inventory.sh
Terraform state is localNo remote backend configuredDo not commit state file (*.tfstate* in .gitignore)
Enrollment tokens are short-livedToken expires after its lifetime (default 24 h)Create a new token in SOCSuite (or gen-enrollment-token.sh) and pass it as ENROLLMENT_TOKEN
Firewall VM disk fullRoot disk was 2.4 GB — too small for Suricata rules (~66 MB) + agentvirsh blockresize firewall vda --size 10G → growpart /dev/vda 1 → resize2fs /dev/vda1

KVM is missing / cloud VM without Nested-Virt

Preflight (or make setup) fails: /dev/kvm fehlt — Target cannot run KVM VMs.

Causes and fixes:

  • KVM modules not loaded: sudo modprobe kvm_intel (Intel) or kvm_amd (AMD) — and enable virtualization in BIOS/UEFI (Intel VT-x / AMD-V), then reboot.
  • Cloud VM (shared): Nested-Virt is usually disabled on shared VMs → KVM is not possible. → Use Dedicated/Bare-Metal (e.g. Hetzner Dedicated, IONOS dedicatedCore) or your own/local server system.
  • Check on the target:
egrep -c '(vmx|svm)' /proc/cpuinfo   # ≥ 1 = CPU virtualization present
ls -l /dev/kvm                        # device must exist

Network conflict (10.50.x.x in use)

Preflight fails on the network check (10.50.0.0/24 (WAN) and/or 10.50.1.0/24 (LAN) in use), or VMs are unreachable after provisioning:

# 1) Check host interfaces
ip a | grep 10.50

# 2) Check other libvirt networks on the host
virsh net-list --all

# 3) Check other VMs/container networks in the same L2 segment
  • Cause: The target (or another VM/container engine on it) already uses the segments 10.50.0.0/24 / 10.50.1.0/24.
  • Fix A (recommended): Choose a target where both segments are free (the one-click flow uses fixed segments).
  • Fix B: Change the segments manually — adjust wan_cidr/lan_cidr in terraform/terraform.tfvars (VM IPs are derived from them) and the segment check + libvirt networks in scripts/setup-host-portable.sh. Both places must match, otherwise preflight or Ansible will fail.

Windows VM does not boot / boot order

  • Symptom: win-server/win-desktop hang during boot, boot into the wrong device (Network/PXE), or stay on a black screen.
  • Fix: make fix-boot — corrects the UEFI boot order after apply (boot from disk instead of network).
  • Missing Autounattend ISO: The Windows unattended install needs the generated Autounattend ISOs → make build-autounattend (re-run if images/ is incomplete), then restart or re-apply the affected VM.
  • RAM: Windows Server 2022 needs ≥ 4 GiB (profile medium/large). Profile small creates no Windows VMs — a “missing” win-server is therefore expected behavior there.

See Also

On this page