Skip to content

Commit 40cb56a

Browse files
andyclaude
andcommitted
ecce-dataserver-start/-stop: resolve apache2 by full path, not bare PATH lookup
Root-caused on beryllium: bin/gateway was failing to launch, showing a blocking "cannot establish a connection to the ECCE Server" dialog. Traced it back to ecce-dataserver-start's `apache2 -f ... -k start` invocation, which relies on `apache2` being on $PATH. Debian only merges /usr/sbin (where the apache2 binary lives) into PATH for root -- confirmed via `systemctl --user show-environment` and gnome-session's own /proc/<pid>/environ that a regular user's desktop-session PATH does not include it. The command silently failed with exit 127, the per-user data server on port 8096 never came up, ecce-gateway-start's `|| true` masked the failure, and gateway only surfaced it downstream as an opaque connection-refused dialog instead of an actual error from the script itself. Resolve apache2 via `command -v`, falling back to /usr/sbin/apache2, and fail with a clear message if neither exists. Same fix applied to ecce-dataserver-stop's apache2 -k stop call. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XJdPpqvvDFJoF1xRH4hv19
1 parent 3e16c6e commit 40cb56a

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

‎packaging/dataserver/ecce-dataserver-start‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,20 @@ STATEDIR="$ECCE_REALUSERHOME/.ECCE/dataserver"
2222
DATAROOT="$STATEDIR/htdocs"
2323
PORT=8096
2424

25+
# Debian only puts /usr/sbin (where the apache2 binary lives) on PATH for
26+
# root -- a regular user's login/desktop session PATH does not include it
27+
# (confirmed via `systemctl --user show-environment` and gnome-session's
28+
# own /proc/<pid>/environ). Relying on bare `apache2` here silently fails
29+
# with "command not found" for any non-root, non-customized-PATH user,
30+
# which then surfaces downstream as bin/gateway's opaque "cannot
31+
# establish a connection to the ECCE Server" dialog instead of an actual
32+
# error from this script. Resolve a full path instead.
33+
APACHE2_BIN="$(command -v apache2 2>/dev/null || echo /usr/sbin/apache2)"
34+
if [ ! -x "$APACHE2_BIN" ]; then
35+
echo "ecce-dataserver-start: no apache2 binary found (looked on PATH and at /usr/sbin/apache2) -- install apache2" >&2
36+
exit 1
37+
fi
38+
2539
port_open() {
2640
(exec 3<>"/dev/tcp/localhost/$1") >/dev/null 2>&1
2741
status=$?
@@ -81,7 +95,7 @@ sed -e "s|##HTTPDROOT##|$STATEDIR|g" \
8195
"$CONF_TEMPLATE" > "$STATEDIR/httpd.conf"
8296

8397
echo "ecce-dataserver-start: starting data server on port $PORT..."
84-
apache2 -f "$STATEDIR/httpd.conf" -k start
98+
"$APACHE2_BIN" -f "$STATEDIR/httpd.conf" -k start
8599
i=0
86100
while [ $i -lt 40 ]; do
87101
if port_open "$PORT"; then break; fi

‎packaging/dataserver/ecce-dataserver-stop‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@ if [ ! -f "$CONF" ]; then
1414
exit 0
1515
fi
1616

17+
APACHE2_BIN="$(command -v apache2 2>/dev/null || echo /usr/sbin/apache2)"
18+
1719
if [ -f "$PIDFILE" ] && kill -0 "$(cat "$PIDFILE" 2>/dev/null)" 2>/dev/null; then
18-
apache2 -f "$CONF" -k stop
20+
"$APACHE2_BIN" -f "$CONF" -k stop
1921
echo "ecce-dataserver-stop: stopped data server (pid $(cat "$PIDFILE"))"
2022
else
2123
echo "ecce-dataserver-stop: data server not running"

0 commit comments

Comments
 (0)