electron-builder icon indicating copy to clipboard operation
electron-builder copied to clipboard

Auto Update download works but installation doesn't on MacOS 13 beta "Ventura"

Open suan opened this issue 1 year ago • 2 comments

  • Electron-Builder Version: 5.2.1
  • Node Version: 14.15.1
  • Electron Version: 10.1.5
  • Electron Type (current, beta, nightly): current
  • Target: MacOS (the problem is only happening on upcoming MacOS 13 Ventura version)

Using electron-updater auto-update. Download of next version happens fine, but actual installation of new version does not happen upon quit, also doesn't happen on quitAndInstall(). When quitAndInstall() is called, the app does not relaunch at all.

It has something to do with this newest beta MacOS version, as the exact same code auto-updates just fine on MacOS 12 Monterey and earlier. Here is my log output, based on adding autoUpdater.logger.transports.file.level = "debug", doesn't seem helpful. If I can make any tweaks to get more relevant logging, please tell me how:

[2022-09-03 09:56:40.958] [info] Checking for update
[2022-09-03 09:56:42.144] [info] Found version 2.2.2 (url: Porterhouse-2.2.2-mac.zip, Porterhouse-2.2.2-installer.dmg)
[2022-09-03 09:56:42.146] [info] Downloading update from Porterhouse-2.2.2-mac.zip, Porterhouse-2.2.2-installer.dmg
[2022-09-03 09:56:42.146] [debug] Checking for macOS Rosetta environment
[2022-09-03 09:56:42.153] [warn] sysctl shell command to check for macOS Rosetta environment failed: Error: Command failed: sysctl sysctl.proc_translated
sysctl: unknown oid 'sysctl.proc_translated'

[2022-09-03 09:56:42.153] [debug] Checking for arm64 in uname
[2022-09-03 09:56:42.158] [info] Checked 'uname -a': arm64=false
[2022-09-03 09:56:42.159] [debug] updater cache dir: /Users/suan/Library/Application Support/Caches/porterhouse-updater
[2022-09-03 09:56:42.365] [info] Update has already been downloaded to /Users/suan/Library/Application Support/Caches/porterhouse-updater/pending/Porterhouse-2.2.2-mac.zip).
[2022-09-03 09:56:42.365] [debug] Creating proxy server for native Squirrel.Mac (fileToProxy=https://github.com/cworsley4/Porterhouse-releases/releases/download/v2.2.2/Porterhouse-2.2.2-mac.zip)
[2022-09-03 09:56:42.366] [debug] Proxy server for native Squirrel.Mac is created (fileToProxy=https://github.com/cworsley4/Porterhouse-releases/releases/download/v2.2.2/Porterhouse-2.2.2-mac.zip)
[2022-09-03 09:56:42.366] [debug] Proxy server for native Squirrel.Mac is starting to listen (fileToProxy=https://github.com/cworsley4/Porterhouse-releases/releases/download/v2.2.2/Porterhouse-2.2.2-mac.zip)
[2022-09-03 09:56:42.368] [debug] Proxy server for native Squirrel.Mac is listening (address=http://127.0.0.1:57768, fileToProxy=https://github.com/cworsley4/Porterhouse-releases/releases/download/v2.2.2/Porterhouse-2.2.2-mac.zip)
[2022-09-03 09:56:42.438] [info] / requested
[2022-09-03 09:56:42.441] [info] /437725b4bfb2385866e78e06adbb41725cb0b819b841870df9ab540dc873df6be996c12b9fce0b228f889e9369e318c676b03390489f987ab7ac455783405c0d.zip requested
[2022-09-03 09:56:42.441] [info] /437725b4bfb2385866e78e06adbb41725cb0b819b841870df9ab540dc873df6be996c12b9fce0b228f889e9369e318c676b03390489f987ab7ac455783405c0d.zip requested by Squirrel.Mac, pipe /Users/suan/Library/Application Support/Caches/porterhouse-updater/pending/Porterhouse-2.2.2-mac.zip

Some guesses of potential causes:

  • This new version of MacOS needs additional entitlements/permissions for electron-updater to work properly
  • electron-updater moving of files is just plain not allowed on beta versions of MacOS maybe
  • ...🤷‍♂️

P/S Made a donation referencing this issue, keep up the great work! 🙂

suan avatar Sep 03 '22 19:09 suan

So electron-builder's electron-updater is merely wrapping the standard electron-implementation electron-updater and spinning up a local server for setFeedUrl. We use the native installer to read the download file from the local server before letting electron/chromium's implementation handle the installation portion. https://github.com/electron-userland/electron-builder/blob/5eb002b806d5bf439992bb0a9c5d7504ccc6d7dc/packages/electron-updater/src/MacUpdater.ts#L193-L199

Are you at least receiving a "update-downloaded" event? Trying to understand where the updater is stalling. https://github.com/electron-userland/electron-builder/blob/5eb002b806d5bf439992bb0a9c5d7504ccc6d7dc/packages/electron-updater/src/MacUpdater.ts#L201-L202

Would you be able to test on a newer version of electron? Curious if there's a critical update needed.

My next second guess is what you already listed: additional entitlements are required.

To add additional logging, I'd recommend patching in log.error instances to the error handlers, such as https://github.com/electron-userland/electron-builder/blob/5eb002b806d5bf439992bb0a9c5d7504ccc6d7dc/packages/electron-updater/src/MacUpdater.ts#L171-L173

An alternative approach might be just attaching a catch to the entire Promise for reject events, logging it, then rethrowing the error for upstream logic to continue using.

mmaietta avatar Sep 03 '22 20:09 mmaietta

@mmaietta Thanks – I definitely do get the update-downloaded event just fine.

It's not straightforward for me to update to a very recent Electron version, but I can try upgrading a few major versions at least if the other approaches don't bear fruit. Looking at their source, https://github.com/electron/electron/blob/479f652f904f773fe3a73a207e97eb39be2748a1/patches/squirrel.mac/feat_add_new_squirrel_mac_bundle_installation_method_behind_flag.patch and maybe https://github.com/electron/electron/blob/956406a1934e9f71935103a67f13cbd7b571304d/patches/squirrel.mac/fix_use_kseccschecknestedcode_kseccsstrictvalidate_in_the_sec.patch look like interesting recent additions.

Looks like there's barely been any changes to electron's auto-update code itself but yeah there have been squirrel patches like above.

I'll also try addtl error logging and see what turns up...

suan avatar Sep 04 '22 16:09 suan

Hey @suan hope all is well! Were you able to dive into the logging and see where the logic is stalling by chance?

mmaietta avatar Sep 23 '22 17:09 mmaietta

Hey so sorry, a bunch of other stuff got in the way and continues to get in the way XD

What’s interesting is at some point an update succeeded. I can’t remember if I had to delete the shipit cache or not. When I have time I wanna go back and further test to get a better picture

Would appreciate if you could keep the issue open, and/or try it on Ventura yourself if you have the ability, esp if others run into it and come looking

On Fri, Sep 23, 2022 at 10:25 AM Mike Maietta @.***> wrote:

Hey @suan https://github.com/suan hope all is well! Were you able to dive into the logging and see where the logic is stalling by chance?

— Reply to this email directly, view it on GitHub https://github.com/electron-userland/electron-builder/issues/7121#issuecomment-1256468404, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABPBV3CB3V7QNCQ2DPYU5LV7XRYFANCNFSM6AAAAAAQEAL5TQ . You are receiving this because you were mentioned.Message ID: @.***>

suan avatar Sep 23 '22 17:09 suan

I unfortunately can't test on Ventura due to my corporate MacBook blocking OS upgrades :/

Definitely happy to keep the issue open for tracking purposes.

mmaietta avatar Sep 23 '22 17:09 mmaietta