Deployment and Imaging Group

 View Only
  • 1.  Netboot (OSX) name being sent to clients is always netboot001

    Posted Nov 04, 2014 06:56 PM

    Soooo looooong story short there are some tweaks that can be made to the rc.netboot file in the /etc folder of the netboot.dmg file in the netboot folder on the deployment server.    THrough a lot of testing I've modified the do_init() function with the following tasks to prove where the naming of the netboot image comes from. 

        # set the ComputerName based on what the NetBoot server told us it was
        machine_name=$(ipconfig netbootoption machine_name 2>&1)
        if [ $? -ne 0 ]; then
            echo "no machine name option available" > /opt/err.txt
        else
            echo "Setting ComputerName to ${machine_name}" > /opt/err.txt
            scutil --set ComputerName "${machine_name}"
        fi
        cd /opt

    When I do that I always get the line Setting ComputerName to netboot001 (Now OSX will change this to "netboot001 (2)", "netboot001 (3)"... later in the process, but at this point in the boot process it's proof of the name I believe.)   Now having this improper name during boot can be problematic.  I am in the process of changing the name post boot, but ideally I would like the netboot server to hand out the correct name to begin with.   Since the communication is already there all I have to do is catch whatever it is on the deployment server that generates that name and throw a query before it pushes it down the pipe.   If anyone has any information on what pushes that down I'd love to know and will share the resulting modifications if it helps ayone.  

    Thanks!  I tihnk having this will make imaging and many other tasks much more functional (Won't change the name of the computer in the manager etc...)



  • 2.  RE: Netboot (OSX) name being sent to clients is always netboot001

    Posted Nov 04, 2014 07:41 PM

    Something that helped me with our environment was changing where the agent grabbed its computer name, I changed the setting to DNS rather then local computer name values.  I quoted something I found just searching the forums quickly tonight, not sure if that helps at all.  I know there was an actual KB article that reference this but can't seem to find it currently.

    Interested to see what you find going this route, please keep posting your findings.

     

    Settings that determine if we use the local computer values or DNS values are found in the NS console at Settings, All Settings, Agents/Plug-ins, Symantec Management Agent, Settings, Symantec Management Agent Settings - Targeted, then select the appropriate filter, Click on the 'UNIX/Linux/Mac' then check the 'Computer information' section. 

    Try adjusting those targeted settings. Reply if things still don't match up. If needed, please consider creating a support case.



  • 3.  RE: Netboot (OSX) name being sent to clients is always netboot001

    Posted Nov 05, 2014 05:02 AM

    AFAIK, The hostname is actually set by PXE Server (Symantec Boot Server) during NetBoot.



  • 4.  RE: Netboot (OSX) name being sent to clients is always netboot001

    Posted Nov 05, 2014 09:24 AM

    Yes.  With the depth of the Symantec products I'm not quite sure what level of the product to address.  I am aware that the netbood service created the BSDP packets and encapsulated in that BSDP handshake at a certain point the name field is sent down stream and then the netboot.rc scripts catches that.  My mission is to find what in Symantec's netboot service actually send that information down.  I have looked through the automatically generated config files, I have looked at the netboot DLL in the SBS folder (Can't recall the name of the file now) but I'm not sure what in generating thenetboot001 name.  Since it does not aut increment I am assuming it is hardcoded somewhere, but if I can get the service to send a variable/token/query instead then we could really start to use this product on thousands of Mac we have.  

    Apple docmentation states that OSX Server supports a having a text file with mac address and computer name in a certain folder (does not say what folder, or the name of the file that I have found) so if I could get netboot server to auto gnerate this file, that might work, if the netboot server supports the text file override written into the "protocol".    So far I have not seen documentation on if that is the case or not and have not been able to build a sample text file on OSX server to transport to a Symantec netboot server to test with.  Or if the server did I couldn't fin the file!



  • 5.  RE: Netboot (OSX) name being sent to clients is always netboot001

    Posted Nov 05, 2014 02:55 PM

    Thank you for the information.

    I am not sure if its possible to override hostname information being assigned to NetBooted machines currently.

     



  • 6.  RE: Netboot (OSX) name being sent to clients is always netboot001

    Posted Nov 15, 2014 01:05 PM

    I have some updates on this:  I was able to get the right name from the start by inserting this into the rc.netboot file in the portion originally specified.   Then on the web server I will show the core of the code for that end too:

        # Get the System S/N using the quicker method than systemprofiler

        machine_sn=`ioreg -l | grep IOPlatformSerialNumber | awk '{print $4}'`

        machine_sn=${machine_sn:1:12}

     

        # do NOT query the ComputerName based on what the NetBoot server told us it was

        ##machine_name=$(ipconfig netbootoption machine_name 2>&1)

        #  No machine name from netboot server, trying HTTP request to workflow

        machine_name=`curl -F "machine_sn=$machine_sn" http://###.###.###.###/ComputerName/`

     

        ## Test to make sure name is not blank

        if [ -z "$machine_name" ]

        then

            ##  This is a empty string

       scutil --set LocalHostName "INVALID_NAME"

       scutil --set ComputerName "$INVALID_NAME"

       scutil --set HostName "$INVALID_NAME"

        else

            ## Name from the CURL command

       scutil --set LocalHostName "$machine_name"

       scutil --set ComputerName "$machine_name"

       scutil --set HostName "$machine_name"

        fi

     

    Then at that URL (Keep in mind the CURL command is using IP address on purpose as DNS services are not running at this point of the boot process).  On that server is a simple PHP set of pages with code similar to below.   This code currently just get's the machine name for our 6.9 database, but I will be adding to it next week to pull from the 7.5 DB and another proprietary DB.  

     

    so the PHP at the url ComputerName in index.php looks like this (this is thanks to a colleage of mine who worked up this part of code.)  Keep in mind you will need the db.php page in the same folder with the connection string.

    <?php
    require_once 'db.php';

    dbOpen();

    if ( isset( $_POST['machine_sn'] ) && ! empty( $_POST['machine_sn'] ) ) {
        $tsql = "select computer.computer_name, computer.serial_num from computer where computer.serial_num = ?";
        $params = array( $_POST['machine_sn'] );
        $result = dbQ( $tsql, $params );
        if ( $result !== false ) {
            $numrows = sqlsrv_num_rows( $result );
            if ( $numrows !== false ) {
                if ( $row = sqlsrv_fetch_object( $result ) ) {
                    echo $row->computer_name;
                }
            } else {
                echo "No computer found with that SN";
            }
            sqlsrv_free_stmt( $result );
        } else {
            echo "error";
        }
    } else {
        echo "error";
    }

    dbClose();
    ?>

     

    I'll let you know more when I work the PHP to query mutiple databases.  So far I've only tried in on one netboot image that I manually modified.  Currently loading another one going the symantec way all the way through rather than a manual modification of the DMG. 



  • 7.  RE: Netboot (OSX) name being sent to clients is always netboot001

    Posted Dec 03, 2014 03:16 PM

    ended up modifying the PHP to throw in a static name if the DS has a blank name:

     

            if ( $numrows !== false ) {
                if ( $row = sqlsrv_fetch_object( $result ) ) {
                    if ( empty( $row->computer_name ) ) {
                        echo "bad_name";
                    } else {
                        echo $row->computer_name;
                    }
                }