Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto updater fails to launch UAC update on full download fallback #2640

Closed
jonzlin95 opened this issue Feb 25, 2018 · 11 comments
Closed

Auto updater fails to launch UAC update on full download fallback #2640

jonzlin95 opened this issue Feb 25, 2018 · 11 comments

Comments

@jonzlin95
Copy link
Contributor

jonzlin95 commented Feb 25, 2018

  • Version: 19.55.2
  • Electron Updater Version: 2.20.1
  • Target: Windows (32 & 64bit)

Hi friends,

We're using the auto-update feature of the electron-builder, and 90%+ of the time it works great. However for some users, they run into

[2018-02-24 20:47:35.078] [error] Cannot download differentially, fallback to full download: Error: EPERM: operation not permitted,

which triggers a full download. This works fine (leads to)

[2018-02-24 21:24:38.746] [info] New version 0.5.0 has been downloaded to C:\Users\Username\AppData\Local\Temp\up-7jJaOf\AppSetup.exe

But upon an attempt to quitAndInstall

[2018-02-24 21:24:39.747] [info] Install on explicit quitAndInstall
[2018-02-24 21:24:39.747] [info] Install: isSilent: false, isRunAfter: true
[2018-02-24 21:24:39.761] [info] Access denied or UNKNOWN error code on spawn, will be executed again using elevate

The final line fails, and so the user is unable to update. Upon restarting the app they are stuck in an update loop, rendering the app unusable until a fresh install of the latest version.

Our current fix is to tell users to run as admin, but ideally the UAC would prompt and allow users to opt into admin.

Here is our relevant package.json lines

    "nsis": {
      "oneClick": true,
      "include": "build/installer.nsh", // Simply checks if VC++ is installed, and attempts an install if not.
      "perMachine": true
    },

Let me know if any more information would be useful for debugging.

Thanks,
Jonathan

@afroewis
Copy link

afroewis commented Mar 1, 2018

I am having one single client that faces the very same problem (this brought me here). He has the latest version installed, yet it will always download the latest version, so he is in an update loop. I just told him to run as an administrator and will get the results soon. However, interestingly, the setup does replace the files (The "Created date" of the files changes).

@jonzlin95
Copy link
Contributor Author

After a few more days of debugging this issue, we've made some new/further? discoveries

  1. Running the application as Administrator successfully auto-updates to the next version
  2. On a failed installation what happens is
    1. We see black cmd window flash (what I assume is the elevate.exe call)
    2. Old app is uninstalled successfully
    3. Everything else fails and user is left without the application.

We tried adding some custom nsis, but it didn't solve the problem.

!macro customInit
    ${IfNot} ${UAC_IsAdmin}
        ShowWindow $HWNDPARENT ${SW_HIDE}
        !insertmacro UAC_RunElevated
        Quit
    ${endif}
!macroend

@akashnimare
Copy link
Contributor

akashnimare commented Mar 9, 2018

@develar some of our use has reported the same issue. Running the app as an admin didn't fix the issue -

"electron-updater": "2.18.2",
"electron-builder": "19.53.6"

autoupdater logs -

[2018-02-27 15:21:38:0487] [info] Checking for update [2018-02-27 15:21:41:0888] [info] Found version 1.8.2 (url: zulip-web-setup-1.8.2.exe) [2018-02-27 15:21:41:0890] [info] Downloading update from zulip-web-setup-1.8.2.exe [2018-02-27 15:21:45:0871] [error] Cannot download differentially, fallback to full download: Error: EPERM: operation not permitted, open 'C:\Program Files\Zulip\package.7z' at C:\Program Files\Zulip\resources\app.asar\node_modules\builder-util-runtime\src\blockMapApi.ts:22:20 at Generator.next () From previous event: at readEmbeddedBlockMapData (C:\Program Files\Zulip\resources\app.asar\node_modules\builder-util-runtime\out\blockMapApi.js:39:21) at C:\Program Files\Zulip\resources\app.asar\node_modules\electron-updater\src\differentialDownloader\FileWithEmbeddedBlockMapDifferentialDownloader.ts:11:44 at Generator.next () at runCallback (timers.js:672:20) at tryOnImmediate (timers.js:645:5) at processImmediate [as _immediateCallback] (timers.js:617:5) From previous event: at FileWithEmbeddedBlockMapDifferentialDownloader.download (C:\Program Files\Zulip\resources\app.asar\node_modules\electron-updater\out\differentialDownloader\FileWithEmbeddedBlockMapDifferentialDownloader.js:37:11) at C:\Program Files\Zulip\resources\app.asar\node_modules\electron-updater\src\NsisUpdater.ts:177:10 at Generator.next () From previous event: at NsisUpdater.differentialDownloadWebPackage (C:\Program Files\Zulip\resources\app.asar\node_modules\electron-updater\out\NsisUpdater.js:232:11) at C:\Program Files\Zulip\resources\app.asar\node_modules\electron-updater\src\NsisUpdater.ts:53:24 at Generator.next () at runCallback (timers.js:672:20) at tryOnImmediate (timers.js:645:5) at processImmediate [as _immediateCallback] (timers.js:617:5) From previous event: at C:\Program Files\Zulip\resources\app.asar\node_modules\electron-updater\out\NsisUpdater.js:118:33 at C:\Program Files\Zulip\resources\app.asar\node_modules\electron-updater\src\BaseUpdater.ts:46:13 at Generator.next () at FSReqWrap.oncomplete (fs.js:114:15) From previous event: at NsisUpdater.executeDownload (C:\Program Files\Zulip\resources\app.asar\node_modules\electron-updater\out\BaseUpdater.js:98:11) at C:\Program Files\Zulip\resources\app.asar\node_modules\electron-updater\src\NsisUpdater.ts:37:16 From previous event: at NsisUpdater.doDownloadUpdate (C:\Program Files\Zulip\resources\app.asar\node_modules\electron-updater\out\NsisUpdater.js:125:11) at C:\Program Files\Zulip\resources\app.asar\node_modules\electron-updater\src\AppUpdater.ts:331:25 at Generator.next () From previous event: at NsisUpdater.downloadUpdate (C:\Program Files\Zulip\resources\app.asar\node_modules\electron-updater\out\AppUpdater.js:366:11) at C:\Program Files\Zulip\resources\app.asar\node_modules\electron-updater\src\AppUpdater.ts:307:49 From previous event: at NsisUpdater.doCheckForUpdates (C:\Program Files\Zulip\resources\app.asar\node_modules\electron-updater\out\AppUpdater.js:337:11) at C:\Program Files\Zulip\resources\app.asar\node_modules\electron-updater\src\AppUpdater.ts:255:25 at Generator.next () at runCallback (timers.js:672:20) at tryOnImmediate (timers.js:645:5) at processImmediate [as _immediateCallback] (timers.js:617:5) From previous event: at NsisUpdater._checkForUpdates (C:\Program Files\Zulip\resources\app.asar\node_modules\electron-updater\out\AppUpdater.js:291:11) at NsisUpdater.checkForUpdates (C:\Program Files\Zulip\resources\app.asar\node_modules\electron-updater\src\AppUpdater.ts:204:35) at appUpdater (C:\Program Files\Zulip\resources\app.asar\main\autoupdater.js:48:14) at WebContents.page.once (C:\Program Files\Zulip\resources\app.asar\main\index.js:165:3) at Object.onceWrapper (events.js:293:19) at emitTwo (events.js:106:13) at WebContents.emit (events.js:194:7) [2018-02-27 15:21:49:0407] [info] New version 1.8.2 has been downloaded to C:\Users\USERNAME\AppData\Local\Temp\up-cpGTTD\zulip-web-setup-1.8.2.exe [2018-02-27 15:21:52:0840] [info] Install on explicit quitAndInstall [2018-02-27 15:21:52:0841] [info] Install: isSilent: false, isRunAfter: true [2018-02-27 15:21:53:0574] [info] Access denied or UNKNOWN error code on spawn, will be executed again using elevate [2018-02-27 15:37:04:0817] [info] Checking for update [2018-02-27 15:37:08:0602] [info] Found version 1.8.2 (url: zulip-web-setup-1.8.2.exe) [2018-02-27 15:37:08:0605] [info] Downloading update from zulip-web-setup-1.8.2.exe [2018-02-27 15:37:13:0461] [info] Full: 41,598.69 KB, To download: 0 KB (0%) [2018-02-27 15:37:13:0472] [info] Differential download: https://github.com/zulip/zulip-electron/releases/download/v1.8.2/zulip-1.8.2-x64.nsis.7z [2018-02-27 15:37:14:0775] [info] New version 1.8.2 has been downloaded to C:\Users\USERNAME\AppData\Local\Temp\up-hUPazF\zulip-web-setup-1.8.2.exe [2018-02-27 15:37:24:0869] [info] Install on explicit quitAndInstall [2018-02-27 15:37:24:0870] [info] Install: isSilent: false, isRunAfter: true [2018-02-27 15:37:25:0305] [info] Access denied or UNKNOWN error code on spawn, will be executed again using elevate [2018-02-27 15:37:42:0868] [info] Checking for update [2018-02-27 15:37:46:0266] [info] Found version 1.8.2 (url: zulip-web-setup-1.8.2.exe) [2018-02-27 15:37:46:0269] [info] Downloading update from zulip-web-setup-1.8.2.exe [2018-02-27 15:37:50:0530] [info] Full: 41,598.69 KB, To download: 0 KB (0%) [2018-02-27 15:37:50:0536] [info] Differential download: https://github.com/zulip/zulip-electron/releases/download/v1.8.2/zulip-1.8.2-x64.nsis.7z [2018-02-27 15:37:51:0297] [info] New version 1.8.2 has been downloaded to C:\Users\USERNAME\AppData\Local\Temp\up-SpfSPb\zulip-web-setup-1.8.2.exe [2018-02-27 15:38:04:0968] [info] Auto install update on quit [2018-02-27 15:38:04:0969] [info] Install: isSilent: true, isRunAfter: false [2018-02-27 15:38:05:0556] [info] Access denied or UNKNOWN error code on spawn, will be executed again using elevate [2018-02-27 15:38:27:0928] [info] Checking for update [2018-02-27 15:38:31:0703] [info] Found version 1.8.2 (url: zulip-web-setup-1.8.2.exe) [2018-02-27 15:38:31:0705] [info] Downloading update from zulip-web-setup-1.8.2.exe [2018-02-27 15:38:35:0351] [info] Full: 41,598.69 KB, To download: 0 KB (0%) [2018-02-27 15:38:35:0361] [info] Differential download: https://github.com/zulip/zulip-electron/releases/download/v1.8.2/zulip-1.8.2-x64.nsis.7z [2018-02-27 15:38:36:0224] [info] New version 1.8.2 has been downloaded to C:\Users\USERNAME\AppData\Local\Temp\up-nlk53M\zulip-web-setup-1.8.2.exe [2018-02-27 15:38:46:0911] [info] Install on explicit quitAndInstall [2018-02-27 15:38:46:0912] [info] Install: isSilent: false, isRunAfter: true [2018-02-27 15:38:47:0319] [info] Access denied or UNKNOWN error code on spawn, will be executed again using elevate [2018-02-27 15:39:07:0119] [info] Checking for update [2018-02-27 15:39:10:0569] [info] Found version 1.8.2 (url: zulip-web-setup-1.8.2.exe) [2018-02-27 15:39:10:0571] [info] Downloading update from zulip-web-setup-1.8.2.exe [2018-02-27 15:39:14:0555] [info] Full: 41,598.69 KB, To download: 0 KB (0%) [2018-02-27 15:39:14:0565] [info] Differential download: https://github.com/zulip/zulip-electron/releases/download/v1.8.2/zulip-1.8.2-x64.nsis.7z [2018-02-27 15:39:15:0186] [info] New version 1.8.2 has been downloaded to C:\Users\USERNAME\AppData\Local\Temp\up-4RxOYX\zulip-web-setup-1.8.2.exe [2018-02-27 15:52:02:0581] [info] Auto install update on quit [2018-02-27 15:52:02:0584] [info] Install: isSilent: true, isRunAfter: false [2018-02-27 15:52:02:0631] [info] Access denied or UNKNOWN error code on spawn, will be executed again using elevate [2018-02-27 15:52:23:0376] [info] Checking for update [2018-02-27 15:52:26:0843] [info] Found version 1.8.2 (url: zulip-web-setup-1.8.2.exe) [2018-02-27 15:52:26:0845] [info] Downloading update from zulip-web-setup-1.8.2.exe [2018-02-27 15:52:30:0635] [info] Full: 41,598.69 KB, To download: 0 KB (0%) [2018-02-27 15:52:30:0681] [info] Differential download: https://github.com/zulip/zulip-electron/releases/download/v1.8.2/zulip-1.8.2-x64.nsis.7z [2018-02-27 15:52:31:0355] [info] New version 1.8.2 has been downloaded to C:\Users\USERNAME\AppData\Local\Temp\up-foKgj4\zulip-web-setup-1.8.2.exe [2018-02-27 15:52:34:0309] [info] Install on explicit quitAndInstall [2018-02-27 15:52:34:0310] [info] Install: isSilent: false, isRunAfter: true [2018-02-27 15:52:34:0737] [info] Access denied or UNKNOWN error code on spawn, will be executed again using elevate [2018-02-27 15:52:54:0954] [info] Checking for update

relevent config

   "win": {
      "target": [
        {
          "target": "nsis-web",
          "arch": [
            "x64",
            "ia32"
          ]
        }
      ],
      "icon": "build/icon.ico"
    },
    "nsis": {
      "perMachine": true,
      "oneClick": false,
      "allowToChangeInstallationDirectory": true
    }
  }

@akashnimare
Copy link
Contributor

akashnimare commented Mar 12, 2018

@develar few notes about this issue -

  • The auto-updater, download updates and install it successfully on some windows system but the differential updates don't work on any of the systems.
  • On some system, the updates are not applied, the updater goes into the loop.

Few reports from our users -

I have a user on Windows reporting that the update doesn't actually apply. App stays as v1.8.1. The update popup comes up, and it seems to go well completely through the installer, but when app starts up again, the update popup comes up yet again, and the version is still v1.8.1. He claims it is installing to the right directory (It installs in C:\Program Files)

I just downloaded the windows app, launched, it cited that there was an update needed so I let it run. Now I no longer have permissions to run the file. I'm W10, and an admin on his PC but even trying to forcefully take permissions does not work.

@develar
Copy link
Member

develar commented Mar 26, 2018

Please try electron-updater 2.21.4

@akashnimare
Copy link
Contributor

Thanks, I'll try it out.

@McGvG
Copy link

McGvG commented Jul 5, 2018

@develar I tried out electron-updater 2.21.4 and I'm still getting the issue as described above:
[error] Cannot download differentially, fallback to full download: Error: EPERM: operation not permitted, open 'C:\Program Files (x86)\myTest\package.7z'

@petervanderwalt
Copy link

I think I am seeing the same

I'm on electron-updater 2.23.3

...
New version 1.1.0 has been downloaded to C:\Users\User\AppData\Roaming\OpenBuildsMachineDriver\__update__\OpenBuildsMachineDriver-Setup-1.1.0.exe
Install on explicit quitAndInstall
Install: isSilent: false, isRunAfter: true
Access denied or UNKNOWN error code on spawn, will be executed again using elevate
Update installer has already been triggered. Quitting application.

User@User-PC MINGW64 /c/OPENBUILDS-ENGINEER/SW-Machine-Drivers (master)

And then just nothing>

@petervanderwalt
Copy link

Just to add more info, but we also face the issue only when
"perMachine": true,

@damianobarbati
Copy link

@openbuilds-engineer did you solve this?

@michaelsogos
Copy link

Hi @develar

Did you have any news?
We have the following config:

    "build": {
        "win": {
            "artifactName": "${productName}_setup_${version}.${ext}",
            "requestedExecutionLevel": "highestAvailable",
            "target": [
                {
                    "target": "nsis",
                    "arch": [
                        "x64",
                        "ia32"
                    ]
                }
            ],
            "publish": [
                {
                    "provider": "generic",
                    "url": "http://11111111111:8081/artifactory/h2pos/"
                }
            ]
        },
        "nsis": {
            "allowElevation": true,
            "allowToChangeInstallationDirectory": true,
            "license": "eula.html",
            "oneClick": false,
            "perMachine": true
        },
    },

Electron builder successfully create an EXE file which require UAC permissions, but once electron-updater finish to download the update i can see my EXE installer file (deployed on a generic server) and an not documented file "update-info.json" which contains:

{
  "fileName": "H2Pos_setup_1.7.2-beta.1.exe",
  "sha512": "YmwsZdHqO+aD9PUcTrmJ/DpiuJ/3XFwvQS/xGwPi8MFewL0VHGt9QBc7MZW4+51SMfAKGz8WU9Vk649camEegQ==",
  "isAdminRightsRequired": false
}

When we run quitAndInstall() method, it fail with the error "spawn: … … elevate.exe".
Is possible that the above JSON, at property "isAdminRightsRequired", the value false can impact and UAC refuse to start installer?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants