How to get sound on Ubuntu in Hyper-V


cereberus

Well-known member
Guru
VIP
Local time
5:07 PM
Posts
5,660
OS
Windows 10 Pro + others in VHDs
One of the weaknesses of Hyper-V is that you cannot get sound unless VM has an RDP server.

Ubuntu can now be installed with XRDP enabling enhanced mode. There are many web guides how to install Ubuntu in enhanced mode e.g.

How to Enable Hyper-V Enhanced Session for Ubuntu 20.04 VMs (nakivo.com)

(I wrote a tutorial but it is out of date).

Note: do not use the option in Hyper-V but install from downloaded iso, as for some reason steps to include xrdp fail.

However, getting sound was a different matter. There was a guide by author of link below, but I could never get it to work.

However, author has recently updated guide to work for 20.04

Deploy a Linux VM on Hyper-V with Sound 20.04 Edition – techbloggingfool.com

Here are the commands - enter one at a time

Code:
sudo apt-get install git libpulse-dev autoconf m4 intltool build-essential dpkg-dev libtool libsndfile-dev libspeexdsp-dev libudev-dev -y

sudo cp /etc/apt/sources.list /etc/apt/sources.list~

sudo sed -Ei 's/^# deb-src /deb-src /' /etc/apt/sources.list

sudo apt-get update

sudo apt build-dep pulseaudio -y

cd /tmp

sudo apt source pulseaudio

pulsever=$(pulseaudio --version | awk '{print $2}')

cd /tmp/pulseaudio-$pulsever

sudo ./configure

sudo git clone https://github.com/neutrinolabs/pulseaudio-module-xrdp.git

cd pulseaudio-module-xrdp

sudo ./bootstrap

sudo ./configure PULSE_DIR="/tmp/pulseaudio-$pulsever"

sudo make

cd /tmp/pulseaudio-$pulsever/pulseaudio-module-xrdp/src/.libs

sudo install -t "/var/lib/xrdp-pulseaudio-installer" -D -m 644 *.so

Then you have to configure Hyper-V enhanced menu. These two screenshot are from above link.

I had to manually start the sound daemon.

Went to youtube, loaded favourite my Dolly Parton video, and BOOM - Sound in Hyper-V for Ubuntu.


I make no claim to any part of this and 100% Kudos to Kevin Trent the author.

-----------------------------------------------------------------------------------------------------------------------------



1627831782719.png


1627831932306.png
 
Last edited:

My Computer

System One

  • OS
    Windows 10 Pro + others in VHDs
    Computer type
    Laptop
    Manufacturer/Model
    ASUS Vivobook 14
    CPU
    I7
    Motherboard
    Yep, Laptop has one.
    Memory
    16 GB
    Graphics Card(s)
    Integrated Intel Iris XE
    Sound Card
    Realtek built in
    Monitor(s) Displays
    N/A
    Screen Resolution
    1920x1080
    Hard Drives
    1 TB Optane NVME SSD, 1 TB NVME SSD
    PSU
    Yep, got one
    Case
    Yep, got one
    Cooling
    Stella Artois
    Keyboard
    Built in
    Mouse
    Bluetooth , wired
    Internet Speed
    72 Mb/s :-(
    Browser
    Edge mostly
    Antivirus
    Defender
    Other Info
    TPM 2.0
Thank You for This content And it's work on Ubuntu focal 20.0 And it doesn't work on Jammy Jellyfish 22.04

Please Update This Content
 

My Computer

System One

  • OS
    Ubuntu
Thank You for This content And it's work on Ubuntu focal 20.0 And it doesn't work on Jammy Jellyfish 22.04

Please Update This Content
And what am I supposed to do?

You are quite welcome to work out changes for 22.04.
 

My Computer

System One

  • OS
    Windows 10 Pro + others in VHDs
    Computer type
    Laptop
    Manufacturer/Model
    ASUS Vivobook 14
    CPU
    I7
    Motherboard
    Yep, Laptop has one.
    Memory
    16 GB
    Graphics Card(s)
    Integrated Intel Iris XE
    Sound Card
    Realtek built in
    Monitor(s) Displays
    N/A
    Screen Resolution
    1920x1080
    Hard Drives
    1 TB Optane NVME SSD, 1 TB NVME SSD
    PSU
    Yep, got one
    Case
    Yep, got one
    Cooling
    Stella Artois
    Keyboard
    Built in
    Mouse
    Bluetooth , wired
    Internet Speed
    72 Mb/s :-(
    Browser
    Edge mostly
    Antivirus
    Defender
    Other Info
    TPM 2.0

My Computer

System One

  • OS
    Windows 11 Pro
    Computer type
    PC/Desktop
    Manufacturer/Model
    N/A
    CPU
    Intel i7-8700K @ 3.70GHz
    Motherboard
    Gigabyte Z370 AORUS Gaming 5 (rev. 1.0)
    Memory
    64GB
    Graphics Card(s)
    Nvidia Quadro K2200
    Sound Card
    Realtek® ALC1220 codec
    Monitor(s) Displays
    Samsung
    Screen Resolution
    1920*1080
    Hard Drives
    Samsung SSD 970 EVO 2TB
    Browser
    MS Edge
    Antivirus
    MS Defender
Try Kali instead - far easier.

 

My Computer

System One

  • OS
    Windows 10 Pro + others in VHDs
    Computer type
    Laptop
    Manufacturer/Model
    ASUS Vivobook 14
    CPU
    I7
    Motherboard
    Yep, Laptop has one.
    Memory
    16 GB
    Graphics Card(s)
    Integrated Intel Iris XE
    Sound Card
    Realtek built in
    Monitor(s) Displays
    N/A
    Screen Resolution
    1920x1080
    Hard Drives
    1 TB Optane NVME SSD, 1 TB NVME SSD
    PSU
    Yep, got one
    Case
    Yep, got one
    Cooling
    Stella Artois
    Keyboard
    Built in
    Mouse
    Bluetooth , wired
    Internet Speed
    72 Mb/s :-(
    Browser
    Edge mostly
    Antivirus
    Defender
    Other Info
    TPM 2.0
I finally got sound to work. Here is what I did.
  1. Follow these instructions to get XRDP working correctly, click How to Enable Hyper-V Enhanced Session for Ubuntu 20.04 VMs The instructions in step 3 miss a step here, once you get to step 3 you'll pass over these steps because you'll have done them already.
  2. Next I had to install Git, follow these instructions, click Git
  3. Next I used these instructions (which didn't work) Deploy a Linux VM on Hyper-V with Sound 20.04 Edition but if you completed 1 & 2 above you can begin following these instructions at the point that it talks about using PowerShell. Follow them till you get to "sudo ./configure" which will fail.
  4. Next I used these instructions to install pulseaudio from source, click Building & Installing PulseAudio from Git – Developer Documentation – PulseAudio
  5. Next I returned to the step following the failed "sudo .configure" and followed on again until "sudo make" finished.
  6. Next I ran "sudo make install"
At this point I checked the settings/sound and still didn't see the xrdp output device. So I shutdown the Ubuntu vm, started it again and logged in. Finally the xrdp output device was present. I clicked on Test and it worked.

I had plenty of errors and failures before I got it working, I'm 95% certain I've captured the elements that made it work in the steps above. Good luck.
 

My Computer

System One

  • OS
    Windows 11 Pro
    Computer type
    PC/Desktop
    Manufacturer/Model
    N/A
    CPU
    Intel i7-8700K @ 3.70GHz
    Motherboard
    Gigabyte Z370 AORUS Gaming 5 (rev. 1.0)
    Memory
    64GB
    Graphics Card(s)
    Nvidia Quadro K2200
    Sound Card
    Realtek® ALC1220 codec
    Monitor(s) Displays
    Samsung
    Screen Resolution
    1920*1080
    Hard Drives
    Samsung SSD 970 EVO 2TB
    Browser
    MS Edge
    Antivirus
    MS Defender
Back
Top Bottom