(solved)Automatic Boot from USB harddrive



  • Hi everyone,

    Congratulation for all your nice job!!

    I'm not sure this the right place to post, so dear mods, feel free to move it wher it should be.

    I googled a lot but actualy do not find what i'm looking for (maybe because i'm a newbie).

    I installed PFSENSE BETA5 on a Usb HDD from a memory stick. everythings fine.

    Trouble:

    As you could imagine, if i installed PFsense on a removable device, this is because the flash memory on the computer is dead (i used a thin client computer).

    My trouble is that booting from USB is not automatic (default will always start from AD0 device which is supposed to be en embed media). So this means that actualy my device could not work as production (without keyboard, screen…and guy in front of it  :)).

    So i would like to modify the default boot menu option in order the default settings to be the USB harddrive.

    Please don't waste your time arguying about the USB device, when i say production, i mean a bench test production  ;). of course when we go to the full production we will selected a better computer.

    So, Could someone point me to the step by step howto modify the default boot sequence in order it start on USB dev as default?  ???

    (i'm totaly noob with freebsd :( )

    Regards



  • Are you talking about the BIOS boot menu, or the FreeBSD/pfSense one?



  • Hi,

    I'm not sure, but i guess this is PFsense/freebsd one.

    The one where it give you choice from starting on embed hard drive, or safe mode, or USB.

    I would like to modify the default value which start after 3 seconds, and that is actualy pointing to embed harddrive to USB.


  • Rebel Alliance Developer Netgate

    The boot menu option to boot from USB does not change the boot device, it just inserts a 10-second delay into the boot process to allow USB devices to be fully detected before proceeding.


  • Rebel Alliance Developer Netgate

    If it does work when using that option, but not when left alone, just make that setting permanent. It's described here:
    http://doc.pfsense.org/index.php/Boot_Troubleshooting

    Just need to add

    kern.cam.boot_delay=10000
    

    To /boot/loader.conf.local



  • Thanks for your help, but maybe i was not clear enough (please appologize if so)….

    when i said
    "I would like to modify the default value which start after 3 seconds, and that is actualy pointing to embed harddrive to USB."

    I do not want to modify the 3 secondes delay. I want to change the default boot...I want my device to boot automaticly on USB drive.

    I did not see any information on your url related to USB drive boot automaticly....I do not have /dev/ad0 or /dev/ad0s1
    on this device...I only have usb drive.

    regards


  • Rebel Alliance Developer Netgate

    Then perhaps there is some confusion here.

    What is not automatic? What exactly do you have to do manually to make it work?

    Does it start to boot and then stop at a mountroot> prompt?



  • Ok i will try to be as clear as possible….

    The device i used did not have hard disk nor flash memory.

    So i installed  pfsense on 40Go Usb hard drive with Usb memory stick.

    it works but i should be in front of the device with keyboard and screen each time i boot it up in order to selest the boot option (start from USB) in order it load pfsense. What i want it just that the device start directly from the usb hard drive it was installed without any human action.

    I guess i have to modify the bot up menu, but don't know where it is loacated and how to do so.


  • Rebel Alliance Developer Netgate

    Then – as I mentioned before -- make the loader.conf.local changes I suggested. That's what the menu option does, it adds that delay setting.



  • ok i will give it a try and come back for feed back.

    regards



  • I've actually been having the same issue but wanted to search the internet plenty before posting. Glad I waited.

    I have tried the above mentioned fix and it works. I am also using pfsense v2.0 beta 5 and the file on my box was actually /boot/loader.conf

    This file is empty by default and it is there specifically to add overrides to the default loader configuration.

    I am liking the idea of using pfsense to boot off of a flashdrive that is plugged directly to the motherboards usb header using an adapter. This way the flash drive will not get messed with, plus it's almost as good as a solid state drive because it will likely never go bad.

    Seems to me that pfsense loads most of what it does into memory so a slow usb flash drive should affect perf much should it? (besides swap of course)

    Also, will this file be preserved after an update?


  • Rebel Alliance Developer Netgate

    Don't touch loader.conf - use loader.conf.local - create it if it does not exist.

    loader.conf.local is not touched by the upgrade process, but loader.conf may be overwritten.



  • After a short check, it seems that what i'm looking for is not in loader.conf.

    I took a picture of the menu i would like to modify:

    I would like  menu "3 Boot PFsense Using USB device" to take place as "1 Bot Pfsense [default]". I did not find any mention on this subject in loader.conf.

    Coudl some one put light on this?

    Thanks


  • Rebel Alliance Developer Netgate

    You cannot change the default of the boot menu in that way.

    I'm not sure how many different ways I can tell you this in the same thread, but you need to edit /boot/loader.conf.local and add

    kern.cam.boot_delay=10000
    

    It does not already exist there, you need to add it, not edit the value.

    The boot menu option only sets that variable. Adding it to loader.conf.local sets the value the same way.



  • @jimp:

    You cannot change the default of the boot menu in that way.

    I'm not sure how many different ways I can tell you this in the same thread, but you need to edit /boot/loader.conf.local and add

    kern.cam.boot_delay=10000
    

    It does not already exist there, you need to add it, not edit the value.

    The boot menu option only sets that variable. Adding it to loader.conf.local sets the value the same way.

    You could repeat it as long as you want, it doesn't work at all. Same result! If i'm not in front of the computer and select option 3 from the menu, PFsense did not boot up and just comes to prompt waiting for me to give instruction.

    Delay is not what i'm waiting for…How could i explain you this. I want the device to start on USB hard drive (where Pfsense is installed) even if i do not have keyboard nor screen. If it is not possible just say it.


  • Rebel Alliance Developer Netgate

    But I'm telling you that all option 3 does it set precisely that variable and nothing else related to bootup. It sets two others but they are related to network cards, not booting. Behold:

    From our beastie.4th patch that drives the menu:

    +		dup bootusbkey @ = if
    +			s" 0" s" hw.mca.enabled" setenv
    +			s" 0" s" hw.bce.tso_enable" setenv
    +			s" 10000" s" kern.cam.boot_delay" setenv
    
    

    So if you want to try adding the other two to /boot/loader.conf.local as well, try:

    hw.mca.enabled=0
    hw.bce.tso_enable=0
    kern.cam.boot_delay=10000
    

    Make sure when you edit that file that it's named properly (all lower case letters) and you probably should edit it from the shell with vi or ee to be safest.



  • morocon-

    Have you even tried adding these options to the file yet? If you try it you may be pleasantly surprised that it works just as jimp has been telling you.

    Sorry for causing the confusion with the loader.conf.local file. Didn't realize I had to create it. I have just tested it and it works great.

    Thank you!



  • Yes i have tried! but it did not boot on USB drive

    here is my beastie start section, i suspect something wrong in it

    
    : beastie-start
    	s" beastie_disable" getenv
    	dup -1 <> if
    		s" YES" compare-insensitive 0= if
    			exit
    		then
    	else
    		drop
    	then
    	beastie-menu
    	s" autoboot_delay" getenv
    	dup -1 = if
    		drop
    		10
    	else
    		0 0 2swap >number drop drop drop
    	then
    	begin
    		dup tkey
    		0 25 at-xy
    		dup 32 = if nip 0 swap then
    		dup -1 = if 0 boot then
    		dup 13 = if 0 boot then
    		dup bootkey @ = if 0 boot then
    		dup bootacpikey @ = if
    			acpienabled? if
    				s" acpi_load" unsetenv
    				s" 1" s" hint.acpi.0.disabled" setenv
    				s" 1" s" loader.acpi_disabled_by_user" setenv
    				s" 0" s" hw.mca.enabled" setenv
    				s" 0" s" hw.bce.tso_enable" setenv
    			else
    				s" YES" s" acpi_load" setenv
    				s" 0" s" hint.acpi.0.disabled" setenv
                                    s" 0" s" hw.mca.enabled" setenv
                                    s" 0" s" hw.bce.tso_enable" setenv
    			then
    			0 boot
    		then
    		dup bootsafekey @ = if
    			s" arch-i386" environment? if
    				drop
    				s" acpi_load" unsetenv
    				s" 1" s" hint.acpi.0.disabled" setenv
    				s" 1" s" loader.acpi_disabled_by_user" setenv
    				s" 1" s" hint.apic.0.disabled" setenv
                                    s" 0" s" hw.mca.enabled" setenv
                                    s" 0" s" hw.bce.tso_enable" setenv
    			then
    			s" 0" s" hw.ata.ata_dma" setenv
    			s" 0" s" hw.ata.atapi_dma" setenv
    			s" 0" s" hw.ata.wc" setenv
    			s" 0" s" hw.eisa_slots" setenv
    			s" 1" s" hint.kbdmux.0.disabled" setenv
    			s" 0" s" hw.mca.enabled" setenv
    			s" 0" s" hw.bce.tso_enable" setenv
    			0 boot
    		then
    		dup bootusbkey @ = if
    			s" 0" s" hw.mca.enabled" setenv
    			s" 0" s" hw.bce.tso_enable" setenv
    			s" 10000" s" kern.cam.boot_delay" setenv
    			0 boot
    		then
    		dup bootverbosekey @ = if
    			s" 0" s" hw.mca.enabled" setenv
    			s" 0" s" hw.bce.tso_enable" setenv
    			s" YES" s" boot_verbose" setenv
    			0 boot
    		then
    		dup bootsinglekey @ = if
    			s" 0" s" hw.mca.enabled" setenv
    			s" 0" s" hw.bce.tso_enable" setenv
    			s" YES" s" boot_single" setenv
    			0 boot
    		then
    		dup escapekey @ = if
    			2drop
    			s" NO" s" autoboot_delay" setenv
    			exit
    		then
    		rebootkey @ = if 0 reboot then
    	again
    ;
    
    previous
    

    I'm not confident with freebsd bash coding, but i suposed somewhere at the beginning of this section is defined what dup menu will be loaded as default. I would like ti to be bootusbkey. Unfortunatly, and even with modification you recommended, it doesn't start, but just come to a prompt that talk about vfs.mountfrom.options whish should have been set to read write.


  • Rebel Alliance Developer Netgate

    Nothing is wrong with that. As you can see the section I posted is within the part you posted (mine just had the +'s because it was from a patch file not the actual file, and I trimmed the surrounding irrelevant text).

    If the menu option worked but adding it to loader.conf.local does not, then you must not be putting the right values into loader.conf.local or the file isn't in the right place, or something else must be wrong.

    Further, you need to give exact precise error messages and not "a prompt that talk about vfs.mountfrom.options". Take a cell phone picture of the screen if you have to, but be precise.




  • Rebel Alliance Developer Netgate

    Sure that's the right URL?

    Host pfsensepict.dyndns.org not found: 3(NXDOMAIN)
    


  • oops, try again, it should be working now that i activated it! :)


  • Rebel Alliance Developer Netgate

    Remove this from /boot/loader.conf and /boot/loader.conf.local

    autoboot_delay="3"
    

    It probably is ignoring the other lines because it says there is a syntax error on that line.



  • Thaanks, do you have a sample of how it should be written?


  • Rebel Alliance Developer Netgate

    /boot/loader.conf should probably be empty.

    And if you want to mimic option 3 exactly, /boot/loader.conf.local should only contain:

    hw.mca.enabled=0
    hw.bce.tso_enable=0
    kern.cam.boot_delay=10000
    

    Nothing else.



  • @jimp:

    /boot/loader.conf should probably be empty.

    And if you want to mimic option 3 exactly, /boot/loader.conf.local should only contain:

    hw.mca.enabled=0
    hw.bce.tso_enable=0
    kern.cam.boot_delay=10000
    

    Nothing else.

    Ok i will do so.

    I found a file call loader.conf (<>loader.conf.local)where the " autoboot_delay="3" " is writen, what should i do with this one?


  • Rebel Alliance Developer Netgate

    Remove it from both files.



  • @jimp:

    Remove it from both files.

    You are the hitman jimp!

    Ok i guess there was some thing wrong in my usb drive, so i decided to start from scrash and re-install f sense on it.

    Then i create the file /boot/loader.conf/local (as you recommended it) including

    hw.mca.enabled=0
    hw.bce.tso_enable=0
    kern.cam.boot_delay=10000
    

    Then reboot, then….Miracle! It works!!

    Thanks guys



  • Same situation here. I'm using a 2,5 inch USB disk drive for my pfSense server. I needed to press 3 in the pfSense boot menu to get it to work. Using the steps outlined in this forum topic I was able to have it boot using USB support automatically. I have put the easy steps together in a tutorial at http://www.zomers.eu/knowledge/pfSense/Pages/Configure-pfSense-2.0-RC1-to-boot-from-USB-disk.aspx



  • Awesome .  thanks for the help.


Log in to reply