@ wrote... (2 years ago)

I've been making LXC containers in Proxmox like a fiend. I'm toally loving Proxmox, if you want several virtual machines I highly recommend it.

Anyhow, trying to run avahi-daemon in the containers often fails. I'm not the first to notice this but the answers were unsatisfying until I found a suggestion to try running with --no-rlimits. That seems to do the trick!

But how to get systemd to run it that way? Very simply as it turns out.

systemd

systemctl edit avahi-daemon.service

Add then in the text editor that opens up, enter the following:

[Service]
ExecStart=
ExecStart=/usr/sbin/avahi-daemon -s --no-rlimits

see comment #2 for a script friendly way to do this

libnss-mdns

libnss-mdns sometimes doesn't install properly though. If you can't ping/lookup other .local hosts then edit /etc/nsswitch.conf and change…

hosts:          files dns

to

hosts:          files mdns4_minimal [NOTFOUND=return] dns

If anybody wants to write me an ansible script to do that I would totally buy you a beer.

Too late, I had to write it myself, container.yml.

Category: tech, Tags: linux, lxc
Comments: 2
Comments
1.
Toastie @ March 2, 2018 wrote... (9 months, 1 week ago)

Thanks for your post, this really helped me out. While I have no Ansible script, you may make use of following command to add --no-rlimits in the systemd service file:

sed -i \
-e 's/ExecStart=\/usr\/sbin\/avahi-daemon -s/ExecStart=\/usr\/sbin\/avahi-daemon --no-rlimits -s/g' \
-e 's/ExecReload=\/usr\/sbin\/avahi-daemon -r/ExecReload=\/usr\/sbin\/avahi-daemon --no-rlimits -r/g' \
/lib/systemd/system/avahi-daemon.service

systemctl daemon-reload
systemctl start avahi-daemon
systemctl status avahi-daemon
2.
Kurt @ March 2, 2018 wrote... (9 months, 1 week ago)

Thanks for the comment Toastie, but you don't actually want to change /lib/systemd/system/avahi-daemon.service your next avahi system update will be unhappy.

An optimization of your general idea is

mkdir -p /etc/systemd/system/avahi-daemon.service.d
cat <<EOF > /etc/systemd/system/avahi-daemon.service.d/override.conf
[Service]
ExecStart=
ExecStart=/usr/sbin/avahi-daemon -s --no-rlimits
EOF


systemctl daemon-reload
systemctl start avahi-daemon
systemctl status avahi-daemon
Click here to add a comment