Sound in an incus container

Hello

I am using incus 6.0.4

NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

i setup a incus container, it seems as though sound cannot work.

I’ve tried alsa, pulseaudio, pipewire, pipewire-pulse

 rtkit-daemon.service - RealtimeKit Scheduling Policy Service
     Loaded: loaded (/lib/systemd/system/rtkit-daemon.service; disabled; vendor preset: enabled)
    Drop-In: /run/systemd/system/service.d
             └─zzz-lxc-service.conf
     Active: failed (Result: exit-code) since Fri 2025-05-23 22:08:34 UTC; 4s ago
    Process: 1031 ExecStart=/usr/libexec/rtkit-daemon (code=exited, status=225/NETWORK)
   Main PID: 1031 (code=exited, status=225/NETWORK)
        CPU: 657us

[1031]: rtkit-daemon.service: Failed at step NETWORK spawning /usr/libexec/rtkit-daemon: Permission denied
[1]: Starting RealtimeKit Scheduling Policy Service...
[1]: rtkit-daemon.service: Main process exited, code=exited, status=225/NETWORK
[1]: rtkit-daemon.service: Failed with result 'exit-code'.
[1]: Failed to start RealtimeKit Scheduling Policy Service.
$ killall pipewire pipewire-pulse wireplumber pulseaudio || true
rm -f ~/.config/pulse/pid ~/.config/pipewire/pid ~/.config/pipewire-pulse/pid \
      /run/user/$(id -u)/pulse/native /run/user/$(id -u)/pipewire-0 \
      ~/.pulse-cookie
sleep 1
PULSE_LOG_LEVEL=4 SPA_LOG_LEVEL=4 PIPEWIRE_DEBUG=4 /usr/bin/pipewire
bash: killall: command not found
[D] pw.context [pipewire.c:250 load_spa_handle()] load lib:'support/libspa-support' factory-name:'support.log'
[D] pw.context [pipewire.c:147 open_plugin()] loaded plugin:'/usr/lib/x86_64-linux-gnu/spa-0.2/support/libspa-support.so'
[D][36591.480847] pw.context   | [      pipewire.c:  250 load_spa_handle()] load lib:'support/libspa-journal' factory-name:'support.log'
[D][36591.481544] pw.context   | [      pipewire.c:  147 open_plugin()] loaded plugin:'/usr/lib/x86_64-linux-gnu/spa-0.2/support/libspa-journal.so'
[D][36591.481587] pw.context   | [      pipewire.c:  250 load_spa_handle()] load lib:'support/libspa-support' factory-name:'support.cpu'
[D][36591.481653] spa.cpu      | [           cpu.c:  276 impl_init()] 0x561333e85ee8: count:72 align:64 flags:000fcbdb
[I][36591.481668] pw.context   | [      pipewire.c:  668 pw_init()] version 0.3.48
[D][36591.481688] pw.main-loop | [     main-loop.c:   52 loop_new()] 0x561333e86200: new
[D][36591.481700] pw.context   | [      pipewire.c:  250 load_spa_handle()] load lib:'support/libspa-support' factory-name:'support.system'
[D][36591.481713] spa.system   | [        system.c:  352 impl_init()] 0x561333e86468: initialized
[D][36591.481724] pw.context   | [      pipewire.c:  250 load_spa_handle()] load lib:'support/libspa-support' factory-name:'support.loop'
[D][36591.481758] spa.system   | [        system.c:  115 impl_pollfd_create()] 0x561333e86468: new fd:4
[D][36591.481772] spa.system   | [        system.c:  221 impl_eventfd_create()] 0x561333e86468: new fd:5
[D][36591.481787] spa.system   | [        system.c:  221 impl_eventfd_create()] 0x561333e86468: new fd:6
[D][36591.481797] spa.loop     | [          loop.c:  881 impl_init()] 0x561333e86618: initialized
[D][36591.481812] spa.system   | [        system.c:  255 impl_signalfd_create()] 0x561333e86468: new fd:7
[D][36591.481826] spa.system   | [        system.c:  255 impl_signalfd_create()] 0x561333e86468: new fd:8
[D][36591.481840] pw.context   | [       context.c:  227 pw_context_new()] 0x561333e8e930: new
[I][36591.481945] pw.conf      | [          conf.c:  415 conf_load()] 0x561333e8e740: loaded config '/usr/share/pipewire/pipewire.conf' with 5 items
[I][36591.481973] pw.conf      | [          conf.c:  847 pw_context_conf_section_for_each()] handle config '/usr/share/pipewire/pipewire.conf' section 'context.properties'
[I][36591.481992] pw.context   | [       context.c:  293 pw_context_new()] 0x561333e8e930: parsed 5 context.properties items
[D][36591.482077] pw.data-loop | [     data-loop.c:  114 loop_new()] 0x561333e92bd0: new
[D][36591.482090] pw.context   | [      pipewire.c:  250 load_spa_handle()] load lib:'support/libspa-support' factory-name:'support.system'
[D][36591.482103] spa.system   | [        system.c:  352 impl_init()] 0x561333e92cf8: initialized
[D][36591.482114] pw.context   | [      pipewire.c:  250 load_spa_handle()] load lib:'support/libspa-support' factory-name:'support.loop'
[D][36591.482144] spa.system   | [        system.c:  115 impl_pollfd_create()] 0x561333e92cf8: new fd:9
[D][36591.482158] spa.system   | [        system.c:  221 impl_eventfd_create()] 0x561333e92cf8: new fd:10
[D][36591.482171] spa.system   | [        system.c:  221 impl_eventfd_create()] 0x561333e92cf8: new fd:11
[D][36591.482181] spa.loop     | [          loop.c:  881 impl_init()] 0x561333e92da8: initialized
[D][36591.482192] pw.mem       | [           mem.c:  149 pw_mempool_new()] 0x561333e9af40: new
[D][36591.482202] pw.work-queue | [    work-queue.c:  108 pw_work_queue_new()] 0x561333e9afa0: new
[D][36591.482215] spa.system   | [        system.c:  221 impl_eventfd_create()] 0x561333e86468: new fd:12
[D][36591.482227] pw.context   | [      pipewire.c:  250 load_spa_handle()] load lib:'support/libspa-dbus' factory-name:'support.dbus'
[D][36591.482447] pw.context   | [      pipewire.c:  147 open_plugin()] loaded plugin:'/usr/lib/x86_64-linux-gnu/spa-0.2/support/libspa-dbus.so'
[D][36591.482466] spa.dbus     | [          dbus.c:  538 impl_init()] 0x561333e92b48: initialized
[D][36591.482583] pw.core      | [     impl-core.c:  453 pw_context_create_core()] 0x561333e9c090: new pipewire-0
[D][36591.482598] pw.global    | [        global.c:  108 pw_global_new()] 0x561333e9c940: new PipeWire:Interface:Core 0
[D][36591.482612] pw.global    | [        global.c:  184 pw_global_register()] 0x561333e9c940: registered 0
[I][36591.482658] pw.conf      | [          conf.c:  847 pw_context_conf_section_for_each()] handle config '/usr/share/pipewire/pipewire.conf' section 'context.spa-libs'
[D][36591.482685] pw.context   | [       context.c: 1355 pw_context_add_spa_lib()] 0x561333e8e930: map factory regex 'audio.convert.*' to 'audioconvert/libspa-audioconvert
[D][36591.482703] pw.context   | [       context.c: 1355 pw_context_add_spa_lib()] 0x561333e8e930: map factory regex 'api.alsa.*' to 'alsa/libspa-alsa
[D][36591.482720] pw.context   | [       context.c: 1355 pw_context_add_spa_lib()] 0x561333e8e930: map factory regex 'api.v4l2.*' to 'v4l2/libspa-v4l2
[D][36591.482735] pw.context   | [       context.c: 1355 pw_context_add_spa_lib()] 0x561333e8e930: map factory regex 'api.libcamera.*' to 'libcamera/libspa-libcamera
[D][36591.482751] pw.context   | [       context.c: 1355 pw_context_add_spa_lib()] 0x561333e8e930: map factory regex 'api.bluez5.*' to 'bluez5/libspa-bluez5
[D][36591.482765] pw.context   | [       context.c: 1355 pw_context_add_spa_lib()] 0x561333e8e930: map factory regex 'api.vulkan.*' to 'vulkan/libspa-vulkan
[D][36591.482780] pw.context   | [       context.c: 1355 pw_context_add_spa_lib()] 0x561333e8e930: map factory regex 'api.jack.*' to 'jack/libspa-jack
[D][36591.482796] pw.context   | [       context.c: 1355 pw_context_add_spa_lib()] 0x561333e8e930: map factory regex 'support.*' to 'support/libspa-support
[I][36591.482838] pw.context   | [       context.c:  394 pw_context_new()] 0x561333e8e930: parsed 8 context.spa-libs items
[I][36591.482849] pw.conf      | [          conf.c:  847 pw_context_conf_section_for_each()] handle config '/usr/share/pipewire/pipewire.conf' section 'context.modules'
[D][36591.482866] pw.module    | [   impl-module.c:  184 pw_context_load_module()] moduledir set to: /usr/lib/x86_64-linux-gnu/pipewire-0.3
[D][36591.482882] pw.module    | [   impl-module.c:  194 pw_context_load_module()] trying to load module: libpipewire-module-rt (/usr/lib/x86_64-linux-gnu/pipewire-0.3/libpipewire-module-rt.so) args({
            nice.level    = -11
            #rt.prio      = 88
            #rt.time.soft = -1
            #rt.time.hard = -1
        })
[D][36591.482999] pw.global    | [        global.c:  108 pw_global_new()] 0x561333ea4c90: new PipeWire:Interface:Module 1
[D][36591.483018] mod.rt       | [     module-rt.c:  791 pipewire__module_init()] module 0x561333ea4eb0: new
[I][36591.483034] mod.rt       | [     module-rt.c:  817 pipewire__module_init()] could not use realtime scheduling, falling back to using RTKit instead
[W][36595.740368] mod.rt       | [     module-rt.c:  224 translate_error()] RTKit error: org.freedesktop.DBus.Error.TimedOut
[W][36595.740636] mod.rt       | [     module-rt.c:  526 set_nice()] could not set nice-level to -11: Input/output error
[W][36620.751833] mod.rt       | [     module-rt.c:  224 translate_error()] RTKit error: org.freedesktop.DBus.Error.TimedOut
[D][36620.751918] mod.rt       | [     module-rt.c:  575 set_rlimit()] rt.time.soft:-1 rt.time.hard:-1
[D][36620.751953] pw.module    | [   impl-module.c:  378 pw_impl_module_update_properties()] 0x561333ea49e0: updated 4 properties
[D][36620.751980] pw.module    | [   impl-module.c:  378 pw_impl_module_update_properties()] 0x561333ea49e0: updated 1 properties
[D][36620.752004] mod.rt       | [     module-rt.c:  846 pipewire__module_init()] initialized using RTKit
[D][36620.752036] pw.global    | [        global.c:  184 pw_global_register()] 0x561333ea4c90: registered 1
[D][36620.752049] pw.module    | [   impl-module.c:  272 pw_context_load_module()] 0x561333ea49e0: loaded module: libpipewire-module-rt
[I][36620.752063] pw.conf      | [          conf.c:  568 load_module()] 0x561333e8e930: loaded module libpipewire-module-rt
[D][36620.752081] pw.module    | [   impl-module.c:  184 pw_context_load_module()] moduledir set to: /usr/lib/x86_64-linux-gnu/pipewire-0.3
[D][36620.752104] pw.module    | [   impl-module.c:  194 pw_context_load_module()] trying to load module: libpipewire-module-protocol-native (/usr/lib/x86_64-linux-gnu/pipewire-0.3/libpipewire-module-protocol-native.so) args((null))
[D][36620.752374] pw.global    | [        global.c:  108 pw_global_new()] 0x561333eaa700: new PipeWire:Interface:Module 2
[D][36620.752407] pw.protocol  | [      protocol.c:   72 pw_protocol_new()] 0x561333eaa880: Created protocol PipeWire:Protocol:Native
[D][36620.752422] pw.protocol  | [      protocol.c:  156 pw_protocol_add_marshal()] 0x561333eaa880: Add marshal PipeWire:Interface:Core/3 to protocol PipeWire:Protocol:Native
[D][36620.752437] pw.protocol  | [      protocol.c:  156 pw_protocol_add_marshal()] 0x561333eaa880: Add marshal PipeWire:Interface:Registry/3 to protocol PipeWire:Protocol:Native
[D][36620.752450] pw.protocol  | [      protocol.c:  156 pw_protocol_add_marshal()] 0x561333eaa880: Add marshal PipeWire:Interface:Module/3 to protocol PipeWire:Protocol:Native
[D][36620.752464] pw.protocol  | [      protocol.c:  156 pw_protocol_add_marshal()] 0x561333eaa880: Add marshal PipeWire:Interface:Device/3 to protocol PipeWire:Protocol:Native
[D][36620.752477] pw.protocol  | [      protocol.c:  156 pw_protocol_add_marshal()] 0x561333eaa880: Add marshal PipeWire:Interface:Node/3 to protocol PipeWire:Protocol:Native
[D][36620.752491] pw.protocol  | [      protocol.c:  156 pw_protocol_add_marshal()] 0x561333eaa880: Add marshal PipeWire:Interface:Port/3 to protocol PipeWire:Protocol:Native
[D][36620.752503] pw.protocol  | [      protocol.c:  156 pw_protocol_add_marshal()] 0x561333eaa880: Add marshal PipeWire:Interface:Factory/3 to protocol PipeWire:Protocol:Native
[D][36620.752517] pw.protocol  | [      protocol.c:  156 pw_protocol_add_marshal()] 0x561333eaa880: Add marshal PipeWire:Interface:Client/3 to protocol PipeWire:Protocol:Native
[D][36620.752530] pw.protocol  | [      protocol.c:  156 pw_protocol_add_marshal()] 0x561333eaa880: Add marshal PipeWire:Interface:Link/3 to protocol PipeWire:Protocol:Native
[D][36620.752543] pw.protocol  | [      protocol.c:  156 pw_protocol_add_marshal()] 0x561333eaa880: Add marshal PipeWire:Interface:Core/0 to protocol PipeWire:Protocol:Native
[D][36620.752555] pw.protocol  | [      protocol.c:  156 pw_protocol_add_marshal()] 0x561333eaa880: Add marshal PipeWire:Interface:Registry/0 to protocol PipeWire:Protocol:Native
[D][36620.752567] pw.protocol  | [      protocol.c:  156 pw_protocol_add_marshal()] 0x561333eaa880: Add marshal PipeWire:Interface:Module/0 to protocol PipeWire:Protocol:Native
[D][36620.752580] pw.protocol  | [      protocol.c:  156 pw_protocol_add_marshal()] 0x561333eaa880: Add marshal PipeWire:Interface:Node/0 to protocol PipeWire:Protocol:Native
[D][36620.752592] pw.protocol  | [      protocol.c:  156 pw_protocol_add_marshal()] 0x561333eaa880: Add marshal PipeWire:Interface:Port/0 to protocol PipeWire:Protocol:Native
[D][36620.752605] pw.protocol  | [      protocol.c:  156 pw_protocol_add_marshal()] 0x561333eaa880: Add marshal PipeWire:Interface:Factory/0 to protocol PipeWire:Protocol:Native
[D][36620.752617] pw.protocol  | [      protocol.c:  156 pw_protocol_add_marshal()] 0x561333eaa880: Add marshal PipeWire:Interface:Client/0 to protocol PipeWire:Protocol:Native
[D][36620.752631] pw.protocol  | [      protocol.c:  156 pw_protocol_add_marshal()] 0x561333eaa880: Add marshal PipeWire:Interface:Link/0 to protocol PipeWire:Protocol:Native
[D][36620.752644] mod.protocol-native | [module-protocol-: 1398 pipewire__module_init()] 0x561333eaa880: new debug:0
[D][36620.752662] mod.protocol-native | [module-protocol-: 1213 create_server()] 0x561333eaa880: created server 0x561333eaad40
[D][36620.752678] mod.protocol-native | [module-protocol-: 1213 create_server()] 0x561333eaa880: created server 0x561333eaaf00
[D][36620.752692] mod.protocol-native | [module-protocol-:  613 init_socket_name()] name:pipewire-0 runtime_dir:/run/user/1000
[E][36620.752717] mod.protocol-native | [module-protocol-:  660 lock_socket()] server 0x561333eaaf00: unable to lock lockfile '/run/user/1000/pipewire-0.lock': Resource temporarily unavailable (maybe another daemon is running)
[D][36620.752741] mod.protocol-native | [module-protocol-: 1140 destroy_server()] 0x561333eaa880: server 0x561333eaaf00
[D][36620.752754] pw.protocol  | [      protocol.c:  111 pw_protocol_destroy()] 0x561333eaa880: destroy
[D][36620.752766] mod.protocol-native | [module-protocol-: 1140 destroy_server()] 0x561333eaa880: server 0x561333eaad40
[D][36620.752780] pw.module    | [   impl-module.c:  297 pw_context_load_module()] "/usr/lib/x86_64-linux-gnu/pipewire-0.3/libpipewire-module-protocol-native.so": failed to initialize: Resource temporarily unavailable
[D][36620.752795] pw.module    | [   impl-module.c:  322 pw_impl_module_destroy()] 0x561333eaa530: destroy
[D][36620.752807] pw.global    | [        global.c:  413 pw_global_destroy()] 0x561333eaa700: destroy 2
[D][36620.752820] pw.global    | [        global.c:  421 pw_global_destroy()] 0x561333eaa700: free
[D][36620.752832] pw.module    | [   impl-module.c:  331 pw_impl_module_destroy()] 0x561333eaa530: free
[E][36620.752882] pw.conf      | [          conf.c:  560 load_module()] 0x561333e8e930: could not load mandatory module "libpipewire-module-protocol-native": Resource temporarily unavailable
[D][36620.752902] pw.context   | [       context.c:  448 pw_context_destroy()] 0x561333e8e930: destroy
[D][36620.752916] pw.data-loop | [     data-loop.c:  159 pw_data_loop_destroy()] 0x561333e92bd0: destroy
[D][36620.752930] pw.data-loop | [     data-loop.c:  224 pw_data_loop_stop()] 0x561333e92bd0 stopping
[D][36620.752941] pw.data-loop | [     data-loop.c:  237 pw_data_loop_stop()] 0x561333e92bd0 stopped
[D][36620.752954] pw.context   | [      pipewire.c:  209 unref_handle()] clear handle 'support.loop'
[D][36620.752975] spa.system   | [        system.c:   88 impl_close()] 0x561333e92cf8: close fd:10
[D][36620.752991] spa.system   | [        system.c:   88 impl_close()] 0x561333e92cf8: close fd:11
[D][36620.753006] spa.system   | [        system.c:   88 impl_close()] 0x561333e92cf8: close fd:9
[D][36620.753019] pw.context   | [      pipewire.c:  209 unref_handle()] clear handle 'support.system'
[D][36620.753031] pw.module    | [   impl-module.c:  322 pw_impl_module_destroy()] 0x561333ea49e0: destroy
[D][36620.753061] pw.global    | [        global.c:  413 pw_global_destroy()] 0x561333ea4c90: destroy 1
[D][36620.753074] pw.global    | [        global.c:  209 global_unregister()] 0x561333ea4c90: unregistered 1
[D][36620.753086] pw.global    | [        global.c:  421 pw_global_destroy()] 0x561333ea4c90: free
[D][36620.753099] pw.module    | [   impl-module.c:  331 pw_impl_module_destroy()] 0x561333ea49e0: free
[D][36620.753176] pw.global    | [        global.c:  413 pw_global_destroy()] 0x561333e9c940: destroy 0
[D][36620.753190] pw.core      | [     impl-core.c:  473 pw_impl_core_destroy()] 0x561333e9c090: destroy
[D][36620.753202] pw.core      | [     impl-core.c:  485 pw_impl_core_destroy()] 0x561333e9c090: free
[D][36620.753217] pw.global    | [        global.c:  209 global_unregister()] 0x561333e9c940: unregistered 0
[D][36620.753229] pw.global    | [        global.c:  421 pw_global_destroy()] 0x561333e9c940: free
[D][36620.753241] pw.context   | [       context.c:  481 pw_context_destroy()] 0x561333e8e930: free
[D][36620.753253] pw.mem       | [           mem.c:  176 pw_mempool_destroy()] 0x561333e9af40: destroy
[D][36620.753267] pw.mem       | [           mem.c:  164 pw_mempool_clear()] 0x561333e9af40: clear
[D][36620.753278] pw.work-queue | [    work-queue.c:  137 pw_work_queue_destroy()] 0x561333e9afa0: destroy
[D][36620.753296] spa.system   | [        system.c:   88 impl_close()] 0x561333e86468: close fd:12
[D][36620.753312] pw.context   | [      pipewire.c:  209 unref_handle()] clear handle 'support.dbus'
[D][36620.753325] pw.context   | [      pipewire.c:  170 unref_plugin()] unloaded plugin:'/usr/lib/x86_64-linux-gnu/spa-0.2/support/libspa-dbus.so'
[E][36620.753399] default      | [      pipewire.c:  123 main()] failed to create context: Resource temporarily unavailable
[D][36620.753418] pw.main-loop | [     main-loop.c:   92 pw_main_loop_destroy()] 0x561333e86200: destroy
[D][36620.753430] pw.context   | [      pipewire.c:  209 unref_handle()] clear handle 'support.loop'
[D][36620.753446] spa.system   | [        system.c:   88 impl_close()] 0x561333e86468: close fd:8
[D][36620.753462] spa.system   | [        system.c:   88 impl_close()] 0x561333e86468: close fd:7
[D][36620.753477] spa.system   | [        system.c:   88 impl_close()] 0x561333e86468: close fd:5
[D][36620.753492] spa.system   | [        system.c:   88 impl_close()] 0x561333e86468: close fd:6
[D][36620.753506] spa.system   | [        system.c:   88 impl_close()] 0x561333e86468: close fd:4
[D][36620.753518] pw.context   | [      pipewire.c:  209 unref_handle()] clear handle 'support.system'
[D] pw.context [pipewire.c:209 unref_handle()] clear handle 'support.log'
[D] pw.context [pipewire.c:209 unref_handle()] clear handle 'support.cpu'
[D] pw.context [pipewire.c:170 unref_plugin()] unloaded plugin:'/usr/lib/x86_64-linux-gnu/spa-0.2/support/libspa-support.so'
[D] pw.context [pipewire.c:209 unref_handle()] clear handle 'support.log'
[D] pw.context [pipewire.c:170 unref_plugin()] unloaded plugin:'/usr/lib/x86_64-linux-gnu/spa-0.2/support/libspa-journal.so'

am I able to set CAP_SYS_NICE or RTKit a container?

i’ve tried turning off both apparmor and seccomp; just for testing. Is this a bug?

incus config set "$RUNTIME_NAME" security.privileged true
incus config set "$RUNTIME_NAME" raw.lxc "lxc.apparmor.profile = unconfined\nlxc.seccomp.profile =" 

Am I making an error if I want to have the audio run in the container?

You can either pass the Unix socket of the audio server from the host to the container (see @catfish reply above), or enable remote audio server. The former is easier to set up.

Thanks.