softwareupdate command not completing

Jason
Contributor II

I have a policy that simply runs a Execute Command of "softwareupdate --install --all". This command works fine locally and applies any pending software updates. However when I run it from JAMF i get this:

Executing Policy Run Software Updates...
Running command softwareupdate --install --all...
Result of command: Software Update Tool Copyright 2002-2012 Apple Inc. Finding available software

...and then nothing. It's like it ends the process right then and doesn't let it continue. Has anyone else experienced this?

2 ACCEPTED SOLUTIONS

thoule
Valued Contributor II

I just created a policy and ran that same sw update command via 'Execute Command' and it worked just fine. Below is the output in the JSS log file for that machine.

Executing Policy ignoreMe... [STEP 1 of 1] Running command softwareupdate --install --all... Result of command: Software Update Tool Copyright 2002-2012 Apple Inc. Finding available software Downloaded OS X Update Downloaded iTunes Installing OS X Update, iTunes Done with OS X Update Done with iTunes Done. You have installed one or more updates that requires that you restart your computer. Please restart immediately.

View solution in original post

GaToRAiD
Contributor II

I've had issues before when executing a command that took a while to do via that option. Try adding in a wait timer after your command so that JSS will hang tight. I.E.

I'm pretty sure this is the correct syntax: softwareupdate --install --all; sleep 10

This way it will sleep for 10 seconds following your command so it gives it time to work. Just a thought, see if that helps.

View solution in original post

11 REPLIES 11

GaToRAiD
Contributor II

No, but I have a possible solution for you.

This one will only install updates that do not require updates.

#!/bin/bash

############### Variables ################################################################
updatelist=/tmp/SWULIST
newlist=/tmp/newlist

############## Check for software Update #################################################
function updatecheck () {

/usr/sbin/softwareupdate -l > $updatelist
############## Reads file created by update list, then flushes out files that require update.
cat /tmp/SWULIST | sed -n '/restart/{x;d;};1h;1!{x;p;};${x;p;}' | awk -F"*" '{print $2}' | sed '/^$/d' > $newlist

############## Installs each update that doesn't require restart
while read p; do
    /usr/sbin/softwareupdate -i $p
#   osascript -e "tell application "Finder""
#   osascript -e "display dialog "Installing: $p""
done < $newlist

}

############## Functions
updatecheck

thoule
Valued Contributor II

Where are you running that command? files & processes -> Execute command? Or via shell script? Any chance there is a & character in there somewhere?

Jason
Contributor II

@thoule I'm running it under Policies > File and Processes > Execute Command just as you were thinking. There aren't any special characters in the command. just "softwareupdate --install --all". Here is the outcome of the command if i run it directly from terminal:

Software Update Tool
Copyright 2002-2012 Apple Inc.

Finding available software
Software Update found the following new or updated software:
     *iBooksDelta-1.0.1
          iBooks Update (1.0.1), 14334K [recommended]
     *iTunes (11.3), 232183K [recommended]

@GaToRAiD, I know there are several scripts in the forums for handling software updates, but at this time I'm just trying to use the built in command to apply everything without creating something more advanced. I'll try your script as it looks pretty straight forward if there are no other solutions, but I'd like to figure out why this isn't working first.

GaToRAiD
Contributor II

@Jason Have you just tried running it via the terminal first, to see if it might be something related to JSS?

Jason
Contributor II

@GaToRAiD, yep, the output from my previous post shows the first part of that. I've let it run all the way through before and it works without issue from Terminal. I didn't let it go all the way through this time just because I want some pending updates left on my test system to see if a fix works properly.

thoule
Valued Contributor II

I just created a policy and ran that same sw update command via 'Execute Command' and it worked just fine. Below is the output in the JSS log file for that machine.

Executing Policy ignoreMe... [STEP 1 of 1] Running command softwareupdate --install --all... Result of command: Software Update Tool Copyright 2002-2012 Apple Inc. Finding available software Downloaded OS X Update Downloaded iTunes Installing OS X Update, iTunes Done with OS X Update Done with iTunes Done. You have installed one or more updates that requires that you restart your computer. Please restart immediately.

GaToRAiD
Contributor II

I've had issues before when executing a command that took a while to do via that option. Try adding in a wait timer after your command so that JSS will hang tight. I.E.

I'm pretty sure this is the correct syntax: softwareupdate --install --all; sleep 10

This way it will sleep for 10 seconds following your command so it gives it time to work. Just a thought, see if that helps.

nessts
Valued Contributor II

check that root does not have a local com.apple.Softwareupdate.plist in preferences that is pointing to a server that does not exist. Do you need a proxy to get out on the internet?
Why don't you just use the software updates item in the policies configuration tool and just install all available updates there?

acdesigntech
Contributor II

are you setting the SUS via the built-in Casper method of defining a SUS in the JSS and assigning clients to it in the Network Segments pane?

Jason
Contributor II

@nessts, There is a plist at /Library/Preferences/com.apple.SoftwareUpdate.plist, but it doesn't point to any specific server (unsure if that's the file you were referring to). The PLISTs under "/Library/Preferences/Managed Preferences" and "/Library/Preferences/Managed Preferences/<USERID>" both do have a CatalogURL pointing to the internal server. We do need a proxy, but that shouldn't (i don't think) matter since we have an internal SUS. The Software Updates policy just tells the system which location to install software updates from doesn't it? i.e. it doesn't actually run them?

@GaToRAiD, I took it one step further and added a 30 second sleep just to be sure, now all i get is this:

Executing Policy Run Software Updates...
Running command softwareupdate --install --all; sleep 30...
Result of command:

Jason
Contributor II

Found my mistake. My test system was recently reimaged and wasn't in a right group. so "softwareupdate --install --all" works all along. just wasn't talking to the right SUS. Thanks everyone