fog.drivers script will not run correctly in postdownloadscripts



  • @Quazz I did not, no. I think I found the /fog reference though and might be our problem.

    I think it might be my postdownload script itself.

    #!/bin/sh
    ## This file serves as a starting point to call your custom postimaging scripts.
    ## <SCRIPTNAME> should be changed to the script you're planning to use.
    ## Syntax of post download scripts are
    #. ${postdownpath}<SCRIPTNAME>
    
    if [ $osid == "5" -o $osid == "6" -o $osid == "7" ]; then #only handling Win7/8/8.1
        clearScreen;
        mkdir /ntfs &>/dev/null
        ntfs-3g -o force,rw $part /ntfs #mount image (remember this is mounting partition [U][B]after[/B][/U] new image is deployed)
        mkdir /fog &>/dev/null
        mount -o nolock,proto=tcp $storageip:/fog/ /fog #this is a share created on server under /fog which contains drivers, software etc.. (just add /fog to exports but you could use existing location i.e. /images and if you do, do not ne$
        dots "Mounting Device";
        if [ "$?" = "0" ]; then
            echo "Done";
            . ${postdownpath}fog.drivers # run fog.drivers script
            umount /ntfs; # unmount when all is done :-)
        else
            echo "Failed To Mount Device";
            sleep 30;
        fi
    fi
    

    @Wayne-Workman I removed it and am testing it now.



  • @THEMCV Remove the >/dev/null 2>&1 part from that command in the script, the one that looks like this:
    rsync -aqz "$remotedriverpath" "$clientdriverpath" >/dev/null 2>&1

    Then we will be able to see an actual error.


  • Moderator

    @THEMCV Did you edit the fog.drivers you got from Tom?

    Because the default version would mount /images/drivers



  • the /fog mount error has disappeared from the process now @Quazz , but the same “Failed to download driver information”


  • Moderator

    @THEMCV Alright, well, I just realized none of this makes sense!

    You are correct, the fog folder isn’t referenced anywhere.

    I’m guessing the issue is REALLY in your /images/postdownloadscipts/fog.drivers



  • @george1421 I really am not sure. I don’t see anything in the script that refers to /fog except in the notation. I added the folder and copied the drivers into there from /images/drivers and am testing it now.



  • @Quazz Okay, I completed this and it’s finished. showmount --exports does show /fog is working. And I added in the drivers that I had in the other location.


  • Moderator

    @THEMCV OK, I understand you may be getting conflicting information here because we are coming at the same problem from different perspectives.

    In my scripts I have the drivers (on the fog server) in /images/drivers …
    That is what the scripts should be trying to mount. You can use /fog/drivers but you will need to setup an export in NFS to do that. Me being lazy I just used the /images share that was already there.

    Looking at the script from Lee’s page this is the line in question

    remotedriverpath="/images/drivers/$osn/$machine"
    

    In this case its saying the drivers are in /images/drivers/… on the fog server. Where is /fog/drivers coming from?


  • Moderator

    @THEMCV The fog directory does not exist by default, it must be manually created, given correct permissions and an entry in /etc/exports needs to be made to export it as a nfs share so it can be mounted on clients.

    mkdir /fog
    chmod 777 /fog
    chown fog:fog /fog
    nano /etc/exports
    
    add this line add the bottom:
    
    /fog *(ro,sync,no_wdelay,subtree_check,insecure_locks,no_root_squash,insecure,fsid=2
    
    then finally do the following command to export the directory:
    
    exportfs -a
    
    Check if it it is being exported with:
    
    showmount --exports
    
    

    Use sudo if necesary

    Do note that you still need to create diretories and add drivers yourself.



  • @george1421 Just so I’m understanding, so the /fog directory should or should not exist? And if it does it is because of the script?



  • @Quazz The IP is correct. I must have gotten things turned around looking at the Auto install script on the FOG wiki.

    So I need to make a fog directory in root like this, correct?

    /fog/Drivers/Win7/OptiPlex 980/x64
    

  • Moderator

    @Quazz That is what I was just trying to reverse engineer. Where did the /fog directory come from? The only nfs share is /images.

    The info that is missing here is that I the mount isn’t happening in this script but in the fog postdownload script from here: https://forums.fogproject.org/topic/4278/utilizing-postscripts-rename-joindomain-drivers-snapins/29

    [edit] Side note, I found that my post install scripts fail when deploying to NVMe disks since the disk structure is different. I was looking at merging some of the code magic Tom created into my scripts too.


  • Moderator

    Am I going crazy or is this a simple issue with the fog server not mounting on the client?

    mount: mounting 10.4.200.150:/fog/ on /fog failed: permission denied
    

    Is the IP correct? Does the /fog folder exist?



  • @Tom-Elliott It was /Drivers/ and not /drivers/ but I changed to /drivers/. Same issue.

    When I was looking over the code I misread and thought I saw a reference to /Drivers, so that’s on me.


  • Senior Developer

    @THEMCV Is it /images/drivers/Win7/OptiPlex 980/x64 or is it /images/Drivers/Win7/OptiPlex 980/x64

    (Notice the D in drivers is capitalized).



  • @Wayne-Workman Okay, got it.

    mount: mounting 10.4.200.150:/fog/ on /fog failed: permission denied
       * Mounting Device...................................................................Done
       * Preparing Drivers..................................................................In progress
    rsync -aqz "/images/drivers/Win7/OptiPlex 980" "/ntfs/Windows/DRV"
    

    Then

    Failed to download driver information
    

    It definitely sat on Preparing Drivers much longer than before, but the same outcome.

    I confirmed the directory is /images/drivers/Win7/OptiPlex 980/x64



  • @THEMCV It’s failing on this line:

    rsync -aqz "$remotedriverpath" "$clientdriverpath" >/dev/null 2>&1
    

    SO, just before that, for troubleshooting purposes, echo out the command it’s running like:

    echo
    echo "rsync -aqz \"$remotedriverpath\" \"$clientdriverpath\""
    echo
    

    Put those three lines one line above the problem line, exactly as I typed it. It will echo out the actual command being run. Then, run the script. The command will get echoed out and look proper. Examine it, copy it, and try to run the command by itself and see what happens.



  • @Tom-Elliott I downloaded that and we’re definitely farther! No more parsing errors, so that’s amazing. Thank you! 🙂

    Now it’s telling me

    mount: mounting 10.4.200.150:/fog/ on /fog failed: permission denied
       * Mounting Device...................................................................Done
       * Preparing Drivers..................................................................In progress
    

    Then it tells me an error has been detected

    Failed to download driver information
    

    So I double checked my directory which is: /images/Drivers/Win7/OptiPlex 980/x64

    I’m using extracted CAB drivers for now, but might switch/try just CAB files. They seem to be in place where they should be.

    Thank you Tom.


  • Senior Developer

    @THEMCV Please try this:

    wget -O /images/postdownloadscripts/fog.drivers http://mastacontrola.com/fog.drivers

    –Fixed.
    Wayne


  • Senior Developer

    @george1421 It’s got nothing to do with the if or not. It’s because (and I’m just guessing) he literally copied and pasted the code.

    Right now the code braces are stripping spaces.

    So he is literally having his file with: [[-z $machine]] rather than [[_-z $machine_]] (replacing the _ with actual spaces.


Log in to reply
 

388
Online

7.5k
Users

14.6k
Topics

137.5k
Posts