NationalSecurityAgency / ghidra

Ghidra is a software reverse engineering (SRE) framework
https://www.nsa.gov/ghidra
Apache License 2.0
50.57k stars 5.78k forks source link

Error starting Ghidra on Debian 12 Bookworm #6217

Closed Marantz2600 closed 7 months ago

Marantz2600 commented 7 months ago

On Debian 12, I am unable to launch Ghidra When trying to use the default command, "ghidraRun", it fails silently.

Digging down a bit, I tried to construct arguments to the launch.sh script.

To Reproduce

Steps to reproduce the behavior:

sls@sls-dell490:~/ghidra/ghidra_11.0.1_PUBLIC$ bash -x /home/sls/ghidra/ghidra_11.0.1_PUBLIC/support/launch.sh debug jdk Ghidra 4G "" ghidra.GhidraRun
+ umask 027
+ VMARGS_FROM_CALLER=
+ VMARGS_FROM_LAUNCH_SH=()
+ VMARGS_FROM_LAUNCH_PROPS=()
+ ARGS=()
+ INDEX=0
+ WHITESPACE='[[:space:]]'
+ for AA in "$@"
++ expr 0 + 1
+ INDEX=1
+ case "$INDEX" in
+ MODE=debug
+ for AA in "$@"
++ expr 1 + 1
+ INDEX=2
+ case "$INDEX" in
+ '[' jdk = jre ']'
+ JAVA_TYPE_ARG=-jdk_home
+ for AA in "$@"
++ expr 2 + 1
+ INDEX=3
+ case "$INDEX" in
+ APPNAME=Ghidra
+ for AA in "$@"
++ expr 3 + 1
+ INDEX=4
+ case "$INDEX" in
+ MAXMEM=4G
+ for AA in "$@"
++ expr 4 + 1
+ INDEX=5
+ case "$INDEX" in
+ '[' '' '!=' '' ']'
+ for AA in "$@"
++ expr 5 + 1
+ INDEX=6
+ case "$INDEX" in
+ CLASSNAME=ghidra.GhidraRun
+ [[ 6 -lt 6 ]]
+ SUPPORT_DIR=/home/sls/ghidra/ghidra_11.0.1_PUBLIC/support
+ [[ /home/sls/ghidra/ghidra_11.0.1_PUBLIC/support = *\!* ]]
+ '[' -f /home/sls/ghidra/ghidra_11.0.1_PUBLIC/support/launch.properties ']'
+ INSTALL_DIR=/home/sls/ghidra/ghidra_11.0.1_PUBLIC/support/..
+ CPATH=/home/sls/ghidra/ghidra_11.0.1_PUBLIC/support/../Ghidra/Framework/Utility/lib/Utility.jar
+ LS_CPATH=/home/sls/ghidra/ghidra_11.0.1_PUBLIC/support/LaunchSupport.jar
+ DEBUG_LOG4J=/home/sls/ghidra/ghidra_11.0.1_PUBLIC/support/debug.log4j.xml
++ command -v java
+ '[' -x /usr/bin/java ']'
++ java -cp /home/sls/ghidra/ghidra_11.0.1_PUBLIC/support/LaunchSupport.jar LaunchSupport /home/sls/ghidra/ghidra_11.0.1_PUBLIC/support/.. -jdk_home -save
+ JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
+ '[' '!' 0 -eq 0 ']'
+ JAVA_CMD=/usr/lib/jvm/java-17-openjdk-amd64/bin/java
+ IFS='
'
+ read -r line
++ java -cp /home/sls/ghidra/ghidra_11.0.1_PUBLIC/support/LaunchSupport.jar LaunchSupport /home/sls/ghidra/ghidra_11.0.1_PUBLIC/support/.. -vmargs
+ VMARGS_FROM_LAUNCH_PROPS+=("$line")
+ IFS='
'
+ read -r line
+ VMARGS_FROM_LAUNCH_PROPS+=("$line")
+ IFS='
'
+ read -r line
+ VMARGS_FROM_LAUNCH_PROPS+=("$line")
+ IFS='
'
+ read -r line
+ VMARGS_FROM_LAUNCH_PROPS+=("$line")
+ IFS='
'
+ read -r line
+ VMARGS_FROM_LAUNCH_PROPS+=("$line")
+ IFS='
'
+ read -r line
+ VMARGS_FROM_LAUNCH_PROPS+=("$line")
+ IFS='
'
+ read -r line
+ VMARGS_FROM_LAUNCH_PROPS+=("$line")
+ IFS='
'
+ read -r line
+ VMARGS_FROM_LAUNCH_PROPS+=("$line")
+ IFS='
'
+ read -r line
+ VMARGS_FROM_LAUNCH_PROPS+=("$line")
+ IFS='
'
+ read -r line
+ VMARGS_FROM_LAUNCH_PROPS+=("$line")
+ IFS='
'
+ read -r line
+ VMARGS_FROM_LAUNCH_PROPS+=("$line")
+ IFS='
'
+ read -r line
+ VMARGS_FROM_LAUNCH_PROPS+=("$line")
+ IFS='
'
+ read -r line
+ VMARGS_FROM_LAUNCH_PROPS+=("$line")
+ IFS='
'
+ read -r line
+ VMARGS_FROM_LAUNCH_PROPS+=("$line")
+ IFS='
'
+ read -r line
+ VMARGS_FROM_LAUNCH_PROPS+=("$line")
+ IFS='
'
+ read -r line
+ VMARGS_FROM_LAUNCH_PROPS+=("$line")
+ IFS='
'
+ read -r line
++ uname -s
+ '[' Linux = Darwin ']'
+ '[' 4G '!=' '' ']'
+ VMARGS_FROM_LAUNCH_SH+=("-Xmx${MAXMEM}")
+ BACKGROUND=false
+ '[' debug = debug ']'
+ SUSPEND=n
+ '[' '' = '' ']'
+ DEBUG_ADDRESS=127.0.0.1:18001
+ '[' debug = debug-suspend ']'
+ VMARGS_FROM_LAUNCH_SH+=("-Dlog4j.configurationFile=${DEBUG_LOG4J}")
+ VMARGS_FROM_LAUNCH_SH+=("-agentlib:jdwp=transport=dt_socket,server=y,suspend=${SUSPEND},address=${DEBUG_ADDRESS}")
+ '[' false = true ']'
+ set -o noglob
+ /usr/lib/jvm/java-17-openjdk-amd64/bin/java -Djava.system.class.loader=ghidra.GhidraClassLoader -Dfile.encoding=UTF8 -Duser.country=US -Duser.language=en -Duser.variant= -Dsun.java2d.opengl=false -Djdk.tls.client.protocols=TLSv1.2,TLSv1.3 -Dcpu.core.limit= -Dcpu.core.override= -Dfont.size.override= -Dpython.console.encoding=UTF-8 -Xshare:off -Dsun.java2d.pmoffscreen=false -Dsun.java2d.xrender=true -Dsun.java2d.uiScale=1 -Dawt.useSystemAAFontSettings=on -Xmx4G -Dlog4j.configurationFile=/home/sls/ghidra/ghidra_11.0.1_PUBLIC/support/debug.log4j.xml -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=127.0.0.1:18001 -showversion -cp /home/sls/ghidra/ghidra_11.0.1_PUBLIC/support/../Ghidra/Framework/Utility/lib/Utility.jar ghidra.Ghidra ghidra.GhidraRun
Listening for transport dt_socket at address: 18001
openjdk version "17.0.10" 2024-01-16
OpenJDK Runtime Environment (build 17.0.10+7-Debian-1deb12u1)
OpenJDK 64-Bit Server VM (build 17.0.10+7-Debian-1deb12u1, mixed mode)
INFO  Using log config file: file:/home/sls/ghidra/ghidra_11.0.1_PUBLIC/support/debug.log4j.xml  (LoggingInitialization.java:50) 
INFO  Using log file: /home/sls/.ghidra/.ghidra_11.0.1_PUBLIC/application.log  (LoggingInitialization.java:51) 

Exception: java.lang.NoClassDefFoundError thrown from the UncaughtExceptionHandler in thread "Ghidra"
+ exit 0

Expected behavior I am hoping that a window will pop up with a user interface allowing me to use the Ghidra application.

Attachments Attached, in the file "installed.txt", is a list of the installed packages on my system. I have also attached a file, "machine-info.txt", that shows uname output and some other stuff.

Environment (please complete the following information):

Marantz2600 commented 7 months ago

Somehow, the file about packages installed failed to attach. Trying again... installed.txt

Marantz2600 commented 7 months ago

I suppose that I should also mention that I am not good at Java.

I used the instructions below to guide me in setting up Java on my system.

link

Marantz2600 commented 7 months ago

Just for fun, I tried stripping stuff out of the command while still reproducing the error...

$ java -Djava.system.class.loader=ghidra.GhidraClassLoader -cp /home/sls/ghidra/ghidra_11.0.1_PUBLIC/Ghidra/Framework/Utility/lib/Utility.jar ghidra.Ghidra ghidra.GhidraRun
OpenJDK 64-Bit Server VM warning: Archived non-system classes are disabled because the java.system.class.loader property is specified (value = "ghidra.GhidraClassLoader"). To use archived non-system classes, this property must not be set
INFO  Using log config file: jar:file:/home/sls/ghidra/ghidra_11.0.1_PUBLIC/Ghidra/Framework/Generic/lib/Generic.jar!/generic.log4j.xml (LoggingInitialization)  
INFO  Using log file: /home/sls/.ghidra/.ghidra_11.0.1_PUBLIC/application.log (LoggingInitialization)  

Exception: java.lang.NoClassDefFoundError thrown from the UncaughtExceptionHandler in thread "Ghidra"
Marantz2600 commented 7 months ago

Got it to work...

My video card has multiple video outputs. So X11 doesn't know which to use by default and I haven't figured out yet how to configure it correctly so that things just work.

So I have to specify in the CLI, the prefix "DISPLAY=:0" on any application using X11.

The following worked and opened the application.

sls@sls-dell490:~/ghidra/ghidra_11.0.1_PUBLIC/support$ DISPLAY=:0 java -Djava.system.class.loader=ghidra.GhidraClassLoader -cp ../Ghidra/Framework/Utility/lib/Utility.jar ghidra.Ghidra ghidra.GhidraRun
OpenJDK 64-Bit Server VM warning: Archived non-system classes are disabled because the java.system.class.loader property is specified (value = "ghidra.GhidraClassLoader"). To use archived non-system classes, this property must not be set
INFO  Using log config file: jar:file:/home/sls/ghidra/ghidra_11.0.1_PUBLIC/Ghidra/Framework/Generic/lib/Generic.jar!/generic.log4j.xml (LoggingInitialization)  
INFO  Using log file: /home/sls/.ghidra/.ghidra_11.0.1_PUBLIC/application.log (LoggingInitialization)  
INFO  Loading user preferences: /home/sls/.ghidra/.ghidra_11.0.1_PUBLIC/preferences (Preferences)  
INFO  Searching for classes... (ClassSearcher)  
INFO  Class search complete (2750 ms) (ClassSearcher)  
INFO  Initializing SSL Context (SSLContextInitializer)  
INFO  Initializing Random Number Generator... (SecureRandomFactory)  
INFO  Random Number Generator initialization complete: NativePRNGNonBlocking (SecureRandomFactory)  
INFO  Trust manager disabled, cacerts have not been set (ApplicationTrustManagerFactory)  
INFO  User sls started Ghidra. (GhidraRun)  

Stupid Java for the cryptic error message with no hint as to the failure point.

Stupid X11 for being just a bit too complicated. Just pick the first display and say what choice was made?

Stupid, stupid, stupid...