atlassian / docker-chromium-xvfb

Docker image for running browser tests against headless Chromium
MIT License
398 stars 125 forks source link

extension "RANDR" missing on display ":99". #10

Open joelmaranhao opened 8 years ago

joelmaranhao commented 8 years ago

Hello there.

Trying Docker and your image for the first time, so please bear with, I may have not got it right So here is what I've done after installing Docker on Ubuntu and installed your image

sudo docker run -i -t markadams/chromium-xvfb /bin/bash

after what I have checked the Chromium browser

root@6f8cc76b7173:/app# which chromium-browser
/usr/bin/chromium-browser

root@6f8cc76b7173:/app#  ls -al /usr/bin/chromium-browser
lrwxrwxrwx 1 root root 22 Apr  7 19:30 /usr/bin/chromium-browser -> /usr/bin/xvfb-chromium

Errors when starting Chromium

root@6f8cc76b7173:/app# chromium-browser 
[119:119:0414/140658:ERROR:browser_main_loop.cc(217)] Running without the SUID sandbox! See https://chromium.googlesource.com/chromium/src/+/master/docs/linux_suid_sandbox_development.md for more information on developing with the sandbox on.
Xlib:  extension "RANDR" missing on display ":99".
[130:130:0414/140659:ERROR:image_metadata_extractor.cc(114)] Couldn't load libexif. libexif.so.12: cannot open shared object file: No such file or directory
[119:132:0414/140659:ERROR:bus.cc(432)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
[119:132:0414/140659:ERROR:bus.cc(432)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
Xlib:  extension "RANDR" missing on display ":99".
[119:119:0414/140659:ERROR:desktop_window_tree_host_x11.cc(891)] Not implemented reached in virtual void views::DesktopWindowTreeHostX11::InitModalType(ui::ModalType)
[161:161:0414/140659:ERROR:sandbox_linux.cc(334)] InitializeSandbox() called with multiple threads in process gpu-process
[119:143:0414/140659:ERROR:browser_gpu_channel_host_factory.cc(145)] Failed to create channel.

Note the extension "RANDR" missing on display ":99".

then Couldn't load libexif

and Failed to connect to socket

are these none critical errors?

suojian commented 8 years ago

I have same error, do you have a solution ?

annalifatou commented 8 years ago

Can you try xvfb-run ?

http://tobyho.com/2015/01/09/headless-browser-testing-xvfb/

mark-adams commented 8 years ago

That's strange. I did the following and didn't have issues:

git clone mark-adams/docker-chromium-xvfb
cd docker-chromium-xvfb/samples/python3
docker build -t sample-py3 .

Then I run docker run sample-py3 and get the following:

============================= test session starts ==============================
platform linux -- Python 3.4.2, pytest-2.9.1, py-1.4.31, pluggy-0.3.1
rootdir: /usr/src/app, inifile: setup.cfg
collected 1 items

test_google.py .

--------- generated xml file: /usr/src/app/test-results/results.py.xml ---------
=========================== 1 passed in 3.72 seconds ===========================

This indicates that everything is working fine.

Cronax42 commented 8 years ago

@mark-adams I'm running into a similar issue.

I'm attempting to use the container as a base, to run my own selenium tests in (technically they are Robot Framework tests using selenium2library but for the purposes of this issue there should be no difference).

When I run the sample test it works fine, but as soon as I try my own test scripts, they cannot open a chrome instance.

For debugging, I tried to manually start 'google-chrome' in the docker, but errors start to occur:

[19:19:0825/100745:ERROR:browser_main_loop.cc(231)] Running without the SUID sandbox! See https://chromium.googlesource.com/chromium/src/+/master/docs/linux_suid_sandbox_development.md for more information on developing with the sandbox on.
Xlib:  extension "RANDR" missing on display ":99".
[19:28:0825/100745:ERROR:bus.cc(432)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
Xlib:  extension "RANDR" missing on display ":99".
[19:19:0825/100745:ERROR:desktop_window_tree_host_x11.cc(901)] Not implemented reached in virtual void views::DesktopWindowTreeHostX11::InitModalType(ui::ModalType)
libudev: udev_has_devtmpfs: name_to_handle_at on /dev: Operation not permitted
[19:39:0825/100746:ERROR:browser_gpu_channel_host_factory.cc(131)] Failed to create channel.

The errors lead me to suspect that there's a permission issue somewhere, but so far I'm unable to get to the root of the issue.

mark-adams commented 8 years ago

@Cronax42 Which image are you using as your base image?

Cronax42 commented 8 years ago

@mark-adams I'm using the Python2 image without onbuild.

srosato commented 8 years ago

I do not know if that helps, but I had this error myself, but after searching on google, I saw that those were mostly warnings. So I ran the container, installed x11vnc in order to give myself a vncserver and ran x11vnc -display :99. I exposed the port 5900 and installed vncviewer on my host machine.

I could then connect using vncviewer localhost:5900 in order to see what was going on with the chrome instance. It was opened with a warning telling me Please start Chromium as a normal user. If you have previously run Chromium as a root, you will need to change the ownership of your profile directory..

I did not want to bother creating a new user, therefore I modified the custom script /usr/bin/google-chrome to include the command chromium --user-data-dir=/chrome-data --no-sandbox $@ &.

mark-adams commented 8 years ago

Super strange. I just ran: docker run -it -v /home/mark/src/github.com/mark-adams/docker-chromium-xvfb/samples/python2:/usr/src/app markadams/chromium-xvfb-py2 py.test and the test passed fine. (obviously your path /home/mark/... would be different)

Have you pulled the latest image? docker pull markadams/chromium-xvfb-py2

Also, what version of Docker are you running? I'm running 1.12.1

srosato commented 8 years ago

I think --user-data-dir not being specified is the problem. I might be wrong, but I use your base image with Karma and when I look at Karma, it tries to launch google-chrome using the --user-data-dir argument. Therefore, when using the markadams/chromium-xvfb as a standalone image, it will fail to launch chrome because it misses that argument. I had to bonify the xvfb-chromium script with the --user-data-dir=/somedir argument. It might be the same with the Python image? Maybe it already specifies the user-data-dir when launching chrome?

kilpatty commented 7 years ago

For what it's worth I'm having this exact same issue

mark-adams commented 7 years ago

@Skilgarriff Can you provide any additional details? What does your Dockerfile look like? What command are you running? Are you running a particular script?

dmitrym0 commented 7 years ago

--no-sandbox did for me. I hacked up the google-chrome script to include it.