This is an update for https://trzeci.eu/configure-graphic-and-sound-on-wsl/
New version of WSL brings lots of fixes and updates: https://blogs.msdn.microsoft.com/commandline/2017/04/11/windows-10-creators-update-whats-new-in-bashwsl-windows-console/.
Unfortunately it’s still impossible to play a sound out of the shelf. The major problem is connected to the lack of direct support for audio devices. The solution is to use PulseAudio, what creates a server on Windows host, and this server plays a sound what is passed from Linux.
The problem with this solution is that it’s not supported:
Thanks to @therealkenk we can pull modified library for Ubuntu 16.04, like it was possible for 14.04: https://github.com/Microsoft/BashOnWindows/issues/486#issuecomment-299682364
In the following part I will present Base setup, what’s needed to do required steps manually, further you can find “Installation script” what does everything automatically, please choose wisely.
After this step it’s possible to enter Linux environment, but it has few pitfalls.
- 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"
- Enable Windows Subsystem for Linux
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
- Restart Windows
- Either execute
bash, then follow an installation process
lxrun /install /yto install windows with root user and without password (a user can be added later on)
- Either execute
Fix sudo (might be not required)
// 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"
Export default display
echo "export DISPLAY=:0.0" >> ~/.bashrc
- xming as X-server – needed to display applications from Linux
- pulseaudio – as a sound server
- Download script from: GIST
- Make sure that you understand what it does, what is:
- Enabling Developer Mode (It will require reboot)
- Installing base WSL component
- Apply fixes:
- Install base packages (unzip, git-core, zsh)
- Install development packages
Is there a version of the audio script for the Windows 10 Fall Creators Update?
Hi, I’ve seen that developer mode is no longer required in Windows Fall Update.
I’ll have to verify this. I’ve seen that it’s officially available to have more than 1 distro running. Do you use Ubuntu?
Yep, haven’t been bothered to use the other two available distros.
The link http://bosmans.ch/pulseaudio from “pulseaudio – as a sound server” does not work.
Error message: You don’t have permission to access /pulseaudio/ on this server.
Here you can get it from a direct link: http://bosmans.ch/pulseaudio/pulseaudio-1.1.zip
Thank you for reporting!
Pulseaudio under Windows does not work anymore, since my 1709 Windows 10 system has been updated (KB4058043 and KB4054517-BS-Build 16299.125) yesterday.
Does anybody else have the same problem?
After de-installing update KB4058043 pulseaudio works again.
Thank you for reporting. Temporarily I have limited access to my W10 machine, thus I wasn’t able to confirm that.
It’s connected to changes in latest WSL, it requires to reinstall pulseaudio on Ubuntu. After that it should work again.
Hi, thanks for that, this works for me :D
I seen a little issue in gist file, at this line.
echo ws.run “%AppData%\Xming\Xming.exe -multiwindow”,0 >> “%userprofile%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\start_xming.vbe”
i solve problem with copy and paste using this.
echo ws.run “%AppData%\Xming\Xming.exe -clipboard -multiwindow”,0 >> “%userprofile%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\start_xming.vbe”
Thanks again :D
Thanks for a page about this, and thanks for the script. I followed every step and I’m getting ‘pthread_mutex_unlock’ errors from pulseaudio. This is causing any app with audio to core dump. I’ve tried with both xming and vcxsrv(my preference) and get the same result.
I’m on Win10 Build 17120.rs4_release.180309-1616. It’s a fast ring preview. I’ve updated and upgraded everything on WSL. Thanks in advance for any help.
I know that this tutorial is not up to date – MS has released few versions of WSL in meantime and they are differ in terms of D-BUS and pulse audio support. I’m working on an updated version, unfortunately I’m very time limited recently. Sorry for that.
Do you have an ETA on when that may be? I can’t seem to get pulseaudio to work at all with this current version
Not yet, problem with pulse-audio needs more investigation.
The good news is that the issue is going to be addressed upstream and it was placed in the WSL’s backlog:
Can you update this configuration for WSL2?
I’ve switched entirely to Linux recently and I didn’t follow fully what’s changing there. Let me check on some VM and see what’s there.