if root filesystem mount read-only (nfs, or etc), when machine boot I see Generating host.conf. eval: cannot create /etc/host.conf: Read-only file system eval: cannot create /etc/host.conf: Read-only file system eval: cannot create /etc/host.conf: Read-only file system ======== in file /etc/rc.d/nsswitch I see: router# grep -R generate_host_conf * rc.d/nsswitch:generate_host_conf() rc.d/nsswitch: generate_host_conf /etc/nsswitch.conf /etc/host.conf filename for host.conf is hardcoded =( Fix: may be add variable into /etc/defaults/rc.conf? How-To-Repeat: boot with / mounted read-only
Hi! 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. Cheers -- Efstratios "GPF" Karatzas
Responsible Changed From-To: freebsd-bugs->freebsd-rc Over to -rc maintainers
This is still and issue. Can't we just get rid of /etc/rc.d/nsswitch? Nothing in the tree seems to need /etc/host.conf.
As /etc/host.conf has no longer been used since FreeBSD 5.0, perhaps the time has come to remove /etc/rc.d/nsswitch. A /etc/host.conf file is only needed to run binaries from FreeBSD 4.x or older with a non-default name resolution order (the hard-coded default was generally DNS, then /etc/hosts). There is no point in changing the pathname since the old binaries refer to /etc/host.conf. A host.conf in a different location would be useless. In any case, the error is written but ignored. The system boots regardless of it.
One can do the 'diskless' setup that NanoBSD does (where a /etc mfs is done, populated from /conf/base/etc), or one can have a symlink to some place writable.
Yes, one can work around it by symlinking /etc/host.conf to somewhere writeable. If you're doing that you might as well remove the nsswitch script if nothing needs host.conf But this is one more thing to customize. I agree with Jilles, perhaps it's time to remove /etc/rc.d/nsswitch. FreeBSD 4 went EOL 9 years ago. People who want to run FreeBSD binaries with a custom host resolution order can easily create /etc/host.conf themselves. Hopefully they still know how to do that since host.conf isn't documented as far as I can tell.
The rc.d/nsswitch script was removed in current (see r359068).