Solved brave does not work /dev/shm/ can not mount in jail

I setup void Linux jail by following this tutorial https://antranigv.am/posts/2021/08/2021-08-21-00-37/
Create a file at /home/james/voidlinux/etc/fstab.pre and insert the following inside

Code:
devfs       /home/james/voidlinux/dev      devfs           rw                      0   0
tmpfs       /home/james/voidlinux/dev/shm  tmpfs           rw,mode=1777    0   0
fdescfs     /home/james/voidlinux/dev/fd   fdescfs         rw,linrdlnk             0   0
linprocfs   /home/james/voidlinux/proc     linprocfs       rw                      0   0
linsysfs    /home/james/voidlinux/sys      linsysfs        rw                      0   0
/tmp        /home/james/voidlinux/tmp      nullfs          rw                      0   0
my Jail conf!
Code:
exec.clean;
allow.raw_sockets;
mount.devfs;

voidlinux {
    $id     = "1";
    $mask   = "255.255.255.0";
    $domain = "srv0.bsd.am";
    devfs_ruleset  = 4;
    allow.mount;
    allow.mount.devfs;
    enforce_statfs = 0;
    mount.fstab = "${path}/etc/fstab.pre";

    exec.start     = "/bin/sh /etc/runit/2 &";
    exec.stop      = "/bin/sh /etc/runit/3";


    ip4.addr      = "lo1|10.10.0.5/24";
    interface     = "lo1";
    host.hostname = "${name}.${domain}";
    path = "/home/james/voidlinux";
    exec.consolelog = "/var/log/jail-${name}.log";
    persist;
    allow.socket_af;
}
and running the jail with
Code:
jexec voidlinux /bin/bash
I follow this post https://forums.freebsd.org/threads/running-google-chrome-in-a-dedicated-linux-jail.85491/
Pulseaudio aware applications can communicate with a Pulseaudio server either by TCP or a Unix-Domain-Socket (similar to Xorg). We configure this feature explicitly by editing /usr/local/etc/pulse/system.pa and add the following two lines:


Code:

load-module module-native-protocol-tcp auth-anonymous=1 auth-ip-acl=127.0.0.1;192.168.178.0/24
load-module module-native-protocol-unix auth-anonymous=1 socket=/tmp/pulse-native

The second line is most important for us: It tells us how the Pulseaudio socket will be named (/tmp/pulse-native). We'll need that information later when we configure Pulseaudio in the Linux jail.

Important: If you do not want remote connections over the network, delete the first line containing module-native-protocol-tcp. If remote connections are o.k. for you (e.g. because you would like to play audio in your Bhyve virtual machines), be sure to set the correct subnet mask (mine is in this case: 192.168.178.0/24).

Now that we have configured the Pulseaudio server, we need to enable it. The package audio/pulseaudio does not come with an rc script to start it up at boot time. Therefore, we have to create one: Create the file /usr/local/etc/rc.d/pulseaudio and let it have the following content:


Code:

#!/bin/sh

# PROVIDE: pulseaudio
# REQUIRE: DAEMON FILESYSTEMS
# KEYWORD: nojail shutdown

. /etc/rc.subr

name="pulseaudio"
desc="Start the Pulseaudio server"
rcvar="pulseaudio_enable"
pulseaudio_bin="/usr/local/bin/${name}"
pulseaudio_pidfile="/var/run/pulse/pid"
start_cmd="${name}_start"
stop_cmd="${name}_stop"
load_rc_config "${name}"

pulseaudio_start()
{
${pulseaudio_bin} --system --disallow-module-loading &
}

pulseaudio_stop()
{
if [ -f "${pulseaudio_pidfile}" ]
then
kill $(cat "${pulseaudio_pidfile}")
fi
}

run_rc_command "$1"


Next, enable the service in /etc/rc.conf:


Code:

pulseaudio_enable="YES"


Finally, start the service so the we do not have to reboot the machine:


Code:

# service pulseaudio start


We are almost there. The one thing left is to let Chrome in the Linux jail know which socket to use when talking to our Pulseaudio server. We could put this information directly into the chrome-wrapper script introduced further up, but I think it's better to make it a system-wide default for our Linux jail. Therefore, create the file /jail/ubuntu/etc/profile.d/05-pulseaudio.sh and add the following line:


Code:

export PULSE_SERVER=unix:/tmp/pulse-native


Note: If you would like to configure remote access, simply replace to line above with


Code:

export PULSE_SERVER="<Host-IP-address>"

where "Host-IP-address" is the addres of the machine running the actual Pulseaudio server.

Debugging sound

If there is no sound, ensure that the Pulseaudio connection is working: Enter the Linux jail and run


Code:

$ pactl list


If everything works, you should see a list of available sources and sinks. If you get something like this:


Code:

Connection failure: Connection refused
pa_context_connect() failed: Connection refused

I ran pulseaudio --start in jail I got N: [pulseaudio] main.c: User-configured server at unix:/tmp/pulse-native , refusing to start/autospawn.

Pulseaudio in jail does not work for me. I ran brave I got
Code:
[21041:21041:0427/030048.804088:ERROR:file_path_watcher_inotify.cc(890)] Failed to read /proc/sys/fs/inotify/max_user_watches
[21044:21044:0427/030048.804090:ERROR:file_path_watcher_inotify.cc(890)] Failed to read /proc/sys/fs/inotify/max_user_watches
[20976:102233:0427/030051.514383:ERROR:file_path_watcher_inotify.cc(337)] inotify_init() failed: Function not implemented (38)
[20976:102235:0427/030057.094409:ERROR:bus.cc(407)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[20976:102235:0427/030057.094481:ERROR:bus.cc(407)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[20976:102235:0427/030057.094515:ERROR:bus.cc(407)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[20976:102235:0427/030057.094543:ERROR:bus.cc(407)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[20976:20976:0427/030057.559411:ERROR:platform_shared_memory_region_posix.cc(214)] Creating shared memory in /dev/shm/.org.chromium.Chromium.acvvs3 failed: No such file or directory (2)
[20976:20976:0427/030057.559475:ERROR:platform_shared_memory_region_posix.cc(217)] Unable to
access(W_OK|X_OK) /dev/shm: No such file or directory (2)
[20976:20976:0427/030057.559494:FATAL:platform_shared_memory_region_posix.cc(219)] This is frequently caused by incorrect permissions on /dev/shm.  Try 'sudo chmod 1777 /dev/shm' to fix.
[0427/030057.678812:ERROR:ptracer.cc(44)] ptrace: Invalid argument (22)
[0427/030057.704025:WARNING:process_reader_linux.cc(400)] Couldn't initialize main thread.
[0427/030057.704095:ERROR:proc_task_reader.cc(47)] format error
[0427/030057.704130:WARNING:exception_snapshot_linux.cc(391)] thread ID 20976 not found in process
[0427/030057.704203:ERROR:process_snapshot_linux.cc(129)] thread not found 20976
[0427/030057.704687:ERROR:proc_task_reader.cc(47)] format error
Trace/breakpoint trap

I could not see /dev/shm/ in jail. Any ideas? Thanks for your help.
 
I removed mount.devfs in jail.conf And brave browser launched with white screen and then auto quit.
Here is the error message
Code:
/opt/brave.com/brave/brave-wrapper: line 43: /dev/fd/63: No such file or directory
/opt/brave.com/brave/brave-wrapper: line 44: /dev/fd/63: No such file or directory
[53062:108297:0427/050000.402781:ERROR:file_path_watcher_inotify.cc(337)] inotify_init() failed: Function not implemented (38)
[53062:108300:0427/050000.557141:ERROR:bus.cc(407)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[53062:108300:0427/050000.557391:ERROR:bus.cc(407)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[53062:108300:0427/050000.557457:ERROR:bus.cc(407)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[53062:108300:0427/050000.557701:ERROR:bus.cc(407)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[53062:108297:0427/050000.579067:ERROR:udev_watcher.cc(51)] Failed to initialize a udev monitor.
[53067:53067:0427/050000.722561:ERROR:angle_platform_impl.cc(44)] Display.cpp:1086 (initialize): ANGLE Display::initialize error 12289: glXQueryExtensionsString returned NULL
ERR: Display.cpp:1086 (initialize): ANGLE Display::initialize error 12289: glXQueryExtensionsString returned NULL
[53067:53067:0427/050000.722715:ERROR:gl_display.cc(515)] EGL Driver message (Critical) eglInitialize: glXQueryExtensionsString returned NULL
[53067:53067:0427/050000.722769:ERROR:gl_display.cc(786)] eglInitialize OpenGL failed with error EGL_NOT_INITIALIZED, trying next display type
[53067:53067:0427/050000.723187:ERROR:angle_platform_impl.cc(44)] Display.cpp:1086 (initialize): ANGLE Display::initialize error 12289: glXQueryExtensionsString returned NULL
ERR: Display.cpp:1086 (initialize): ANGLE Display::initialize error 12289: g
 
Hi Mate, i start pulseaudio like this for my ubuntu jail

i have tested pulseaudio with firefox,
obs studio and davinci resolve running in the jail

freebsd

Code:
~/.config/pulse/default.pa

Code:
#!/usr/local/bin/pulseaudio -nF

# include default.pa and override
.include /usr/local/etc/pulse/default.pa

# jail
.ifexists module-esound-protocol-unix.so
load-module module-esound-protocol-unix
.endif
load-module module-native-protocol-unix socket=/tmp/pulseaudio.socket

this line in the default.pa on freebsd

Code:
load-module module-native-protocol-unix socket=/tmp/pulseaudio.socket

creates the /tmp/pulseaudio.socket

and then in the client.conf in the jail we set the default-server to the location of the socket

Code:
default-server = /tmp/pulseaudio.socket


linux jail

Code:
~/.config/pulse/client.conf

Code:
# This file is part of PulseAudio.
#
# PulseAudio is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# PulseAudio is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.

## Configuration file for PulseAudio clients. See pulse-client.conf(5) for
## more information. Default values are commented out.  Use either ; or # for
## commenting.

; default-sink = oss_output.dsp1
; default-source =
default-server = /tmp/pulseaudio.socket
; default-dbus-server =

; autospawn = yes
; daemon-binary = /usr/local/bin/pulseaudio
; extra-arguments = --log-target=syslog

; cookie-file =

; enable-shm = yes
; shm-size-bytes = 0 # setting this 0 will use the system-default, usually 64 MiB

; auto-connect-localhost = no
; auto-connect-display = no

note the line default-server is set to the pulseaudio socket created by the default.pa on freebsd

Code:
default-server = /tmp/pulseaudio.socket

then on the freebsd host i use a script to start pulseaudio and run an application in the jail

freebsd

Code:
pulseaudio --start --daemonize 2>/dev/null

pactl info output on freebsd

Code:
Server String: /var/run/user/1001/pulse/native
Library Protocol Version: 35
Server Protocol Version: 35
Is Local: yes
Client Index: 0
Tile Size: 65472
User Name: djwilcox
Host Name: pollux
Server Name: pulseaudio
Server Version: 16.1
Default Sample Specification: s16le 2ch 44100Hz
Default Channel Map: front-left,front-right
Default Sink: oss_output.dsp1
Default Source: oss_input.dsp0
Cookie: a17b:2a2a

pactl info in the jail

Code:
Server String: /tmp/pulseaudio.socket
Library Protocol Version: 35
Server Protocol Version: 35
Is Local: yes
Client Index: 0
Tile Size: 65472
User Name: djwilcox
Host Name: pollux
Server Name: pulseaudio
Server Version: 16.1
Default Sample Specification: s16le 2ch 44100Hz
Default Channel Map: front-left,front-right
Default Sink: oss_output.dsp1
Default Source: oss_input.dsp0
Cookie: 2b66:86d5

jail config

Code:
# fstab
devfs           /usr/local/jails/linux/ubuntu/dev      devfs           rw                      0       0
tmpfs           /usr/local/jails/linux/ubuntu/dev/shm  tmpfs           rw,size=1g,mode=1777    0       0
fdescfs         /usr/local/jails/linux/ubuntu/dev/fd   fdescfs         rw,linrdlnk             0       0
linprocfs       /usr/local/jails/linux/ubuntu/proc     linprocfs       rw                      0       0
linsysfs        /usr/local/jails/linux/ubuntu/sys      linsysfs        rw                      0       0
/tmp            /usr/local/jails/linux/ubuntu/tmp      nullfs          rw                      0       0
/home           /usr/local/jails/linux/ubuntu/home     nullfs          rw                      0       0
# uncomment the line below for the xdg runtime directory for wayland
#/var/run/user/1001 /usr/local/jails/linux/ubuntu/run/user/1001  nullfs rw                      0       0

the pulseaudio socket is created in the /tmp directory which is mounted in the jail

devfs.rules

Code:
[ubuntu_jail=7]
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 'drm*' unhide
add path 'nvidia*' unhide
add path 'speaker*' unhide

i unhide dri, drm and nvidia
which means i can use the gpu in the jail

i had a similar issue to you with firefox showing up as a transparent window
because i had some settings the nvidia driver in the jail for davinci resolve in my ~/.zshenv in the jail

Code:
export __NV_PRIME_RENDER_OFFLOAD=1
export __GLX_VENDOR_LIBRARY_NAME=nvidia

once i commented this lines out firefox worked
 
heres a post i wrote about connecting dbus from the jail to the host
by passing the hosts DBUS_SESSION_BUS_ADDRESS in a script from the host to a jail

and using Wayland windows instead of Xwayland to display windows from the jail


i get the same error about

Code:
/proc/sys/fs/inotify/max_user_watches

when i try and run google chrome in a jail because that directory doesnt exist
 
Hi Mate, i start pulseaudio like this for my ubuntu jail

i have tested pulseaudio with firefox,
obs studio and davinci resolve running in the jail

freebsd

Code:
~/.config/pulse/default.pa

Code:
#!/usr/local/bin/pulseaudio -nF

# include default.pa and override
.include /usr/local/etc/pulse/default.pa

# jail
.ifexists module-esound-protocol-unix.so
load-module module-esound-protocol-unix
.endif
load-module module-native-protocol-unix socket=/tmp/pulseaudio.socket

this line in the default.pa on freebsd

Code:
load-module module-native-protocol-unix socket=/tmp/pulseaudio.socket

creates the /tmp/pulseaudio.socket

and then in the client.conf in the jail we set the default-server to the location of the socket

Code:
default-server = /tmp/pulseaudio.socket


linux jail

Code:
~/.config/pulse/client.conf

Code:
# This file is part of PulseAudio.
#
# PulseAudio is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# PulseAudio is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.

## Configuration file for PulseAudio clients. See pulse-client.conf(5) for
## more information. Default values are commented out.  Use either ; or # for
## commenting.

; default-sink = oss_output.dsp1
; default-source =
default-server = /tmp/pulseaudio.socket
; default-dbus-server =

; autospawn = yes
; daemon-binary = /usr/local/bin/pulseaudio
; extra-arguments = --log-target=syslog

; cookie-file =

; enable-shm = yes
; shm-size-bytes = 0 # setting this 0 will use the system-default, usually 64 MiB

; auto-connect-localhost = no
; auto-connect-display = no

note the line default-server is set to the pulseaudio socket created by the default.pa on freebsd

Code:
default-server = /tmp/pulseaudio.socket

then on the freebsd host i use a script to start pulseaudio and run an application in the jail

freebsd

Code:
pulseaudio --start --daemonize 2>/dev/null

pactl info output on freebsd

Code:
Server String: /var/run/user/1001/pulse/native
Library Protocol Version: 35
Server Protocol Version: 35
Is Local: yes
Client Index: 0
Tile Size: 65472
User Name: djwilcox
Host Name: pollux
Server Name: pulseaudio
Server Version: 16.1
Default Sample Specification: s16le 2ch 44100Hz
Default Channel Map: front-left,front-right
Default Sink: oss_output.dsp1
Default Source: oss_input.dsp0
Cookie: a17b:2a2a

pactl info in the jail

Code:
Server String: /tmp/pulseaudio.socket
Library Protocol Version: 35
Server Protocol Version: 35
Is Local: yes
Client Index: 0
Tile Size: 65472
User Name: djwilcox
Host Name: pollux
Server Name: pulseaudio
Server Version: 16.1
Default Sample Specification: s16le 2ch 44100Hz
Default Channel Map: front-left,front-right
Default Sink: oss_output.dsp1
Default Source: oss_input.dsp0
Cookie: 2b66:86d5

jail config

Code:
# fstab
devfs           /usr/local/jails/linux/ubuntu/dev      devfs           rw                      0       0
tmpfs           /usr/local/jails/linux/ubuntu/dev/shm  tmpfs           rw,size=1g,mode=1777    0       0
fdescfs         /usr/local/jails/linux/ubuntu/dev/fd   fdescfs         rw,linrdlnk             0       0
linprocfs       /usr/local/jails/linux/ubuntu/proc     linprocfs       rw                      0       0
linsysfs        /usr/local/jails/linux/ubuntu/sys      linsysfs        rw                      0       0
/tmp            /usr/local/jails/linux/ubuntu/tmp      nullfs          rw                      0       0
/home           /usr/local/jails/linux/ubuntu/home     nullfs          rw                      0       0
# uncomment the line below for the xdg runtime directory for wayland
#/var/run/user/1001 /usr/local/jails/linux/ubuntu/run/user/1001  nullfs rw                      0       0

the pulseaudio socket is created in the /tmp directory which is mounted in the jail

devfs.rules

Code:
[ubuntu_jail=7]
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 'drm*' unhide
add path 'nvidia*' unhide
add path 'speaker*' unhide

i unhide dri, drm and nvidia
which means i can use the gpu in the jail

i had a similar issue to you with firefox showing up as a transparent window
because i had some settings the nvidia driver in the jail for davinci resolve in my ~/.zshenv in the jail

Code:
export __NV_PRIME_RENDER_OFFLOAD=1
export __GLX_VENDOR_LIBRARY_NAME=nvidia

once i commented this lines out firefox worked
Thank you so much, Mate. I followed your instruction to setup pulseaudio. Unfortunately It does not work for me.
Here is my rc.conf
Code:
hostname="free"
keymap="us.kbd"
ifconfig_msk0="DHCP"
ifconfig_msk0_ipv6="inet6 accept_rtadv"
ntpd_enable="YES"
ntpd_sync_on_start="YES"
moused_nondefault_enable="NO"
wlans_wpi0="wlan0"
ifconfig_wlan0="WPA SYNCDHCP"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="NO"
kld_list="i915kms"
dbus_enable="YES"
sndiod_enable="YES"
linux_enable="NO"
moused_flags="-l 2"
moused_enable="NO"
jail_enable="NO"
pf_enable="YES"
dnsmasq_enable="NO"
cloned_interfaces="lo1"
ifconfig_lo1_aliases="inet 10.10.0.1-12/24"
pulseaudio_enable="NO"
devfs_load_rulesets="YES"
I copy your
~/.config/pulse/default.pa
for freebsd
~/.config/pulse/client.conf for linux jail.
In FreeBSD when i start
Code:
pulseaudio --start --daemonize 2>/dev/null
And pactl info:
Code:
Server String: /tmp/pulse-PZMuJRZNgvTa/native
Library Protocol Version: 35
Server Protocol Version: 35
Is Local: yes
Client Index: 0
Tile Size: 65472
User Name: james
Host Name: free
Server Name: pulseaudio
Server Version: 16.1
Default Sample Specification: s16le 2ch 44100Hz
Default Channel Map: front-left,front-right
Default Sink: oss_output.dsp0
Default Source: oss_input.dsp0
Cookie: a852:e11f
In Linux jail I ran
Code:
 pulseaudio --start
N: [pulseaudio] main.c: User-configured server at /tmp/pulseaudio.socket, refusing to start/autospawn.
I got sndiod enable in freebsd. Is it a problem to conflict with pulseaudio?
Thanks again for your help.
 
Do I need to enable Linux binary compatibility
Code:
service linux onestart
for linux jail to run?
I ran it without linux enable, I ran st terminal in Linux jail I got error

openpty failed: No such file or directory

If I enable linux binary compatibility, and run
Code:
xhost +
in freebsd and
Code:
export DISPLAY=:0
in linux jail. St terminal works and display in freebsd.

Thanks
 
Hi Mate, you dont need to start pulseaudio in the jail

heres how it works

you start pulseaudio on the freebsd host which uses the default.pa
and creates the pulseaudio socket in the /tmp directory which is mounted in the jail

in the jail when you run a application that uses pulseaudio
it picks up the settings in the client.conf and uses the pulseaudio socket in the /tmp directory

stop pulseaudio on the freebsd host by running

Code:
pulseaudio -k

then start pulseaudio on the freebsd host by running

Code:
pulseaudio --start --daemonize 2>/dev/null

and then in the jail run

Code:
pactl info
 
Do I need to enable Linux binary compatibility
Code:
service linux onestart
for linux jail to run?
I ran it without linux enable, I ran st terminal in Linux jail I got error

openpty failed: No such file or directory

If I enable linux binary compatibility, and run
Code:
xhost +
in freebsd and
Code:
export DISPLAY=:0
in linux jail. St terminal works and display in freebsd.

Thanks
I have linux enabled in my rc.conf

Code:
zfs_enable="YES"
clear_tmp_enable="YES"
syslogd_flags="-ss"
hostname="pollux"
ifconfig_ue0="DHCP"
local_unbound_enable="YES"
sshd_enable="NO"
#moused_enable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="AUTO"
# pf firewall
pf_enable="YES"
# time and date
ntpd_enable="YES"
ntpd_sync_on_start="YES"
# power settings
powerd_enable="YES"
powerd_flags="-a hiadaptive -b adaptive"
performance_cx_lowest="Cmax"
economy_cx_lowest="Cmax"
# kld list
kld_list="nvidia-modeset nvidia-drm linux linux64 i915kms ext2fs mac_priority fusefs"
# wayland
seatd_enable="YES"
# dbus
dbus_enable="YES"
# linux
linux_enable="YES"
ubuntu_enable="NO"
# virtual oss - start with: sudo sysrc onestart virtual_oss
virtual_oss_enable="NO"
# sndiod audio
sndiod_enable="YES"
# jack
jackd_enable="NO"
jackd_user="djwilcox"
jackd_rtprio="YES"
# musicpd
musicpd_enable="YES"
# devfs rules for user mounting drives
devfs_system_ruleset="localrules"
# ralink wifi
wlans_run0="wlan0"
ifconfig_wlan0="WPA SYNDHCP"
dnscrypt_proxy_enable="YES"
dnscrypt_proxy_pidfile="/var/run/dnscrypt-proxy.pid"
dnscrypt_proxy_logfile="/var/log/dnscrypt-proxy.log"
# jail enable
jail_enable="YES"
# cloned loopback interface for jail
cloned_interfaces="lo1"
ifconfig_lo1_aliases="inet 10.10.0.1-12/24"
jail_parallel_start="YES"
jail_list="ubuntu"

freebsd root dot files


freebsd dotfiles


notes on github

 
the other thing to check is if the user in the jail has the same uid and gid
as the user on the freebsd host

so that the user in the jail has access to the pulseaudio socket in the /tmp directory

if you check the id of your user on the freebsd host and the user in the jail do they match

Code:
id

Code:
uid=1001(djwilcox) gid=1001(djwilcox) groups=1001(djwilcox),0(wheel),5(operator),44(video),47(realtime)

my user in the jail has the same username djwilcox, uid 1001 and gid 1001 as on the freehost
that way there are no permission issues

i edited the /etc/passwd and /etc/groups files in the jail and added the settings from freebsd for my user

ls /tmp directory

Code:
Yes Master ? ls -l /tmp
total 4
drwx------  2 djwilcox wheel   2 27 Apr 12:57 babel-Puf8y5
drwxr-xr-x  2 djwilcox wheel   2 27 Apr 12:57 babel-stable-681
srwxrwxrwx  1 djwilcox wheel   0 27 Apr 12:57 dbus-pkgAV4CuHc
-rw-r--r--  1 djwilcox wheel 111 27 Apr 20:18 emacs100199273-pollux~
srwxr-xr-x  1 djwilcox wheel   0 27 Apr 18:34 mpv-R2wYIa
srwxrwxrwx  1 djwilcox wheel   0 27 Apr 20:22 pulseaudio.socket
drwxr-xr-x  2 root     wheel   3 27 Apr 12:56 sndio
drwx------  2 djwilcox wheel   3 27 Apr 12:57 tmux-1001
 
Thanks, Mate. I followed your last post. I ran
pulseaudio -k
then
pulseaudio --start --daemonize 2>/dev/null in freebsd. I ran
pactl infoin freebsd
I got
Code:
Server String: /tmp/pulse-PZMuJRZNgvTa/native
Library Protocol Version: 35
Server Protocol Version: 35
Is Local: yes
Client Index: 0
Tile Size: 65472
User Name: james
Host Name: free
Server Name: pulseaudio
Server Version: 16.1
Default Sample Specification: s16le 2ch 44100Hz
Default Channel Map: front-left,front-right
Default Sink: oss_output.dsp0
Default Source: oss_input.dsp0
Cookie: f66a:2f91

In linux jail,
Code:
pactl info
Connection failure: Connection refused
pa_context_connect() failed: Connection refused
 
freebsd id
Code:
uid=1001(james) gid=1001(james) groups=1001(james),0(wheel),4(tty),44(video),145(webcamd),920(vboxusers)
linux id
Code:
uid=1000(james) gid=1000(james) groups=1000(james),4(wheel),5(tty),12(audio),13(video),19(storage),21(network),25(input)
Linux ls -l /tmp/
Code:
 ls -l /tmp/
total 32
srwxrwxrwx 1  1001 root   0 Apr 27 18:33 dbus-khncMqQEip
drwx------ 2  1001 root 512 Apr 27 17:23 nvim.james
drwx------ 2 root  root 512 Apr 27 18:34 nvim.root
drwx------ 2  1001 root 512 Apr 27 19:24 pulse-PZMuJRZNgvTa
drwx------ 2 james root 512 Apr 27 06:25 pulse-v1HVrLvd4vJf
drwx------ 2 james root 512 Apr 27 03:42 runtime-james
drwxr-xr-x 2 root  root 512 Apr 27 18:32 sndio
drwx------ 2 james root 512 Apr 27 04:35 wmpf_files
drwxr-xr-x 2  1001 root 512 Apr 27 18:04 zsh-fzf-tab-james
 
My pulse audio socket in /tmp/ is pulse-PZMuJRZNgvTa and pulse-v1HVrLvd4vJf. I do not know why is that?
 
hi mate

the pulseaudio.socket in the /tmp directory
is owned by my user

the directory listing starts with s
showing that the pulseaudio.socket is a socket

Code:
srwxrwxrwx  1 djwilcox wheel   0 27 Apr 20:38 pulseaudio.socket

do you have any other pulseaudio config files left over in any other directories
that might be being used when pulseaudio is started

maybe somewhere like

Code:
/usr/local/etc/pulse
 
when i start pulseaudio the socket is created in the /tmp directory

i have my XDG_RUNTIME_DIR set to

Code:
 /var/run/user/1001

Code:
Yes Master ? ls -l /var/run/user/1001/pulse
total 1
srwxrwxrwx  1 djwilcox djwilcox 0 27 Apr 20:44 native
-rw-------  1 djwilcox djwilcox 6 27 Apr 20:44 pid

freebsd

Code:
pactl info

Code:
Yes Master ? pactl info
Server String: /var/run/user/1001/pulse/native
Library Protocol Version: 35
Server Protocol Version: 35
Is Local: yes
Client Index: 0
Tile Size: 65472
User Name: djwilcox
Host Name: pollux
Server Name: pulseaudio
Server Version: 16.1
Default Sample Specification: s16le 2ch 44100Hz
Default Channel Map: front-left,front-right
Default Sink: oss_output.dsp1
Default Source: oss_input.dsp0
Cookie: 1cfd:62e2
 
pactl info

XDG_RUNTIME_DIR
Thanks, Mate. I do not have XDG_RUNTIME_DIR set in my freebsd.
I just set it
export XDG_RUNTIME_DIR=/var/run/user/`id -u`
And for permanent, add it to .xprofile file in home directory.
when I ran
Code:
 pactl info
Failed to create secure directory (/var/run/user/1001/pulse): No such file or directory
Connection failure: Connection refused
pa_context_connect() failed: Connection refused
I just created that directory using sudo mkdir -p /var/run/usr/1001/ and chown to james:james
Code:
 ls -lah /var/run/usr/1001/
total 12
drwxr-xr-x  3 james james  512B Apr 27 16:10 .
drwxr-xr-x  3 root  wheel  512B Apr 27 16:10 ..
drwxr-xr-x  2 james james  512B Apr 27 16:10 pulse
But I still get the error message
Failed to create secure directory (/var/run/user/1001/pulse): No such file or directory
Connection failure: Connection refused
pa_context_connect() failed: Connection refused
 
heres how i set up the xdg directory

create the directory

Code:
sudo mkdir -p /var/run/user/"$(id -u)"

chown the directory

Code:
sudo chown -R "${USER}":"$(id -u)" /var/run/user/"$(id -u)"

chmod the directory

Code:
sudo chmod 700 /var/run/user/"$(id -u)"

Code:
/var/run/user/1001

is owned by my user and wheel on freebsd

it doesnt look like the /tmp/pulseaudio.socket file is being created
when you start pulseaudio on freebsd
 
just a thought do you have XDG_CONFIG_HOME set in your shell config

maybe pulseaudio isnt picking up the ~/.config/pulse/default.pa file

Code:
# xdg directories
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_CACHE_HOME="$HOME/.cache"
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_RUNTIME_DIR="/var/run/user/`id -u`"
 
just a thought do you have XDG_CONFIG_HOME set in your shell config

maybe pulseaudio isnt picking up the ~/.config/pulse/default.pa file

Code:
# xdg directories
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_CACHE_HOME="$HOME/.cache"
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_RUNTIME_DIR="/var/run/user/`id -u`"
Yes, I did not set it. I am gonna set these in zshrc.
Thanks I report back how it goes.
 
my jail fstab has /home mounted using nullfs
which i notice you dont have set

Code:
/home           /usr/local/jails/linux/ubuntu/home     nullfs          rw                      0       0

i wonder if the issue is because you dont have /home in your jails fstab
then the ~/.config/pulse/client.conf isnt being used because you dont have a home directory

if you edit your jails fstab and set home to be mounted with nullfs
and then restart the jail does it have a home directory set to the username in the jail
 
Yes, I did not set it. I am gonna set these in zshrc.
Thanks I report back how it goes.
hi mate, those settings need to be added to your

Code:
~/.zshenv

on both the freebsd host and the jail

then source the ~/.zshenv file

Code:
source ~/.zshenv

check the xdg directories are set with printenv

Code:
printenv

Code:
XDG_CACHE_HOME=/home/djwilcox/.cache
XDG_CONFIG_HOME=/home/djwilcox/.config
XDG_DATA_HOME=/home/djwilcox/.local/share
XDG_RUNTIME_DIR=/var/run/user/1001
 
In freebsd,
Code:
pactl info
Server String: /var/run/user/1001/pulse/native
Library Protocol Version: 35
Server Protocol Version: 35
Is Local: yes
Client Index: 0
Tile Size: 65472
User Name: james
Host Name: free
Server Name: pulseaudio
Server Version: 16.1
Default Sample Specification: s16le 2ch 44100Hz
Default Channel Map: front-left,front-right
Default Sink: oss_output.dsp0
Default Source: oss_input.dsp0
Cookie: 1370:cf24
Code:
ls /tmp/
dbus-khncMqQEip         pulse-tTFzgkmFSkba      wmpf_files
nvim.james              pulse-v1HVrLvd4vJf      zsh-fzf-tab-james
nvim.root               runtime-james
pulse-PZMuJRZNgvTa      sndio
In linux jail,
Code:
pactl info
Connection failure: Connection refused
 
my jail fstab has /home mounted using nullfs
which i notice you dont have set

Code:
/home           /usr/local/jails/linux/ubuntu/home     nullfs          rw                      0       0

i wonder if the issue is because you dont have /home in your jails fstab
then the ~/.config/pulse/client.conf isnt being used because you dont have a home directory

if you edit your jails fstab and set home to be mounted with nullfs
and then restart the jail does it have a home directory set to the username in the jail
Thanks, Mate. Seems like my .config loaded just fine.
In Linux jail,
Code:
pulseaudio --start
N: [pulseaudio] main.c: User-configured server at /tmp/pulseaudio.socket, refusing to start/autospawn.
Server is configured at /tmp/pulseaudio.socket
 
hi mate,

you need to start pulseaudio on the freebsd host and not in the jail

on freebsd run

Code:
pulseaudio --start --daemonize

then in the jail run

Code:
pactl info

see if that works

freebsd is the pulseaudio server using the deafult.pa
and the application in the jail is the pulseaudio client using the client.conf
 
In freebsd I can see pulseaudio.socket now
Code:
ls /tmp/
dbus-khncMqQEip         pulse-tTFzgkmFSkba      sndio
nvim.james              pulse-v1HVrLvd4vJf      wmpf_files
nvim.root               pulseaudio.socket       zsh-fzf-tab-james
pulse-PZMuJRZNgvTa      runtime-james
In linux, I can also see it
Code:
ls -l /tmp/
total 36
srwxrwxrwx 1 james root   0 Apr 27 18:33 dbus-khncMqQEip
drwx------ 2 james root 512 Apr 27 19:49 nvim.james
drwx------ 2 root  root 512 Apr 27 20:02 nvim.root
drwx------ 2 james root 512 Apr 27 19:24 pulse-PZMuJRZNgvTa
drwx------ 2 james root 512 Apr 27 21:01 pulse-tTFzgkmFSkba
drwx------ 2  1000 root 512 Apr 27 06:25 pulse-v1HVrLvd4vJf
srwxrwxrwx 1 james root   0 Apr 27 21:20 pulseaudio.socket
drwx------ 2  1000 root 512 Apr 27 03:42 runtime-james
drwxr-xr-x 2 root  root 512 Apr 27 18:32 sndio
drwx------ 2  1000 root 512 Apr 27 04:35 wmpf_files
drwxr-xr-x 2 james root 512 Apr 27 21:11 zsh-fzf-tab-james
Code:
 pactl info
Server String: /tmp/pulseaudio.socket
Library Protocol Version: 35
Server Protocol Version: 35
Is Local: yes
Client Index: 1
Tile Size: 65472
User Name: james
Host Name: free
Server Name: pulseaudio
Server Version: 16.1
Default Sample Specification: s16le 2ch 44100Hz
Default Channel Map: front-left,front-right
Default Sink: oss_output.dsp0
Default Source: oss_input.dsp0
Cookie: e135:538d

It works now. Thank you so much for your help. :) really appreciated your time, Mate.
 
Back
Top