I got some weird dhcp-problem and tried to nail it down by deleting the chroot-directory to get an clean start, but got a new problem instead. Every start/restart with the clean chroot failed with Can't open /usr/local/etc/dhcpd.conf: No such file or directory Debugging the rc-script with 'sh -x' showed the failing command: /usr/local/sbin/dhcpd -t -cf /usr/local/etc/dhcpd.conf -lf /var/db/dhcpd/dhcpd.leases -pf /var/run/dhcpd/dhcpd.pid -user dhcpd -group dhcpd -chroot /var/db/dhcpd Seems that the rc-script failed somehow to copy the dhcpd.conf to the chroot before starting the program. After copying the dhcpd.conf manually to /var/db/dhcpd/usr/local/etc/dhcpd.conf it worked. Full log of 'sh -x' is attached. rc.conf settings: hilti@kirk:~> grep dhcp /etc/rc.conf dhcpd_enable="YES" # dhcpd enabled dhcpd_flags="-q" # command option(s) dhcpd_conf="/usr/local/etc/dhcpd.conf" # DHCP configuration file #dhcpd_ifaces="" # ethernet interface(s) dhcpd_withumask="022" # file creation mask dhcpd_chuser_enable="YES" # runs w/o privileges? dhcpd_withuser="dhcpd" # user name to run as dhcpd_withgroup="dhcpd" # group name to run as dhcpd_chroot_enable="YES" # runs chrooted? dhcpd_devfs_enable="YES" # uses devfs if available? dhcpd_rootdir="/var/db/dhcpd" # directory to run in #dhcpd_flags="-early_chroot" # needs full root Port compile options: hilti@kirk:~> cat /var/db/ports/isc-dhcp41-server/options # This file is auto-generated by 'make config'. # No user-servicable parts inside! # Options for isc-dhcp41-server-4.1.e_2,2 _OPTIONS_READ=isc-dhcp41-server-4.1.e_2,2 WITHOUT_DHCP_IPV6=true WITH_DHCP_PARANOIA=true WITHOUT_DHCP_LDAP=true WITHOUT_DHCP_LDAP_SSL=true Fix: Workaround: Manually copy /usr/local/etc/dhcpd.conf to the chroot. Patch attached with submission follows: How-To-Repeat: Use dhcpd with dhcpd_chroot_enable="YES" in /etc/rc.conf and start with empty chroot.
Maintainer of net/isc-dhcp41-server, Please note that PR ports/162447 has just been submitted. If it contains a patch for an upgrade, an enhancement or a bug fix you agree on, reply to this email stating that you approve the patch and a committer will take care of it. The full text of the PR can be found at: http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/162447 -- Edwin Groothuis via the GNATS Auto Assign Tool edwin@FreeBSD.org
State Changed From-To: open->feedback Awaiting maintainers feedback (via the GNATS Auto Assign Tool)
Hello, It does not look like you have attached the correct patch? Could you please reply with the correct patch? Thanks! -- Douglas William Thrift <douglas@douglasthrift.net> <http://douglasthrift.net/>
Douglas Thrift schrieb: >Hello, > >It does not look like you have attached the correct patch? Could you >please reply with the correct patch? Hi, I attached the outout of | sudo screen -L sh -x /usr/local/etc/rc.d/isc-dhcpd restart not a patch. Sorry, I didn't red the descrition good enough and missused it for uploading the logfile. bye, Hilko
Douglas Thrift schrieb: >Hello, > >It does not look like you have attached the correct patch? Could you >please reply with the correct patch? Hi, I looked at the problem again and I think I know what happens. The relevant parts of the rc-script are: start_precmd=dhcpd_precmd restart_precmd="dhcpd_checkconfig" dhcpd_precmd () { setup_umask setup_chroot setup_chuser setup_leases setup_flags } dhcpd_checkconfig () { local rc_flags_mod setup_flags rc_flags_mod="$rc_flags" # Eliminate '-q' flag if it is present case "$rc_flags" in *-q*) rc_flags_mod=`echo "${rc_flags}" | sed -Ee 's/(^-q | -q | -q$)//'` ;; esac if ! ${command} -t -q ${rc_flags_mod}; then err 1 "`${command} -t ${rc_flags_mod}` Configuration file sanity check failed" fi } I used > /usr/local/etc/rc.d/isc-dhcpd restart when dhcpd wasn't running and the chroot was empty. If I understand it correctly it can't work, because in the rc-script dhcpd_checkconfig () is executed before dhcpd_precmd () where the chroot is created. But if dhcpd is called with the -chroot option it looks in the chroot for the config file. So, I think the solution is to strip out the '-chroot' with an extended sed expression so that dhcpd -t ${rc_flags_mod} will always test the config file that will be copied to the chroot. I've attached a patch with a modified sed expression. Tested here. Please review with care. My sed fu isn't too strong. ;-) Another thing I noticed is that dhcpd_checkconfig is only called by 'isc-dhcpd restart', not by 'isc-dhcpd start'. Moving the call of dhcpd_checkconfig to dhcpd_precmd. I've attached a second patch with this. Position in dhcpd_precmd was chosen arbitrary. If dhcpd_checkconfig is called after setup_chroot it isn't necessary to change the sed expression to fix my problem. Nevertheless I think both fixes should be combined. bye, Hilko
Hi, maybe the attached version of the first diff is better, because we know $dhcpd_rootdir and there is no need to use a regexp to catch it. bye, Hilko
State Changed From-To: feedback->open Feedback received
Responsible Changed From-To: freebsd-ports-bugs->zi I'll take it.
State Changed From-To: open->analyzed Evaluating solutions.
zi 2012-03-19 01:28:35 UTC FreeBSD ports repository Modified files: net/isc-dhcp41-server/files isc-dhcpd.in net/isc-dhcp42-server/files isc-dhcpd.in Log: - Resolve issue where the the daemon would fail to start [1] - Resolve issue on systems set to UTC time would fail copying /etc/localtime to the chroot [2] PR: ports/162447 [1] Submitted by: Hilko Meyer <hilko.meyer@gmx.de> [1] Reported by: dougb@ [2] Feature safe: yes Revision Changes Path 1.6 +15 -5 ports/net/isc-dhcp41-server/files/isc-dhcpd.in 1.3 +15 -4 ports/net/isc-dhcp42-server/files/isc-dhcpd.in _______________________________________________ cvs-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/cvs-all To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
State Changed From-To: analyzed->closed Committed, with minor changes. Thanks!