每次重启VPS时,Dnsmasq都无法启动。下面是关于它的日志。
Aug 22 18:14:51 debian dnsmasq[776]: dnsmasq: syntax check OK.
Aug 22 18:14:51 debian dnsmasq[798]: chown: invalid user: ‘dnsmasq:nogroup’
Aug 22 18:14:51 debian systemd[1]: dnsmasq.service: Control process exited, code=exited status=2
Aug 22 18:14:51 debian systemd[1]: Failed to start dnsmasq - A lightweight DHCP and caching DNS server.
Aug 22 18:14:51 debian systemd[1]: dnsmasq.service: Unit entered failed state.
Aug 22 18:14:51 debian systemd[1]: dnsmasq.service: Failed with result 'exit-code'.
我已经在/etc/dnsmasq.conf
文件中正确设置了用户名和组名。我尝试重新安装dnsmasq,然后它就起作用了。但在我重新启动VPS后,它无法再次启动。然后我必须重新安装...
因此,如果我想使用dnsmasq,我必须不重启我的VPS。但我想知道是什么导致了这种情况,以及如何一劳永逸地解决它。我的VPS系统是Debian 9,内核是4.9.0-7-amd64。
发布于 2018-08-23 11:23:56
最后,我找到了问题并解决了它。正如系统所通知的那样,chown: invalid user: ‘dnsmasq:nogroup’
是错误的代码。我认为这应该是dnsmasq未能自动添加用户或组导致的错误。
一种解决方案可能是手动添加名为"dnsmasq“的用户。我没有试过,但我认为它会起作用。另一种处理方法是在相关文件中查找用户"dnsmasq“,并将用户"dnsmasq”替换为现有的用户,如“无人”。
/etc/init.d/dnsmasq
文件中有3个地方需要替换。
if [ ! "$DNSMASQ_USER" ]; then DNSMASQ_USER="*dnsmasq*" fi
# /run may be volatile, so we need to ensure that # /run/dnsmasq exists here as well as in postinst if [ ! -d /run/dnsmasq ]; then mkdir /run/dnsmasq || return 2 chown *dnsmasq*:nogroup /run/dnsmasq || return 2 fi
# /run may be volatile, so we need to ensure that # /run/dnsmasq exists here as well as in postinst if [ ! -d /run/dnsmasq ]; then mkdir /run/dnsmasq || return 2 chown *dnsmasq*:nogroup /run/dnsmasq || return 2 fi
替换上面3个放大的位置。
虽然我不确定为什么dnsmasq无法访问帐户文件。
https://stackoverflow.com/questions/51976913
复制相似问题