Отлаживаем ISC DHCP в SMF

Игрушечки с WAN boot и AI привели меня … к dhcp 😉

Наигрался, назапускался. При попытке запустить через svc (svcadm enable svc:/network/dhcp/server:ipv4) – проблема:

root@host:/var/svc/log# svcs -xv
svc:/network/dhcp/server:ipv4 (ISC DHCP Server)
State: maintenance since Wed Oct 17 09:55:55 2012
Reason: Start method exited with $SMF_EXIT_ERR_FATAL.
See: http://sun.com/msg/SMF-8000-KS
See: man -M /usr/share/man -s 1M dhcpd
See: /var/svc/log/network-dhcp-server:ipv4.log
Impact: This service is not running.

В ручном режиме все работает. Ок. Будем делать все как положено 😉

svccfg -s svc:/network/dhcp/server:ipv4 setprop config/debug=true
svcadm refresh svc:/network/dhcp/server:ipv4
svcadm clear svc:/network/dhcp/server:ipv4

Читаем логи:

[ Oct 17 10:00:19 Executing start method ("/lib/svc/method/isc-dhcp"). ]
Internet Systems Consortium DHCP Server 4.1-ESV-R6
Copyright 2004-2012 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
[ Oct 17 10:00:19 Method "start" exited with status 0. ]
Can't open /var/db/isc-dhcp/dhcpd4.leases for append.
[ Oct 17 10:00:19 Stopping because all processes in service exited. ]
[ Oct 17 10:00:19 Executing stop method (:kill). ]
[ Oct 17 10:00:19 Restarting too quickly, changing state to maintenance. ]
[ Oct 17 10:01:12 Leaving maintenance because clear requested. ]
[ Oct 17 10:01:12 Enabled. ]

Ага. Найдено:

root@host:/var/svc/log# ls -la /var/db/isc-dhcp/dhcpd*
-rw-r--r-- 1 root root 407 Oct 17 09:54 /var/db/isc-dhcp/dhcpd4.leases
-rw-r--r-- 1 root root 501 Oct 17 09:49 /var/db/isc-dhcp/dhcpd4.leases~
-rw-r--r-- 1 dhcpserv netadm 0 Oct 16 14:31 /var/db/isc-dhcp/dhcpd6.leases
-rw-r--r-- 1 dhcpserv netadm 0 Oct 16 14:31 /var/db/isc-dhcp/dhcpd6.leases~

Вносим нужные изменения:

chown dhcpserv:netadm /var/db/isc-dhcp/*
svcadm clear svc:/network/dhcp/server:ipv4

Вуаля:

root@host:/var/svc/log# svcs svc:/network/dhcp/server:ipv4
STATE STIME FMRI
online 10:01:12 svc:/network/dhcp/server:ipv4

Не забываем отлючить debug:

svccfg -s svc:/network/dhcp/server:ipv4 setprop config/debug=false
svcadm refresh svc:/network/dhcp/server:ipv4
svcadm restart svc:/network/dhcp/server:ipv4

Leave a Reply