misc/137271: Cannot update /etc/host.conf when root filesystems mount read-only

Efstratios Karatzas gpf.kira at gmail.com
Thu Jan 28 21:20:12 UTC 2010

The following reply was made to PR misc/137271; it has been noted by GNATS.

From: Efstratios Karatzas <gpf.kira at gmail.com>
To: bug-followup at freebsd.org, admin at lissyara.su
Subject: Re: misc/137271: Cannot update /etc/host.conf when root filesystems 
	mount read-only
Date: Thu, 28 Jan 2010 23:18:00 +0200

 Not sure if this belongs in the PR database, but I have a couple of quick fixes.
 fix a)
 step 1:
 append the following line to your /etc/rc.conf file
 sudo echo "nsswitch_host_conf=\"/usr/local/etc/host.conf\" " >> /etc/rc.conf
 You can of course change the pathname to whatever you desire, as well
 as the variable name as long as it begins with a "nsswitch_" prefix
 step 2:
 goto /etc/rc.d/nsswitch
 As you can see, in lines 93, 94 & and 97 the "/etc/host.conf" is hardcoded
 Replace it with the variable defined in /etc/rc.conf
 For example, line 93 becomes
 if [ ! -f $nsswitch_host_conf -o \
 etc. So no more hardcoding!
 *But* I really doubt that changing the location of system
 configuration files is
 a wise thing to do. I would avoid this solution and go with the
 solution b instead.
 fix b)
 Just boot with read/write partition / so you can make /etc/host.conf a
 symbolic link
 to /usr/local/etc/host.conf or some other path of your picking. Then change to
 read only mode for the partition. Makes more sense and seems a lot safer.
 Hope this helps.
 Efstratios "GPF" Karatzas

More information about the freebsd-bugs mailing list