From e235c9935c3db4fdd81fcdc5d503ecd2587c0cad Mon Sep 17 00:00:00 2001 From: Aditya Raj Singh Date: Sun, 30 Aug 2026 20:42:21 +0530 Subject: [PATCH] fix(install): generate /etc/machine-id on systems without /proc (#2274) * fix(install): generate /etc/machine-id on systems without /proc The install script read the fingerprint UUID from /proc/sys/kernel/random/uuid, which FreeBSD does not have. On pfSense the redirect still created /etc/machine-id, cat failed, and the agent was left with an empty machine-id file. The [ ! -f ] guard then skipped regeneration on every later run. Fall back to uuidgen when /proc is unavailable, mirroring how the script already picks between sha256sum and FreeBSD's sha256, and leave no file behind when neither source exists. * fix(install): regenerate empty machine id --- supplemental/scripts/install-agent.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/supplemental/scripts/install-agent.sh b/supplemental/scripts/install-agent.sh index b7907b1c..e4e9dcea 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