KPXE Exit to USB Boot



  • How do I enable boot to USB after the PXE Boot screen?

    Bios is setup to boot to the USB Stick.
    I have about 30 Wyse terminals that are being reprovisioned as Ubuntu machines (running off USB).

    The problem is even though the Primary boot is set to /dev/sdb
    After PXE the Wyse OS is started (/dev/sda).
    I need to setup so that PXE Exits to secondary hard drive.

    The Post here: https://forums.fogproject.org/topic/7113/make-customized-option-as-default-on-boot-menu/13

    Does exactly what I need it to do.



  • OK I will check that out first before marking as solved… just incase someone else wants to do the same thing. This company is to damn cheap to get new 100 dollar machines to replace the 30 thin clients… BAUGH… yes I agree its not the norm but I know Fog can do it… It can do anything :-)


  • Developer

    @sourceminer There is a GRUB4DOS (that’s what it actually is, so it’s not a full blown official GRUB binary) command called fallback. Description reads like that:

    Go into unattended boot mode: if the default boot entry has any errors,
    instead of waiting for the user to do anything, it immediately starts
    over using the NUM entry (same numbering as the ‘default’ command).
    This obviously won’t help if the machine was rebooted by a kernel that
    GRUB loaded.

    I myself haven’t tried that yet. You might give it a go. Though I am not sure how the numbers are for how we use GRUB4DOS on the command line rather than a real config file.



  • @Sebastian-Roth is there any way to have the GRUB Try to boot to hd0 and if it fails boot to hd1?


  • Developer

    @sourceminer Let me know if you’re fine with me marking this solved…


  • Developer

    @sourceminer Good to hear that you found a workaround. You could even make that the default on boot but that’s up to you.

    In any case I would look into what I wrote about web root directory and link as I have a feeling that something could be wrong on your server. Might cause you a head ace at some point in time. It’s really wired that you’d upload a changed file via WinSCP and the change does not show up on page reload.



  • @Sebastian-Roth we must have posted at the same time. Along the same lines I did the same thing with a menu item. See above your post.


  • Developer

    @sourceminer I just changed that file /var/www/fog/lib/fog/bootmenu.class.php (line 134) on my RC10 server, saved change, reloaded the page in the browser and sure see the change. So there is something wrong on your side. Possibly there are still other versions of FOG in the web root directory. Run this command to check (withou the shell>):

    shell> find /var/www/ -name "bootmenu.class.php"
    /var/www/html/fog/lib/fog/bootmenu.class.php
    

    See there usually is a link /var/www/fog pointing to /var/www/html/fog - this is for kind of historical and compatibility reasons. Check it out to see if you have a proper link:

    shell> ls -al /var/www/
    total 4
    drwxr-xr-x.  4 root root   44 Nov 11 19:48 .
    drwxr-xr-x. 21 root root 4096 Nov 11 19:43 ..
    drwxr-xr-x.  2 root root    6 Oct 19 22:39 cgi-bin
    lrwxrwxrwx.  1 root root   18 Nov 11 19:48 fog -> /var/www/html/fog/
    drwxr-xr-x.  3 root root   17 Nov 11 19:46 html
    

    As well I wanted to point out that in the old post you are referring to in your initial post I actually used a GRUB command map ... as well. You might want to play with that as well to possibly make it work: rootnoverify (hd1);map (hd1) (hd0);chainloader (hd1)+1



  • OK so I have managed to find something that works, still however this requires manual intervention otherwise the machine will not boot unless you select the item from the menu. Im not familiar enough with GRUB to know if you can Attempt to boot to HD0 but if its unavailable go to HD1…

    Here is what I have done:

    Created a PXE Menu fog.usbboot
    Parameters:
    chain -ar http://${fog-ip}/${fog-webroot}/service/ipxe/grub.exe --config-file=“rootnoverify (hd1);map (hd1) (hd0);chainloader (hd1)+1” || MENU

    0_1512769694716_2017-12-08_12-52-05.png

    It is not set as default and displays for all hosts.

    This allows the PXE to see the disk as hd1
    0_1512769804682_2017-12-08_12-31-40.png



  • Thank you

    Interesting that the file downloading from the server is different from the one I edited… (EDITED: Realized that I didnt register this test device yet, Registered and added to the same group as the other WYSE terminals). Since doing this still I see that the default boot will go to hd0. When does Exit to Grub_First_HDD take into effect?
    Where is that file located to edit the first boot disk to hd1?

    As @george1421 suspected did the bootmenu.class file change location in RC10?

    0_1512763785694_2017-12-08_12-09-07.png

    0_1512754153738_2017-12-08_09-24-29.png


  • Developer

    @sourceminer As I said, we are more to happy to help you. So I’ll just ask my questions again: Can you please post a picture of the changed code as well as open the following URL in your browser - http://x.x.x.x/fog/service/ipxe/boot.php?mac=yy:yy:yy:yy:yy:yy (but substitute x.x.x.x with your FOG server IP and yy:yy:yy:yy:yy:yy with a MAC addresses of one of your clients) - and post the full text here.



  • Totally understand the position of not being musical… I was simply asking if it was doable. I mean if you already have the option to set the option for primary disk wouldn’t you potentially want to add that disk as the exit boot to as well? Just a thought. Also I appreciate help from everyone especially @george1421 and love thinking out of the box, however as seen in my responses, i was answering questions but they seemed to have been disregarded. So I apologize if my annoyance offended others.

    I had posted this as well due to someone suggesting posting again as I re-opened an older topic (as another person wanted to do this as well as yourself) the solution honestly fits perfect for this.

    So with all that said. It was a long night. We we ended up placing the boot order to usb then pxe.
    This allowed us to image then boot. However it will not allow us to remotely image again due to the issue of not booting to the usb after pxe.

    Interestingly there were 2 newer models of these Wyse terminals that when set to boot from usb after pxe in the bios they worked (as we would usually expect) also we had to change the primary disk back to /dev/sda. The older ones just didn’t work the same for whatever reason.


  • Developer

    @sourceminer said in KPXE Exit to USB Boot:

    Would like to see an EXIT option for alternate hard disk.

    Quite frankly… this is not a musical request programme! FOG is an open source project and its people (!) are doing all this just for the fun of it. George hast offered his ideas and quite some time over the last hours trying to open your mind to other solutions than booting off that USB stick as a second hard drive. If you wanna stick to it that’s fine. And we still try to give you a hand with that. But it’s got no priority on our list whatsoever! Hardly anyone is using FOG this way and doing that heavily depends on BIOS firmware playing nicely. So it might work but won’t promise it does.

    That said, I have done booting off a second drive years ago and it worked for me on some machines but not all. So keep that in mind.

    OK so the file: /var/www/fog/lib/fog/bootmenu.class.php
    I have changed line 134 to include hd1
    Doesn’t seem to work.

    Seems like you’re looking at the right spot. Can you please post a picture of the changed code as well as open the following URL in your browser - http://x.x.x.x/fog/service/ipxe/boot.php?mac=yy:yy:yy:yy:yy:yy (but substitute x.x.x.x with your FOG server IP and yy:yy:yy:yy:yy:yy with a MAC addresses of one of your clients) - and post the full text here.



  • Well I guess for now I will just tell people to hit ESC when they see the PXE boot so that the units will boot up for now. Would like to see an EXIT option for alternate hard disk.



  • OK so the file: /var/www/fog/lib/fog/bootmenu.class.php
    I have changed line 134 to include hd1
    Doesn’t seem to work.

    0_1512699116208_2017-12-07_18-09-03.png


  • Moderator

    @sourceminer Whelp then the developers removed the file then. Just modify the other one, the bootmenu.class.php.



  • Running Version 1.5.0-RC-10
    SVN Revision: 6080
    Dec 08, 2017 1:53 am


  • Moderator

    @sourceminer What version of FOG are you using?



  • @george1421 said in KPXE Exit to USB Boot:

    grep -R -e “rootnoverify (hd0);chainloader” *

    there is no ipxemenu.class.php
    0_1512697810693_2017-12-07_17-49-22.png


  • Moderator

    @sourceminer said in KPXE Exit to USB Boot:

    Im not seeing an ipxemenu.class.php

    Here are the exact path of these files on my FOG 1.4.4 server.

    /var/www/html/fog/lib/fog/bootmenu.class.php
    /var/www/html/fog/lib/pages/ipxemenu.class.php

    This is how I found the files.

    cd /var/www/html/fog 
    
    grep -R -e "rootnoverify (hd0);chainloader" *
    

Log in to reply
 

385
Online

39.4k
Users

11.1k
Topics

105.3k
Posts

Looks like your connection to FOG Project was lost, please wait while we try to reconnect.