Running X11 Software in Incus Container?

Good afternoon, @stgraber.

So I have X11 running thanks to your help, but can’t figure pulseaudio.

This is my X11 profile:

config:
  environment.DISPLAY: :0
  environment.PULSE_SERVER: unix:/home/incus/pulse-native
  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/1922401103/pulse/native
    gid: "1000"
    listen: unix:/home/incus/pulse-native
    mode: "0777"
    security.gid: "1933400513"
    security.uid: "1933401103"
    type: proxy
    uid: "1000"
  X0:
    bind: container
    connect: unix:@/tmp/.X11-unix/X0
    listen: unix:@/tmp/.X11-unix/X0
    security.gid: "1933400513"
    security.uid: "1933401103"
    type: proxy
  mygpu:
    type: gpu
name: gui_internet
used_by:
- /1.0/instances/internet

I decide on using a Debian 12 guest because I do not like how Ubuntu forces snap on you. The security gid and uid are correct for my daily driver user on the host as I used Active Directory on my host to manage access and identity. I created the “incus” user within the guest much like “ubuntu” exists in ubuntu containers.

I install Chromium and navigated to youtube to test audio but unfortunately its not working. Here is the output:

incus@internet:~$ ALSA lib pulse.c:242:(pulse_connect) PulseAudio: Unable to connect: Timeout

[2893:2893:1028/195551.429358:ERROR:alsa_util.cc(204)] PcmOpen: default,Connection refused
E: [pulseaudio] main.c: Daemon startup failed.
ALSA lib pulse.c:242:(pulse_connect) PulseAudio: Unable to connect: Timeout

[2893:2893:1028/195621.457349:ERROR:alsa_util.cc(204)] PcmOpen: plug:default,Connection refused
ALSA lib pulse.c:242:(pulse_connect) PulseAudio: Unable to connect: Connection refused

[2893:2893:1028/195621.459747:ERROR:alsa_util.cc(204)] PcmOpen: default,Connection refused
ALSA lib pulse.c:242:(pulse_connect) PulseAudio: Unable to connect: Connection refused

[2893:2893:1028/195621.460126:ERROR:alsa_util.cc(204)] PcmOpen: plug:default,Connection refused

Unfortunately, systemctl isn’t much help:

Oct 28 19:55:53 internet systemd[151]: pulseaudio.service: start operation timed out. Terminating.
Oct 28 19:55:53 internet systemd[151]: pulseaudio.service: Failed with result 'timeout'.
Oct 28 19:55:53 internet systemd[151]: Failed to start pulseaudio.service - Sound Service.
Oct 28 19:55:53 internet systemd[151]: pulseaudio.service: Scheduled restart job, restart counter is at 7.
Oct 28 19:55:53 internet systemd[151]: Stopped pulseaudio.service - Sound Service.
Oct 28 19:55:53 internet systemd[151]: Starting pulseaudio.service - Sound Service...
Oct 28 19:56:10 internet pulseaudio[203]: Daemon already running.
Oct 28 19:56:10 internet pulseaudio[203]: pa_pid_file_create() failed.
Oct 28 19:57:23 internet systemd[151]: pulseaudio.service: start operation timed out. Terminating.
Oct 28 19:57:23 internet systemd[151]: pulseaudio.service: Failed with result 'timeout'.
Oct 28 19:57:23 internet systemd[151]: Failed to start pulseaudio.service - Sound Service.
Oct 28 19:57:24 internet systemd[151]: pulseaudio.service: Scheduled restart job, restart counter is at 8.
Oct 28 19:57:24 internet systemd[151]: Stopped pulseaudio.service - Sound Service.
Oct 28 19:57:24 internet systemd[151]: Starting pulseaudio.service - Sound Service...

Any ideas?
Thank you!

EDIT: I made some edits to the profile as follows:

config:
  environment.DISPLAY: :0
  environment.PULSE_SERVER: unix:/home/incus/pulse-native
  user.user-data: "#cloud-config\nruncmd:\n  - 'sed -i \"s/; enable-shm = yes/enable-shm
    = no/g\" /etc/pulse/client.conf'\npackages:\n  - x11-apps\n  - mesa-utils\n  -
    pulseaudio\nwrite_files:\n  - owner: root:root\n    permissions: '0644'\n    append:
    true\n    content: |\n      PULSE_SERVER=unix:/var/pulse-native\n    path: /etc/environment
    \n"
description: GUI LXD profile
devices:
  PASocket1:
    bind: container
    connect: unix:/run/user/1922401103/pulse/native
    gid: "1000"
    listen: unix:/var/pulse-native
    mode: "0777"
    security.gid: "1933400513"
    security.uid: "1933401103"
    type: proxy
    uid: "1000"
  X0:
    bind: container
    connect: unix:@/tmp/.X11-unix/X0
    listen: unix:@/tmp/.X11-unix/X0
    security.gid: "1933400513"
    security.uid: "1933401103"
    type: proxy
  mygpu:
    type: gpu
name: gui_internet
used_by:
- /1.0/instances/internet

Same result with same errors :confused: