How to get sound on Ubuntu in Hyper-V


cereberus

Well-known member
Guru
VIP
Local time
2:36 AM
Posts
7,121
OS
Windows 11 Pro + Win11 Canary VM.
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 11 Pro + Win11 Canary VM.
    Computer type
    Laptop
    Manufacturer/Model
    ASUS Zenbook 14
    CPU
    I9 13th gen i9-13900H 2.60 GHZ
    Motherboard
    Yep, Laptop has one.
    Memory
    16 GB soldered
    Graphics Card(s)
    Integrated Intel Iris XE
    Sound Card
    Realtek built in
    Monitor(s) Displays
    laptop OLED screen
    Screen Resolution
    2880x1800 touchscreen
    Hard Drives
    1 TB NVME SSD (only weakness is only one slot)
    PSU
    Internal + 65W thunderbolt USB4 charger
    Case
    Yep, got one
    Cooling
    Stella Artois (UK pint cans - 568 ml) - extra cost.
    Keyboard
    Built in UK keybd
    Mouse
    Bluetooth , wireless dongled, wired
    Internet Speed
    900 mbs (ethernet), wifi 6 typical 350-450 mb/s both up and down
    Browser
    Edge
    Antivirus
    Defender
    Other Info
    TPM 2.0, 2xUSB4 thunderbolt, 1xUsb3 (usb a), 1xUsb-c, hdmi out, 3.5 mm audio out/in combo, ASUS backlit trackpad (inc. switchable number pad)

    Macrium Reflect Home V8
    Office 365 Family (6 users each 1TB onedrive space)
    Hyper-V (a vm runs almost as fast as my older laptop)
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 11 Pro + Win11 Canary VM.
    Computer type
    Laptop
    Manufacturer/Model
    ASUS Zenbook 14
    CPU
    I9 13th gen i9-13900H 2.60 GHZ
    Motherboard
    Yep, Laptop has one.
    Memory
    16 GB soldered
    Graphics Card(s)
    Integrated Intel Iris XE
    Sound Card
    Realtek built in
    Monitor(s) Displays
    laptop OLED screen
    Screen Resolution
    2880x1800 touchscreen
    Hard Drives
    1 TB NVME SSD (only weakness is only one slot)
    PSU
    Internal + 65W thunderbolt USB4 charger
    Case
    Yep, got one
    Cooling
    Stella Artois (UK pint cans - 568 ml) - extra cost.
    Keyboard
    Built in UK keybd
    Mouse
    Bluetooth , wireless dongled, wired
    Internet Speed
    900 mbs (ethernet), wifi 6 typical 350-450 mb/s both up and down
    Browser
    Edge
    Antivirus
    Defender
    Other Info
    TPM 2.0, 2xUSB4 thunderbolt, 1xUsb3 (usb a), 1xUsb-c, hdmi out, 3.5 mm audio out/in combo, ASUS backlit trackpad (inc. switchable number pad)

    Macrium Reflect Home V8
    Office 365 Family (6 users each 1TB onedrive space)
    Hyper-V (a vm runs almost as fast as my older laptop)

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 11 Pro + Win11 Canary VM.
    Computer type
    Laptop
    Manufacturer/Model
    ASUS Zenbook 14
    CPU
    I9 13th gen i9-13900H 2.60 GHZ
    Motherboard
    Yep, Laptop has one.
    Memory
    16 GB soldered
    Graphics Card(s)
    Integrated Intel Iris XE
    Sound Card
    Realtek built in
    Monitor(s) Displays
    laptop OLED screen
    Screen Resolution
    2880x1800 touchscreen
    Hard Drives
    1 TB NVME SSD (only weakness is only one slot)
    PSU
    Internal + 65W thunderbolt USB4 charger
    Case
    Yep, got one
    Cooling
    Stella Artois (UK pint cans - 568 ml) - extra cost.
    Keyboard
    Built in UK keybd
    Mouse
    Bluetooth , wireless dongled, wired
    Internet Speed
    900 mbs (ethernet), wifi 6 typical 350-450 mb/s both up and down
    Browser
    Edge
    Antivirus
    Defender
    Other Info
    TPM 2.0, 2xUSB4 thunderbolt, 1xUsb3 (usb a), 1xUsb-c, hdmi out, 3.5 mm audio out/in combo, ASUS backlit trackpad (inc. switchable number pad)

    Macrium Reflect Home V8
    Office 365 Family (6 users each 1TB onedrive space)
    Hyper-V (a vm runs almost as fast as my older laptop)
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