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

AppImage files no longer runnable after upgrading to Electron-Builder@23.0.0 #6678

Closed
Nantris opened this issue Feb 24, 2022 · 28 comments · Fixed by #6684 or #6695
Closed

AppImage files no longer runnable after upgrading to Electron-Builder@23.0.0 #6678

Nantris opened this issue Feb 24, 2022 · 28 comments · Fixed by #6684 or #6695
Assignees

Comments

@Nantris
Copy link

Nantris commented Feb 24, 2022

  • Electron-Builder Version: 23.0.0
  • Node Version: 14.17.6
  • Electron Version: 17.0.0
  • Electron Type (current, beta, nightly): Current/stable
  • Target: Linux AppImage

Newly generated AppImage executables throw an error when executed: "Cannot mount AppImage, please check your FUSE setup"

Upon downgrading to 22.x.x, the AppImage executables work perfectly again.

@Nantris Nantris changed the title AppImages no longer buildable after upgrading to Electron-Builder@23.0.0 AppImages no longer runnable after upgrading to Electron-Builder@23.0.0 Feb 24, 2022
@Nantris Nantris changed the title AppImages no longer runnable after upgrading to Electron-Builder@23.0.0 AppImage files no longer runnable after upgrading to Electron-Builder@23.0.0 Feb 24, 2022
@mmaietta
Copy link
Collaborator

mmaietta commented Feb 25, 2022

The only thing I can find that could potentially be related is updating upstream dependency, app-builder-bin, which was upgraded to support Snap compression IIRC v22.14.13...v23.0.0 packages/builder-util/package.json
No other files re: AppImage were touched during the upgrade from 22.14.13 to 23

Regarding the error, I did a quick search for other ways to resolve it and found this: https://www.reddit.com/r/debian/comments/k1kt96/comment/gdp80yp
Have you tried this approach?

@Nantris
Copy link
Author

Nantris commented Feb 25, 2022

Thanks for the reply and research!

The AppImages are not runnable on other machines I have either. I came across that thread, but it doesn't seem related, and indeed does not fix it.

Downgrading to 22.14.13 and rebuilding immediately fixes the issue.

I do recall seeing something about downloading app-builder-bin, I think, on the first run with 23.0.0

OS are Kubuntu 21.10 and Mint 20.2.

@mmaietta
Copy link
Collaborator

I think it might be this commit on app-builder-bin?
develar/app-builder@c24d1b5
Commit title has AppImage runtime 13

I honestly don't know a thing about AppImages

@lyswhut
Copy link

lyswhut commented Feb 26, 2022

Same problem in v23.0.1
System: Ubuntu 18.10

image

Alert link: https://github.com/AppImage/AppImageKit/wiki/FUSE

@mmaietta
Copy link
Collaborator

Curious if your issue is related to #6624
Does building with Electron 16 succeed?

@lyswhut
Copy link

lyswhut commented Feb 28, 2022

I tried builds of appImage versions of electron 13.6.8, 13.6.9, 16.0.8, none of them work:

Squashfs image uses (null) compression, this version supports only xz, zlib.

Cannot mount AppImage, please check your FUSE setup.
You might still be able to extract the contents of this AppImage 
if you run it with the --appimage-extract option. 
See https://github.com/AppImage/AppImageKit/wiki/FUSE 
for more information
open dir error: No such file or directory

This doesn't seem to be related to electron, falling back to electron-builder 22.x.x works again

@mmaietta
Copy link
Collaborator

I'm wondering if compression is no longer optional param. Could you give this patch a try using patch-package? That should unblock you for the interim

app-builder-lib+23.0.1.patch

diff --git a/node_modules/app-builder-lib/out/targets/AppImageTarget.js b/node_modules/app-builder-lib/out/targets/AppImageTarget.js
index 31344b3..0be0fe4 100644
--- a/node_modules/app-builder-lib/out/targets/AppImageTarget.js
+++ b/node_modules/app-builder-lib/out/targets/AppImageTarget.js
@@ -75,13 +75,12 @@ class AppImageTarget extends core_1.Target {
                 fileAssociations: this.packager.fileAssociations,
                 ...options,
             }),
+            "--compression",
+            packager.compression === "maximum" ? "xz" : "zlib",
         ];
         appBuilder_1.objectToArgs(args, {
             license,
         });
-        if (packager.compression === "maximum") {
-            args.push("--compression", "xz");
-        }
         await packager.info.callArtifactBuildCompleted({
             file: artifactPath,
             safeArtifactName: packager.computeSafeArtifactName(artifactName, "AppImage", arch, false),

@lyswhut
Copy link

lyswhut commented Feb 28, 2022

@mmaietta Build fails after applying patch:

  • electron-builder  version=23.0.1 os=4.18.0-15-generic
  • loaded configuration  file=package.json ("build" field)
  • writing effective config  file=build/builder-effective-config.yaml
  • rebuilding native dependencies  dependencies=bufferutil@4.0.6, utf-8-validate@5.0.8 platform=linux arch=x64
  • packaging       platform=linux arch=x64 electron=13.6.9 appOutDir=build/linux-unpacked
  • building        target=AppImage arch=x64 file=build/lx-music-desktop v1.18.0 x64.AppImage
  ⨯ enum value must be one of xz,gzip, got 'zlib'  
  ⨯ /home/user/app/lxm/node_modules/app-builder-bin/linux/x64/app-builder process failed ERR_ELECTRON_BUILDER_CANNOT_EXECUTE

packager.compression is normal

@lyswhut
Copy link

lyswhut commented Feb 28, 2022

I hardcoded --compression as gzip:

diff --git a/node_modules/app-builder-lib/out/targets/AppImageTarget.js b/node_modules/app-builder-lib/out/targets/AppImageTarget.js
index 31344b3..0be0fe4 100644
--- a/node_modules/app-builder-lib/out/targets/AppImageTarget.js
+++ b/node_modules/app-builder-lib/out/targets/AppImageTarget.js
@@ -75,13 +75,12 @@ class AppImageTarget extends core_1.Target {
                 fileAssociations: this.packager.fileAssociations,
                 ...options,
             }),
+            "--compression",
+           "gzip",
         ];
         appBuilder_1.objectToArgs(args, {
             license,
         });
-        if (packager.compression === "maximum") {
-            args.push("--compression", "xz");
-        }
         await packager.info.callArtifactBuildCompleted({
             file: artifactPath,
             safeArtifactName: packager.computeSafeArtifactName(artifactName, "AppImage", arch, false),

and then get the following error:

  • electron-builder  version=23.0.1 os=4.18.0-15-generic
  • loaded configuration  file=package.json ("build" field)
  • writing effective config  file=build/builder-effective-config.yaml
  • rebuilding native dependencies  dependencies=bufferutil@4.0.6, utf-8-validate@5.0.8 platform=linux arch=x64
  • packaging       platform=linux arch=x64 electron=13.6.9 appOutDir=build/linux-unpacked
  • building        target=AppImage arch=x64 file=build/lx-music-desktop v1.18.0 x64.AppImage
  ⨯ cannot execute  cause=exit status 1
                    errorOut=/home/user/.cache/electron-builder/appimage/appimage-13.0.0/linux-x64/mksquashfs: Compressor "gzip" is not supported!
    /home/user/.cache/electron-builder/appimage/appimage-13.0.0/linux-x64/mksquashfs: Compressors available:
    	lzo
    	xz
    	zstd (default)
    
                    command=/home/user/.cache/electron-builder/appimage/appimage-13.0.0/linux-x64/mksquashfs '/home/user/app/lxm/build/__appImage-x64' '/home/user/app/lxm/build/lx-music-desktop v1.18.0 x64.AppImage' -offset 189632 -all-root -noappend -no-progress -quiet -no-xattrs -no-fragments -comp gzip
                    workingDir=/home/user/app/lxm/build/__appImage-x64

Hardcoding --compression as xz, it can be compiled and run successfully, but the APP startup is very slow

@mscharley
Copy link

Seconding the slow startup with xz compression, for my app the startup is several orders of magnitude slower with the xz appimage, ~15 seconds to hit application code and a further ~30 seconds to initialise and show the first window instead of around 0.4 seconds for the entire boot up phase to complete using the unpacked linux folder distribution.

@mmaietta yes, this is exactly the issue I've been having with #6624, you're correct.

@Nantris
Copy link
Author

Nantris commented Mar 1, 2022

Ah this does seem a duplicate of #6624. I'll leave it to @mmaietta to decide whether to close this issue and consolidate the discussion.

@mmaietta
Copy link
Collaborator

mmaietta commented Mar 2, 2022

I think if we can downgrade app-builder-bin to 4.0.0, that might resolve the issue since that predates the compression enum changes I think
I'm purely basing it off of the two app-builder-bin releases that were 6mo ago seem to align with the two commits here: https://github.com/develar/app-builder/commits/master

Either that, or we have to rollback to 3.x and hopefully not remove any recently introduced features.

@lyswhut
Copy link

lyswhut commented Mar 2, 2022

I can attest that downgrading app-builder-bin to 4.0.0 works:

  1. cd node_modules/builder-util
  2. npm install app-builder-bin@4.0.0
  3. Build your AppImage package

@mscharley
Copy link

That hack didn't work for me, with no compression setting enabled:

> electron-builder --publish never

  • electron-builder  version=23.0.1 os=5.15.25-1-lts
  • loaded configuration  file=/home/mscharley/Code/mscharley/notes-nc/electron-builder.yml
  • writing effective config  file=dist/builder-effective-config.yaml
  • packaging       platform=linux arch=x64 electron=17.1.0 appOutDir=dist/linux-unpacked
  • building        target=AppImage arch=x64 file=dist/notes-nc-0.3.0.AppImage
  • default Electron icon is used  reason=application icon is not set
  ⨯ enum value must be one of xz,gzip, got 'zlib'
  ⨯ /home/mscharley/Code/mscharley/notes-nc/node_modules/builder-util/node_modules/app-builder-bin/linux/x64/app-builder process failed ERR_ELECTRON_BUILDER_CANNOT_EXECUTE
Exit code:
1  failedTask=build stackTrace=Error: /home/mscharley/Code/mscharley/notes-nc/node_modules/builder-util/node_modules/app-builder-bin/linux/x64/app-builder process failed ERR_ELECTRON_BUILDER_CANNOT_EXECUTE

With compression: maximum enabled it builds fine, as it does without this hack applied.

@mscharley
Copy link

Never mind, I still had the patch applied that mmaietta asked me to try. With a fresh node_modules folder it's working for me as well. I haven't tried snaps though, only appimage.

@lyswhut
Copy link

lyswhut commented Mar 2, 2022

If you applied the app-builder-lib+23.0.1.patch patch before, you need to reinstall electron-builder:

  1. npm r electron-builder
  2. npm i electron-builder@23 -D
  3. cd node_modules/builder-util
  4. npm i app-builder-bin@4.0.0
  5. Build your AppImage package

@mmaietta
Copy link
Collaborator

mmaietta commented Mar 2, 2022

@slapbox Would you be willing to open a ticket/issue in the app-builder repo regarding the broken appimage for app-builder-bin 4.0.1? We'll want to have this tracked there as well as we're effectively blocked on upgrading to future versions of app-builder-bin.

I'll downgrade app-builder-bin to 4.0.0, it looks like it may drop snap lzo support though. Oh well...previous functionality shouldn't be broken.

@Nantris
Copy link
Author

Nantris commented Mar 2, 2022

@mmaietta I'll be happy to help out however I can, but I'm not sure what repo corresponds to the npm package, because none is listed: https://www.npmjs.com/package/app-builder-bin

Can you advise?

Thank you for your hard work, it's truly appreciated.

@mmaietta
Copy link
Collaborator

mmaietta commented Mar 3, 2022

Nvm, I took a stab at it just by reading the error logs. I think it'll fix it, but as the PR says, I have no idea how to test it.
PR develar/app-builder#77

@develar please take a look when you have a chance, that way we can have a proper fix in electron-builder without reverting lzo feature introduction.

@mmaietta mmaietta self-assigned this Mar 3, 2022
develar pushed a commit to develar/app-builder that referenced this issue Mar 3, 2022
@mmaietta
Copy link
Collaborator

mmaietta commented Mar 3, 2022

@lyswhut @slapbox could you please try using 4.1.1? 🤞 that fixed the issue

cd node_modules/builder-util
npm i app-builder-bin@4.1.1

@Nantris
Copy link
Author

Nantris commented Mar 3, 2022

@mmaietta thanks for your continuing work on this!

I'm sorry to report that using yarn's resolutions to pin app-builder-bin to 4.1.1 across our project didn't fix the issue - we still get the message about "please check your FUSE setup."

Here's the output of yarn why app-builder-bin, to show that only 4.1.1 is installed:
image

@mmaietta
Copy link
Collaborator

mmaietta commented Mar 3, 2022

Is there any additional info to the error? Something like this? Squashfs image uses (null) compression, this version supports only xz, zlib.

@Nantris
Copy link
Author

Nantris commented Mar 3, 2022

Unfortunately not, it seems. I'm checking the system logs - but maybe there's somewhere else I should look?

All I see in the system logs is this line, immediately after the app fails to start:

3/3/22 4:02 PM ubuntu systemd[977] app-\x2fhome\x2fme\x2fDesktop\x2ftemp\x2fBroken-23c77109fa4c4b7f9aa6529ae8d59c07.scope: Deactivated successfully.


Edit: Running it directly from the terminal like ./Our-Broken.AppImage outputs what you expected:

Squashfs image uses (null) compression, this version supports only xz, zlib.

Cannot mount AppImage, please check your FUSE setup.
You might still be able to extract the contents of this AppImage
if you run it with the --appimage-extract option.
See https://github.com/AppImage/AppImageKit/wiki/FUSE
for more information
open dir error: No such file or directory

@mscharley
Copy link

@mmaietta same results here. I even tried applying your patches so that there's always a compression option passed through. Good news, both lzo and zstd work as options to the build but zstd produces the expected Squashfs image uses (null) compression, this version supports only xz, zlib. message as the old default, and lzo produces Squashfs image uses lzo compression, this version supports only xz, zlib.

@mscharley
Copy link

For what it's worth, I'm running Arch Linux and Slapbox appears to be using Ubuntu and AppImages are supposed to be fully self-contained anyway so I don't think there's anything distribution specific going on here.

@lyswhut
Copy link

lyswhut commented Mar 4, 2022

Thanks for your work, but 4.1.1 still doesn't work, the error message looks the same as 4.1.0, go back to 4.0.0 for it to work:

image

@mmaietta
Copy link
Collaborator

mmaietta commented Mar 4, 2022

Thanks for the updates.

Downgrading to 4.0.0 breaks a bunch of other tests with snaps, I'm still trying to figure out a graceful downgrade.

@mmaietta
Copy link
Collaborator

mmaietta commented Mar 6, 2022

Published in v23.0.2 🙂

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