- Windows 10 April 2018 Update (1803)
was used while preparing this post
WSL doesn't currently support sound devices. Hence when you open a GUI desktop or apps in X410, you will not hear anything other than the basic system bells (ex. CTRL+G). We hope Microsoft add the support in the future version of WSL. You should be able to encourage them by upvoting the following UserVoice topic:
- Sound card & ALSA support
Meanwhile... there is a workaround...
STEP 1 Download PulseAudio for Windows
PulseAudio version 1.1 was available for Windows as of this writing; it's indeed an old version but it works on Windows 10.
STEP 2 Unzip the file from Step 1 to a folder
STEP 3 Edit 'etc\pulse\default.pa'
|FROM||load-module module-waveout sink_name=output source_name=input|
|TO||load-module module-waveout sink_name=output source_name=input record=0|
Please note that for security and privacy concerns Windows 10 (April 2018 Update) seems to restrict the access to audio recording devices. You can probably somehow override this feature, but since we just want to hear the sound we're simply disabling it from the PulseAudio server by adding the 'record=0'.
|TO||load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1|
This enables the PulseAudio server to accept connections only from 127.0.0.1 via TCP.
STEP 4 Edit 'etc\pulse\daemon.conf'
|FROM||; exit-idle-time = 20|
|TO||exit-idle-time = -1|
If this option is set to a non negative value, the server automatically terminates itself when the last client disconnects and the time is passed more than this option (in seconds).
STEP 5 Test run 'bin\pulseaudio.exe'
The 'pulseaudio.exe' is the executable for PulseAudio server (also referred to as a daemon) that we need for our Linux apps.
When you first run pulseaudio.exe, you'll see the Windows Firewall Alert popup that asks you if you want to allow other devices for connecting to the server. Since we'll only be using a loopback address (= 127.0.0.1), you should select 'Cancel'; you don't have to allow other devices.
If there was an error, the server exits immediately. If that's the case, go to Step 3 and make sure you've changed the lines correctly.
Press CTRL+C to stop the server.
STEP 6 Add PulseAudio related settings to your X410 launching batch file
start /B x410.exe /desktop start "" /B "C:\wsl\pulseaudio\bin\pulseaudio.exe" -D ubuntu1804.exe run "if [ -z \"$(pidof xfce4-session)\" ]; then export DISPLAY=127.0.0.1:0.0; export PULSE_SERVER=tcp:127.0.0.1; xfce4-session; pkill '(gpg|ssh)-agent'; taskkill.exe /IM x410.exe; taskkill.exe /IM pulseaudio.exe /T /F; fi;"
• start "" /B "C:\wsl\pulseaudio\bin\pulseaudio.exe" -D
Launches pulseaudio.exe as a server. You need to adjust the path to 'pulseaudio.exe' according to your setup.
• export PULSE_SERVER=tcp:127.0.0.1;
In order to let Linux apps know there is a PulseAudio server running at 127.0.0.1, we need to export the 'PULSE_SERVER' environment variable.
• taskkill /IM pulseaudio.exe /F /T
Pulseaudio.exe has its own '--kill' command line switch for terminating the running server. But it doesn't seem to work in Windows 10.