首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >每次重启VPS时Dnsmasq都无法启动

每次重启VPS时Dnsmasq都无法启动
EN

Stack Overflow用户
提问于 2018-08-23 08:42:57
回答 1查看 497关注 0票数 -1

每次重启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。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-08-23 11:23:56

最后,我找到了问题并解决了它。正如系统所通知的那样,chown: invalid user: ‘dnsmasq:nogroup’是错误的代码。我认为这应该是dnsmasq未能自动添加用户或组导致的错误。

一种解决方案可能是手动添加名为"dnsmasq“的用户。我没有试过,但我认为它会起作用。另一种处理方法是在相关文件中查找用户"dnsmasq“,并将用户"dnsmasq”替换为现有的用户,如“无人”。

/etc/init.d/dnsmasq文件中有3个地方需要替换。

  1. if [ ! "$DNSMASQ_USER" ]; then DNSMASQ_USER="*dnsmasq*" fi
  2. # /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. # /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无法访问帐户文件。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51976913

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档