ericspod/DicomBrowser

qt.qpa.screen: QXcbConnection: Could not connect to display :0

Pablohn26 opened this issue · 7 comments

Hi,

I am trying to run this software. I am using the dockerfile to build an image but I cannot run it with provided instructions.

After a few fixes (that I do not know if they are ok to be honest), when I run the container I get the following error:

sudo docker run -ti --rm --net=host --env="DISPLAY" --volume="$HOME/.Xauthority:/root/.Xauthority:rw" dicombrowser
QStandardPaths: XDG_RUNTIME_DIR points to non-existing path '/run/user/1000', please create it with 0700 permissions.
No protocol specified
qt.qpa.screen: QXcbConnection: Could not connect to display :0
Could not connect to any X display.

OS: Fedora 30

Hi, I encountered a problem like this before and neglected to commit fixes until now. The PyQt issues should be resolved. Your docker command might have a problem with being run as sudo perhaps. I have rebuilt the image on Unbunt 16.04 and ran it with the command you have with and without sudo and can't reproduce the problem. In the Dockerfile, just before the CMD line, add RUN lines to create the directory explicitly and set its permissions:

RUN mkdir -p /run/user/1000
RUN chmod 0700 /run/user/1000

See if that fixes the issue, I can update the Dockerfile if so

Now I am using Debian 10 (buster) and I am still getting a similar error but with different values:

sudo docker run -ti --rm --net=host --env="DISPLAY" --volume="$HOME/.Xauthority:/root/.Xauthority:rw" dicombrowser
[sudo] password for pablo: 
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
No protocol specified
qt.qpa.screen: QXcbConnection: Could not connect to display :1
Could not connect to any X display.

When I repeat you steps from Fedora I will let you know.

I wonder if your $DISPLAY variable is set to a different screen, try:

sudo docker run -ti --rm --net=host -e DISPLAY=:0 --volume="$HOME/.Xauthority:/root/.Xauthority:rw" dicombrowser

Still not working:

pablo@torrevalde:~$ sudo docker run -ti --rm --net=host -e DISPLAY=:0 --volume="$HOME/.Xauthority:/root/.Xauthority:rw" dicombrowser
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
No protocol specified
qt.qpa.screen: QXcbConnection: Could not connect to display :0
Could not connect to any X display.
pablo@torrevalde:~$ sudo echo $DISPLAY
:1
pablo@torrevalde:~$ echo $DISPLAY
:1
pablo@torrevalde:~$  sudo docker run -ti --rm --net=host -e DISPLAY=:1 --volume="$HOME/.Xauthority:/root/.Xauthority:rw" dicombrowser
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
No protocol specified
qt.qpa.screen: QXcbConnection: Could not connect to display :1
Could not connect to any X display.

It's perhaps a permission issue? Does running xhost +local:docker before docker run help? I managed to duplicate something like your error and this was the solution. I would also suggest following the post install steps for being able to run Docker without sudo.

Sorry @ericspod for my late response.

I have tried again from scratch on my personal computer (Fedora) and now it is running just with docker build and docker run (no need of xhost command, I do not know why). I have seen your suggestion on your comment and here 6a3709a and for now you can set this issue as fixed.

In addition, I will try in two debian computers to be sure your instructions work on debian too.

Just for information, xhost +local:docker fixed my problem on Debian

pablo@torrevalde:~/test/DicomBrowser$ sudo docker run -ti --rm --net=host --env="DISPLAY" --volume="$HOME/.Xauthority:/root/.Xauthority:rw" dicombrowser
No protocol specified
qt.qpa.xcb: could not connect to display :1
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.

pablo@torrevalde:~/test/DicomBrowser$ xhost +local:docker
non-network local connections being added to access control list
pablo@torrevalde:~/test/DicomBrowser$ sudo docker run -ti --rm --net=host --env="DISPLAY" --volume="$HOME/.Xauthority:/root/.Xauthority:rw" dicombrowser
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
libGL error: MESA-LOADER: failed to open swrast (search paths /usr/lib/xorg/modules/dri)
libGL error: failed to load driver: swrast