This is more like a notebook entry, rather than full tutorial.

References:

In this post I will describe how to install WSL on Windows 10, configure X11 to run any Linux application in GUI mode, and fix missing sound problem.

Base setup

After this step it’s possible to enter Linux environment, but it has few pitfalls.

  1. Enable developer mode in settings, or use command line alternative (run as Administrator)
    reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
  2. Enable Windows Subsystem for Linux
    Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
  3. Restart Windows
  4. Run cmd and:
    1. Either execute bash, then follow an installation process
    2. Or, lxrun /install /y to install windows with root user and without password (a user can be added later on)

Enhancement

Fix language

ℹ️ Linux inherits original Windows language, so in case on non-English host system, when you feel odd to use non-English️ Linux, you must change it by a bash command:

echo LANG="en_US.utf8" >> ~/.bashrc

Fix sudo

ℹ️ Linux installation inherits Windows host name, but it is not configured fully, sudo needs to have updated /etc/hosts file with a right host name

sudo sh -c "echo '127.0.0.1 `hostname`' >> /etc/hosts"

Fix D-BUS

sudo sed -i 's$<listen>.*</listen>$<listen>tcp:host=localhost,port=0</listen>$' /etc/dbus-1/session.conf
sudo sed -i 's$<auth>EXTERNAL</auth>$<auth>ANONYMOUS</auth>$' /etc/dbus-1/session.conf
sudo sed -i 's$</busconfig>$<allow_anonymous/></busconfig>$' /etc/dbus-1/session.conf

X11 Server

Default export

echo "export DISPLAY=:0.0" >> ~/.bashrc

Windows server

I use xming and it works fine.

Audio support

Solution bases on issue.

Add and install pulse audio

sudo add-apt-repository ppa:aseering/wsl-pulseaudio
sudo apt-get update
sudo apt-get install libpulse0 -y
echo export PULSE_SERVER=tcp:localhost >> ~/.bashrc

Install pulse audio on Windows

ℹ️ it requires unzip to be installed on Linux.

GIST: install_pulseaudio.bat

The script does:

  • download pulse audio from: http://bosmans.ch/pulseaudio/pulseaudio-1.1.zip
  • unpack it into: "%AppData%\PulseAudio
  • Creates a start script in %userprofile%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\start_pulseaudio.vbe
  • With content: ws.run "%AppData%\PulseAudio\bin\pulseaudio.exe --exit-idle-time=-1",0
  • Modifies default settings for pulse audio
@ECHO OFF
SET "LINUXTMP=$(echo '%TMP:\=\\%' | sed -e 's|\\|/|g' -e 's|^\([A-Za-z]\)\:/\(.*\)|/mnt/\L\1\E/\2|')"
echo LINUXTMP = "%LINUXTMP%"
 
ECHO --- PulseAudio...
C:\Windows\System32\bash.exe -xc "wget -cO '%LINUXTMP%/pulseaudio.zip' 'http://bosmans.ch/pulseaudio/pulseaudio-1.1.zip'"
 
ECHO --- Extracting PulseAudio
md "%TMP%\pulseaudio"
C:\Windows\System32\bash.exe -xc "unzip -o '%LINUXTMP%/pulseaudio.zip' -d '%LINUXTMP%/pulseaudio'"
 
ECHO --- Installing PulseAudio
xcopy /e "%TMP%\pulseaudio" "%AppData%\PulseAudio\"
 
ECHO --- Setting PulseAudio to run at startup
echo set ws=wscript.createobject("wscript.shell") > "%userprofile%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\start_pulseaudio.vbe"
echo ws.run "%AppData%\PulseAudio\bin\pulseaudio.exe --exit-idle-time=-1",0 >> "%userprofile%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\start_pulseaudio.vbe"
 
REM Recomended/required settings
echo load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1 >> "%AppData%\PulseAudio\etc\pulse\default.pa"
"%userprofile%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\start_pulseaudio.vbe"
ECHO When prompted, DO NOT allow 'pulseaudio' access to any of your networks.  It doesn't need access.
 
ECHO All Done
PAUSE
 
235 Kudos
Don't
move!