Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't connect to X11 (Ubuntu 22.04.3 LTS) #16

Open
Utopiah opened this issue Feb 27, 2024 · 8 comments
Open

can't connect to X11 (Ubuntu 22.04.3 LTS) #16

Utopiah opened this issue Feb 27, 2024 · 8 comments

Comments

@Utopiah
Copy link

Utopiah commented Feb 27, 2024

Failed to initialize graphics environment

java.awt.AWTError: Can't connect to X11 window server using ':0' as the value of the DISPLAY variable.

(base) utopiah@r15-desktop4090:~/Prototypes/android-studio-docker$ echo $DISPLAY
:0

with in compose.yml having

       # Mount the proper locationm for x11 server if you are running this in native linux
      - /tmp/.X11-unix:/tmp/.X11-unix .
      - android_studio:/androidstudio-data
    environment:
      - DISPLAY=:0 # Set DISPLAY environment variable
@Utopiah
Copy link
Author

Utopiah commented Mar 1, 2024

Same error on Ubuntu 23.10

@Utopiah
Copy link
Author

Utopiah commented Mar 1, 2024

I tried xhost + or adding in $HOME/.bash_profile

JAVA_OPTIONS=-Djava.awt.headless=true
export JAVA_OPTIONS

but same result.

@Deadolus
Copy link
Owner

Deadolus commented Mar 4, 2024

The error tells you that you can't connect to the display server.
Usually, the server listens on :0, but this could also be some other variable.
What does your shell (not inside docker!) DISPLAY environment variable say?

@Utopiah
Copy link
Author

Utopiah commented Mar 4, 2024

That's what I thought which is why I shared

echo $DISPLAY
:0

isn't it matching?

@Utopiah
Copy link
Author

Utopiah commented Mar 4, 2024

Not sure if it makes a difference in that case but I run docker here as a user, not as root.

@Deadolus
Copy link
Owner

Deadolus commented Mar 4, 2024

Not sure if it makes a difference in that case but I run docker here as a user, not as root.

That should not make a difference.
Make sure you are running x11, not wayland mabe?
Maybe some problem with your .xauthority file not allowing access to the x11 server?
Sorry can't help here, I am also no display server expert.

@Deadolus Deadolus changed the title can't conenct to X11 (Ubuntu 22.04.3 LTS) can't connect to X11 (Ubuntu 22.04.3 LTS) Mar 4, 2024
@Utopiah
Copy link
Author

Utopiah commented Mar 4, 2024

Seems so :

fabien@fabien-CORSAIR-ONE-i160:~$ echo $XDG_SESSION_TYPE
x11

No worries I'll investigate https://stackoverflow.com/questions/44429394/x11-forwarding-of-a-gui-app-running-in-docker and report here!

@mihalycsaba
Copy link

@Utopiah I assume you use wayland try running this in the terminal 'xhost + local:' works on gnome

@Deadolus maybe this can be added in the run.sh for wayland?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants