Missing audio in libvirt/qemu/virt-manager VM, suspect missing audio driver

I sometimes play around with distros, but I’m missing audio.
And I noticed that for arch, they have a qemu-audio-pipewire plugin and I can’t seem to find in the guix package repository. Nor can I find the audio-pipewire.so library in the guix qemu package.

Is that why I have no audio?

If so, is there a quick way to fix this issue?

clone the guix source and grep for that string

git clone https://codeberg.org/guix/guix && cd guix
grep -re '\bqemu.*pipewire\b' gnu/packages # or something like that

guix search also accepts quoted regexp. once you find the package name, use guix edit $pkgname

… or are you already searching in the source?

1 Like

It looks like arch has something of a metapackage for qemu (see qemu-desktop in the PKGBUILD if you want).

it looks like that metapackage passes the options needed to build in build(). at some point, the _pick() function extracts the artifacts and packs them into individual packages… jeez whoever wrote _pick() really didn’t want anyone to understand it lol. it’s terse.

you may need to write something like:

(define qemu-with-pipewire
 (package
  (inherit qemu)
  (name "qemu-with-pipewire")
  ;; ...
))
  • Then slightly change the package’s inputs
  • add one or two build flags
  • ensure that any other files needed are also in their correct place.

However, that’s not a fantastic first package if you haven’t written one before. Iterating on that will take a long time, then you can only know it works by replacing the instance on your system. It’s slightly less burdonsome maybe if it’s in a VM … but not much easier.

Try modifying build flags and inputs for something that already exists or building a package that doesn’t. Definitely refer to “The perfect setup” section in the manual.

1 Like

… or are you already searching in the source?

No. I’m looking at this as too much work for now.
Stuff like this takes me a long time and I have yet to create my first package.

VM with audio is not my first priority if it becomes a small project in my list of small projects.

I had the same issue. Try installing the gst-plugins-good package, that fixed the issue for me.

1 Like

You will eventually need to write packages, especially if you’re using Guix as a daily driver. Fortunately, it’s much easier than on other distros.

1 Like

That didn’t work for me.
Does one have to reboot the host for it to work?

hmm, i don’t remember rebooting. Did you install it in your user profile or system-wide in your configuration? Cause i installed it system-wide, maybe that makes a difference.

1 Like

User profile, but I tried system-wide and that doesn’t seem to work either.
I added gst-plugins-base as well to no avail. I have noticed that virt-manager has issues with failing to load gstreamer plugins.

(.virt-manager-real:15921): GSpice-WARNING **: 21:23:07.102: Failed to create pipeline: pas d’élément « appsrc »
/gnu/store/h0raiynr5liyf8ri2sxkk9mpkdyrvdv8-python-pygobject-3.50.0/lib/python3.11/site-packages/gi/overrides/Gio.py:42: Warning: g_object_ref: assertion 'G_IS_OBJECT (object)' failed
  return Gio.Application.run(self, *args, **kwargs)
/gnu/store/h0raiynr5liyf8ri2sxkk9mpkdyrvdv8-python-pygobject-3.50.0/lib/python3.11/site-packages/gi/overrides/Gio.py:42: Warning: g_object_get: assertion 'G_IS_OBJECT (object)' failed
  return Gio.Application.run(self, *args, **kwargs)
/gnu/store/h0raiynr5liyf8ri2sxkk9mpkdyrvdv8-python-pygobject-3.50.0/lib/python3.11/site-packages/gi/overrides/Gio.py:42: Warning: g_object_unref: assertion 'G_IS_OBJECT (object)' failed
  return Gio.Application.run(self, *args, **kwargs)

(.virt-manager-real:15921): GSpice-WARNING **: 21:23:07.103: Failed to create pipeline: pas d’élément « autoaudiosrc »```

What else have you installed system-wide that might be used by virt-manager?

Hmm, that’s strange. I don’t remember the exact error i encountered, but it does look similar to what i had. Aside from gst-plugins-good, the only other audio-related package in my system config is alsa-utils, but i don’t think that would do anything. I suppose it’s worth a try though.

1 Like

That didn’t work either.

What about virt-manager itself? Do you have that installed system-wide?

yes, virt-manager is also installed system-wide (do you also have the libvirt-service-type in your config btw?)

1 Like

I see. I didn’t feel the need for virt-manager to be available system-wide. I guess I’ll try that out. For libvirt-service type, I have this in my /etc/config.scm

(use-service-modules ...
  virtualization)
...
(operating-system
...
  (packages (append (specifications->package '(... 
"alsa-utils"
"gst-plugins-base" 
"gst-plugins-good" 
"virt-manager")) %base-packages))
... 
  (service libvirt-service-type
     (libvirt-configuration (tls-port "16514")
       (unix-sock-group "libvirt")
       (unix-sock-rw-perms "0770")))
  (service virtlog-service-type                     
    (virtlog-configuration (max-clients 1000)))
 ...        

Even with “virt-manager” added, it’s still not working, although I haven’t rebooted yet.

Maybe I need to restart the libvirt service.

have you specifically tried gst-plugins-good instead of gst-plugins-base? Other than that i wouldn’t know anymore what the problem could be. For what it’s worth though, the gst-plugins-good fix that worked for me was something i found in an archlinux post on reddit, so it could be worth looking for more generic topics about the issue and seeing if you can apply that to Guix.

1 Like

have you specifically tried gst-plugins-good instead of gst-plugins-base?

I have now and it did not work. I was using both before instead of only gst-plugins-base. I made a typo in my previous comment.

Which sound device do you use?

it could be worth looking for more generic topics about the issue and seeing if you can apply that to Guix.

That’s what I opened this thread with, although I did not mention that part. I saw topics where the qemu-audio-pipewire plugin was not configured or installed and then noticed that it’s completely missing in guix.

I’m using HDA (ICH9) as my sound device. I just booted up my vm to see if it’s still working and audio still works. At this point the only thing i can think of is that i have (service home-pipewire-service-type) in my guix home config. Other than that i don’t think i did anything special when it comes to audio configuration.

1 Like

When I try to add that service, I get this error:

$ guix home container ./home-configuration.scm
guix home: error: service 'pipewire' requires 'dbus', which is not provided by any service

If your VM mostly builds on %desktop-services, then it has pulseaudio-service. you can check for that by using herd status. Does this VM also have XFCE and X11?

IIRC, this needs to be removed before adding the pipewire and pipewire-pulse packages along with some way to start pipewire as a service under your user.

D-Bus

This is semi-related, but just in case… You definitely need d-bus session for the user. The guix home command there is complaining that pipewire doesn’t isn’t accompanied by a dbus session that’s defined in a service via guix home.

You probably already have a user d-bus session. qdbusviewer below can help you sort that out. Then just figure out what’s starting dbus for your user. it’s different depending on how X11 gets started.

For d-bus, guix home container ./home-configuration.scm command needs to --share a socket file. Otherwise things outside the container can’t talk to the d-bus inside the container – though I don’t even think that container environment can spawn your services. guix home container is more useful for checking that your env is set up right and for making small changes.

if you run guix shell qttools -- qdbusviewer, it’s a GUI that lets you walk through the dbus interfaces. d-feet is a bit better, but there’s no package for it.

bustle is available on flatpak, but that’s a bit much to set up if you’re just poking around a system. It’s easy to install on guix once you have flatpak, but IIRC there are a few things required for that. fonts require a quick fix, but it can be confusing. a d-bus portal is definitely needed.

There’s always dbus-monitor, but it’s CLI.

dbus-monitor --session --profile "type='signal',interface='org.freedesktop.DBus.Properties'"

you’ll probably have to add (service home-dbus-service-type) to your config as well, that will start a dbus session for your user.

1 Like

Are you using AI to reply?

1 Like