Enable sound inside jail

captobvious

Member

Reaction score: 1
Messages: 48

I am running xfce4 from a jail and accessing it with xnest. Is there a way to get audio working from inside the jail?
 

Nukama

Active Member

Reaction score: 43
Messages: 129

If your jail is on the same host, you could allow access to audio devices (i.e. desktop.local) with
/etc/devfs.rules:
Code:
# Devices usually found in a desktop jail.
#
[devfsrules_desktop_jail=5]
add include $devfsrules_hide_all
add include $devfsrules_unhide_basic
add include $devfsrules_unhide_login
add path 'mixer*' unhide
add path 'dsp*' unhide
add path 'dri' unhide
add path 'dri/card0' unhide
and add following to your jail setup in /etc/rc.conf or /usr/local/etc/ezjail/desktop_local:
Code:
export jail_desktop_local_devfs_ruleset="devfsrules_desktop_jail"
 
Last edited by a moderator:

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 7,681
Messages: 30,610

Nukama said:
and add following to your jail setup in /etc/rc.conf or /usr/local/etc/ezjail/desktop_local:
Code:
export jail_desktop_local_devfs_ruleset="devfsrules_desktop_jail"
Or simply use
Code:
jail_<name>_devfs_ruleset="devfsrules_desktop_jail"
in /etc/rc.conf when you don't use sysutils/ezjail.

No need to export anything, it's all taken care of by the jail rc script.
 

chrbr

Aspiring Daemon

Reaction score: 242
Messages: 675

This thread is a few years old but one of the first hits seeking "freebsd jail audio" with a popular search engine. Therefore it might be helpful for somebody else using FreeBSD-11.1 to have an example what works for myself nowadays. Only details have changed with repect to 2011. /etc/devfs.rules is a copy of the jails section in /etc/defaults/devfs.rules with two lines added. This is copied from the excellent howtodo https://forums.freebsd.org/threads/53362/. The content of /etc/devfs.rules is
Code:
# Devices usually found in a desktop jail for sound.
#
[devfsrules_desktop_jail=5]
add include $devfsrules_hide_all
add include $devfsrules_unhide_basic
add include $devfsrules_unhide_login
add path zfs unhide
add path 'mixer*' unhide
add path 'dsp*' unhide
This file is activated by a line in /etc/rc.conf as
Code:
jail_fox_devfs_ruleset=5
In contrast to the 2011 syntax the index and not the name is specified. I hope this is a useful update.
Kind regards,
Christoph
 
Top