最近升级后,avahi-daemon 不再启动。此外,无论我是否将 stderr 重定向到文件,行为都会有所不同。
如果我使用调试选项 ( avahi-daemon --debug
) 运行 avahi,我会得到以下输出:
Found user 'avahi' (UID 84) and group 'avahi' (GID 84).
Successfully dropped root privileges.
avahi-daemon 0.6.32 starting up.
Failed to chroot(): Permission denied
chroot.c: chroot() helper started
chroot.c: chroot() helper got command 0d
avahi-daemon 0.6.32 exiting.
chroot.c: chroot() helper got command 0c
chroot.c: chroot() helper exiting with return value 0
如果我添加 stderr IO 重定向 ( avahi-daemon --debug 2>avahi.stderr
),我会得到不同的行为:
在终端 ( stdout
) 上,我得到
File size limit exceeded
现在avahi.stderr
包含
Found user 'avahi' (UID 84) and group 'avahi' (GID 84).
Successfully dropped root privileges.
但是,没有 avahi 进程正在运行。
当我只是重定向时2>/dev/stdin
,我得到与没有重定向相同的行为。
相应的 strace 输出:
strace avahi-daemon --debug
:
由于 stackexchange 的大小限制,这个位于 Pastebin 中: http://paste.pound-python.org/show/J1sYeeXcKYKlHxN6QAX0/
strace avahi-daemon --debug 2>strace.out
(在File size limit exceeded
标准输出上):
由于 stackexchange 的大小限制,该文件位于 Pastebin 中: http://paste.pound-python.org/show/VpFokjSr6kmNAA98s4Y6/
我的环境(输出env
,我的非root用户名已被审查)是这样的:
由于 stackexchange 的大小限制,这个位于 Pastebin 中: http://paste.pound-python.org/show/3s9Qo1WVMB6mLtf15pXp/
avahi 版本:
avahi-daemon -V
打印avahi-daemon 0.6.32
.
关于配置:
% ls -la /etc | grep avahi
drwx------ 3 root root 4096 Mar 9 13:29 avahi
% ls -la /etc/avahi
drwx------ 3 root root 4096 Mar 9 13:29 .
drwxr-xr-x 242 root root 20480 Mar 9 13:29 ..
-rwxr-xr-x 1 root root 2509 Feb 19 13:52 avahi-autoipd.action
-rw-r--r-- 1 root root 1747 Feb 19 13:52 avahi-daemon.conf
-rw-r--r-- 1 root root 1747 Dec 25 18:22 avahi-daemon.conf.pacnew
lrwxrwxrwx 1 root root 38 Mar 9 13:25 avahi-daemon.conf.pacsave -> /usr/local/etc/avahi/avahi-daemon.conf
-rwxr-xr-x 1 root root 2743 Feb 19 13:52 avahi-dnsconfd.action
-rw-r--r-- 1 root root 1121 Feb 19 13:52 hosts
drwx------ 2 root root 4096 Mar 9 13:29 services
嗯,/usr/local/etc/avahi/avahi-daemon.conf
就是我常用的配置,更新的时候已经换掉了。如果我使用该配置,我会得到相同的行为,并且无论/etc/avahi/avahi-daemon.conf
是就地常规文件还是符号链接都没关系。
/etc/avahi/avahi-daemon.conf
在这里,我发布了创建这个问题的内容:
# This file is part of avahi.
#
# avahi is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# avahi is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
# License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with avahi; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA.
# See avahi-daemon.conf(5) for more information on this configuration
# file!
[server]
#host-name=foo
#domain-name=local
#browse-domains=0pointer.de, zeroconf.org
use-ipv4=yes
use-ipv6=yes
#allow-interfaces=eth0
#deny-interfaces=eth1
#check-response-ttl=no
#use-iff-running=no
#enable-dbus=yes
#disallow-other-stacks=no
#allow-point-to-point=no
#cache-entries-max=4096
#clients-max=4096
#objects-per-client-max=1024
#entries-per-entry-group-max=32
ratelimit-interval-usec=1000000
ratelimit-burst=1000
[wide-area]
enable-wide-area=yes
[publish]
#disable-publishing=no
#disable-user-service-publishing=no
#add-service-cookie=no
#publish-addresses=yes
publish-hinfo=no
publish-workstation=no
#publish-domain=yes
#publish-dns-servers=192.168.50.1, 192.168.50.2
#publish-resolv-conf-dns-servers=yes
#publish-aaaa-on-ipv4=yes
#publish-a-on-ipv6=no
[reflector]
#enable-reflector=no
#reflect-ipv=no
[rlimits]
#rlimit-as=
rlimit-core=0
rlimit-data=4194304
rlimit-fsize=0
rlimit-nofile=768
rlimit-stack=4194304
rlimit-nproc=3
我使用 Arch Linux,带有 OpenRC(即没有 systemd),无论我使用包avahi
还是avahi-nosystemd
.我之前在使用 avahi 时遇到过一些问题,比如它先运行然后崩溃。
这里可能发生了什么?
答案1
解决方案:
/etc/avahi/
avahi-daemon
需要在删除 root 权限后才能访问。
因此,/etc/avahi/
所有子目录都应具有 mode 755
,所有文件都应具有 mode ,同时它们仍由 user和 group644
拥有。root
root
答案2
与另一个提到的问题相关的是,您从 avahi-daemon 收到“超出文件大小限制”错误,因为它在配置中将文件大小 rlimit 设置为 0,并且您重定向到文件会创建一个大小大于零的文件。
要禁用此功能,请注释掉 avahi 配置中的 rlimit-fsize=0,即
[rlimits]
#rlimit-as=
rlimit-core=0
rlimit-data=4194304
#rlimit-fsize=0