Completely disabling pulse audio (playback and record) in service VMs that don't need sound

125 views
Skip to first unread message

daltong defourne

unread,
Jul 11, 2017, 4:40:34 AM7/11/17
to qubes-users
Hi!

Basically, I want to disable pulseaudio for stuff like firewall VM and VPN VM and the like.

They don't need it and it makes pavucontrol pannel a mess.

I tried just doing a

sudo pactl exit

in terminal of VMs that don't need sound and it works like a charm

HOWEVER

inserting a
pactl exit
line into
/rw/config/rc.local
has no effect pulse still starts after reboot and the VM is still seen in pavucontrol)

All other commands in rc. local are executed as expected, so it's not a rc.local issue per se, but rather maybe something like pulseaudio startup thing.

Any pointers as to how to reliably "de-pulse-ize" VMs at startup?

P.S.: uninstalling pulseaudio from template breaks things for me on several VMs and is not an option.

Noor Christensen

unread,
Jul 11, 2017, 5:37:49 AM7/11/17
to qubes-users
On Tue, Jul 11, 2017 at 01:40:34AM -0700, daltong defourne wrote:
> All other commands in rc. local are executed as expected, so it's not
> a rc.local issue per se, but rather maybe something like pulseaudio
> startup thing.
>
> Any pointers as to how to reliably "de-pulse-ize" VMs at startup?
>
> P.S.: uninstalling pulseaudio from template breaks things for me on
> several VMs and is not an option.

You might want to take a look at /etc/qubes/autostart directory in your
TemplateVMs. There is a "OnlyShowIn" that can be used to define in what VMs
the application should autostart, either by name or type
(appvm/templatevm etc).

Check the README.txt in that directory for some guidelines, and look at
the existing files for examples.

-- noor

|_|O|_|
|_|_|O| Noor Christensen
|O|O|O| no...@fripost.org ~ 0x401DA1E0
signature.asc

daltong defourne

unread,
Jul 11, 2017, 6:58:11 PM7/11/17
to qubes-users, kchr+qub...@fripost.org
Thanks!

Is it possible to do this on a per-app-VM basis and not on a per-template basis?

Salmiakki

unread,
Jul 11, 2017, 7:41:56 PM7/11/17
to qubes-users, kchr+qub...@fripost.org
On Wednesday, 12 July 2017 00:58:11 UTC+2, daltong defourne wrote:

> Is it possible to do this on a per-app-VM basis and not on a per-template basis?
>

> > TemplateVMs. There is a "OnlyShowIn" that can be used to define in what VMs
> > the application should autostart, either **by name** or type
> > (appvm/templatevm etc).

Shouldn't that cover your use-case?

Salmiakki

unread,
Jul 11, 2017, 7:49:14 PM7/11/17
to qubes-users, kchr+qub...@fripost.org
And according to the README in /etc/qubes/autostart you can override everything from within the VM using ~/.config/autostart:

> This mechanism overrides only content of /etc/xdg/autostart, files placed in
> ~/.config/autostart are unaffected, so can be used to override settings per-VM
> basis.

Salmiakki

unread,
Jul 11, 2017, 8:04:44 PM7/11/17
to qubes-users, kchr+qub...@fripost.org
I liked this idea, so I wanted to try.

This seems to work:

in /etc/qubes/autostart/qubes-pulseaudio.desktop.d/30_qubes.conf
put this:

[Desktop Entry]
OnlyShowIn=X-AppVM;

Now only AppVMs have audio.
Putting a name in there did not work for me but going to an AppVM and doing this:
mkdir ~/.config/autostart
cp /etc/xdg/autostart/pulseaudio.desktop ~/.config/autostart/

and adding X-GNOME-Autostart-enabled=false
to that worked!

daltong defourne

unread,
Jul 12, 2017, 9:17:54 AM7/12/17
to qubes-users, kchr+qub...@fripost.org
Hi!
Tried that (X-GNOME-Autostart-enabled=false) and pulse still starts


Does it have to be the only line there (I mostly kept the original content)

I also tried doing those manipulations with qubes-pulseaudio.desktop file, to no result

Noor Christensen

unread,
Jul 12, 2017, 10:34:15 AM7/12/17
to qubes-users
On Wed, Jul 12, 2017 at 06:17:53AM -0700, daltong defourne wrote:
> On Wednesday, July 12, 2017 at 3:04:44 AM UTC+3, Salmiakki wrote:
> > Putting a name in there did not work for me but going to an AppVM and doing this:
> > mkdir ~/.config/autostart
> > cp /etc/xdg/autostart/pulseaudio.desktop ~/.config/autostart/
> >
> > and adding X-GNOME-Autostart-enabled=false
> > to that worked!
>
> Hi!
> Tried that (X-GNOME-Autostart-enabled=false) and pulse still starts
>
> Does it have to be the only line there (I mostly kept the original
> content)
>
> I also tried doing those manipulations with qubes-pulseaudio.desktop
> file, to no result

I don't know what the X-GNOME-Autostart-enabled does, but here's a short
summary on how to use the "ShowIn" XDG fields.

You can provide multiple values for this field. For example, if you only
want the application to run on AppVMs and DisposableVMs:

> [Desktop Entry]
> OnlyShowIn=X-AppVM;X-DisposableVM;

The "ShowIn" field can also be negated. For example, if you want an
application to never run in a TemplateVM but anywhere else:

> [Desktop Entry]
> NotShowIn=X-TemplateVM;

From /etc/qubes/autostart/README.txt:

> This mechanism overrides only content of /etc/xdg/autostart, files
> placed in ~/.config/autostart are unaffected, so can be used to
> override settings per-VM basis.

It is suggested to use ~/.config/autostart if you need to override anything for
a specific VM. In your case, I guess you want something like the following...

# In TemplateVM
# /etc/qubes/autostart/qubes-pulseaudio.desktop.d/30_qubes.conf:

[Desktop Entry]
NotShowIn=X-QUBES;

On each AppVM you want to enable this application for, create:

# ~/.config/autostart/qubes-pulseaudio.desktop.d/30_qubes.conf

[Desktop Entry]
OnlyShowIn=X-AppVM;
NotShowIn=

Possibly you can skip "OnlyShowIn" and just clear the "NotShowIn" value.

I have found the following Qubes-specific identifiers so far, partly from an
earlier qubes-users thread[0]:

X-QUBES Seems to match any type of Qubes VM

X-AppVM Any VM except TemplateVM, ProxyVM, NetVM
X-NetVM
X-ProxyVM
X-TemplateVM
X-DisposableVM
X-UpdateableVM TemplateVM or StandaloneVM
X-NonUpdateableVM Any VM except UpdateableVM

Also, here are some non-Qubes identifiers I've seen elsewhere:

GNOME
KDE
MATE
Unity
Cinnamon

I am not aware of any way to specify a VM name in this context. Maybe because
/etc/xdg/autostart is only relevant for a TemplateVM. And when you get to your
custom files in ~/.config/autostart you are already in a specific VM so no need
to specify it there.

If you really want to do it on the TemplateVM and no config on AppVM, I guess
you could put something in /rw/config/rc.local that only runs if $HOST variable
matches your VM name.

[0] https://groups.google.com/forum/#!topic/qubes-users/smztkltkwOg

-- noor

|_|O|_|
|_|_|O| Noor Christensen
|O|O|O| no...@fripost.org ~ 0x401DA1E0
signature.asc

daltong defourne

unread,
Jul 13, 2017, 8:27:58 AM7/13/17
to qubes-users, kchr+qub...@fripost.org
Okay, after a bit of fiddling I have managed to disable it in "app vms of choice" by simply placing a config that only has

[Desktop Entry]
OnlyShowIn=X-TemplateVM;

in "override" directory (~/.config/autostar) for pulseaudio

However, templates that have startup parameters for both pulseaudio and qubes-pulseaudio need both overriden as separate entries

Thanks a huge lot!
You fellows rule!

> |O|O|O| ~ 0x401DA1E0

cyrinux

unread,
Jul 13, 2017, 9:49:40 AM7/13/17
to qubes-users
Hi,
Very interesting.
Which template do you use?
I try to get this working with a fedora 25 based appvm and pulseaudio start yet.
Could you please do a summary?
Thanks a lot guys
Reply all
Reply to author
Forward
0 new messages