LXD vga type console login blocks audio devices in host OS
Hello team,
I have a Ubuntu Desktop VM running named "esa-desktop" on LXD as below. When I launch a console via lxc console --type vga esa-desktop, it launches remote console successfully but also throws below errors and my PC built-in mic and speaker does not work anymore. Could you please help if audio transfer could be disabled?
$ lxc ls
+---------------+---------+------+------+-----------------+-----------+
| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |
+---------------+---------+------+------+-----------------+-----------+
| esa-desktop | STOPPED | | | VIRTUAL-MACHINE | 0 |
$ lxc console esa-desktop --type vga
(remote-viewer:1804033): GLib-GObject-WARNING **: 12:13:06.540: g_object_get_is_valid_property: object class 'GstAutoAudioSink' has no property named 'volume'
(remote-viewer:1804033): GLib-GObject-WARNING **: 12:13:06.567: g_object_get_is_valid_property: object class 'GstAutoAudioSrc' has no property named 'volume'
$ lxd version
5.21.1 LTS
Here, testing with spicy (rather than remote-viewer) I have similar warnings:
$ lxc launch images:ubuntu/noble/desktop nd1 --vm -c limits.cpu=2 -c limits.memory=6GiB
$ lxc console -t vga nd1
GSpice-Message: 09:54:19.429: main channel: opened
port 0x589770488300 org.spice-space.webdav.0: opened
port 0x589770488300 org.spice-space.webdav.0: closed
/dev/shm/jack_db-0/__db.001: No such file or directory
(spicy:1214121): GLib-GObject-WARNING **: 09:54:41.215: g_object_get_is_valid_property: object class 'GstAutoAudioSink' has no property named 'volume'
/dev/shm/jack_db-0/__db.001: No such file or directory
(spicy:1214121): GLib-GObject-WARNING **: 09:54:41.221: g_object_get_is_valid_property: object class 'GstAutoAudioSrc' has no property named 'volume'
However, those warnings are consistent with the fact that the VM has no real audio device attached to it:
That said, my host's sound is unaffected by having this VGA console opened.
@selcem-artan, could you please indicate how you created that esa-desktop VM?
Also, it'd be useful if you could share the following details on your host machine (I've provided results for my host machine):
$ echo "$XDG_SESSION_TYPE"
wayland
$ cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04.4 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.4 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy
$ uname -a
Linux sdeziel-lemur 6.5.0-28-generic #29~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Apr 4 14:39:20 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
Thanks!
@simondeziel is there a way to invoke the spice client without sound mode?
@tomponline not that I could find when looking at both remote-viewer and spicy man pages.
@selcem-artan also, once you have the VGA console running, could you check your host's sound configuration and see if there is are new output and input devices showing?
gnome-control-center sound will let you see the sound menu which should look like this:
If if you click on the Output Device and Input Device drop down lists, you should see which devices are currently actives and which are present.
Hello Sİmon and Tom,
I am creating my VM using below; lxc launch images:ubuntu/22.04/desktop esa-desktop --vm -c limits.cpu=1 -c limits.memory=2GiB
I will check for sound setting as you showed
I am sharing "Audio" settings from both my main OS (left), and Ubuntu Desktop VM (right). IN left one, no more selection is available
@selcem-artan thanks, so far that doesn't seem to indicate a problem. Could you please share the other bits of information from your host, those from https://github.com/canonical/lxd/issues/13402#issuecomment-2082912230? Those will help us narrow down what it could be.
So far, I've been unable to reproduce this issue locally while using the same guest OS. My local environment runs under Wayland (XDG_SESSION_TYPE=wayland).
I'll close the issue as I'm unable to reproduce it. @selcem-artan please let us know if you are still experiencing it and share a bit more information about your local environment to help us reproduce and fix it. Thank you
I have the same problem. After reading this, I realized it has to do with how the viewer process gets spawned.
As a workaround, I use xdg-open with the socket url, and replaced in "/snap/lxd/current/bin/remote-viewer" this line:
exec unshare -U -r chroot "/var/lib/snapd/hostfs/" "${CMD}" "$@"
with this:
# Use xdg-open instead of launching the viewer in a new ns
# must have a valid audio device, e.g.:
# lxc config set VM_NAME raw.qemu -- "-device intel-hda -device hda-duplex -audio spice"
xdg-open "$@"
VIEWER=$(echo "/usr/bin/${CMD} $@" | sed 's/\+/\./g' )
echo "waiting for viewer to close..."
echo "VIEWER: $VIEWER"
VIEWER_PID=$(pgrep -f "${VIEWER}")
echo "VIEWER_PID: $VIEWER_PID"
while [ -n "$VIEWER_PID" ]; do
VIEWER_PID=$(pgrep -f "${VIEWER}")
sleep 1s
done
echo "release socket"
exit 0
To use the modified script, I mount it over the existing one in the lxd snap:
sudo mount --bind ${HOME}/remote-viewer /snap/lxd/current/bin/remote-viewer
With this I have working sound (including mic) in the an ubuntu vm. The vm must have a valid audio device, e.g.:
lxc config set VM_NAME raw.qemu -- "-device intel-hda -device hda-duplex -audio spice"
I have attached the complete file: remote-viewer