Pfsense 2.0 NanoBSD on USB Thumbdrive workaround - Quick dirty fix



  • I've been taking a look at making pfsense 2.0 work off a thumbdrive install and managed to find some useful information on making FreeBSD 8.0 work.  A write to a thumbdrive will normally result in the GEOM not finding the bootable device.
    This is a quick dirty fix that works remarkably well and just what I needed - I was previously using the full install on a Western Digital Raptor 10K RPM drive (only reliable spare drive I had) that was toasting the mini-itx setup and needed to reduce the heat output and power consumption.

    Setup

    • Intel D201GLY2 motherboard

    • 1GB Kingston ValueRam DDR2-667

    • Toshiba 4GB thumbdrive

    • pfsense 2.0 Beta 4 i386 built on Mon Sep 27 05:13:14

    The main problem it seems, is that FreeBSD 8.x doesn't wait for the USB device to mount properly before attempting to boot.
    This is solved by entering the command prompt on the first boot by pressing any key and entering: set kern.cam.boot_delay=10000 (I used 15000 because 10000 fails once in a few boots)
    Then enter: boot
    In short, look at the screenshot:

    After this is done, the system waits long enough for the USB thumbdrive to mount and it will work just fine.  The problem comes back on reboots though.  So I edited /boot/loader.conf (through Diagnostics -> Edit File so that there is no need to muck around with read/ write permissions):

    Caveats:  This setting will not survive a firmware update and the steps above need to be repeated after a firmware update.  Also, if the config is restored (as I did) immediately after the initial config, the first step of entering the command prompt needs to be done one more time when pfsense automatically reboots.

    Hopefully, this will help anyone who wants to use a thumbdrive for pf2.0.  They are cheaper than the CF cards and adaptors in some parts of the world (a CF->SATA adaptor costs more than a 4GB SLC flash over on my side of the pond).  The Toshiba drive is a cheap unit that is slow and I eventually intend to swap it out for a Sandisk Ultra Backup (basically a Sandisk Contour in a plastic shell) which is one of the fastest available and it is cheap.


  • Rebel Alliance Developer Netgate

    Already a known issue… :-)

    http://redmine.pfsense.org/issues/495

    That setting may have to be used in loader.conf on the CD and elsewhere, or IIRC we can also set that in the kernel config.

    It would cause a longer boot time for everyone though.



  • Yep.  Didn't see it in a quick search through the forums though.  Took me jumping through a few hoops to find the solution through google and some FreeBSD boards.  Of course, it would increase the boot time but that beats not having a functional router.  ;D
    Would be nice enough if there's a way to just retain the loader.conf/ loader.conf.local upon upgrades.


  • Rebel Alliance Developer Netgate

    loader.conf.local should be left alone on 2.0 full installs, but not for NanoBSD since that would require extra action post-upgrade. (See here: http://redmine.pfsense.org/issues/892 )



  • Yeah.  I saw that too when searching for a way to 'retain' the loader.conf file.

    Out of curiosity, is there a way to not reboot automatically after a full restore of a config file?


  • Rebel Alliance Developer Netgate

    Not that I'm aware of without manually hacking the file to remove the reboot call.



  • Ok. Thanks a lot.


Log in to reply