sysbox icon indicating copy to clipboard operation
sysbox copied to clipboard

VNC (X Server, Guacd, Guacamole) does not work after installing sysbox on docker host

Open rubenanapu opened this issue 2 years ago • 7 comments

I'm used to launching 4 containers (VNC + Guacd + Guacamole + AnotherContainer) and I can launch a graphical app in AnotherContainer, and I can always visualize it, either directly connecting to VNC or through Guacamole.

However, since I installed sysbox in the Docker Host, the graphical tools doesn't work as expect anymore.

If I put runtime: sysbox-runc in the docker-compose file, when I try to run a graphical app it says it cannot connect to the DISPLAY.

But If I remove runtime: sysbox-runc from the docker-compose file, I can launch graphical things but parts of the window are missing.

I tested installing sysbox on a docker host that runs Ubuntu 18.04, and also on another host that runs Ubuntu 20.04 but the problem happens in both cases.

Has anybody else experienced this? If so, how did you solve it?

In the image below we can see an example of gazebo on the left, and rviz on the right, that are not shown properly.

rviz-and-gazebo

rubenanapu avatar Aug 23 '21 12:08 rubenanapu

@rubenanapu, thanks for reporting this.

I can think of a couple of issues that may explain what you are observing when you make use of "sysbox-runc" in your docker-compose file. But none of that would explain your second issue: parts of the window are missing when you don't use sysbox-runc.

Let's step back for a sec and try to understand your scenario in more details. Can you please share your docker-compose file to help me reproduce the issue locally?

Thanks.

rodnymolina avatar Aug 23 '21 16:08 rodnymolina

Hi @rodnymolina ,

sure. This is the docker-compose.yml file you can use to reproduce the issue:

version: '3'

services:
  vnc:
    image: x11vnc/desktop:latest
    container_name: vnc
    hostname: vnc
    ports:
      - 5901:5901
      - 6901:6901
      - 6080:6080
    volumes:
      - x11_volume:/tmp/.X11-unix:rw
    command:
      - sudo chown -R ubuntu:ubuntu /tmp/.X11-unix && /sbin/my_init --quiet -- /sbin/setuser ubuntu && startvnc.sh >> /home/ubuntu/.log/vnc.log

  ros:
    image: osrf/ros:noetic-desktop-full
    container_name: ros
    hostname: ros
    environment:
      - "QT_X11_NO_MITSHM=1"  #fix some QT bugs
      - DISPLAY=:0
    volumes:
      - x11_volume:/tmp/.X11-unix:rw
    depends_on:
      - vnc
    entrypoint: [ "/bin/bash", "-c" ]
    command:
      - source /opt/ros/noetic/setup.bash && stdbuf -o L roslaunch gazebo_ros empty_world.launch --screen

volumes:
  x11_volume:

I normally do the following:

  1. Stop any existing container of this docker-compose with: docker-compose down
  2. Remove any volume named x11_volume with:

docker volume rm -f $(docker volume ls --filter 'name=x11_volume' -q)

  1. Start the containers with: docker-compose up

After starting the containers, you should see the vnc container printing something like this:

vnc | Open your web browser with URL: vnc | http://localhost:6080/vnc.html?resize=downscale&autoconnect=1&password=ueuO4Apd

You can then open that URL in your browser in order to see the Graphical Tools. The URL/password will be different each time you run docker-compose up. You should also repeat the 3 steps each time you want to run docker-compose up just to make sure you will be able to access the Graphical Tools using the web browser.

When you open the web browser, you will see something like this: x11-broken-with-sysbox

Before installing sysbox, the way it originally works is like this:

before-sysbox-ce

Please let me know if I can help you diagnose it in any other way.

rubenanapu avatar Nov 18 '21 00:11 rubenanapu

You are setting DISPLAY=:0 and share /tmp/.X11-unix for the ros container. Sharing an X unix socket does not work yet with sysbox, compare #272. A possible solution is to use X over TCP with x11docker to avoid using a unix socket. Compare #452.

mviereck avatar Jan 06 '22 21:01 mviereck

I have tested the current master version of Sysbox / upcoming version 0.5.0. The issue above should be solved with it. Sharing unix sockets is no longer a problem with new kernel feature of id-mapped mounts (kernel version >=5.12). Previous shiftfs failed with this.

mviereck avatar Mar 06 '22 12:03 mviereck

Hi @rubenanapu , let us know if you would like to try the upcoming v0.5.0 version please. We are likely going to post a beta version of it on the repo very soon.

ctalledo avatar Mar 07 '22 05:03 ctalledo

Hi @mviereck, @ctalledo, and @rodnymolina

First, Congratulations to the Nestybox team for integrating the Docker, Inc, as announced yesterday in the blog.

Now, back to technical talks, I've just installed nestybox on Ubuntu 22.04, which has the kernel 5.15.0-1004-aws and I'm still having the problem in which parts of the screen are black.

At least one of the problems described in the issue was solved:

  • When I add runtime: sysbox-runc to the docker-compose.yaml file, at least now I do not have that error which says it cannot connect to the DISPLAY.

But as I mentioned, just for you to know, some parts of the screen/application are still not shown with and without runtime: sysbox-runc in the docker-compose.yaml file. (the black in the background is ok because it is a terminal, but the black in the Gazebo window is still a problem):

Gazebo-still-black

Update

I then uninstalled sysbox, restarted the PC and installed sysbox again, and the problem of not connecting to DISPLAY appeared again. The errors are when starting rviz after connecting to the ros container with docker exec -it ros bash:

root@ros:/# rviz 
qt.qpa.xcb: could not connect to display :0
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.

Aborted (core dumped)

and also when starting gazebo:

root@ros:/# gazebo --verbose 
Gazebo multi-robot simulator, version 11.10.2
Copyright (C) 2012 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org

[Msg] Waiting for master.
Gazebo multi-robot simulator, version 11.10.2
Copyright (C) 2012 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org

[Msg] Waiting for master.
[Msg] Connected to gazebo master @ http://127.0.0.1:11345
[Msg] Publicized address: 172.25.1.3
[Err] [RenderEngine.cc:749] Can't open display: :0
[Wrn] [RenderEngine.cc:89] Unable to create X window. Rendering will be disabled
[Wrn] [RenderEngine.cc:292] Cannot initialize render engine since render path type is NONE. Ignore this warning ifrendering has been turned off on purpose.
[Msg] Loading world file [/usr/share/gazebo-11/worlds/empty.world]
[Msg] Connected to gazebo master @ http://127.0.0.1:11345
[Msg] Publicized address: 172.25.1.3
[Err] [RenderEngine.cc:749] Can't open display: :0
[Wrn] [RenderEngine.cc:89] Unable to create X window. Rendering will be disabled
[Wrn] [RenderEngine.cc:292] Cannot initialize render engine since render path type is NONE. Ignore this warning ifrendering has been turned off on purpose.
[Wrn] [GuiIface.cc:120] could not connect to display :0
[Msg] Could not load the Qt platform plugin "xcb" in "" even though it was found.
[Err] [GuiIface.cc:124] 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. 

rubenanapu avatar May 11 '22 13:05 rubenanapu

I am not sure, but I suspect an issue with graphic card drivers. What graphic card is installed in your computer? Unfortunately sysbox cannot share the device files yet.

It might help to use a not accelerated X server that uses software rendering only.

A possible test setup:

  • Install Xephyr
  • Run e.g. Xephyr :1
  • Set DISPLAY=:1 instead of DISPLAY=:0

If that helps, you could use x11docker to improve the setup.

mviereck avatar May 11 '22 18:05 mviereck