Ubuntu DHCPD 无法启动

Ubuntu DHCPD 无法启动

我今天升级到了 Ubuntu 16.04,我知道这是一次迟来的升级。升级完成后,ISC DHCP 服务器停止运行。

这似乎是一个权限问题,但我很难弄清楚。

我正在使用以下命令来测试/启动服务器:

sudo /usr/sbin/dhcpd -user dhcpd -group dhcpd -f -4 -pf /run/dhcp-server/dhcpd.pid -cf /etc/dhcp/dhcpd.conf

输出结果为

Internet Systems Consortium DHCP Server 4.3.3
Copyright 2004-2015 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Config file: /etc/dhcp/dhcpd.conf
Database file: /var/lib/dhcp/dhcpd.leases
PID file: /run/dhcp-server/dhcpd.pid
Can't open lease database /var/lib/dhcp/dhcpd.leases: Permission denied --
  check for failed database rewrite attempt!
Please read the dhcpd.leases manual page if you
don't know what to do about this.
<snip>

有人会认为这只是改变租赁文件的所有权/权限的问题,以下是现有的权限:

mike@wilma:~$ sudo ls -lad /var/lib/dhcp/ /var/lib/dhcp/*
drw-rw-r-- 2 dhcpd dhcpd   4096 Jul  3 23:02 /var/lib/dhcp/
-rw-r--r-- 1 dhcpd dhcpd      0 Aug  4  2016 /var/lib/dhcp/dhclient.leases
-rw-rw-r-- 1 dhcpd dhcpd 842233 Jul  3 11:55 /var/lib/dhcp/dhcpd.leases

确保用户确实存在...

@wilma:~$ id dhcpd
uid=112(dhcpd) gid=123(dhcpd) groups=123(dhcpd)

我现在已经关闭了 apparmor,所以这不是问题。

任何帮助将不胜感激。

使用 systemctl ....

mike@wilma:~$ sudo systemctl restart isc-dhcp-server.service
[sudo] password for mike: 
Sorry, try again.
[sudo] password for mike: 

日志文件的结果

Jul  3 23:50:12 wilma systemd[1]: Stopped ISC DHCP IPv4 server.
Jul  3 23:50:12 wilma systemd[1]: Started ISC DHCP IPv4 server.
/usr/share/man/man8/dhcpd.8.gz
Jul  3 23:50:12 wilma dhcpd[26877]: Internet Systems Consortium DHCP Server 4.3.3
Jul  3 23:50:12 wilma sh[26877]: Internet Systems Consortium DHCP Server 4.3.3
Jul  3 23:50:12 wilma sh[26877]: Copyright 2004-2015 Internet Systems Consortium.
Jul  3 23:50:12 wilma sh[26877]: All rights reserved.
Jul  3 23:50:12 wilma sh[26877]: For info, please visit https://www.isc.org/software/dhcp/
Jul  3 23:50:12 wilma dhcpd[26877]: Copyright 2004-2015 Internet Systems Consortium.
Jul  3 23:50:12 wilma dhcpd[26877]: All rights reserved.
Jul  3 23:50:12 wilma dhcpd[26877]: For info, please visit https://www.isc.org/software/dhcp/
Jul  3 23:50:12 wilma dhcpd[26877]: Config file: /etc/dhcp/dhcpd.conf
Jul  3 23:50:12 wilma sh[26877]: Config file: /etc/dhcp/dhcpd.conf
Jul  3 23:50:12 wilma sh[26877]: Database file: /var/lib/dhcp/dhcpd.leases
Jul  3 23:50:12 wilma sh[26877]: PID file: /run/dhcp-server/dhcpd.pid
Jul  3 23:50:12 wilma dhcpd[26877]: Database file: /var/lib/dhcp/dhcpd.leases
Jul  3 23:50:12 wilma dhcpd[26877]: PID file: /run/dhcp-server/dhcpd.pid
Jul  3 23:50:12 wilma dhcpd[26877]: Internet Systems Consortium DHCP Server 4.3.3
Jul  3 23:50:12 wilma dhcpd[26877]: Copyright 2004-2015 Internet Systems Consortium.
Jul  3 23:50:12 wilma dhcpd[26877]: All rights reserved.
Jul  3 23:50:12 wilma dhcpd[26877]: For info, please visit https://www.isc.org/software/dhcp/
Jul  3 23:50:12 wilma dhcpd[26877]: Can't chown new lease file: Operation not permitted
Jul  3 23:50:12 wilma dhcpd[26877]: 
Jul  3 23:50:12 wilma sh[26877]: Can't chown new lease file: Operation not permitted

文件的权限由 systemctl 脚本更改:

mike@wilma:~$ sudo ls -lad /var/lib/dhcp/ /var/lib/dhcp/*
drwxrwxr-x 2 root  dhcpd   4096 Jul  3 23:50 /var/lib/dhcp/
-rw-r--r-- 1 dhcpd dhcpd      0 Aug  4  2016 /var/lib/dhcp/dhclient.leases
-rw-rw-r-- 1 root  dhcpd 842233 Jul  3 11:55 /var/lib/dhcp/dhcpd.leases
-rw-r--r-- 1 root  root       0 Jul  3 23:50 /var/lib/dhcp/dhcpd.leases.1562154612

答案1

这可能是您在 4.3.3 中遇到的一个已知错误:

https://bugs.launchpad.net/ubuntu/+source/isc-dhcp/+bug/1186662

升级 ISC 可能是最简单的。

答案2

我想感谢大家花时间和精力来帮助我。问题不知怎么就解决了,恐怕我无法给出原因,它只是重新开始工作了。系统日志显示租约没有问题。

再次感谢:)

相关内容