Tag Archives: pulseaudio

Ubuntu on WSL: X and sound server detection explained

When I started using Ubuntu more than a decade ago I was impressed how well it worked out of the box. It detected most of my machine’s hardware and I could start working on it immediately. The Windows Subsystem for Linux is a much newer Ubuntu platform which can also run graphical applications without any extra configuration inside Ubuntu.

If you set up and start an X server or a PulseAudio server on Windows and start Ubuntu in WSL, the starting Ubuntu instance detects the presence of the servers and caches the configuration while the instance is running. The detection takes a few hundred milliseconds at the first start in the worst case, but using a cached configuration is fast and the delay is unnoticeable in subsequently started shells.

The detection is performed by /etc/profile.d/wsl-integration.sh from the wslu package and the configuration is cached in $HOME/.cache/wslu/integration.

If you would like to use a different X or sound configuration, like redirecting graphical applications to a remote X server you can prepopulate the cached configuration with a script running before /etc/profile.d/wsl-integration.sh or you can disable the detection logic with a similar script by making $HOME/.cache/wslu/integration an empty file.