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
This commit is contained in:
Aditya Raj Singh
2026-08-30 11:12:21 -04:00
committed by GitHub
parent 7c60f02802
commit e235c9935c
+10 -3
View File
@@ -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