Skip to content

Lightweight server monitoring with historical data, docker stats, and alerts.

fix(install): generate /etc/machine-id on systems without /proc (#2274)

Aditya Raj Singhe235c9935c3d
diff --git a/supplemental/scripts/install-agent.sh b/supplemental/scripts/install-agent.sh
index b7907b1c6..e4e9dcea3 100755
--- a/supplemental/scripts/install-agent.sh
+++ b/supplemental/scripts/install-agent.sh
@@ -796,9 +796,16 @@ set_selinux_context
# Cleanup
rm -rf "$TEMP_DIR"
-# Make sure /etc/machine-id exists for persistent fingerprint
-if [ ! -f /etc/machine-id ]; then
- cat /proc/sys/kernel/random/uuid | tr -d '-' > /etc/machine-id
+# Make sure /etc/machine-id exists and is non-empty for persistent fingerprint
+if [ ! -s /etc/machine-id ]; then
+ if [ -r /proc/sys/kernel/random/uuid ]; then
+ tr -d '-' < /proc/sys/kernel/random/uuid > /etc/machine-id
+ elif command -v uuidgen >/dev/null; then
+ # FreeBSD has no /proc/sys/kernel/random/uuid
+ uuidgen | tr -d '-' > /etc/machine-id
+ else
+ echo "No UUID source found, skipping /etc/machine-id creation"
+ fi
fi
# Check for NVIDIA GPUs and grant device permissions for systemd service