title: Running "google-chrome" on WSL Ubuntu as --headless --no sandbox gives multiple errors - how do I take screenshot using headless in WSL?
body: <p>I'm running Windows 10 and I have been using an Ubuntu Linux distro under the Windows Linux Subsystem.</p>
  <p>I want to be able to use Chrome.exe or google-chrome to run headless and take screenshots, generate pdfs etc... as part of library calls, but can't see to do that (e.g. to use jupyter_to_medium library launches chrome in the background to take screenshot).</p>
  <p>I have tried multiple things to debug it with google-chrome independently of the library or programme I'm using.</p>
  <p>Here's what I've tried:</p>
  <ol>
  <li><p>I <strong>can</strong> launch Chrome (Windows executable) via the Ubuntu terminal, having redirected it to the Windows executable:</p>
  <pre><code>/mnt/c/Program\ Files\ \(x86\)/Google/Chrome/Application/chrome.exe
  </code></pre>
  <p>When I do that, a new tab opens in my Windows Chrome browser so no issues here.</p>
  </li>
  <li><p>When I try to use <code>google-chrome</code> headless in ubuntu terminal I get <strong>MULTIPLE ISSUES</strong> e.g.</p>
  <p>2a) Trying to get a screenshot - <strong>FAILs</strong> showing <code>Network service crashed, restarting service</code> endless loop - had to CTRL^C to stop it</p>
  <pre><code> (base) etzimopoulos@DESKTOP-HI9P6E4:~$ google-chrome --headless --disable-gpu --screenshot https://www.chromestatus.com/
  [0626/055458.471044:ERROR:udev_watcher.cc(61)] Failed to enable receiving udev events.
  [0626/055458.612113:ERROR:network_service_instance_impl.cc(262)] Network service crashed, restarting service.
  [0626/055458.696014:ERROR:network_service_instance_impl.cc(262)] Network service crashed, restarting service.
  ...
  </code></pre>
  <p>2b) Trying to get a screenshot using a <strong>different parameters</strong> <code>--no-sandbox --disable-setuid-sandbox</code> , getting different error this time.</p>
  <pre><code>$ sudo google-chrome --no-sandbox --disable-setuid-sandbox --headless --screenshot https://www.chromestatus.com/
  [0626/061854.348849:ERROR:udev_watcher.cc(61)] Failed to enable receiving udev events.
  [0626/061855.311675:ERROR:platform_shared_memory_region_posix.cc(46)] Descriptor access mode (0) differs from expected (2)
  [0626/061855.312483:WARNING:crash_handler_host_linux.cc(366)] Could not translate tid - assuming crashing thread is thread group leader; syscall_supported=0
  [0626/061855.474617:WARNING:crash_handler_host_linux.cc(366)] Could not translate tid - assuming crashing thread is thread group leader; syscall_supported=0
  --2020-06-26 06:18:55--  https://clients2.google.com/cr/report
  Resolving clients2.google.com (clients2.google.com)... 216.58.210.46, 2a00:1450:4009:800::200e
  Connecting to clients2.google.com (clients2.google.com)|216.58.210.46|:443... connected.
  HTTP request sent, awaiting response... [0626/061855.655013:ERROR:headless_shell.cc(399)] Abnormal renderer termination.
  429 Too Many Requests
  2020-06-26 06:18:55 ERROR 429: Too Many Requests.
  
  
  Unexpected crash report id length
  Failed to get crash dump id.
  Report Id: ```
  
  </code></pre>
  </li>
  <li><p>Trying to run the <strong>Windows executable Chrome.exe</strong> with same parameters, seems to run but not screenshot is being taken (no new files in my directory)</p>
  </li>
  <li><p>Trying to run <code>google-chrome</code> <strong>without</strong> elevated privilages in WSL I get a different error:</p>
  <p><code>google-chrome --headless --disable-gpu --screenshot https://www.chromestatus.com/ 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)</code></p>
  </li>
  </ol>
  <p>Any help or direction would be hugely appreciated. My other option would be to run a VM on windows 10 with native Linux UI and terminal, which would probably work.</p>
  <p>But is there a way to have it all setup in WSL?</p>
  <p>Thank you.</p>