Skip to content

PCGen fails to start on Fedora Silverblue (Toolbox) due to missing X11/HeadlessException #7334

Open

Description

@Tealk

Describe the bug
Trying to run ./pcgen.sh inside a Fedora Silverblue [Toolbox](https://docs.fedoraproject.org/en-US/fedora-silverblue/toolbox/) container fails with a java.awt.HeadlessException, even when wrapping execution in xvfb-run.

To Reproduce

Steps to reproduce the behavior:

  1. Use Fedora Silverblue (e.g., 42)

  2. Create a toolbox:

    toolbox create
    toolbox enter
  3. Download and extract PCGen v6.08.00 RC8

  4. Try to launch it:

    xvfb-run ./pcgen.sh
  5. You get the following error:

    java.awt.HeadlessException: 
    No X11 DISPLAY variable was set,
    or no headful library support was found,
    but this program performed an operation which requires it
    

Expected behavior
PCGen should start in the simulated X11 environment provided by xvfb-run, or at least gracefully detect a headless environment.

Environment:

  • OS: Fedora Silverblue (Immutable OS)
  • Execution: via toolbox container (Fedora base)
  • PCGen version: v6.08.00 RC8
  • Java version: OpenJDK 17
  • xorg-x11-server-Xvfb installed and xvfb-run available

Activity

  1. karianna commented on May 26, 2025

    @karianna
    Contributor

    I don't have a definitive answer/fix for this, but GPT4o suggested the following, YMMV:


    You’re encountering a java.awt.HeadlessException when running PCGen inside a Fedora Silverblue Toolbox container using xvfb-run. Despite xvfb-run usually simulating a display, Java isn’t detecting it properly here. This is likely due to one or more of the following:

    🔍 Diagnosis
    1. DISPLAY variable not properly set within the toolbox environment or not visible to Java.
    2. xvfb-run not properly wrapping the application, or some additional dependency is missing.
    3. Java headless mode incorrectly enabled or defaulting due to environment.

    ⸻

    ✅ Suggested Fixes

    Here’s a step-by-step checklist that should resolve the issue:

    ⸻

    1. Install missing packages inside toolbox

    Ensure your toolbox container has the following installed:

    sudo dnf install xorg-x11-server-Xvfb xorg-x11-xauth xorg-x11-utils

    Also, ensure xvfb-run is available (some Fedora base containers may not include it by default).

    ⸻

    1. Use xvfb-run with explicit Java invocation

    Rather than using ./pcgen.sh directly, run the Java command explicitly via xvfb-run. PCGen’s shell script often wraps Java internally, which can interfere with environment vars.

    Example:

    xvfb-run java -jar pcgen.jar

    Or if PCGen uses a main class and classpath:

    xvfb-run java -cp .:path/to/libs/* pcgen.core.Main

    ⸻

    1. Confirm DISPLAY is available inside xvfb-run

    To verify that DISPLAY is being set properly inside xvfb-run, you can debug like this:

    xvfb-run bash -c 'echo $DISPLAY; java -jar pcgen.jar'

    If DISPLAY is blank or not a valid X11 socket, then xvfb-run isn’t initializing correctly.

    ⸻

    1. Add -Djava.awt.headless=false

    Sometimes Java assumes a headless environment unless explicitly told otherwise:

    xvfb-run java -Djava.awt.headless=false -jar pcgen.jar

    ⸻

    1. Try with Xephyr or a nested X session as a workaround

    If xvfb-run continues to fail, as a fallback, run PCGen in a nested X server like Xephyr. From host:

    Xephyr :1 -screen 1024x768 &

    Then in your toolbox:

    export DISPLAY=:1
    java -Djava.awt.headless=false -jar pcgen.jar

    ⸻

    🧪 Test Outside Toolbox

    Just to isolate whether it’s the Toolbox container causing the problem, try running the same xvfb-run command directly on Silverblue (outside toolbox). If it works there, the issue likely stems from isolation, permissions, or X11 socket access inside the container.

    ⸻

    🛠 Bonus: Check for X11 libs

    Ensure your toolbox container has X11 libraries needed for GUI applications:

    sudo dnf install libXrender libXext libXtst libXi

    ⸻

    Let me know what you get when you try xvfb-run java -Djava.awt.headless=false -jar pcgen.jar — that’s usually the most direct workaround.

  2. Tealk commented on May 26, 2025

    @Tealk
    Author

    xorg seems to be already installed:

    Failed to resolve the transaction:
    Package "xorg-x11-server-Xvfb-21.1.16-1.fc42.x86_64" is already installed.
    Package "xorg-x11-xauth-1:1.1.3-3.fc42.x86_64" is already installed.
    No match for argument: xorg-x11-utils
    

    I don't know exactly why it no longer works. Some time ago I was still able to start it

    xvfb-run bash -c 'echo $DISPLAY; java -jar pcgen.jar'
    :99
    17:08:30.54 INFO main Main:138 Starting PCGen v6.08.00 RC8
    17:08:30.76 INFO main LanguageBundle:134 Initialising language bundle with locale en_US.
    17:08:30.104 SEVERE main Main:484 Uncaught error - ignoring
    java.awt.HeadlessException: 
    No X11 DISPLAY variable was set,
    or no headful library support was found,
    but this program performed an operation which requires it,
    
    	at java.desktop/sun.awt.HeadlessToolkit.getScreenSize(HeadlessToolkit.java:186)
    	at pcgen.gui2.plaf.LookAndFeelManager.initLookAndFeel(LookAndFeelManager.java:142)
    	at pcgen.system.Main.configureUI(Main.java:273)
    	at pcgen.system.Main.startupWithGUI(Main.java:228)
    	at pcgen.system.Main.main(Main.java:157)
    
  3. karianna commented on May 27, 2025

    @karianna
    Contributor

    @Tealk Did you try the other 4 diagnosis steps? What was the outcome of those?

  4. Tealk commented on May 27, 2025

    @Tealk
    Author

    yes:

    xvfb-run java -Djava.awt.headless=false -jar pcgen.jar
    Exception in thread "main" java.lang.UnsatisfiedLinkError: Can't load library: /usr/lib/jvm/java-21-openjdk/lib/libawt_xawt.so
    	at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2422)
    	at java.base/java.lang.Runtime.load0(Runtime.java:852)
    	at java.base/java.lang.System.load(System.java:2025)
    	at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
    	at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:331)
    	at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:197)
    	at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:139)
    	at java.base/jdk.internal.loader.NativeLibraries.findFromPaths(NativeLibraries.java:259)
    	at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:249)
    	at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2427)
    	at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:916)
    	at java.base/java.lang.System.loadLibrary(System.java:2063)
    	at java.desktop/java.awt.Toolkit$2.run(Toolkit.java:1384)
    	at java.desktop/java.awt.Toolkit$2.run(Toolkit.java:1382)
    	at java.base/java.security.AccessController.doPrivileged(AccessController.java:319)
    	at java.desktop/java.awt.Toolkit.loadLibraries(Toolkit.java:1381)
    	at java.desktop/java.awt.Toolkit.initStatic(Toolkit.java:1419)
    	at java.desktop/java.awt.Toolkit.<clinit>(Toolkit.java:1393)
    	at pcgen.util.Logging.<clinit>(Logging.java:51)
    	at pcgen.system.Main.main(Main.java:138)
    
  5. karianna commented on May 29, 2025

    @karianna
    Contributor

    Really not sure in that case sorry :-(

  6. xrogaan commented on Aug 9, 2025

    @xrogaan

    You say you use OpenJDK 17, but that last post refer to OpenJDK 21. Do you perhaps have a misconfigured java install?

  7. Tealk commented on Aug 9, 2025

    @Tealk
    Author

    The current version of Java in the Fedora toolbox:

    java -version
    openjdk version "21.0.7" 2025-04-15
    OpenJDK Runtime Environment (Red_Hat-21.0.7.0.6-1) (build 21.0.7+6)
    OpenJDK 64-Bit Server VM (Red_Hat-21.0.7.0.6-1) (build 21.0.7+6, mixed mode, sharing)
    

    However, I was able to work around the problem by using the distro box with a Debian VM. I installed Java 11 there.

    java -version
    openjdk version "11.0.28" 2025-07-15 LTS
    OpenJDK Runtime Environment Corretto-11.0.28.6.1 (build 11.0.28+6-LTS)
    OpenJDK 64-Bit Server VM Corretto-11.0.28.6.1 (build 11.0.28+6-LTS, mixed mode)
    
  8. xrogaan commented on Aug 9, 2025

    @xrogaan

    Works fine for me through OpenJDK 17. Either RedHat's OpenJDK does weird things or Java 21 can't run the software.

  9. xrogaan commented on Aug 13, 2025

    @xrogaan

    Hello, update on OpenJDK 21: I upgraded my distro and now run OpenJDK 21 (debian). No issue in sight. So it may just be Red Hat's flavor that is problematic, or a user issue.

    To be certain, could @Tealk try out termurin's OpenJDK? https://adoptium.net/installation/linux#centosrhelfedora-instructions

  10. CodePhase commented on Jun 12, 2026

    @CodePhase
    Contributor

    I just came across this in my new Fedora 44 install. It turns out that by default Fedora 44 only installs the headless version of openjdk. I had to
    sudo dnf install java-25-openjdk
    to get it working. Not sure how you do that in Silverblue but hopefully that helps.

  11. Vest commented on Jun 15, 2026

    @Vest
    Contributor

    @CodePhase, can you please try to check with master a command ./gradlew run?
    I think, I have changed the build script in a way that the downloaded JDK is used for running the app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions