Multiple shairport-sync instances in LXC containers #1250
Replies: 4 comments 1 reply
-
Awesome guide! thank you! |
Beta Was this translation helpful? Give feedback.
-
Hi, @noelhibbard , many thanks for this write-up. I am trying to use this for a Proxmox LXC on my Raspberry Pi 4 and experience issues.
HDMI "soundcards" are showing in the container under proc:
/var/lib/lxc/100/config on the host:
|
Beta Was this translation helpful? Give feedback.
-
@DaCHack, try changing |
Beta Was this translation helpful? Give feedback.
-
for the nqptp part i would add
|
Beta Was this translation helpful? Give feedback.
-
Deploy shairport-sync in Debian LXC container
I loaded Debian Buster on bare metal to compose these instructions but they should work on other Debian based distros like Ubuntu but I haven't tested. These instructions also explain how to map the sound cards into the containers so it's not necessary to use a PulseAudio server. Commands prefixed with a # will are run on the host. Commands prefixed with a $ will be run in the LXC container.
Install LXC and ALSA
Create network bridge
You need to create a network bridge in order for the containers to sit on your host network and aquire an IP via DHCP. Follow these directions: https://wiki.debian.org/LXC/SimpleBridge#Host_device_as_bridge
Reboot Server after creating bridge
You can restart the network without rebooting but you risk loosing connectivity so it's safer to just reboot
Create new LXC container
Configure the container so that it has access to your soundcards and uses the network bridge created above.
Add/change these lines:
If you have an elaborate ALSA config you can map the ALSA config file into the container so you only have to maintain the config on the host. To do that, add a line like this to the LXC config file:
Start container, set the root password and enable root access via SSH
Now you can SSH into the container
Install prereqs for compiling/running shairport-sync
Edit shairport-sync.conf however you wish (the defaults should work fine though)
Enable/Start shairport-sync service
Other tidbits
Once you have the container the way you like it, you can make a copy with another name to run another instance of shairport-sync. The new container will have a random MAC address so it will get its own IP.
The root file system for a container it located here. You can copy files between the host/container and edit files from the host but it's a good idea to do this while the container is in a stopped state:
The containers should autostart when the host starts. If you need to stop all the containers you can use this command
This command will autostart any containers that aren't already running:
Beta Was this translation helpful? Give feedback.
All reactions