WSL: Chrome fails to launch

  • A brief description

Chrome fails to launch.

  • Your Windows build number

10.0.14385

  • Commands required to reproduce the error
/usr/bin/google-chrome
  • Strace of the failing command

https://gist.githubusercontent.com/Manouchehri/da19ce4b9874c0a893210fa509fc1a33/raw/5fea50f4e81233e1cbe65ccdd92a295352ae9197/strace-chrome-wsl-fail.txt

  • Required packages and commands to install
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo apt-get update
sudo apt-get install google-chrome-unstable

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 93 (15 by maintainers)

Most upvoted comments

Chrome now works out of the box with sandbox on 16273 thanks to @benhillis work in #2242. There are a couple of caveats (there are always caveats). First, the pthread_mutex_unlock(&m->mutex) fail (which is #486) will still trigger if you have pulse audio installed. Which you do, if you installed the whole ubuntu-desktop meta package. This had me confused earlier as well (see the strikeout). There are two ways around. One is to push though it with the PulseAudio 8 PPA. The other is to purge pulse from your system. I’d recommend the latter.

The other caveat, which is of the soft variety, is that chrome would really rather be living in an environment with a functioning dbus and opengl (ie mesa llvmpipe). Putting it all together, something like the following should get you there:

sudo update && sudo apt upgrade
sudo apt install ubuntu-desktop wget mesa-utils
sudo apt purge pulseaudio libpulse0 && sudo apt autoremove
wget https://dl.google.com/linux/direct/google-chrome-unstable_current_amd64.deb
sudo dpkg -i google-chrome-unstable_current_amd64.deb
sudo apt -f install           # probably
export DISPLAY=localhost:0
export NO_AT_BRIDGE=1
exec dbus-run-session -- bash
sudo service dbus start
google-chrome-unstable        # look mom, no flags

And there you have it.

Hey,

Sorry to revive already closed issue, but haven’t wanted to create another issue for basically same problem.

I’d like to just point out that this issue is connected not only with Chrome, but also with any other application using Chromium engine - including any Electron application.

This last group includes popular text editors such as Atom… and amazing MSFT product - VS Code. It would be really nice if you’ve reconsider fixing this issue to support development tools created by other teams in Microsoft. 😃

Best regards, Chris.

I should add that the Mozilla people deserve a big kudos for writing sane portable posix code #481. Chrome has no business firing up a file watcher, having a whole IP address tracking subsytem, or poking around /proc. It’s a browser, Google.

I get this error in wsl when I run google-chrome

[1023/204234.433299:ERROR:exception_handler_server.cc(361)] getsockopt: Invalid argument (22)                                                                                                                            

There are lots of missing pieces before Chrome will run on WSL. This issue as raised by @Manouchehri is not well formed and I’m glad this has been marked bydesign.

Anyway, I hit the following for starters:

  1. dir_reader_linux.h: WSL doesn’t like something about casting tolinux_dirent* (I think; I hit this before I started taking notes). #1769. Can work-around by using DirReaderFallback.

  2. render_sandbox_host_linux.cc: Half-close on socketpair(AF_UNIX, SOCK_SEQPACKET, ...). #546. This can be worked around easily as it happens by just not calling shutdown().

  3. thread_helpers.cc (44): Check failed: 3UL <= task_stat.st_nlink (3 vs. 1). #1267. This module queries proc/self/task/ and doesn’t like what it sees. Code in question looks like:

        // At least "..", "." and the current thread should be present.
        CHECK_LE(3UL, task_stat.st_nlink);    // <--- this fails on WSL, commented out check.
        // Counting threads via /proc/self/task could be racy. For the purpose of`
        // determining if the current proces is monothreaded it works: if at any
        // time it becomes monothreaded, it'll stay so.`
        return task_stat.st_nlink == 3;       // <--- wrong return value on WSL (hacked to <= 3)
    
  4. stack_trace_posix.cc (584): Failed to parse the contents of /proc/self/maps. I haven’t looked into why. #708

  5. file_path_watcher_linux.cc: general unhappiness due to lack of inotify in WSL #216. Replace with file_path_watcher_stub.cc

  6. The work around in #637 doesn’t take because chrome wants the unix socket for dbus, period. #376 and #1326 etc. Can probably be worked-around but I didn’t bother, because…

  7. address_tracker_linux.cc(172): Could not bind NETLINK socket: Invalid argment. #468

I quit at the NETLINK issue. There are some others I haven’t listed; notably chrome has it’s own hand rolled version of strace built into the debug build that doesn’t work for reasons.

Folks, this is getting a smidgeon heated…

First – thanks @Manouchehri for reporting this! It is a thing that WSL cannot currently do. While it’s not on the short-term road map, I for one do hope that WSL eventually reaches a level of completeness where it’s able to run apps like Chrome.

It’s not something that is expected to work in the Anniversary Release. But as has been pointed out on other tickets, there are WSL users who (rightly or wrongly) expect browsers to work now. This ticket documents what their actual status is.

@therealkenc – your definition of “sane” matches what’s expected to work for Windows Anniversary Edition. But this bug tracker has a broader scope than that; it is currently described as encompassing future and long-term work as well. If you would like to narrow its definition to match your description, please post a pull request modifying README.md.

For the people that are expierencing issues after using: https://docs.microsoft.com/en-us/windows/wsl/tutorials/gui-apps

Check the wsl version with:

wsl --list --verbose

If the wsl distro is version 1 then convert the distro to version 2 with: Check this documentation: https://docs.microsoft.com/en-us/windows/wsl/basic-commands#set-wsl-version-to-1-or-2

wsl --set-version <name> 2

I followed this docs https://docs.microsoft.com/en-us/windows/wsl/tutorials/gui-apps

And I got these errors

$ google-chrome
[2014:2014:1112/172745.466766:ERROR:browser_dm_token_storage_linux.cc(94)] Error: /etc/machine-id contains 0 characters (32 were expected).
[1112/172745.479719:ERROR:file_io_posix.cc(144)] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq: No such file or directory (2)
[1112/172745.479781:ERROR:file_io_posix.cc(144)] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq: No such file or directory (2)
Trace/breakpoint trap

Dev channel 60.0.3080.5 Headless Chrome runs out of the box with the libudev-stub workaround. Below is a screencap of headfull chrome talking to headless chrome, both running simultaneously on WSL. The headless side is totally a “CLI development use case scenario”. The other isn’t. Or something.

Notable side remark from the Google developer in that link above, quote: “Since I’m on Mac, I created convenient aliases…” Something to think about.

wsl-headless-chrome

@therealkenc I am literally the person who added some of the strace guidelines to CONTRIBUTING.md (https://github.com/Microsoft/BashOnWindows/pull/642)… No need for the snide comments.

Anyway, I don’t get why asking about the world’s most popular browser is so upsetting. It was going to be asked sooner or later.

@imkow GUIs definitely work. See #637.

Hopper

Any solution?

NodeJS Linux Development. DotNet Linux development. C/C++ Linux development.

You can in principle use Windows VSCode though WSL interop, but then you’ll run headlong into DrvFS limitations (777 perms, symlinks, NTFS unfriendly filenames, files pinned by open handles). Chrome on WSL isn’t all that useful (possibly notwithstanding headless), because all interaction goes through HTTP, which means it can just as well be running on Windows. VSCode talks to the filesystem, and there is the rub.

Okay I’ve done a new libpulse build for WSL 16.04 Xenial. I jumped through the Launchpad PPA hoops, but I gather it takes time for the build bots to do their thing. It might or might not show up here eventually. I also put up a .deb package in the libudev-stub github release page here.

So the low tech steps, if you are feeling lucky, might be:

sudo apt-get install ubuntu-desktop       # and in general get firefox running with VcXsrv
sudo dpkg -i google-chrome-unstable_current_amd64.deb
sudo apt -f install                       # probably
sudo dpkg -i libpulse0_8.0-0ubuntu3.2ppa1_amd64.deb
sudo dpkg -i libudev-stub-0.9.0-WSL.deb   # doing this **last** is seriously important
google-chrome-unstable --no-sandbox

Again a heads up that the libudev-stub symbolic link will get blown away by apt-get <almost anything>, so if you get an error unrelated to pthread_mutex_unlock(&m->mutex) right out of the gate it probably means the link has been clobbered. Just reinstall the libudev-stub .deb to fix it up.

Bonne chance.

A binary package is also now ready. Low-tech steps for chrome on WSL:

sudo apt-get install ubuntu-desktop wget libxss1 libappindicator1 libindicator7
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome-stable_current_amd64.deb
wget https://github.com/therealkenc/libudev-stub/releases/download/v0.9.0/libudev-stub-0.9.0-WSL.deb
sudo dpkg -i libudev-stub-0.9.0-WSL.deb
google-chrome --no-sandbox

There is (at least) one annoyance, being that chrome does not exit properly when closed. If this happens, hit ctrl-c a couple of times and then run killall chrome nacl_helper to clean up the process leftovers.

So, “workaround-available”. Or something.

Thanks @aseering and @benhillis.

We appreciate people pushing the limits to what WSL can do. This tracker has become one of the best places where people can show off and ask questions about areas that are not officially supported (examples #637, #611, and #481). I know I get a kick out of reading these and do not want us to do anything to stifle the creativity.

For the issue, @Manouchehri, thank you for reporting it. If nothing else people who try and run Chrome can see other people’s experience. We all know that Chrome is not a priority, but it is still good information to have. Also, for the record, thank you for the help with CONTRIBUTING.md.

The Windows Anniversary Update is pretty well locked down at this point. We have a blog post talking a bit about what comes next. Naturally our priority list will grow for the next release. No spoilers on our conversations but I can promise that we’re looking at this forum and the User Voice. More information on that when we have something fun to share.

The problem is related to socketpair creation. As Chromium relies on sockets for IPC in Linux/BSD/MacOS, you can expect other chromium based stuff to fail (Chrome/Opera/Spotify/…).

@therealkenc - Unfortunately I didn’t have enough time to get the priority futex work done for this release. I’m hoping to knock this one out very early for the next release.

This is getting especially interesting given the release of chrome-headless. Thanks everyone for your work on this!

Got a bit further this weekend. Chrome 53.0.2785.143 now runs somewhat stable on 15042 with this small patch. Stable enough to play youtube videos anyway, which was a non-starter in November. It still does an ‘awe snap’ if you try hard enough. As you can see from the patch, the main blocker for chrome running out of the box remains udev.

The patch is a lot smaller because #1326 was squashed (thanks Sunil). I can’t explain precisely what caused the stability improvement. The patch doesn’t work around anything new, and the previous one worked around #1326 already. Could be any number of random WSL fixes since November. Could be changes in chromium since 52.0.2743.82.

VSCode, unfortunately, remains obstinate. This is frustrating, because “it should be working now”. Sigh. I’ll bang on it some more.

ob-screencap:

chrome-wsl-feb27

Google guys don’t agree with you. It’s a whole OS inside a browser. xD

No, it didn’t. Not even a little bit. Four of the seven issues are known to the WSL team. That Google dicks with Linux kernel internals in (1), (3), and (4) is on Google not Microsoft. Seeing what it would take to get Chrome working was an exercise of no value to the WSL team. If any of those three were even marginally inside WSL’s scope (like #546) I would have opened an actionable and reproducible test case.

As BashOnWindows is intended to development purposes, rather than normal usage scenarios with GUIs, I think this isn’t a problem. Except it’s not about GUIs.

I downloaded the latest version today (81.0.4044) and I got this error as well. I don’t know why this ticket is closed =/

Chrome now works out of the box with sandbox on 16273 thanks to @benhillis work in #2242. There are a couple of caveats (there are always caveats). First, the pthread_mutex_unlock(&m->mutex) fail (which is #486) will still trigger if you have pulse audio installed. Which you do, if you installed the whole ubuntu-desktop meta package. This had me confused earlier as well (see the strikeout). There are two ways around. One is to push though it with the PulseAudio 8 PPA. The other is to purge pulse from your system. I’d recommend the latter.

The other caveat, which is of the soft variety, is that chrome would really rather be living in an environment with a functioning dbus and opengl (ie mesa llvmpipe). Putting it all together, something like the following should get you there:

sudo update && sudo apt upgrade
sudo apt install ubuntu-desktop wget mesa-utils
sudo apt purge pulseaudio libpulse0 && sudo apt autoremove
wget https://dl.google.com/linux/direct/google-chrome-unstable_current_amd64.deb
sudo dpkg -i google-chrome-unstable_current_amd64.deb
sudo apt -f install           # probably
export DISPLAY=localhost:0
export NO_AT_BRIDGE=1
exec dbus-run-session -- bash
sudo service dbus start
google-chrome-unstable        # look mom, no flags

And there you have it.

I want to use Capybara to run some automated tests with Chrome, how do I choose to run the google-chrome-dev instead of the default Chrome? Only Chrome 78 (unstable) will run, however, Selenium (for Capybara) requires webdriver. Webdriver only support version 77.

WSL-Chrome-78

FYI, I’ve been using WSL since late last year. I would normally wipe off Windows and install Ubuntu, but WSL has been working for me since then. However, I am now trying to write some tests for my Google Polymer based web apps, and the tools use Web Component Tester, and so I hit this problem where it can’t launch the browser to run my tests. It does seem like there is a solution trying to find it’s way out, but the whole ‘no GUI’ stance makes me think it’ll not be supported for some time, even if it is made to work soon (which seems likely). As such, I’m think I’m going to switch back to Ubuntu, which is a bit of a shame, tbh…WSL is kind of awesome really.

Unfortunately vscode is a no-go at the moment. It is impractical to debug on WSL right now due to gdb limitations; and even on a good day without gdb limitations it would be a bear to debug down at this level because of all the libchromiumcontent threads and message passing between nodejs and the electron renderer process. The strace output doesn’t show anything glaringly broken, so I can’t even pinpoint places in the source to add debug output lines.

I have been waiting for #1006 to flip and then perhaps try to find someone motivated enough on the vscode team to take a look and maybe make some educated guesses. It fails early in vscode-loader, which itself is a complicated package. Either vscode-loader is failing itself, or it tries to load some node native library that in turn hits a WSL gap not disturbed by Chrome proper. I also have an eye on #1910.

Atom gets a little further (at least it lights up), but can’t open files. I don’t use Atom so I didn’t track the fail very far.

Right; a few tips (I’ll put up some docs in the repo when I get a chance). If you have problems with pulsecore #486 (message) just do a apt-get purge pulseaudio so chrome doesn’t try to use it. [edit] PulseAudio 8 on Xenial 16.04 seems to be an issue, so you’ll need a patched version. See instructions below.

Not only is it possible to run without Ubuntu desktop, I haven’t even tried using it with Unity and Compiz. I tried (and failed) to explain this over in #637 (message and message). Installing the ubuntu-desktop package is just to get the libraries chrome expects on your system. Your mixed Xfce4 setup should fly.

Your display variable should properly be localhost:0 (ie 127.0.0.1:0), not :0. The latter might work, but technically means X11 over AF_UNIX on /tmp/.X11-unix/X0, not AF_INET over localhost:6000.

Finally, you’ll have a better (ie more stable) experience with the latest mesa llvmpipe. I built my own but there’s a ppa here. You can see what you are running with glxinfo -B.

No need to track down the install -f further. It appears to be a common enough problem on Real Ubuntu and that’s the standard fix. Thanks for trying it out!

Sure, the following from the command prompt will get you right back here. You need to be on an insider build 14951 or better which has the Win32 interop stuff.

"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe" \
    --profile-directory="Default" https://github.com/Microsoft/BashOnWindows/issues/648

I looked at this again last weekend and made a little more progress. My current patch against 52.0.2743.82 is here. The patch is enough to get chrome running without --single-process (ie with multiprocess), by working around #514 and #706. It still has too many problems to be usable, but it is just usable enough to send this post.

The FUTEX_CMP_REQUEUE_PRIVATE #1006 problem I mentioned above was a false positive of sorts. It’s still a missing WSL feature, but glibc pthreads seems to fallback awkwardly (I’d hate to say gracefully) to FUTEX_WAKE_PRIVATE, which is supported.

This patch is also enough to get Electron 1.3.8 to launch, but (sadly) not enough for VS Code to fire up yet.

wsl-electron

Alot of programs fails on shutdown, please fix it (or waiting for the fix, simulate a correct return value)

This works great for me. I installed VcXsrv , started “XLaunch” in windows, and then started up my Windows Subsystem Ubuntu bash console and followed @therealkenc 's comment from Aug 24, 2017.

I’m using it to run automated tests in Chrome. It all works wonderfully.

Thank you!

I have the impression that google chrome works if you:

  • install a XWindows server on your windows box (I use VcXsrv X SErver 1.19.6.0 - it include GxLib 1.3 (? not sure of the lib ?) wich is needed by chrome)
  • export DISPLAY=:0

But since that’s the conclusion of a long work, with lots of trials, I would rather hope that someone else could confirm that…

GREAT!!! it works fine!!! A problem: xfce4 needs pulseaudio 😦 So, if I install Chrome… bye bye desktop integration with xfce 😦

SOLVED! I don’t know how, but now I have xfce4 without Pulse 😃 desktop

@therealkenc surprised you’re building with nacl. I’d assume it would be easier to pare the build down.

What about use_udev = false, would that help? there’s more stuff like this in build/args/headless.gn; see also gn args <outdir> --list

I have written a stub library for libudev.so.1 that enables stock Chrome for Ubuntu to run on WSL 15046. I had mentioned doing this back in September #1121 (message), but Chrome was blocking on bigger problems at the time and can be compiled without udev support (notably for Android). There are still two blocking bugs outstanding, but it turns out they only manifest in debug builds (DCHECK fails). You can head on over to the github page to download and build if you feel lucky.

FWIW the /proc/sys/kernel/shmmax read was removed from chrome back in June.

@Manouchehri While we greatly appreciate your taking the time to stretch Bash/WSL and investigate this issue, we are being quite explicit in that we do not support GUI/desktop apps; we are only supporting command-line applications at this time.

That several GUI apps do run (to a greater or lesser degree), is purely a side-effect of the team improving our syscall implementation over time.

We’ll be sure to (very) publicly announce if this position changes, but expect that we’ll only be supporting command-line scenarios and tools for the foreseeable future.