From 68a223c4637614a776493952bfd88490607b2c4a Mon Sep 17 00:00:00 2001 From: Thales Maciel Date: Thu, 29 Jan 2026 14:59:57 -0300 Subject: [PATCH] Store API sockets in runtime dir --- README.md | 2 +- run.sh | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 34ef433..afb2dd5 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ Each VM writes a metadata file at `state/vms//info` with the following field - `created_at`: timestamp when the VM was launched. - `guest_ip`: IP address assigned to the guest. - `tap`: host TAP interface name attached to the bridge. -- `api_sock`: path to the Firecracker API socket. +- `api_sock`: path to the Firecracker API socket (stored under `$XDG_RUNTIME_DIR/banger/` when available). - `log`: path to the Firecracker log file. - `base_loop`: loop device backing the base rootfs (if present). - `cow_file`: copy-on-write image file (if present). diff --git a/run.sh b/run.sh index 105e8b6..9730e89 100755 --- a/run.sh +++ b/run.sh @@ -169,7 +169,11 @@ VM_TAG="${VM_ID:0:8}" VM_DIR="$VM_ROOT/$VM_ID" mkdir -p "$VM_DIR" -API_SOCK="$STATE/fc-$VM_TAG.sock" +RUNTIME_DIR="${XDG_RUNTIME_DIR:-/run/user/$(id -u)}" +SOCK_DIR="$RUNTIME_DIR/banger" +sudo mkdir -p "$SOCK_DIR" +sudo chown "$(id -u):$(id -g)" "$SOCK_DIR" +API_SOCK="$SOCK_DIR/fc-$VM_TAG.sock" LOG_FILE="$VM_DIR/firecracker.log" TAP_DEV="tap-fc-$VM_TAG"