Problems with Image and first run scripts

mike_pinto
New Contributor III

Hey all, I apologize in advance if this has already been addressed, but I looked and could not find anything. We're having problems with our images holding our wireless settings (preferred SSID). I've tried baking them into the image and also using a script at first run (works when executed manually).

For some reason it's not executing any of our scripts at first run (logs prove this to be the case). We're new to the Casper suite so I'd assume we've done something wrong.

Here is the process we took when creating our image(s):

  1. Started with clean install on a MacBook Air
  2. Made a few changes (root, remote management, joined wifi, etc)
  3. Used Composer to build OS Package
  4. Made a configuration profile with the OS Package

Anything wrong with this process? Is there any reason why it would not hold our wireless settings? We've tried this with both 10.7.5 and 10.8.4 on a MacBook Pro and Air. I've never had this problem in the past. I do see our network under preferred networks, but it will not connect automatically and still requires authentication to do so.

Any help would be greatly appreciated,
Thanks!

1 ACCEPTED SOLUTION

stevewood
Honored Contributor II
Honored Contributor II

How are you calling the scripts? Are they in one post image script that is set to run at reboot? Or are you trying to call each script individually?

I use thin imaging here, laying down only apps and scripts over the factory OS, so I do not bake in any settings or apps. As part of the imaging process I have a package named PostImage.pkg that drops a LaunchDaemon and a script on the system. After Casper reboots the machine, the launchd kicks off my postimage script that handles things like editing /etc/authorization, setting power management, scroll bars, and running SoftwareUpdate. It deletes itself at the end and reboots the machine.

Since moving to this method, I've had no problems with scripts running.

View solution in original post

12 REPLIES 12

ahambidge
New Contributor II

Have you checked the permissions on the script(s)? I've been capturing some User Experience stuff in Composer and noticed that it will retain the permissions of whatever files you capture; so if you're using the Fill User Templates option on Desktop Pattern, it'll keep the owner/group & permissions from the account you pulled the plist from and put that in your User Template folder.

This may not be 100% applicable to what you're doing, but it's an idea.

Chris_Hafner
Valued Contributor II

I won't comment on the validity of how you're handling it currently (other than saying that you should be using launchd with a self deleting script but you may already be trying that).

I'd like to promote the use of Profiles to handle this specific task. I've been using them for over a year now to handle SSIDs and auto join rather than going crazy with MCX or scripts. Once you get the APN setup (super easy with your JAMF acct. rep) simply scope and create profiles via the JSS web interface. The only trick to know is that you should enter ALL of the local SSIDs that you DO NOT WANT the unit to auto join. Just make sure that the "auto-join" checkbox is un-checked and that they NEVER autojoin those SSIDs. Better yet, it will constantly enforce it!

Hobbs155
Contributor

You cannot bake network settings into the base image on 10.8 (not sure if this applies to 10.7), we run a configureNetworkSettings script at first reboot that will determine os version and weather wi-fi/airport is on or off, the script then uses the networksetup command to set all the desired network setttings, this behaviour is because of the preferences.plist in /Application Support/System Configuration being generated cleanly on first boot so any network settings you set in the image will essential get trashed. We would be happy to provide a sample of our configureNetworkSettings script if you so wish.

mike_pinto
New Contributor III

Thank you all for the help. I went ahead and tried this with a DMG I pulled from DeployStudio (SSID baked in) and it worked fine.

@Hobbs Here's our script:
/usr/sbin/networksetup -addpreferredwirelessnetworkatindex en0 "$SSID" 0 WPA2 "$PASS"

@Chris
I wouldn't mind making use of profiles, but wouldn't that require the client to be enrolled in the JSS? They're not in inventory since they have no network connectivity.

Thanks again!

stevewood
Honored Contributor II
Honored Contributor II

How are you calling the scripts? Are they in one post image script that is set to run at reboot? Or are you trying to call each script individually?

I use thin imaging here, laying down only apps and scripts over the factory OS, so I do not bake in any settings or apps. As part of the imaging process I have a package named PostImage.pkg that drops a LaunchDaemon and a script on the system. After Casper reboots the machine, the launchd kicks off my postimage script that handles things like editing /etc/authorization, setting power management, scroll bars, and running SoftwareUpdate. It deletes itself at the end and reboots the machine.

Since moving to this method, I've had no problems with scripts running.

Chris_Hafner
Valued Contributor II

Well I did make an assumption that you were imaging via casper imaging with an internet connection (either netboot or via HDDs). Are you imaging with hard drives and not internet connection?

brushj
New Contributor III

Thanks for the feedback everyone. I work with Mike and we have both been working on this issue together.

Steve, that sounds like a good method of approach, we will try out your suggestions and see if we can get that working.

Chris, we are imaging via thunderbolt with an external drive that has an OS and a repository partition on it. We have also tried using one of the newest model Macbook Air's and installed the repository on a separate partition. So they have wi-fi while the imaging process is taking place, but not afterwards.

Chris_Hafner
Valued Contributor II

Fair enough... in that case I agree. with Steve. launchd script that deletes itself is the way to go.

mike_pinto
New Contributor III

Sorry Chris, I should have been more clear.

We ended up creating a Post Install package coupled with a LaunchDaemon to call on a script (as suggested). This works great so I appreciate all the help. The only problem we're having now is that the client is still not enrolling. When I do a manual recon on the client it gives the following error:

"There was an error.

The file /Library/Preferences/com.jamfsoftware.jamf.plist does not exist. Use the createConf verb to create it."

I get this error whether I package QuickAdd in our config or not. Any idea's? I didn't think we would need to use the QuickAdd when using Casper Imaging.

Thanks again!

Chris_Hafner
Valued Contributor II

Boy that's interesting... and no, you should not have to run the QuickAdd when imaging via Casper Imaging. Can you manually locate that file and check permissions on it? I've not run across that one yet and a brief search of jamfnation didn't turn anything up so. Could you include the text of the full script? You've included the command which should at the very least (I'm no script genius BTW) the shell and an exit command.

mike_pinto
New Contributor III

It's working now. "Allow Invalid Certificate" in Casper Imaging wasn't set (thought it was already). Boy do I feel dumb!

Thanks for all the help!

Chris_Hafner
Valued Contributor II

... wow~! Didn't think of that one. By the way, you should look into getting a proper SSL cert. GoDaddy sells them cheap so long as you have no clients @10.4 or older.