Deploy A Linux VM on Hyper-V with Sound

By default you can not pass sound through to your host Windows system’s audio devices from a Linux virtual machine. I struggled finding reliable instructions for getting this to work and ended up using a third party solution called PulseAudio.

To get started, you’ll need an Ubuntu VM to work with and we’ll need to install Hyper-V if you haven’t already. Open PowerShell as an Administrator and install the Hyper-V components. Run: Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All

Hyper-V can also be installed using the GUI. Go to the Control Panel -> Programs and Features > Turn Windows Features on or off and choose it from the menu (both boxes).

Once you have the Hyper-V tools installed, launch the Hyper-V Manager and use the Quick Create feature to automatically install and configure and Ubuntu Linux VM.

After the creation of your new VM has finished, right click on it in the Hyper-V Manager and start the virtual machine. Right click on it again to connect to the console.

After you get logged on to your new Linux machine, the first thing we need to do is to configured the repos so that you can download the PulseAudio software we will be using to enable your VM’s sound. In the show Applications menu, open Software and Updates. Go to the Ubuntu Software tab and select all of the boxes.

Now, open a terminal from the Show Applications menu and run the following lines to install and configure PulseAudio. Reboot the Linux VM when you are finished.

cd /tmp
sudo apt source pulseaudio 
cd /tmp/pulseaudio*
sudo ./configure
cd /usr/src/xrdp-pulseaudio-installer
sudo make PULSE_DIR="/tmp/pulseaudio-11.1"
sudo install -t "/var/lib/xrdp-pulseaudio-installer" -D -m 644 *.so

When the system comes back on line, connect again and use the Show Applications menu to open Settings. Go to the sound section and set the Output device to xrdp sink. Set the Input Device to xrdp source. That’s it. If everything went according to plan, your Ubuntu VM should be able to pass sound through to your Windows Host.

About Kevin Trent

IT professional with almost 30 years of experience in Infrastructure, Architecting, Administration, Development, and Communications.

4 Responses

  1. Michael

    Getting an error after sudo ./configure
    checking for gm4… no
    checking for m4… no
    configure: error: m4 missing

    and can’t continue

    Like

  2. Michael

    Ok solved it by doing:
    sudo apt-get install m4

    but then also needed the following before ./configure would complete:
    sudo apt-get install libtool
    sudo apt-get install libsndfile-dev
    sudo apt-get install libcap-dev

    Like

  3. Michael

    After installing required dependencies to get ./configure to work, now the next step i get this…

    michael@UbuntuVM:/tmp/pulseaudio-13.99.1$ cd /usr/src/xrdp-pulseaudio-installer
    bash: cd: /usr/src/xrdp-pulseaudio-installer: No such file or directory

    Not sure what to do next, your guide appears to be missing a lot of steps…

    Liked by 1 person

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s