• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Enable sound inside jail

Nukama

Active Member

Thanks: 43
Messages: 129

#2
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

Thanks: 5,508
Messages: 25,688

#3
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

Thanks: 204
Messages: 594

#5
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