KittyCAD / modeling-app

The KittyCAD modeling app.
https://kittycad.io/modeling-app/download
MIT License
431 stars 37 forks source link

[BUG]: Upgrade from v0.26.3 to v0.26.4 on Linux not working #4474

Closed r-barton closed 1 week ago

r-barton commented 2 weeks ago

Describe the bug

When attempting to upgrade the modeling app on linux, I end up receiving an error Image

Steps to Reproduce

  1. Download and run Zoo.Modeling.App-0.26.3-x86_64-linux.AppImage
  2. Wait for new version toast to appear
  3. Click on "Restart app now" (nothing happens)
  4. Close app to start new version

Expected Behavior

I've only noticed this happening with v0.26.3 to v0.26.4 version change, but would expect the same behavior with previous linux versions

Screenshots and Recordings

No response

Desktop OS

Ubuntu 22.04 LTS

Browser

Chrome

Version

v0.26.3 -> v0.26.4

Additional Context

No response

lf94 commented 2 weeks ago

Checked it out. It downloads, but the file is apparently already deleted when the updater tries to remove the old version, causing the new version to not be moved. The new version actually exists fully downloaded in ~/.cache , but this failure causes no move.

@pierremtb could you investigate this

lf94 commented 2 weeks ago

That particular error window appears when you exit the application after this failure (already mentioned by Ryan)

pierremtb commented 2 weeks ago

@lf94 Thanks! I'll have a deeper look tonight. I was able to reproduce, some console logs

Install: isSilent: true, isForceRunAfter: false
Error: Error: ENOENT: no such file or directory, unlink '/Users/pierremtb/Downloads/Zoo.Modeling.App-0.26.3-arm64-linux.AppImage'
    at unlinkSync (node:fs:1884:11)
    at AppImageUpdater.doInstall (/tmp/.mount_Zoo.Mo50mn43/resources/app.asar/node_modules/electron-updater/out/AppImageUpdater.js:76:29)
    at AppImageUpdater.install (/tmp/.mount_Zoo.Mo50mn43/resources/app.asar/node_modules/electron-updater/out/BaseUpdater.js:61:25)
    at /tmp/.mount_Zoo.Mo50mn43/resources/app.asar/node_modules/electron-updater/out/BaseUpdater.js:92:18
    at App.<anonymous> (/tmp/.mount_Zoo.Mo50mn43/resources/app.asar/node_modules/electron-updater/out/ElectronAppAdapter.js:38:48)
    at Object.onceWrapper (node:events:634:26)
    at App.emit (node:events:531:35)
updater-error Error: ENOENT: no such file or directory, unlink '/Users/pierremtb/Downloads/Zoo.Modeling.App-0.26.3-arm64-linux.AppImage'
    at unlinkSync (node:fs:1884:11)
    at AppImageUpdater.doInstall (/tmp/.mount_Zoo.Mo50mn43/resources/app.asar/node_modules/electron-updater/out/AppImageUpdater.js:76:29)
    at AppImageUpdater.install (/tmp/.mount_Zoo.Mo50mn43/resources/app.asar/node_modules/electron-updater/out/BaseUpdater.js:61:25)
    at /tmp/.mount_Zoo.Mo50mn43/resources/app.asar/node_modules/electron-updater/out/BaseUpdater.js:92:18
    at App.<anonymous> (/tmp/.mount_Zoo.Mo50mn43/resources/app.asar/node_modules/electron-updater/out/ElectronAppAdapter.js:38:48)
    at Object.onceWrapper (node:events:634:26)
    at App.emit (node:events:531:35) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'unlink',
  path: '/Users/pierremtb/Downloads/Zoo.Modeling.App-0.26.3-arm64-linux.AppImage'
}
pierremtb commented 2 weeks ago

Also noticed that Ubuntu 24.04 is messing with appimages a bit too, had to run this https://github.com/electron/electron/issues/42510#issuecomment-2171583086

pierremtb commented 1 week ago

This is the line that fails https://github.com/electron-userland/electron-builder/blob/master/packages/electron-updater/src/AppImageUpdater.ts#L96

Note that running the exact command provided in the error output in a separate terminal works. Ran a watch command to check that .cache folder for any weirdo file name change but didn't see anything strange. Still unsure what's going on. Will dive in more today.

pierremtb commented 1 week ago

Side note: we have pretty much zero instructions from the download page for Linux, and after trying it out on a few different Ubuntu systems it's pretty annoying to have to copy paste this list of packages I ended up noting down somewhere. We should at least provide this list, but really find a better way to have it auto install. Will create separate issue for this.

sudo apt install zlib1g-dev libfuse2 libnss3 libatk1.0-0 libatk-bridge2.0-0 libcups2 libgtk-3-0 libgbm-dev libasound2 xdg-utils
pierremtb commented 1 week ago

Renaming the initial app image to something like ZMA.AppImage doesn't change anything, still the same error. Was making sure because this is a different code path in the electron-updater code https://github.com/electron-userland/electron-builder/blob/6a6bed46c428b45105ada071a9cb89b5d4f93d9e/packages/electron-updater/src/AppImageUpdater.ts#L89

This is starting to make me go crazy. Stat-ing the file at the same time shows it exists and doesn't change. But mv somehow fails on stat

pierremtb commented 1 week ago

I was starting to wonder if we ever had the updater working on Linux AppImages (I know I never tested it personally, as we went from tauri to electron the only requirement was to keep the previous platforms Windows and macOS to migrate and keep updating to electron builds. But I knew you had tested it at some point @lf94)

Started to go back in time, updater tests on the Release PRs for 0.26.5, 0.26.4 fail in the same way, but 0.26.0 was working. So we had it working at some point post migration. I'll keep testing to pinpoint which release and find a way to bisect on commits after that.

pierremtb commented 1 week ago

The updater-test showed the issue on Cut Release 0.26.3, but not on Cut Release 0.26.2. Finally something to work with

pierremtb commented 1 week ago

Wellllll that's one bit in https://github.com/KittyCAD/modeling-app/compare/v0.26.2...v0.26.3 that is definitely smoking

Image

Reverting that change at https://github.com/KittyCAD/modeling-app/pull/4501/commits/2f708d535d32dcb9ae1d62f74428117d8ca26e28, let's see what the updater-test bundles say once built

pierremtb commented 1 week ago

https://github.com/KittyCAD/modeling-app/pull/4501#issuecomment-2483810703