Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-0: Launch headless scripts in headless mode to avoid macOS Dock activity (Closes #6859)

Ryan Kurtz192964537332
diff --git a/Ghidra/RuntimeScripts/Linux/server/svrAdmin b/Ghidra/RuntimeScripts/Linux/server/svrAdmin
index 8ef5906033..d0ae587e11 100755
--- a/Ghidra/RuntimeScripts/Linux/server/svrAdmin
+++ b/Ghidra/RuntimeScripts/Linux/server/svrAdmin
@@ -45,7 +45,7 @@ fi
OWNER="$(grep '^wrapper.app.account=' "${CONFIG}" | cut -d '=' -f 2)"
if [ -z "${OWNER}" -o "${OWNER}" = "$(whoami)" ]; then
- VMARGS="-DUserAdmin.invocation=$(basename "${SCRIPT_FILE}")"
+ VMARGS="-DUserAdmin.invocation=$(basename "${SCRIPT_FILE}") -Djava.awt.headless=true"
"${SCRIPT_DIR}"/../support/launch.sh fg jre svrAdmin "${MAXMEM}" "$VMARGS" ghidra.server.ServerAdmin "${CONFIG}" "$@"
else
echo "Running svrAdmin with $SUDO as ${OWNER} ..."
diff --git a/Ghidra/RuntimeScripts/Linux/support/analyzeHeadless b/Ghidra/RuntimeScripts/Linux/support/analyzeHeadless
index 4ce2c330dd..4e7b26fd86 100755
--- a/Ghidra/RuntimeScripts/Linux/support/analyzeHeadless
+++ b/Ghidra/RuntimeScripts/Linux/support/analyzeHeadless
@@ -18,7 +18,7 @@ DEBUG_ADDRESS=127.0.0.1:13002
# Limit the # of garbage collection and JIT compiler threads in case many headless
# instances are run in parallel. By default, Java will assign one thread per core
# which does not scale well on servers with many cores.
-VMARG_LIST="-XX:ParallelGCThreads=2 -XX:CICompilerCount=2 "
+VMARG_LIST="-XX:ParallelGCThreads=2 -XX:CICompilerCount=2 -Djava.awt.headless=true "
# Resolve symbolic link if present and get the directory this script lives in.
# NOTE: "readlink -f" is best but works on Linux only, "readlink" will only work if your PWD
diff --git a/Ghidra/RuntimeScripts/Linux/support/sleigh b/Ghidra/RuntimeScripts/Linux/support/sleigh
index 2f3ba1097d..0f8fa20d21 100755
--- a/Ghidra/RuntimeScripts/Linux/support/sleigh
+++ b/Ghidra/RuntimeScripts/Linux/support/sleigh
@@ -8,6 +8,8 @@
# the physical memory available to the OS. Uncomment MAXMEM setting if non-default value is needed.
#MAXMEM=1G
+VMARG_LIST="-Djava.awt.headless=true "
+
# Resolve symbolic link if present and get the directory this script lives in.
# NOTE: "readlink -f" is best but works on Linux only, "readlink" will only work if your PWD
# contains the link you are calling (which is the best we can do on macOS), and the "echo" is the
@@ -15,4 +17,4 @@
SCRIPT_FILE="$(readlink -f "$0" 2>/dev/null || readlink "$0" 2>/dev/null || echo "$0")"
SCRIPT_DIR="${SCRIPT_FILE%/*}"
-"${SCRIPT_DIR}"/launch.sh fg jdk Sleigh "$MAXMEM" "" ghidra.pcodeCPort.slgh_compile.SleighCompileLauncher "$@"
+"${SCRIPT_DIR}"/launch.sh fg jdk Sleigh "$MAXMEM" "${VMARG_LIST}" ghidra.pcodeCPort.slgh_compile.SleighCompileLauncher "$@"