mountlate not late enough for nfe0 with dhcp
William Palfreman
william at palfreman.com
Thu May 26 22:03:43 UTC 2011
I find my nfe0 interface on my media server (an Acer Revo Atom) has not
finished dhcp by the time /etc/rc.d/mountlate is run, or
/etc/rc.d/mountcritremote. So the two NFS filesystems I want to mount cause
booting to halt in the most inconvenient manner possible for a machine with
no keyboard.
I originally had this problem with mountcritremote, so I added the late
option to /ett/fstab:
nfshost:/share /nfs nfs rw,late 0 0
nfshost:/data /data nfs ro,late 0 0
But the network was still not up by the time /etc/rc.d/mountlate ran. So I
slowed things down with the patch you can see below.
I am not saying that you should add something so crude to the base system,
but I do think that it would be better if failure to mount an NFS share due
to DHCP not being finished did not cause the boot to halt. Non-root
filesystem NFS mounts are rarely so critical that is it necessary to drop
into single user mode instead - especially as these days many machines do
not have a console continuously attached. It would be better just to retry
mounting NFS in the background.
Here's how I slow it down, anyway. Ten seconds seems to be plenty:
$ diff -u /usr/src/etc/rc.d/mountlate /etc/rc.d/mountlate
--- /usr/src/etc/rc.d/mountlate 2009-08-03 10:13:06.000000000 +0200
+++ /etc/rc.d/mountlate 2011-05-26 22:34:49.000000000 +0200
@@ -14,6 +14,13 @@
start_cmd="mountlate_start"
stop_cmd=":"
+ping -c1 -t1 8.8.8.8 > /dev/null
+if [ $? -ne 0 ]; then
+ echo "Sleeping 10 waiting for network to come up"
+ sleep 10
+ ping -c1 -t1 8.8.8.8 > /dev/null || echo "Network might still be down,
pressing on"
+fi
+
mountlate_start()
{
local err latefs
@@ -40,8 +47,8 @@
;;
*)
echo 'Mounting /etc/fstab filesystems failed,' \
- ' startup aborted'
- stop_boot true
+ ' startup continuing'
+ stop_boot false
;;
esac
$ uname -a
FreeBSD host.domain.com 8.2-STABLE FreeBSD 8.2-STABLE #0: Thu May 26
18:53:04 CEST 2011 root at host.domain.com:/usr/obj/usr/src/sys/TV amd64
[built from RELENG_8 as of a few days ago]
More information about the freebsd-stable
mailing list