You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Did you change the IP used in the tutorial? Try 0.0.0.0 instead of 127.0.0.1. The server will listen to any IPs instead of being restricted to the localhost. Should work just fine, but I wouldn't recommend using it in public networks.
Edit: I've forgotten that you will need a script to get the Windows IP (running the pulseaudio server) and export it to the WSL environment so that the programs can find it. (e.g. powershell -Command "$ipv4 = Test-Connection -ComputerName (hostname) -Count 1 | Select -ExpandProperty IPV4Address; $ipv4.IPAddressToString")
Edit: I've forgotten that you will need a script to get the Windows IP (running the pulseaudio server) and export it to the WSL environment so that the programs can find it. (e.g. powershell -Command "$ipv4 = Test-Connection -ComputerName (hostname) -Count 1 | Select -ExpandProperty IPV4Address; $ipv4.IPAddressToString")
i pasted this " $ipv4 = Test-Connection -ComputerName (hostname) -Count 1 | Select -ExpandProperty IPV4Address; $ipv4.IPAddressToString " in PowerShell and it gave me this 192.168.1.4
how to export it to wsl
for example
export PULSE_SERVER=tcp:192.168.1.4 or what
can you explain this plz ??
also i was using this bat file to launch xfce4 desktop on arch wsl on x410 with pusleaudio enabled from a shortcut to this bat file on wsl1
if you can tell me what to just change in this file to make pusle audio works
in this screenshot i just changed DISPLAY from localhost to what in screenshot to make it take the new ip address in wsl2
i want to do the same for pulse server to make it work on wsl2
Change your bat file to include the following before of the command starting with arch.exe. It will create a local variable (MYIP) with your Windows IP. After that, you can call %MYIP% where you would have a server IP (e.g. export PULSE_SERVER=tcp:%MYIP%).
@echo off FOR /F "delims=\" %%A IN ('powershell -Command "$ipv4 = Test-Connection -ComputerName (hostname) -Count 1 | Select -ExpandProperty IPV4Address; $ipv4.IPAddressToString"') DO SET "MYIP=%%A" ::echo %MYIP%
P.S.: This is a workaround and if your computer IP changes during your use (e.g. connecting to a different WiFi network), you will probably need to stop the services and then run this script again to update the IP and restart the services.
i am also facing the same issue, i even tried using ALSA to host an audio server, but it looks like it's not supported ?
all the old guides apparently don't work on wsl 2
I think I have figure out one or two solutions for this issue.
Check out your wsl's ip with this command for ubuntu: ifconfig eth0 | grep 'inet '
you will get some thing like "inet 172.24.201.27 netmask 255.255.240.0 broadcast 172.24.207.255",
and that ip after "inet" is your wsl' ip.
Add it to pulseaudio /etc/pulse/default.pa line 61 auth-ip-acl and run pulseaudio.exe again, it should work now.
According to this: archlinux-pulseaudio, you can add "auth-anonymous=1" to /etc/pulse/default.pa line 61.
After you done that, restart pulseaudio.exe and wsl2 can use audio correctly.
I tried both solutions out with cmus in wsl2, it works for me with ArchLinux.
Reacted by Jonathan, Hemanta, JDawgTechie, Zuo Zongyuan, Alice P. Hacker, Sam and acelinkio
Hi all - I am facing the same issue described here, and I tried the solution from Jack Deng (@JackTheMico) but it did not worked as expected...
So, to explain what I did:
I setted up pulseaudio on Windows10 to match with the IP of my WSL2 image instance (let's call it $MY_IP) in /etc/pulse/default.pa (line 61) (+ other config in daemon.conf), and run it on Windows10.
I also added "auth-anonymous=1" to /etc/pulse/default.pa, line 61.
I installed pulseaudio on my Ubuntu 20.04 in WSL2, and exported the PULSE_SERVER to tcp:$MY_IP.
Do I need to run the daemon on Ubuntu, or nothing more than what I already did?
For now, using X410 as X11 server, I expected to have sound when launching Firefox (or whatever), but nothing more than the video :/
I tried cmus as well, but I have the following error when playing a sound:
There are many ways to be sure the wsl ip is set correctly each time it changes, but what I ended up doing for now, is creating shell script(setup-pulseaudio.sh) in /usr/profile.d that runs a script I made in /usr/bin named setup-pulseaudio like below:
The script will run each time your shell is started and it simply replaces line 61 of default.pa with the line assigned to REPLACE, which contains the current PULSE_ID.
If you wanted, you could also check to see if pulseaudio.exe is running, kill it, delete any existing runtime pid file at C:\Users\<username>\.pulse, and start pulseaudio.exe. In addition, you could make sure your x-server is running. Personally, my x-server is always running and I don't mind starting pulseaudio manually since I don't use it very often.
and write the result of ifconfig eth0 | grep 'inet ' in /etc/pulse/default.pa (line 61). But when I try: '.\pulseaudio.exe' I get: .pulseaudio.exe: command not found
I do not know what I am missing. Any help would really appreciated .
Thanks Adriankhl for your answer... I was not understanding so actually I was doing the first steps inside Ubuntu (WSL 2) and not the powershell of windows. Now it is working, but sound it is really bad, any way to improve that?
So I had attempted to get some of the suggestions from this thread, as well as from others I'd found while doing research and wasn't able to get them working reliably.
If none of the above options works, as has happened to me since changing to WSL 2, you can use the following in your ~/.bashrc file to correct for deficiencies:
# Get the IP Address of the Windows 10 Host and use it in Environment.
HOST_IP=$(host `hostname` | grep -oP '(\s)\d+(\.\d+){3}' | tail -1 | awk '{ print $NF }' | tr -d '\r')
export DISPLAY=$HOST_IP:0.0
export PULSE_SERVER=tcp:$HOST_IP
It grabs the IP address of the Windows host, no matter what it is, and exports it to the WSL 2 environment.
Now using the built-in audio of WSLg. Works very well! No more need to redirect PULSE_SERVER to specific IP address. Just works out of the box in WSL2 in Windows 10 Preview builds higher than 21364. What doesn't work is theming for QT and GTK2 apps. Cannot launch elevated GUI programs anymore. These will require adjusting command lines and some experimentation. But sound works great! Have full GPU acceleration, too! Transparency in Gnome-Terminal functions as intended.
And did I say that sound works really well for a preview?
Activity
Gabrielcarvfer commentedon Jun 20, 2019
Did you change the IP used in the tutorial? Try 0.0.0.0 instead of 127.0.0.1. The server will listen to any IPs instead of being restricted to the localhost. Should work just fine, but I wouldn't recommend using it in public networks.
Edit: I've forgotten that you will need a script to get the Windows IP (running the pulseaudio server) and export it to the WSL environment so that the programs can find it. (e.g. powershell -Command "$ipv4 = Test-Connection -ComputerName (hostname) -Count 1 | Select -ExpandProperty IPV4Address; $ipv4.IPAddressToString")
elswerky commentedon Jun 21, 2019
i pasted this " $ipv4 = Test-Connection -ComputerName (hostname) -Count 1 | Select -ExpandProperty IPV4Address; $ipv4.IPAddressToString " in PowerShell and it gave me this 192.168.1.4
how to export it to wsl
for example
export PULSE_SERVER=tcp:192.168.1.4 or what
can you explain this plz ??
also i was using this bat file to launch xfce4 desktop on arch wsl on x410 with pusleaudio enabled from a shortcut to this bat file on wsl1
if you can tell me what to just change in this file to make pusle audio works
in this screenshot i just changed DISPLAY from localhost to what in screenshot to make it take the new ip address in wsl2
i want to do the same for pulse server to make it work on wsl2
can you

Gabrielcarvfer commentedon Jun 21, 2019
Change your bat file to include the following before of the command starting with arch.exe. It will create a local variable (MYIP) with your Windows IP. After that, you can call %MYIP% where you would have a server IP (e.g. export PULSE_SERVER=tcp:%MYIP%).
@echo off FOR /F "delims=\" %%A IN ('powershell -Command "$ipv4 = Test-Connection -ComputerName (hostname) -Count 1 | Select -ExpandProperty IPV4Address; $ipv4.IPAddressToString"') DO SET "MYIP=%%A" ::echo %MYIP%P.S.: This is a workaround and if your computer IP changes during your use (e.g. connecting to a different WiFi network), you will probably need to stop the services and then run this script again to update the IP and restart the services.
bigworld12 commentedon Sep 4, 2019
i am also facing the same issue, i even tried using ALSA to host an audio server, but it looks like it's not supported ?
all the old guides apparently don't work on wsl 2
JackTheMico commentedon Nov 19, 2019
I think I have figure out one or two solutions for this issue.
Check out your wsl's ip with this command for ubuntu:
ifconfig eth0 | grep 'inet 'you will get some thing like "inet 172.24.201.27 netmask 255.255.240.0 broadcast 172.24.207.255",
and that ip after "inet" is your wsl' ip.
Add it to pulseaudio /etc/pulse/default.pa line 61 auth-ip-acl and run pulseaudio.exe again, it should work now.
According to this: archlinux-pulseaudio, you can add "auth-anonymous=1" to /etc/pulse/default.pa line 61.
After you done that, restart pulseaudio.exe and wsl2 can use audio correctly.
I tried both solutions out with cmus in wsl2, it works for me with ArchLinux.
raekuul commentedon Feb 13, 2020
Jack Deng (@JackTheMico) Is that a client-side change (inside WSL2) or a server-side one (inside Windows)?
EDIT: Or am I thinking of this backwards and WSL is the server and Windows pa has to be the client?
hemanta212 commentedon Mar 21, 2020
raekuul All changes are in windows side.
k0pernicus commentedon May 5, 2020
Hi all - I am facing the same issue described here, and I tried the solution from Jack Deng (@JackTheMico) but it did not worked as expected...
So, to explain what I did:
Do I need to run the daemon on Ubuntu, or nothing more than what I already did?
For now, using X410 as X11 server, I expected to have sound when launching Firefox (or whatever), but nothing more than the video :/
I tried cmus as well, but I have the following error when playing a sound:
k0pernicus commentedon May 5, 2020
Ok, solved!
So, I exported this environment variable in my Ubuntu:
and the result of the command
ifconfig eth0 | grep 'inet 'in /etc/pulse/default.pa (line 61).I have now sound and video launching Firefox from Ubuntu, on Windows now 👍
Adriankhl commentedon May 16, 2020
I recommend running a script like this to configure and run PulseAudio .
I installed PulseAudio with cygwin but I believe something similar should work with other installation methods.
nkrapivin commentedon May 23, 2020
I was able to install PulseAudio in WSL2 too, but the sound is very choppy.
Any way to fix this?
devcircus commentedon May 24, 2020
There are many ways to be sure the wsl ip is set correctly each time it changes, but what I ended up doing for now, is creating shell script(setup-pulseaudio.sh) in /usr/profile.d that runs a script I made in /usr/bin named
setup-pulseaudiolike below:The script will run each time your shell is started and it simply replaces line 61 of
default.pawith the line assigned toREPLACE, which contains the currentPULSE_ID.If you wanted, you could also check to see if pulseaudio.exe is running, kill it, delete any existing runtime pid file at
C:\Users\<username>\.pulse, and start pulseaudio.exe. In addition, you could make sure your x-server is running. Personally, my x-server is always running and I don't mind starting pulseaudio manually since I don't use it very often.juancopi81 commentedon Jun 3, 2020
Hi k0pernicus,
I am having problems with this. I already tried:
and write the result of
ifconfig eth0 | grep 'inet 'in /etc/pulse/default.pa (line 61). But when I try: '.\pulseaudio.exe' I get: .pulseaudio.exe: command not foundI do not know what I am missing. Any help would really appreciated .

Adriankhl commentedon Jun 3, 2020
JuanCarlosPi (@juancopi81) do
./pulseaudio.exeinsteadjuancopi81 commentedon Jun 3, 2020
Thanks Adriankhl for your answer... I was not understanding so actually I was doing the first steps inside Ubuntu (WSL 2) and not the powershell of windows. Now it is working, but sound it is really bad, any way to improve that?
JDawgTechie commentedon Jun 19, 2020
Many thanks to JackTheMico. Could not get audio working with WSL2. Was thinking my Windows host IP had to be in that config file. Working good now!
eamondo2 commentedon Oct 9, 2020
So I had attempted to get some of the suggestions from this thread, as well as from others I'd found while doing research and wasn't able to get them working reliably.
Git Page
This is an attempt to collate what ended up working, hopefully it will be of some help.
timriker commentedon Oct 21, 2020
I’ve set in etc/pulse/default.pa this:
load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1;172.16.0.0/12This will authorize all local connections for WSL1 and the RFC-1918 block 172.16.0.0/12 which is the default space for WSL2.
I would not recommend
auth-anonymous=1as this would allow any remote machine to connect. I use this inside my .bashrc:JDawgTechie commentedon Oct 21, 2020
Excellent suggestions, thank you! Although I couldn't get anything to work right by editing bashrc so I just updated my bat file instead:
ubuntu2004.exe run "if [ -z \"$(pidof xfce4-session)\" ]; then export DISPLAY=$(ip route|awk '/^default/{print $3}'):0.0; export PULSE_SERVER=${PULSE_SERVER:-tcp:$(ip route|awk '/^default/{print $3}')}; startxfce4; pkill '(gpg|ssh)-agent'; taskkill.exe /IM pulseaudio.exe /F; taskkill.exe /IM vcxsrv.exe; fi;"Woot! No more having to change the IPs.
timriker commentedon Oct 22, 2020
See my notes in #5816 which works for WSL1 as well.
dcharlespyle commentedon Feb 22, 2021
If none of the above options works, as has happened to me since changing to WSL 2, you can use the following in your ~/.bashrc file to correct for deficiencies:
It grabs the IP address of the Windows host, no matter what it is, and exports it to the WSL 2 environment.
marksteward commentedon May 7, 2021
Audio will be built in, https://devblogs.microsoft.com/commandline/the-initial-preview-of-gui-app-support-is-now-available-for-the-windows-subsystem-for-linux-2/
dcharlespyle commentedon May 14, 2021
Now using the built-in audio of WSLg. Works very well! No more need to redirect PULSE_SERVER to specific IP address. Just works out of the box in WSL2 in Windows 10 Preview builds higher than 21364. What doesn't work is theming for QT and GTK2 apps. Cannot launch elevated GUI programs anymore. These will require adjusting command lines and some experimentation. But sound works great! Have full GPU acceleration, too! Transparency in Gnome-Terminal functions as intended.
And did I say that sound works really well for a preview?
FirefoxSystem commentedon Sep 6, 2021
Hello guys,
after days of unsuccessful attempts I solved the no sound problem by inserting in the file /etc/pulse/client.conf the following line:
default-server = 192.168.1.2obviously the IPv4 LAN address of your computer not that of the virtual card 'vEthernet (WSL)'
Happy listening :)
Hello
singhdilveer1 commentedon Dec 12, 2022
I came here for a solution but installing pulseaudio on the ubuntu instance solved the issue.