Activate WSLg in Pengwin

by mmyoji

2 min read

I tried WSLg because I might need to run chromedriver for next job.

I had ever struggled and gave up running chromedriver in normal WSL(WSL2) environment before, so I thought this was a good opportunity.

The following step is limited for WSL2 + Pengwin distro that I've been using.


  • OS: Windows 11, 21H2, 22000.708
  • GPU: GeForce RTX 2080


ref: GUI app support has arrived for the Windows Subsystem for Linux on the latest Windows Insiders Preview build 21362+ and Pengwin supports it out of the box — Whitewater Foundry

  1. Install NVIDIA GPU driver for WSL
  2. Install required packages in WSL
pengwin-setup update

# Open setup dialog
# and select [GUI], then install necessary packages.

After package installation, restart WSL (or restart Windows).

Install Google Chrome


cd /tmp
sudo wget
sudo dpkg -i google-chrome-stable_current_amd64.deb
sudo apt install --fix-broken -y
sudo dpkg -i google-chrome-stable_current_amd64.deb

# Start Google Chrome app in Linux GUI for test

Install chromedriver


# 1. check your google chrome version on WSLg
# 2. Download the same version of chromedriver with google-chrome
#    The version was 102.0.5005.61 this time.

cd /tmp
sudo mv chromedriver /usr/bin/chromedriver
sudo chown root:root /usr/bin/chromedriver
sudo chmod +x /usr/bin/chromedriver

Run the following script when you want to test.


 * $ npm init -y
 * $ npm install selenium-webdriver
 * $ vim main.js

// main.js
const { Builder, Browser, By, Key, until } = require("selenium-webdriver");

(async function main() {
  const driver = await new Builder().forBrowser(Browser.CHROME).build();
  try {
    await driver.get("");
    await driver.findElement("q")).sendKeys("webdriver", Key.RETURN);
    await driver.wait(until.titleIs("webdriver - Google Search"), 1000);
    // Replace the string with 'webdriver - Google 検索' when your language setting is Japanese.
  } finally {
    await driver.quit();

// node main.js