microsoft/WSL

Google Chrome (headless) errors

lfurzewaddock opened this issue ยท 13 comments

  • Your Windows build number: (Type ver at a Windows Command Prompt)

MS Win Version: 10.0.17134 Build 17134

  • What you're doing and what's happening: (Copy&paste specific commands and their output, or include screen shots)

$ google-chrome --headless --disable-gpu --dump-dom https://www.chromestatus.com/

output

[0606/230417.381147:ERROR:gpu_process_transport_factory.cc(1017)] Lost UI shared context.

Yeah, this one is happening with folks on headless Real Linux (f.e. a Docker container) too, like here. I was able to get the following to work:

$ google-chrome --no-gpu --no-sandbox --disable-setuid-sandbox --headless --dump-dom http://www.chromestatus.com

But YRMV. This was with Chrome 67.0.3396.79 and 68.0.3440.15. Unfortunately there isn't much in the way of a WSL actionable here. You could start looking for a diverge against a headless Real Linux VM with a CONFIG_DRM=n kernel, but smart money says you'll get the same result there too.

One more data point, since it is bound to come up eventually. On 17686 and 67.0.3396.79, headfull Chrome fails thus:

$ google-chrome
Failed to move to new namespace: PID namespaces supported, Network namespace supported, but failed: errno = Permission denied
Failed to generate minidump.Illegal instruction (core dumped)

I haven't dug into it, but the error message by itself is curious because (AFAIK) we don't have network namespaces. What might be happening here is Chrome is getting confused by the WSL's unusual set of supported / unsupported namespace features. If that's the case it might well run in a headless VM, but who knows without trying.

Network namespaces are supported, but only when you are running elevated, which puts them somewhere in the partially supported WSL feature category. This is because Windows actually supports a concept much like a Linux network namespace, but just as Linux requires 'sudo' to use them due to the side-effects, Windows requires elevated admin privileges. This is not ideal, and from the beginning there have been suggestions to integrate sudo better, but currently the only option is to run elevated.

I had wondered but didn't have my container thing handy to try (hence the hedge). That run above wasn't elevated of course, but Chrome is under the impression network namespace available anyway. The message doesn't mean much though, since by that point Chrome has skidded off the track and probably doesn't know up from down.

But yep, recent Chrome (headless and otherwise) works fine if you start WSL escalated. So there's your work-around.

That UserVoice you mention is more about people annoyed by the popup notification. Mapping WSL UID 0 to Windows Administrator privileges is another matter. I empathise entirely that the problem worms real fast. I've just about got WSL nmap running and understand the dilemma. But the more surface you guys cover, the higher the risk that "You need to run WSL as Administrator or it doesn't work right" becomes idiomatic. Which is classic security anti-pattern.

This wasn't as much of a problem back in 2016 when the only thing people reasonably expected to work was ping. If people start using WSL elevated just so they can run their webpage test scripts, that gets more ugly.

One more data point, since it is bound to come up eventually. On 17686 and 67.0.3396.79, headfull Chrome fails thus

I see this same "Failed to move to new namespace ... Permission denied" error from Chrome 71 on Windows 1809 (17763) with Ubuntu 18.04. For headfull, a workaround is to pass "--no-sandbox".

I got the following error for passing the "--no-sandbox"
[0602/230132.465909:ERROR:nacl_helper_linux.cc(310)] NaCl helper process running without a sandbox! Most likely you need to configure your SUID sandbox correctly
Can somebody help?

I have what appears to be a problem related to the issue reported here. I'm attempting to use Chromedriver under WSL (I'm using Ubuntu 18.04) to run headless tests under Rails/Cucumber/Capybara/Selenium.

My environment:

  • Operating system / CI Environment: Microsoft Windows [Version 10.0.18362.239] with WSL running Ubuntu 18.04 [Linux version 4.4.0-18362-Microsoft (Microsoft@Microsoft.com) (gcc version 5.4.0 (GCC) ) #1-Microsoft Mon Mar 18 12:02:00 PST 2019]
  • Ruby/Rails version: 2.6.1p33 (2019-01-30 revision 66950) [x86_64-linux]/5.2.3
  • Browser and version: Google Chrome 75.0.3770.100
  • Webdrivers::Chromedriver.required_version = '75.0.3770.140'
      unknown error: Chrome failed to start: crashed
        (unknown error: DevToolsActivePort file doesn't exist)
        (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.) (Selenium::WebDriver::Error::UnknownError)
      #0 0x7f8211ae07a9 <unknown>

I'm running Chrome in this case with the flags headless single-process no-gpu no-sandbox disable-setuid-sandbox, but have also tried disable-gpu proxy-server="direct://" disable-dev-shm-usage proxy-bypass-list="*", all to no effect.

For above issue on WSL1 it was enough to run WSL as admin or use sudo and after chrome with specific options.

Without admin or sudo:

$ google-chrome 
Failed to move to new namespace: PID namespaces supported, Network namespace supported, but failed: errno = Permission denied
Trace/breakpoint trap (core dumped)

The solution is to run WSL as admin or use sudo:

$ sudo google-chrome -v
(google-chrome:12596): Gtk-WARNING **: 15:07:50.906: cannot open display:        

This warning is ok because we will run chrome with following options:

$ google-chrome --no-sandbox --disable-gpu --disable-features=VizDisplayCompositor --headless --dump-dom https://www.chromestatus.com

For what it's worth Firefox (sync not working with duo but that is a firefox issue not wsl), Arora, Dillo all working fine within WSL1
(chromium seems to start but then all the extensions crash and recrash, over and over again)
firefox-working-inside-wsl1-ubuntu-1804

For me I just keep getting this when trying to run --headless:

[0320/115638.849509:WARNING:gpu_process_host.cc(1165)] The GPU process has crashed 1 time(s)
[0320/115638.996520:WARNING:gpu_process_host.cc(1165)] The GPU process has crashed 2 time(s)
[0320/115639.147790:WARNING:gpu_process_host.cc(1165)] The GPU process has crashed 3 time(s)
[0320/115639.249479:WARNING:gpu_process_host.cc(1165)] The GPU process has crashed 4 time(s)
[0320/115639.349025:WARNING:gpu_process_host.cc(1165)] The GPU process has crashed 5 time(s)
[0320/115639.451006:WARNING:gpu_process_host.cc(1165)] The GPU process has crashed 6 time(s)
[0320/115639.451038:FATAL:gpu_data_manager_impl_private.cc(1034)] The display compositor is frequently crashing. Goodbye.
Failed to generate minidump.Illegal instruction (core dumped)

Ironically I've been able to get non-headless (headful?) working, but headless would be better for testing :/

For me I just keep getting this when trying to run --headless:

[0320/115638.849509:WARNING:gpu_process_host.cc(1165)] The GPU process has crashed 1 time(s)
[0320/115638.996520:WARNING:gpu_process_host.cc(1165)] The GPU process has crashed 2 time(s)
[0320/115639.147790:WARNING:gpu_process_host.cc(1165)] The GPU process has crashed 3 time(s)
[0320/115639.249479:WARNING:gpu_process_host.cc(1165)] The GPU process has crashed 4 time(s)
[0320/115639.349025:WARNING:gpu_process_host.cc(1165)] The GPU process has crashed 5 time(s)
[0320/115639.451006:WARNING:gpu_process_host.cc(1165)] The GPU process has crashed 6 time(s)
[0320/115639.451038:FATAL:gpu_data_manager_impl_private.cc(1034)] The display compositor is frequently crashing. Goodbye.
Failed to generate minidump.Illegal instruction (core dumped)

Ironically I've been able to get non-headless (headful?) working, but headless would be better for testing :/

I got the same error when running --headless.

Any hints on how did you get it to run non-headless? I failed with either non-headless or headless. For non-headless mode, I did

google-chrome-stable --no-sandbox

# [31222:31222:0330/125021.842748:ERROR:edid_parser.cc(102)] Too short EDID data: manufacturer id
# [31222:31256:0330/125021.846515:ERROR:udev_watcher.cc(61)] Failed to enable receiving udev events.
# [31222:31271:0330/125021.914188:ERROR:bus.cc(393)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
# [31222:31271:0330/125021.932517:ERROR:bus.cc(393)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
# [31222:31271:0330/125021.932559:ERROR:bus.cc(393)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
# [31222:31317:0330/125022.062926:ERROR:object_proxy.cc(632)] Failed to call method: org.freedesktop.DBus.Properties.Get: object_path= /org/freedesktop/UPower: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UPower was not provided by any .service files
# [31222:31317:0330/125022.063941:ERROR:object_proxy.cc(632)] Failed to call method: org.freedesktop.UPower.GetDisplayDevice: object_path= /org/freedesktop/UPower: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UPower was not provided by any .service files
# [31222:31317:0330/125022.065537:ERROR:object_proxy.cc(632)] Failed to call method: org.freedesktop.UPower.EnumerateDevices: object_path= /org/freedesktop/UPower: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UPower was not provided by any .service files
# [31267:31267:0330/125022.196704:ERROR:viz_main_impl.cc(161)] Exiting GPU process due to errors during initialization
# [31222:31255:0330/125022.337900:FATAL:scoped_file.cc(43)] : Bad file descriptor (9)
# [0330/125022.338439:ERROR:nacl_helper_linux.cc(308)] NaCl helper process running without a sandbox!
# Most likely you need to configure your SUID sandbox correctly
# [1]    31222 trace trap (core dumped)  google-chrome-stable --no-sandbox

Any hints on how did you get it to run non-headless?

I realised after posting this that I didn't actually manage to get it running properly in headful: it would sometimes render initially, but I could never get it to load any webpages - the tabs would just always crash ๐Ÿ˜ข

Is there anything new on this? :'(

Impossible to run google-chrome in my Ubuntu 18.04.5 LTS with WSL 1.