install-or-defer icon indicating copy to clipboard operation
install-or-defer copied to clipboard

Found no recommended update

Open Eliesmbr opened this issue 3 years ago • 32 comments

On a Macbook with version 11.3.1, the script does not find any updates, although /usr/sbin/softwareupdate --list finds updates (11.4). The log says the following:

May 28 11:26:00 Install or Defer.sh[52463] <Notice>: Starting Install or Defer.sh. Performing validation and error checking... May 28 11:26:00 Install or Defer.sh[52463] <Notice>: Connection to swscan.apple.com port 443 [tcp/https] succeeded! May 28 11:26:00 Install or Defer.sh[52463] <Notice>: Validation and error checking passed. Starting main process... May 28 11:26:00 Install or Defer.sh[52463] <Notice>: No logo provided, or no image file exists at specified path. Using Software Update icon. May 28 11:26:00 Install or Defer.sh[52463] <Notice>: Max deferral time undefined, or not set to a positive integer. Using default value. May 28 11:26:00 Install or Defer.sh[52463] <Notice>: Maximum deferral time: 72h:00m:00s May 28 11:26:00 Install or Defer.sh[52463] <Notice>: Checking for pending system updates... May 28 11:26:07 Install or Defer.sh[52463] <Notice>: No recommended updates available. May 28 11:26:07 Install or Defer.sh[52463] <Notice>: Updating Jamf Pro inventory... May 28 11:26:08 Install or Defer.sh[52463] <Notice>: Retrieving inventory preferences from https://xxx/... May 28 11:26:08 Install or Defer.sh[52463] <Notice>: Locating hard drive information... May 28 11:26:08 Install or Defer.sh[52463] <Notice>: Finding extension attributes... May 28 11:26:08 Install or Defer.sh[52463] <Notice>: Locating accounts... May 28 11:26:08 Install or Defer.sh[52463] <Notice>: Locating applications... May 28 11:26:08 Install or Defer.sh[52463] <Notice>: Locating package receipts... May 28 11:26:08 Install or Defer.sh[52463] <Notice>: Searching path: /System/Applications May 28 11:26:08 Install or Defer.sh[52463] <Notice>: Locating software updates... May 28 11:26:08 Install or Defer.sh[52463] <Notice>: Locating printers... May 28 11:26:10 Install or Defer.sh[52463] <Notice>: Searching path: /Applications May 28 11:26:15 Install or Defer.sh[52463] <Notice>: Locating hardware information (macOS 11.3.1)... May 28 11:26:19 Install or Defer.sh[52463] <Notice>: Submitting data to https://xxx/... May 28 11:26:21 Install or Defer.sh[52463] <Notice>: <computer_id>107</computer_id> May 28 11:26:21 Install or Defer.sh[52463] <Notice>: Killing any active jamfHelper notifications... May 28 11:26:21 Install or Defer.sh[52463] <Notice>: Cleaning up stored plist values... May 28 11:26:21 Install or Defer.sh[52463] <Notice>: Cleaning up script resources... May 28 11:26:21 Install or Defer.sh[52463] <Notice>: mkdir: /private/tmp/install-or-defer: File exists May 28 11:26:21 Install or Defer.sh[52463] <Notice>: Script will end here.

The strange thing is that when I copy the script to the macbook and run it locally, it finds updates and continues to run correctly. When i run sudo jamf policy -event install-or-defer it also behaves correctly. Only when it comes from the policy triggered via check-in.

I have checked the function check_for_updates() and see no problem. Locally it correctly reports that updates are available, but via Jamf it runs into the last else for unknown reasons and then executes exit_without_updating. Also tested this on another macbook with version 11.3.1. This problem does not occur there. Maybe you can give me an advice how to debug this problem.

Cheers

Eliesmbr avatar May 28 '21 09:05 Eliesmbr

Interesting. When a Jamf Pro policy installs this payload, the script execution is kicked off from a LaunchDaemon, so I don't think the policy trigger is necessarily what's causing this. Can you try installing the package client-side and confirm it has the same behavior? Would be helpful to rule out the Jamf Pro workflow as a possible factor.

Would also help to know the specific hardware model of the Mac, specifically whether it has a T1/T2 Apple Security Chip or if it's an Apple Silicon model. It's possible some update output behavior has changed in a recent Big Sur build, and I know the softwareupdate binary has different behavior depending on architecture.

mpanighetti avatar May 28 '21 23:05 mpanighetti

If you see it happening with manual package install, recommend enabling debug mode on the script by changing the first line to #!/bin/bash -x then reloading the LaunchDaemon. This should give much more detailed output in the console logs; the relevant bit I'd like to see is the actual output of the softwareupdate --list command.

mpanighetti avatar Jun 02 '21 21:06 mpanighetti

Sorry for the late reply.

Here are some specs of one of the affected systems. System 1: MacBook Pro (16-inch, 2019) MacOS: 11.1.0 Build: 20C69

System 2: MacBook Pro (16-inch, 2019) MacOS: 11.3.1 Build: 20E241

System 3: MacBook Pro (13-inch, 2020, Four Thunderbolt 3 ports) MacOS: 11.3.0 Build: 20E232

When i install the package on client-side it finds updates and continues to run correctly. The weird thing is, on some devices it behaves correctly and on some it doesn't.

Eliesmbr avatar Jul 01 '21 14:07 Eliesmbr

Hi there @mpanighetti . I have a similar problem as @Eliesmbr, however what I'm seeing is the machines install IoD, it recognizes pending updates and download them fine, it will run for several days while the user defers, but then at a point sometime before the force date it will run it's check and suddenly report No recommended updates available and clean itself up. However, the machine does still recognize a pending update.

Here is sample log output, in this case it had been running for several days as expected, this is the end of the log and then my manual softwareupdate -l check. This specific machine is a 2018 MBP.

Finding available software

Downloaded macOS Catalina Security Update 2021-004
Done.
Deferral deadline: 2021-08-19 09:27:46
Time remaining: 00d:20h:53m:01s
Prompting to install updates now or defer...
User clicked Defer after 00d:01h:04m:18s.
Next prompt will appear after 2021-08-20 13:39:03.
Starting Install or Defer.sh. Performing validation and error checking...
Connection to swscan.apple.com port 443 [tcp/https] succeeded!
Validation and error checking passed. Starting main process...
No logo provided, or no image file exists at specified path. Using Software Update icon.
Max deferral time undefined, or not set to a positive integer. Using default value.
Maximum deferral time: 07d:00h:00m:00s
Checking for pending system updates...
No recommended updates available.
Updating Jamf Pro inventory...
Retrieving inventory preferences from https://jamf.pro:8443/...
Finding extension attributes...
Locating applications...
Locating accounts...
Locating package receipts...
Searching path: /Applications
Locating hard drive information...
Locating software updates...
Locating plugins...
Searching path: /Library/Internet Plug-Ins
Gathering application usage information from the JamfDaemon...
Locating hardware information (Mac OS X 10.15.7)...
Searching path: /System/Applications
Searching path: /Library/Application Support/corp
Submitting data to https://jamf.pro:8443/...
<computer_id>777</computer_id>
Killing any active jamfHelper notifications...
Cleaning up stored plist values...
Cleaning up script resources...
/Library/LaunchDaemons/com.corp.install-or-defer.plist -> /private/tmp/install-or-defer/com.corp.install-or-defer.plist
/Library/Scripts/Install or Defer.sh -> /private/tmp/install-or-defer/Install or Defer.sh
Unloading com.corp.install-or-defer LaunchDaemon...

ABCDEFG:~ madmin$ softwareupdate -l
Software Update Tool

Finding available software
Software Update found the following new or updated software:
* Label: macOS Catalina Security Update 2021-004-10.15.7
	Title: macOS Catalina Security Update 2021-004, Version: 10.15.7, Size: 1852819K, Recommended: YES, Action: restart, 
ABCDEFG:~ madmin$ 

dpertschi avatar Aug 24 '21 21:08 dpertschi

This isn't necessarily a fix, but I just released version 4.1.4 which, among other things, provides more consistent variable string protection. Recommend giving this a try, and I'd suggest trying the release unmodified on some test devices to see if it enforces restarts and updates more consistently.

mpanighetti avatar Sep 14 '21 00:09 mpanighetti

@Eliesmbr @dpertschi On an affected system, try running sudo launchctl kickstart -k system/com.apple.softwareupdated, then pushing Install or Defer, see if that forces the software update daemon to reload and properly show pending updates. If that's a reliable fix, we could add that as an initial step in the script to kickstart the daemon.

mpanighetti avatar Oct 05 '21 16:10 mpanighetti

@mpanighetti Where would you suggest adding that into the code? Happy to test this for you as my pending update which was deferred has disappared again

Tue Nov 23 17:09:20 GMT 2021: The next prompt is deferred until after 2021-11-23 17:10:40. Tue Nov 23 17:14:20 GMT 2021: Starting install-or-defer.sh. Performing validation and error checking... Tue Nov 23 17:14:21 GMT 2021: Validation and error checking passed. Starting main process... Tue Nov 23 17:14:21 GMT 2021: Max deferral time undefined, or not set to a positive integer. Using default value. Tue Nov 23 17:14:21 GMT 2021: Maximum deferral time: 03d:00h:00m:00s Tue Nov 23 17:14:21 GMT 2021: Deferral deadline: 2021-11-25 14:06:53 Tue Nov 23 17:14:21 GMT 2021: Time remaining: 01d:20h:52m:32s Tue Nov 23 17:14:21 GMT 2021: Checking for pending system updates... Tue Nov 23 17:18:31 GMT 2021: No critical updates available. Tue Nov 23 17:18:31 GMT 2021: Updating Jamf Pro inventory... Tue Nov 23 17:19:19 GMT 2021: Killing any active jamfHelper notifications... Tue Nov 23 17:19:19 GMT 2021: Cleaning up stored plist values... Tue Nov 23 17:19:19 GMT 2021: Cleaning up script resources... Tue Nov 23 17:19:19 GMT 2021: Unloading install-or-defer LaunchDaemon... Tue Nov 23 17:19:19 GMT 2021: Script will end here. Tue Nov 23 17:19:19 GMT 2021: LaunchDaemon install-or-defer was unloaded...

master-vodawagner avatar Nov 23 '21 17:11 master-vodawagner

Its either the softwareupdate LD needs a kick or for some odd reason I'm breaking out early of the IF statement on line 534

# Get the "deferred until" timestamp, if one exists.
DEFERRED_UNTIL=$(/usr/bin/defaults read "$PLIST" UpdatesDeferredUntil 2>"/dev/null")
if [[ -n "$DEFERRED_UNTIL" ]] && (( DEFERRED_UNTIL > $(/bin/date +%s) && FORCE_DATE > DEFERRED_UNTIL )); then
    # If the policy ran recently and was deferred, we need to respect that
    # "defer until" timestamp, as long as it is earlier than the deferral
    # deadline.
    echo "The next prompt is deferred until after $(/bin/date -jf "%s" "+%Y-%m-%d %H:%M:%S" "$DEFERRED_UNTIL")."
    exit 0
fi

master-vodawagner avatar Nov 23 '21 17:11 master-vodawagner

I'd put this kickstart right before the pending update check in check_for_updates to ensure the process is ready to go.

mpanighetti avatar Nov 23 '21 18:11 mpanighetti

Sorry, only just gotten around to this. I've added the kickstart section and testing now.

Should know by Monday if the kickstart works or not

master-vodawagner avatar Jan 21 '22 11:01 master-vodawagner

@mpanighetti That hasn't worked :(

Checks for recommended macOS updates, or exits if no such updates are

available.

check_for_updates () {

launchctl kickstart -k system/com.apple.softwareupdated
sleep 120
UPDATE_CHECK=$(/usr/sbin/softwareupdate --list 2>&1)

LOG OUTPUT Fri Jan 21 13:20:52 GMT 2022: Start of preinstall script... Fri Jan 21 13:20:52 GMT 2022: Killing any active jamfHelper notifications... Fri Jan 21 13:20:52 GMT 2022: Unloading and removing /Library/LaunchDaemons/install-or-defer.plist... Fri Jan 21 13:20:52 GMT 2022: End of preinstall script... Fri Jan 21 13:20:52 GMT 2022: Starting install-or-defer.sh. Performing validation and error checking... Fri Jan 21 13:20:53 GMT 2022: Validation and error checking passed. Starting main process... Fri Jan 21 13:20:53 GMT 2022: Max deferral time undefined, or not set to a positive integer. Using default value. Fri Jan 21 13:20:53 GMT 2022: Maximum deferral time: 03d:00h:00m:00s Fri Jan 21 13:20:53 GMT 2022: Deferral deadline: 2022-01-24 12:28:24 Fri Jan 21 13:20:53 GMT 2022: Time remaining: 02d:23h:07m:31s Fri Jan 21 13:20:53 GMT 2022: The next prompt is deferred until after 2022-01-21 15:57:53. Fri Jan 21 13:25:53 GMT 2022: Starting install-or-defer.sh. Performing validation and error checking... Fri Jan 21 13:25:54 GMT 2022: Validation and error checking passed. Starting main process... Fri Jan 21 13:25:54 GMT 2022: Max deferral time undefined, or not set to a positive integer. Using default value. Fri Jan 21 13:25:54 GMT 2022: Maximum deferral time: 03d:00h:00m:00s Fri Jan 21 13:25:54 GMT 2022: Deferral deadline: 2022-01-24 12:28:24 Fri Jan 21 13:25:54 GMT 2022: Time remaining: 02d:23h:02m:30s Fri Jan 21 13:25:54 GMT 2022: The next prompt is deferred until after 2022-01-21 15:57:53. Fri Jan 21 13:30:54 GMT 2022: Starting install-or-defer.sh. Performing validation and error checking... Fri Jan 21 13:30:55 GMT 2022: Validation and error checking passed. Starting main process... Fri Jan 21 13:30:55 GMT 2022: Max deferral time undefined, or not set to a positive integer. Using default value. Fri Jan 21 13:30:55 GMT 2022: Maximum deferral time: 03d:00h:00m:00s Fri Jan 21 13:30:55 GMT 2022: Deferral deadline: 2022-01-24 12:28:24 Fri Jan 21 13:30:55 GMT 2022: Time remaining: 02d:22h:57m:29s Fri Jan 21 13:30:55 GMT 2022: The next prompt is deferred until after 2022-01-21 15:57:53. Fri Jan 21 13:35:55 GMT 2022: Starting install-or-defer.sh. Performing validation and error checking... Fri Jan 21 13:35:55 GMT 2022: Validation and error checking passed. Starting main process... Fri Jan 21 13:35:55 GMT 2022: Max deferral time undefined, or not set to a positive integer. Using default value. Fri Jan 21 13:35:55 GMT 2022: Maximum deferral time: 03d:00h:00m:00s Fri Jan 21 13:35:55 GMT 2022: Deferral deadline: 2022-01-24 12:28:24 Fri Jan 21 13:35:55 GMT 2022: Time remaining: 02d:22h:52m:29s Fri Jan 21 13:35:55 GMT 2022: The next prompt is deferred until after 2022-01-21 15:57:53. Mon Jan 24 10:46:00 GMT 2022: Starting install-or-defer.sh. Performing validation and error checking... Mon Jan 24 10:45:46 GMT 2022: Validation and error checking passed. Starting main process... Mon Jan 24 10:45:46 GMT 2022: Max deferral time undefined, or not set to a positive integer. Using default value. Mon Jan 24 10:45:46 GMT 2022: Maximum deferral time: 03d:00h:00m:00s Mon Jan 24 10:45:46 GMT 2022: Deferral deadline: 2022-01-24 12:28:24 Mon Jan 24 10:45:46 GMT 2022: Time remaining: 00d:01h:42m:38s Mon Jan 24 10:45:46 GMT 2022: Checking for pending system updates... Mon Jan 24 10:50:31 GMT 2022: Update requires a restart / shutdown... Mon Jan 24 10:50:31 GMT 2022: Updates found: macOS Monterey 12.2 Mon Jan 24 10:50:31 GMT 2022: Prompting to install updates now or defer... Mon Jan 24 10:50:46 GMT 2022: User clicked Defer after 00d:00h:00m:15s. Mon Jan 24 10:50:46 GMT 2022: Next prompt will appear after 2022-01-24 12:28:24. Mon Jan 24 10:55:46 GMT 2022: Starting install-or-defer.sh. Performing validation and error checking... Mon Jan 24 10:55:47 GMT 2022: Validation and error checking passed. Starting main process... Mon Jan 24 10:55:47 GMT 2022: Max deferral time undefined, or not set to a positive integer. Using default value. Mon Jan 24 10:55:47 GMT 2022: Maximum deferral time: 03d:00h:00m:00s Mon Jan 24 10:55:47 GMT 2022: Deferral deadline: 2022-01-24 12:28:24 Mon Jan 24 10:55:47 GMT 2022: Time remaining: 00d:01h:32m:37s Mon Jan 24 10:55:47 GMT 2022: Checking for pending system updates... Mon Jan 24 11:00:02 GMT 2022: No critical updates available. Mon Jan 24 11:00:02 GMT 2022: Updating Jamf Pro inventory... Mon Jan 24 11:01:07 GMT 2022: Killing any active jamfHelper notifications... Mon Jan 24 11:01:07 GMT 2022: Cleaning up stored plist values... Mon Jan 24 11:01:07 GMT 2022: Cleaning up script resources... Mon Jan 24 11:01:07 GMT 2022: Unloading install-or-defer LaunchDaemon... Mon Jan 24 11:01:07 GMT 2022: Script will end here. Mon Jan 24 11:01:07 GMT 2022: LaunchDaemon install-or-defer was unloaded...

master-vodawagner avatar Jan 24 '22 11:01 master-vodawagner

That's a bummer, but it seems like there are enough issues with stability around the softwareupdate process in macOS Big Sur+ that it's still probably worthwhile to add this kickstart step before any run of the softwareupdate binary. Just added that to #70.

mpanighetti avatar Jan 27 '22 17:01 mpanighetti

OK, if you can think of anything else to try I'm happy to give it ago

master-vodawagner avatar Jan 27 '22 17:01 master-vodawagner

Happened again, seems a bit silly but would a second check_updates be worthwhile until we can ID the correct fix?

Logic: If currently deferred & check_Updates returns no updates try again?

Fri Jan 28 13:30:26 GMT 2022: Deferral deadline: 2022-01-31 11:16:51 Fri Jan 28 13:30:26 GMT 2022: Time remaining: 02d:21h:46m:25s Fri Jan 28 13:30:26 GMT 2022: The next prompt is deferred until after 2022-01-28 14:20:10. Fri Jan 28 16:43:48 GMT 2022: Starting install-or-defer.sh. Performing validation and error checking... Fri Jan 28 16:43:50 GMT 2022: Validation and error checking passed. Starting main process... Fri Jan 28 16:43:50 GMT 2022: Max deferral time undefined, or not set to a positive integer. Using default value. Fri Jan 28 16:43:50 GMT 2022: Maximum deferral time: 03d:00h:00m:00s Fri Jan 28 16:43:50 GMT 2022: Deferral deadline: 2022-01-31 11:16:51 Fri Jan 28 16:43:50 GMT 2022: Time remaining: 02d:18h:33m:01s Fri Jan 28 16:43:50 GMT 2022: Checking for pending system updates... Kickstarting com.apple.softwareupdated... Fri Jan 28 16:45:19 GMT 2022: No critical updates available. Fri Jan 28 16:45:19 GMT 2022: Updating Jamf Pro inventory... Fri Jan 28 16:46:47 GMT 2022: Killing any active jamfHelper notifications... Fri Jan 28 16:46:47 GMT 2022: Cleaning up stored plist values... Fri Jan 28 16:46:47 GMT 2022: Cleaning up script resources... Fri Jan 28 16:46:47 GMT 2022: Unloading install-or-defer LaunchDaemon... Fri Jan 28 16:46:47 GMT 2022: Script will end here. Fri Jan 28 16:46:47 GMT 2022: LaunchDaemon install-or-defer was unloaded...

master-vodawagner avatar Jan 28 '22 17:01 master-vodawagner

So queried the install.log, found this snippet so the softwareupdated process genuinely could not find an update

2022-01-28 16:45:18+00 X2102825 softwareupdated[588]: Refreshing available updates from scan 2022-01-28 16:45:18+00 X2102825 SoftwareUpdateNotificationManager[1209]: AssertionMgr: Take com.apple.softwareupdate.NotifyAgentAssertion-BadgingCountChanged assertion with type BackgroundTask for pid 1209, id 0x8263 2022-01-28 16:45:18+00 X2102825 softwareupdated[588]: Scan (f=1, d=0) completed 2022-01-28 16:45:18+00 X2102825 softwareupdated[588]: 0 updates found:

master-vodawagner avatar Jan 28 '22 17:01 master-vodawagner

Yeah, this was my suspicion, that the update check is actually running but not seeing updates for some reason. That would seem to be a macOS bug, which isn't surprising considering more of them seem to be popping up over time. Unfortunately, this script logic only functions if it's getting consistent results from softwareupdate --list, so if a given macOS release is sometimes failing to find updates, the most reliable fix I can think of would be to manually update and see if the bug is fixed the next time an update comes around.

I'm going to merge the kickstart addition because it feels like a beneficial change that will hopefully at least partly reduce frequency of hanging update checks or erroneous 0 updates found results. I'll leave this issue open for the time being, we can see if someone comes up with a reliable workaround or fix for getting softwareupdate checks working again.

mpanighetti avatar Jan 28 '22 17:01 mpanighetti

So I tried increasing the sleep 60 to 5 mins inside the kickstart just to ensure everything was running before the softwareupdate --list from the check_updates function but even that came up with no updates found.

The odd thing is the red dot above the settings app was there when the softwareupdate --list reported no updates

Mon Jan 31 18:09:47 GMT 2022: Starting install-or-defer.sh. Performing validation and error checking... Mon Jan 31 18:09:47 GMT 2022: Validation and error checking passed. Starting main process... Mon Jan 31 18:09:47 GMT 2022: Max deferral time undefined, or not set to a positive integer. Using default value. Mon Jan 31 18:09:47 GMT 2022: Maximum deferral time: 03d:00h:00m:00s Mon Jan 31 18:09:47 GMT 2022: Deferral deadline: 2022-02-03 15:05:48 Mon Jan 31 18:09:47 GMT 2022: Time remaining: 02d:20h:56m:01s Mon Jan 31 18:09:47 GMT 2022: The next prompt is deferred until after 2022-01-31 18:14:13. Mon Jan 31 18:14:47 GMT 2022: Starting install-or-defer.sh. Performing validation and error checking... Mon Jan 31 18:14:48 GMT 2022: Validation and error checking passed. Starting main process... Mon Jan 31 18:14:48 GMT 2022: Max deferral time undefined, or not set to a positive integer. Using default value. Mon Jan 31 18:14:48 GMT 2022: Maximum deferral time: 03d:00h:00m:00s Mon Jan 31 18:14:48 GMT 2022: Deferral deadline: 2022-02-03 15:05:48 Mon Jan 31 18:14:48 GMT 2022: Time remaining: 02d:20h:51m:00s Mon Jan 31 18:14:48 GMT 2022: Checking for pending system updates... Mon Jan 31 18:14:48 GMT 2022: Kickstarting com.apple.softwareupdated process... Mon Jan 31 18:21:03 GMT 2022: No critical updates available. Mon Jan 31 18:21:03 GMT 2022: Updating Jamf Pro inventory... Mon Jan 31 18:21:52 GMT 2022: Killing any active jamfHelper notifications... Mon Jan 31 18:21:52 GMT 2022: Cleaning up stored plist values... Mon Jan 31 18:21:52 GMT 2022: Cleaning up script resources...

master-vodawagner avatar Jan 31 '22 18:01 master-vodawagner

From previous logs, it looks like you were testing this in macOS Monterey? I haven't had a chance to play with this script much in Monterey since I'm looking at the MDM command functionality as a potential future replacement, but I'm starting to tinker with it now. Hopefully will have something to report there in terms of official support soon.

mpanighetti avatar Feb 01 '22 02:02 mpanighetti

Screenshot 2022-02-09 at 12 18 23

This attempt was fresh, no deferment period

master-vodawagner avatar Feb 09 '22 12:02 master-vodawagner

I'm not sure if the kickstart is helping or not, I'm getting lots of reports from users that the Running update box is just stuck indefinitely

####################### START OF INSTALL OR DEFER 4.1.8 ####################### Wed Feb 16 11:42:12 GMT 2022: Start of preinstall script... Wed Feb 16 11:42:12 GMT 2022: Killing any active jamfHelper notifications... Wed Feb 16 11:42:12 GMT 2022: Unloading and removing /Library/LaunchDaemons/install-or-defer.plist... Wed Feb 16 11:42:12 GMT 2022: End of preinstall script... Wed Feb 16 11:42:12 GMT 2022: Starting install-or-defer.sh. Performing validation and error checking... Wed Feb 16 11:42:12 GMT 2022: Validation and error checking passed. Starting main process... Wed Feb 16 11:42:13 GMT 2022: Max deferral time undefined, or not set to a positive integer. Using default value. Wed Feb 16 11:42:13 GMT 2022: Maximum deferral time: 03d:00h:00m:00s Wed Feb 16 11:42:13 GMT 2022: Deferral deadline: 2022-02-19 11:42:13 Wed Feb 16 11:42:13 GMT 2022: Time remaining: 03d:00h:00m:00s Wed Feb 16 11:42:13 GMT 2022: Checking for pending system updates... Wed Feb 16 11:42:13 GMT 2022: Kickstarting com.apple.softwareupdated process... Wed Feb 16 11:43:25 GMT 2022: Update requires a restart / shutdown... Wed Feb 16 11:43:25 GMT 2022: Updates found: macOS Monterey 12.2 Wed Feb 16 11:43:25 GMT 2022: Prompting to install updates now or defer... Wed Feb 16 11:47:36 GMT 2022: User clicked Run Updates after 00d:00h:04m:11s. Wed Feb 16 11:47:36 GMT 2022: Kickstarting com.apple.softwareupdated process... Running all Apple system updates...

master-vodawagner avatar Feb 18 '22 16:02 master-vodawagner

During one of my monthly Apple calls, we discussed this issue of "inconsistancy" with the softwareupdate binary. Several customers from the Apple reps are reporting this kind of behaviour and it was hinted that /usr/libexec/mdmclient AvailableOSUpdates provided some stability.

i'm currently testing the below changes to the kickstart_softwarepdated function

# Force-restarts the com.apple.softwareupdated service. Necessary to make
# repeated update checks more reliable in macOS Big Sur and later.
kickstart_softwareupdated () {

    echo "$(date): Kickstarting com.apple.softwareupdated process..." >> "${LOG_PATH}"
#    /bin/launchctl kickstart -k "system/com.apple.softwareupdated"
    /usr/libexec/mdmclient AvailableOSUpdates
    sleep 60

}

master-vodawagner avatar Feb 18 '22 17:02 master-vodawagner

macOS 12.3 beta release notes indicate Apple's actively working on improving reliability of software update checks and update enforcement MDM commands, so hopefully we'll see some stability on the other side of that update.

mpanighetti avatar Feb 23 '22 07:02 mpanighetti

@mpanighetti Worth highlighting that your changes in V5.0.1 around deleting /Library/Preferences/com.apple.SoftwareUpdate.plist breaks for those enrolled in AppleSeed or Appel Developer programmes. Primarily because it removes the CatalogURL for seed programmes.

Obviously not an issue for production devices but is it possible to add a new config profile argument for Apple Seed? Boolean true/false and if true inject in the correct CatalogURL?

master-vodawagner avatar Feb 25 '22 14:02 master-vodawagner

Thanks, I didn't realize the beta programs wrote values to that plist that need to persist. What is the correct CatalogURL in these cases?

mpanighetti avatar Feb 25 '22 18:02 mpanighetti

@master-vodawagner I've updated the restart_softwareupdate_daemon function to restore the CatalogURL key if previously defined, can you confirm that addresses the issue you're seeing before I merge and add a new release? This method avoids requiring the user to define a config profile value and just looks for an existing key entry.

mpanighetti avatar Feb 25 '22 20:02 mpanighetti

@master-vodawagner I've updated the restart_softwareupdate_daemon function to restore the CatalogURL key if previously defined, can you confirm that addresses the issue you're seeing before I merge and add a new release? This method avoids requiring the user to define a config profile value and just looks for an existing key entry.

Yep, I'll try testing this week. I've checked the pull commit and looks like a good way to resolve my problem

master-vodawagner avatar Feb 28 '22 10:02 master-vodawagner

I'm still getting this bug :( Is it possible to gleam the required information from alternative sources on the device (outside of softwareupdate)

master-vodawagner avatar May 19 '22 17:05 master-vodawagner

I'm just wondering if its worth looking at the softwareupdate --no-scan function? I know technically it could cause a bleep if the workflow occurs during 12.3 and then 12.4 gets released however its just unreliable softwareupdate --list

Using some logic like

New update detected by Jamf ( if ! -f $PLIST ) > run softwareupdate --list

then when the default defer prompt re-appears

If deferred = true ( if -f $PLIST ) > run softwareupdate --no-scan

master-vodawagner avatar May 20 '22 15:05 master-vodawagner

I like the idea, but do we have any confidence that --no-scan will function when softwareupdate is in a hanging/broken/sad state? It's not a documented argument in latest macOS (maybe never was, don't recall).

mpanighetti avatar May 20 '22 19:05 mpanighetti

My only thought there would be to scrap using softwareupdate —list when the defer prompts re-appears after 4 hours… otherwise we’ll have to start looking into log stream with sub systems and keyword searches

Scenario

New update detected by Jamf ( if ! -f $PLIST ) > run softwareupdate --list

then when the default defer prompt re-appears

run jamfHelper prompt to install or defer without invoking softwareupdate —list

master-vodawagner avatar May 20 '22 20:05 master-vodawagner