I am following Simos’ blog post Running X11 software in LXD containers – Mi blog lah! and audio does not work.
LXD 4.0.0 (Edge)
The LXC profile is a copy/ paste from Simos’ post.
config:
environment.DISPLAY: :0
environment.PULSE_SERVER: unix:/home/ubuntu/pulse-native
nvidia.driver.capabilities: all
nvidia.runtime: "true"
user.user-data: |
#cloud-config
runcmd:
- 'sed -i "s/; enable-shm = yes/enable-shm = no/g" /etc/pulse/client.conf'
packages:
- x11-apps
- mesa-utils
- pulseaudio
description: GUI LXD profile
devices:
PASocket1:
bind: container
connect: unix:/run/user/1000/pulse/native
listen: unix:/home/ubuntu/pulse-native
security.gid: "1000"
security.uid: "1000"
uid: "1000"
gid: "1000"
mode: "0777"
type: proxy
X0:
bind: container
connect: unix:@/tmp/.X11-unix/X1
listen: unix:@/tmp/.X11-unix/X0
security.gid: "1000"
security.uid: "1000"
type: proxy
mygpu:
type: gpu
name: x11
used_by: []
Running pactl info
returns Connection refused
.
ubuntu@firefox:~$ pactl info
Connection failure: Connection refused
pa_context_connect() failed: Connection refused
The container log contains
$ lxc info --show-log local:firefox
Name: firefox
Location: none
Remote: unix://
Architecture: x86_64
Created: 2020/04/18 02:52 UTC
Status: Running
Type: container
Profiles: default, x11
Pid: 27344
Ips:
eth0: inet 10.67.174.95 veth45940b54
eth0: inet6 fd42:e196:7303:cb4f:216:3eff:fea9:2457 veth45940b54
eth0: inet6 fe80::216:3eff:fea9:2457 veth45940b54
lo: inet 127.0.0.1
lo: inet6 ::1
Resources:
Processes: 57
Disk usage:
root: 184.80MB
CPU usage:
CPU usage (in seconds): 43
Memory usage:
Memory (current): 316.76MB
Network usage:
eth0:
Bytes received: 48.30MB
Bytes sent: 531.74kB
Packets received: 12206
Packets sent: 6569
lo:
Bytes received: 4.22kB
Bytes sent: 4.22kB
Packets received: 46
Packets sent: 46
Log:
lxc firefox 20200418025248.733 ERROR cgfsng - cgroups/cgfsng.c:mkdir_eexist_on_last:1151 - File exists - Failed to create directory "/sys/fs/cgroup/cpuset//lxc.monitor.firefox"
lxc firefox 20200418025248.733 ERROR cgfsng - cgroups/cgfsng.c:mkdir_eexist_on_last:1151 - File exists - Failed to create directory "/sys/fs/cgroup/cpuset//lxc.payload.firefox"
lxc firefox 20200418025248.734 ERROR utils - utils.c:lxc_can_use_pidfd:1855 - Invalid argument - Kernel does not support waiting on processes through pidfds
lxc firefox 20200418025248.738 WARN cgfsng - cgroups/cgfsng.c:fchowmodat:1569 - No such file or directory - Failed to fchownat(17, memory.oom.group, 1000000000, 0, AT_EMPTY_PATH | AT_SYMLINK_NOFOLLOW )
The error above says the /sys/fs/cgroup/cpuset//lxc.monitor.firefox
file exists already. However, this file does not exist. Not sure whether the double slash is causing this problem? Doing ls
on the /sys/fs/cgroup/cpuset/
directory shows the following.
ubuntu@firefox:~$ ls -lah /sys/fs/cgroup/cpuset/
total 0
drwxrwxr-x 2 nobody root 0 Apr 18 03:49 .
drwxr-xr-x 15 root root 380 Apr 18 03:49 ..
-rw-r--r-- 1 nobody nogroup 0 Apr 18 03:49 cgroup.clone_children
-rw-rw-r-- 1 nobody root 0 Apr 18 03:55 cgroup.procs
-rw-r--r-- 1 nobody nogroup 0 Apr 18 03:55 cpuset.cpu_exclusive
-rw-r--r-- 1 nobody nogroup 0 Apr 18 03:49 cpuset.cpus
-r--r--r-- 1 nobody nogroup 0 Apr 18 03:55 cpuset.effective_cpus
-r--r--r-- 1 nobody nogroup 0 Apr 18 03:55 cpuset.effective_mems
-rw-r--r-- 1 nobody nogroup 0 Apr 18 03:55 cpuset.mem_exclusive
-rw-r--r-- 1 nobody nogroup 0 Apr 18 03:55 cpuset.mem_hardwall
-rw-r--r-- 1 nobody nogroup 0 Apr 18 03:55 cpuset.memory_migrate
-r--r--r-- 1 nobody nogroup 0 Apr 18 03:55 cpuset.memory_pressure
-rw-r--r-- 1 nobody nogroup 0 Apr 18 03:55 cpuset.memory_spread_page
-rw-r--r-- 1 nobody nogroup 0 Apr 18 03:55 cpuset.memory_spread_slab
-rw-r--r-- 1 nobody nogroup 0 Apr 18 03:49 cpuset.mems
-rw-r--r-- 1 nobody nogroup 0 Apr 18 03:55 cpuset.sched_load_balance
-rw-r--r-- 1 nobody nogroup 0 Apr 18 03:55 cpuset.sched_relax_domain_level
-rw-r--r-- 1 nobody nogroup 0 Apr 18 03:55 notify_on_release
-rw-rw-r-- 1 nobody root 0 Apr 18 03:49 tasks
By the way, the audio is working on the LXD host (my regular laptop).
$ pactl info
Server String: /run/user/1000/pulse/native
Library Protocol Version: 33
Server Protocol Version: 33
Is Local: yes
Client Index: 24
Tile Size: 65472
User Name: myusername
Host Name: myhostname
Server Name: pulseaudio
Server Version: 13.0
Default Sample Specification: s16le 2ch 44100Hz
Default Channel Map: front-left,front-right
Default Sink: alsa_output.usb-0b0e_Jabra_Link_370_745C4BE44B24-00.analog-stereo
Default Source: alsa_input.usb-0b0e_Jabra_Link_370_745C4BE44B24-00.mono-fallback
Cookie: c778:bfaa
I also tried with an LXD disk device instead but it showed the same connection refused error. I am wondering whether this is an LXD/ LXC issue or a problem with my laptop… BTW, I got Virtualbox running on my laptop too and there the Audio is not working. For example, my Windows virtual machine cannot find the device although I believe Virtualbox is configured correctly.
How can I troubleshoot this further?