From 5765dccf44826dd870db32a49475bb8419d2621c Mon Sep 17 00:00:00 2001 From: Gael Leblan Date: Wed, 10 Jun 2026 17:37:49 +0200 Subject: [PATCH] fix(agent): adding checks for session and explicit systemd requirement Signed-off-by: Gael Leblan --- installer/linux/agent-installer-service-user.sh | 3 ++- installer/linux/agent-installer-session-user.sh | 8 +++++++- installer/linux/agent-installer.sh | 3 ++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/installer/linux/agent-installer-service-user.sh b/installer/linux/agent-installer-service-user.sh index a0e1f6af..f703dabe 100644 --- a/installer/linux/agent-installer-service-user.sh +++ b/installer/linux/agent-installer-service-user.sh @@ -58,7 +58,7 @@ if [ -z "${home_dir}" ]; then fi os=$(uname | tr '[:upper:]' '[:lower:]') -systemd_status=$(systemctl is-system-running) +systemd_status=$(systemctl is-system-running 2>/dev/null || true) install_dir="${home_dir}/${OPENAEV_INSTALL_DIR}-${user}" service_name="${user}-${OPENAEV_SERVICE_NAME}" tenant_id="${OPENAEV_TENANT_ID}" @@ -71,6 +71,7 @@ fi if [ "$systemd_status" != "running" ] && [ "$systemd_status" != "degraded" ]; then echo "Systemd is in unexpected state: $systemd_status. Installation is not supported." + echo "Prerequisite: an active systemd system manager is required for service-user mode." exit 1 else echo "Systemd is in acceptable state: $systemd_status" diff --git a/installer/linux/agent-installer-session-user.sh b/installer/linux/agent-installer-session-user.sh index 848b9df5..97bb82e6 100644 --- a/installer/linux/agent-installer-session-user.sh +++ b/installer/linux/agent-installer-session-user.sh @@ -3,7 +3,7 @@ set -e base_url=${OPENAEV_URL} architecture=$(uname -m) -systemd_status=$(systemctl is-system-running) +systemd_status=$(systemctl is-system-running 2>/dev/null || true) os=$(uname | tr '[:upper:]' '[:lower:]') install_dir="$HOME/${OPENAEV_INSTALL_DIR}" @@ -24,6 +24,12 @@ else echo "Systemd is in acceptable state: $systemd_status" fi +if ! systemctl --user show-environment >/dev/null 2>&1; then + echo "Error: systemd user manager is not available in this session." + echo "Prerequisite: an active systemd user manager is required for session-user mode." + exit 1 +fi + echo "Starting install script for ${os} | ${architecture}" echo "01. Stopping existing ${session_name}..." diff --git a/installer/linux/agent-installer.sh b/installer/linux/agent-installer.sh index 26e24ae2..7c9a0ce1 100644 --- a/installer/linux/agent-installer.sh +++ b/installer/linux/agent-installer.sh @@ -3,7 +3,7 @@ set -e base_url=${OPENAEV_URL} architecture=$(uname -m) -systemd_status=$(systemctl is-system-running) +systemd_status=$(systemctl is-system-running 2>/dev/null || true) os=$(uname | tr '[:upper:]' '[:lower:]') install_dir="${OPENAEV_INSTALL_DIR}" @@ -17,6 +17,7 @@ fi if [ "$systemd_status" != "running" ] && [ "$systemd_status" != "degraded" ]; then echo "Systemd is in unexpected state: $systemd_status. Installation is not supported." + echo "Prerequisite: an active systemd system manager is required for service mode." exit 1 else echo "Systemd is in acceptable state: $systemd_status"