In my tutorial entitled “Ubuntu LXD Virtual Machine” we learned how to create an Ubuntu LXD VM from a simple command line. In this presentation, we take the Ubuntu LXD VM further by adding sound support from the LXD host sound device. We add the Gnome Software Center store. We add the Brave Browser to the Ubuntu 22.04 Desktop LXD VM since there are no browsers preinstalled. We also add RDP support with sound and demonstrate that it works via an Apache Guacamole session.
To create and start the Ubuntu 22.04 LXD VM with a GUI desktop:
lxc launch images:ubuntu/22.04/desktop test-vm --vm --profile default --profile untagged -c limits.memory=4096MB -c limits.cpu=2
Note that your system will not have an “untagged” profile. That was added in a previous tutorial and it is designed to present the LXD VM with an address on your MAIN LAN.
Next, we stopped the LXD VM in order to enlarge its disk allocation and to provide RAW QEMU support for sound:
lxc stop test-vm
lxc config device override test-vm root size=50GiB
lxc config set test-vm raw.qemu -- "-device intel-hda -device hda-duplex"
Next we start the LXD VM back up and connect to its console:
lxc start test-vm
lxc console test-vm --type=vga
Open a terminal and update the software repository and install any updates:
sudo apt update && sudo apt upgrade -y
Find out what version kernel is running in the LXD VM:
uname -a
Using the version of the kernel you are running add the linux-modules-extra and reboot afterwards:
sudo apt install linux-modules-extra-5.15.0-39-generic
sudo reboot
Install dependencies to prepare to install the Brave Browser:
sudo apt install apt-transport-https wget ca-certificates gnupg2 ubuntu-keyring curl -y
Install the Brave Key:
sudo curl -fsSLo /usr/share/keyrings/brave-browser-archive-keyring.gpg https://brave-browser-apt-release.s3.brave.com/brave-browser-archive-keyring.gpg
Add the Brave repository to the package manager and update the repository:
echo "deb [signed-by=/usr/share/keyrings/brave-browser-archive-keyring.gpg arch=amd64] https://brave-browser-apt-release.s3.brave.com/ stable main"|sudo tee /etc/apt/sources.list.d/brave-browser-release.list
sudo apt update
Install the Brave Browser:
sudo apt install brave-browser -y
Get the script to install RDP with Sound Support:
wget https://c-nergy.be/downloads/xRDP/xrdp-installer-1.5.2.zip
Unzip the downloaded archive:
unzip xrdp-installer-1.5.2.zip
Run the XRDP installation script with the “-s” qualifier for sound support:
bash xrdp-installer-1.5.2.sh -s
Reboot your system.
sudo reboot
Connect to the console again and start a terminal:
lxc console test-vm --type=vga
Add a user account and grant it “sudo” privilege:
sudo adduser scott
sudo usermod -aG sudo scott
At this point, in the settings control panel, your output sound device is most likely missing. To fix this, run the following three commands to remove and reinstall pulse audio and reboot:
rm -r ~/.config/pulse
sudo apt remove --purge alsa-base pulseaudio* gnome-control-center
sudo apt install alsa-base pulseaudio gnome-control-center
sudo reboot
You now have a LXD VM that you can connect to with RDP and it will have sound support. You can use Remmina, Apache Guacamole, or Microsoft Windows to connect to your Ubuntu 22.04 LXD VM desktop via RDP and enjoy your sound!
Be sure to watch my other LXD VM videos and my LXD videos in general to answer other questions not covered in this tutorial.