Date: Thu, 14 Apr 2011 05:55:53 +1000 From: Peter Jeremy <peterjeremy@acm.org> To: freebsd-net@freebsd.org Subject: Re: Diskless booting issues Message-ID: <20110413195553.GA6773@server.vk2pj.dyndns.org> In-Reply-To: <20110410211012.GA82480@server.vk2pj.dyndns.org> References: <20110410211012.GA82480@server.vk2pj.dyndns.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--PmA2V3Z32TCmWXqI Content-Type: multipart/mixed; boundary="ZGiS0Q5IWpPtfppv" Content-Disposition: inline --ZGiS0Q5IWpPtfppv Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable I've managed to resolve one of the problems I raised. On 2011-Apr-11 07:10:12 +1000, Peter Jeremy <peterjeremy@acm.org> wrote: >For various reasons, I occasionally boot my netbook as a diskless >client of my main server (this is a quick/easy way to test upgrades >without needing to install them). Since I got a query about this, this is "diskless" in the old Sun diskless workstation sense - the filesystem is mounted RW so the netbook behaves normally except that the filesystem is remote rather than the local SSD. This is different to the approach assumed by /etc/rc.initdiskless where the remote filesystem is RO with some magic directory trees that are copied to a local RW ramdisk. >First problem: If it loses network connectivity (ie, I unplug the >network cable) for more than a minute or so, it seems to lockup and >need a hard reboot, even if the network is restored. I haven't gotten anywhere with this. >Second problem: When running on the local SSD, I have lagg setup so >it seamlessly switches between wired and wifi (this is really nice). >Partially to resolve the above and partially to improve portability, >I'd like to do the same when running diskless but can't work out how >to make it work. > >The relevant bits of my native rc.conf look like: > ifconfig_re0=3D"up" > ifconfig_ath0=3D"ether XX:XX:XX:XX:XX:XX" > wlans_ath0=3D"wlan0" > ifconfig_wlan0=3D"WPA" > cloned_interfaces=3D"lagg0" > ifconfig_lagg0=3D"SYNCDHCP laggproto failover laggport re0 laggport wlan0" > >Gluing this in the diskless rc.conf gives me a hang during startup, as >does changing 'SYNCDHCP' to 'inet MYHOST' and adding 'up'. Turns out that > ifconfig lagg0 inet MYHOST laggproto failover laggport re0 laggport wlan= 0 up results in MYHOST existing on both re0 and lagg0 and this causes the network to completely stop - even if you later remove one of the IP addresses. You need to remove the IP address from re0 before adding it to lagg0. This presents a bit of a catch-22 since once I remove the IP address from re0, I no longer have access to a filesystem to run an ifconfig to add the IP adddress to lagg0. My solution was to use a temporary ramdisk to hold a statically-linked copy of ifconfig in a new rc.d script (see attached) to handle moving the IP address from re0 to lagg0 and then let the existing netif handle the wifi side with te following rc.conf entries (cf above): ifconfig_ath0=3D"ether XX:XX:XX:XX:XX:XX" wlans_ath0=3D"wlan0" ifconfig_wlan0=3D"WPA" ifconfig_lagg0=3D"laggport wlan0" --=20 Peter Jeremy --ZGiS0Q5IWpPtfppv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=lagg #!/bin/sh # # Create lagg0 if necessary and flip current IP address from re0 to lagg0 # PROVIDE: lagg # REQUIRE: FILESYSTEMS # BEFORE: netif # KEYWORD: nojail . /etc/rc.subr . /etc/network.subr name="lagg" start_cmd="lagg_start" stop_cmd=":" cmdifn= : ${lagg_phys:=re0} : ${lagg_dev:=lagg0} : ${lagg_tmp:=/mnt} lagg_start() { # Ensure that the lagg device exists ifexists "$lagg_dev" || ifconfig "$lagg_dev" create # Create a ramdisk to temporarily hold a copy of ifconfig md_dev=$(/sbin/mdconfig -a -t swap -s 8m) mdmfs -S -s 8m -o async $md_dev "$lagg_tmp" # Copy /rescue (because it's statically linked) tar -cf - -C /rescue . | tar -xf - -C "$lagg_tmp" ### Actually flip the interface # Wanted IP address addr=$(/mnt/ifconfig "$lagg_phys" | grep 'inet ') # Delete address from existing interface /mnt/ifconfig "$lagg_phys" delete # Setup new interface /mnt/ifconfig "$lagg_dev" $addr laggport "$lagg_phys" up # Unwind ramdisk umount /mnt mdconfig -d -u ${md_dev#md} } load_rc_config $name run_rc_command "$@" --ZGiS0Q5IWpPtfppv-- --PmA2V3Z32TCmWXqI Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (FreeBSD) iEYEARECAAYFAk2l/8kACgkQ/opHv/APuIcULwCfQNFMbVTbmddOhQj20YS72iI7 1R4AmwVzQz4azeA/XfMPfQC4VWK09BWH =Tt0e -----END PGP SIGNATURE----- --PmA2V3Z32TCmWXqI--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110413195553.GA6773>