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

BUG: `ar`/`fpm` fails during linux build

Open Bug-Reaper opened this issue 1 year ago • 13 comments

  • Electron-Builder Version: 24.13.3
  • Node Version: v16.20.2
  • Electron Version: 29.4.5
  • Target: ARM64 Linux

Trying to build my large electron app for debian (total packaged sized is ~4Gib). I get an error when running: DEBUG=electron-builder:* electron-builder --linux --arm64 --config the.spice.must.flow.cjs.

The ar/fpm commands seems to sh*t the bed? Kinda looks like maybe a corrupt workingDir (see error textworkingDir=)? Or possibly just some edge-case since my app is quite large. The fact I get different errors sometimes also smells race-condition-y.

FPM Error

 ⨯ cannot execute  cause=exit status 1
                    out={:timestamp=>"2024-09-08T12:40:40.513518-0400", :message=>"Setting workdir", :workdir=>"/var/folders/lx/3zfzg6xd4_l1lzqbl04kb22h0000gn/T", :level=>:info, :file=>"/Users/llama/Library/Caches/electron-builder/fpm/fpm-1.9.3-20150715-2.2.2-mac/lib/app/lib/fpm/command.rb", :line=>"294", :method=>"execute"}
    {:timestamp=>"2024-09-08T12:40:40.514008-0400", :message=>"Setting attribute", :output_type=>"deb", :level=>:debug, :file=>"/Users/llama/Library/Caches/electron-builder/fpm/fpm-1.9.3-20150715-2.2.2-mac/lib/app/lib/fpm/command.rb", :line=>"338", :method=>"block (2 levels) in execute"}
    {:timestamp=>"2024-09-08T12:40:40.514073-0400", :message=>"Setting attribute", :input_type=>"dir", :level=>:debug, :file=>"/Users/llama/Library/Caches/electron-builder/fpm/fpm-1.9.3-20150715-2.2.2-mac/lib/app/lib/fpm/command.rb", :line=>"338", :method=>"block (2 levels) in execute"}

    ...A lot more logs like above..

AR Error

⨯ cannot execute  cause=exit status 1
                    out={:timestamp=>"2024-09-07T20:55:12.296629-0400", :message=>"Debian packaging tools generally labels all files in /etc as config files, as mandated by policy, so fpm defaults to this behavior for deb packages. You can disable this default behavior with --deb-no-default-config-files flag", :level=>:warn}
    {:timestamp=>"2024-09-07T20:58:54.087859-0400", :message=>"Process failed: ar failed (exit code 1). Full command was:[\"ar\", \"-qc\", \"/Users/llama/Sorcery/releaseday/soundsafari/dist/soundsafari_0.0.0_arm64.deb\", \"debian-binary\", \"control.tar.gz\", \"/var/folders/lx/3zfzg6xd4_l1lzqbl04kb22h0000gn/T/package-deb-build-da69da7c67dbde14e317f0e9bc2e87b96ea0cd2d4a3622bfe2c477b2b469/data.tar.xz\"]", :level=>:error}

Does anyone know how to run the build such that I can see the stderr from ar/fpm during build?

Also curious if this might be a downstream issue with some dep-library used for linux builds?

Bug-Reaper avatar Sep 08 '24 19:09 Bug-Reaper

Do you have a sample repo to repro this with? Wondering if this related to some custom configuration you have.

"Debian packaging tools generally labels all files in /etc as config files, as mandated by policy,

mmaietta avatar Sep 09 '24 00:09 mmaietta

@mmaietta I don't off-hand have something to reproduce this, may spin something up if I have the time.

Not sure what's going on here but the build I did some digging, there's a few open issues I might tag here.


My project size shouldn't be a related cause of issue. There's some talk about ~10Gib max file-size b/c of ar archive limitations:

"File sizes are limited to 10 ASCII decimal digits, allowing for up to approximately 9536.74 MiB member files."

I also tried forcing a newer version of fpm but received the same error.


I recently discovered that despite the above error ⨯ cannot execute cause=exit status 1 the build command actually does produce a valid .deb that I was able to install on ARM flavored Ubuntu with no issue. Leads me to believe ar can potentially exit with code 1 even when successful or some other madness.

Also I just checked and my build contains no files or folders named or including the string "etc" assuming unrelated for now but good call-out.

Bug-Reaper avatar Sep 12 '24 08:09 Bug-Reaper

Do you know a way to not clean-up failed build temp files so that I can manually attempt to re-run the last failed command?

Bug-Reaper avatar Sep 12 '24 08:09 Bug-Reaper

The easiest route is to probably just patch cleanup and cleanupSync in node_modules/temp-file/out/main.js subdependency with a return as the first line of the function, as that's the package that electron-builder is leveraging under-the-hood (npm package temp-file)

Build paths should also be easy to find with the env var DEBUG=electron-builder set. I've tried to maintain+add logging to make things like this easier. If anything is missing for your debugging, let me know and I can add some additional logging for the next release

mmaietta avatar Sep 12 '24 16:09 mmaietta

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.

github-actions[bot] avatar Mar 27 '25 00:03 github-actions[bot]

Ohh this definitely still impacts me GH actions bot!

It's annoying b/c the build does succeed so the benefit to solving this is low. I do get a little bit better each time I try to fix these deeper build problems. Can hopefully give this some cycles in a couple of weeks.

Bug-Reaper avatar Mar 29 '25 01:03 Bug-Reaper

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.

github-actions[bot] avatar Apr 30 '25 00:04 github-actions[bot]

I get same err:

running electron-builder with arguments: --linux,deb,--publish,never
  • electron-builder  version=26.0.12 os=6.11.0-1012-azure
  • loaded configuration  file=/home/runner/work/openblock-desktop/openblock-desktop/electron-builder.yaml
  • loaded parent configuration  file=/home/runner/work/openblock-desktop/openblock-desktop/node_modules/electron-webpack/out/electron-builder.js
  • executing @electron/rebuild  electronVersion=15.5.7 arch=x64 buildFromSource=false appDir=./
  • installing native dependencies  arch=x64
  • preparing       moduleName=@serialport/bindings-cpp arch=x64
  • finished        moduleName=@serialport/bindings-cpp arch=x64
  • completed installing native dependencies
  • packaging       platform=linux arch=x64 electron=15.5.7 appOutDir=dist/linux-unpacked
  • downloading     url=https://github.com/electron/electron/releases/download/v15.5.7/electron-v15.5.7-linux-x64.zip size=82 MB parts=8
  • downloaded      url=https://github.com/electron/electron/releases/download/v15.5.7/electron-v15.5.7-linux-x64.zip duration=906ms
  • building        target=deb arch=x64 file=dist/OpenBlock-Desktop_v2.5.4_linux_amd64.deb
  • adding autoupdate files for: deb. (Beta feature)  resourceDir=dist/linux-unpacked/resources
  • downloading     url=https://github.com/electron-userland/electron-builder-binaries/releases/download/fpm-1.9.3-2.3.1-linux-x86_64/fpm-1.9.3-2.3.1-linux-x86_64.7z size=5.0 MB parts=1
  • downloaded      url=https://github.com/electron-userland/electron-builder-binaries/releases/download/fpm-1.9.3-2.3.1-linux-x86_64/fpm-1.9.3-2.3.1-linux-x86_64.7z duration=466ms
  ⨯ cannot execute  cause=exit status 1
                    out={:timestamp=>"2025-05-05T02:30:46.065850+0000", :message=>"Debian packaging tools generally labels all files in /etc as config files, as mandated by policy, so fpm defaults to this behavior for deb packages. You can disable this default behavior with --deb-no-default-config-files flag", :level=>:warn}
    {:timestamp=>"2025-05-05T02:36:44.539350+0000", :message=>"Process failed: ar failed (exit code 1). Full command was:[\"ar\", \"-qc\", \"/home/runner/work/openblock-desktop/openblock-desktop/dist/OpenBlock-Desktop_v2.5.4_linux_amd64.deb\", \"debian-binary\", \"control.tar.gz\", \"/tmp/package-deb-build-41b5c13c4a67647c40176ed29cb333b9f16fbfe84384825c7234bd90890b/data.tar.gz\"]", :level=>:error}
    
                    command=/home/runner/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86_64/fpm -s dir --force -t deb -d libnotify4 -d libxtst6 -d libnss3 --deb-recommends libappindicator3-1 --deb-compression gz --architecture amd64 --after-install /tmp/t-LefXDZ/0-after-install --after-remove /tmp/t-LefXDZ/1-after-remove --description '
     OpenBlock as a self-contained desktop application' --version 2.5.4 --package /home/runner/work/openblock-desktop/openblock-desktop/dist/OpenBlock-Desktop_v2.5.4_linux_amd64.deb --name openblock-desktop --maintainer 'Openblock.cc Team <[email protected]>' --url 'https://github.com/openblockcc/openblock-desktop#readme' --vendor 'Openblock.cc Team <[email protected]>' --deb-priority optional --license MIT /home/runner/work/openblock-desktop/openblock-desktop/dist/linux-unpacked/=/opt/OpenBlockDesktop /home/runner/work/openblock-desktop/openblock-desktop/buildResources/linux/512x512.png=/usr/share/icons/hicolor/512x512/apps/openblock-desktop.png /tmp/t-LefXDZ/5-OpenBlockDesktop.desktop=/usr/share/applications/openblock-desktop.desktop
                    workingDir=
/home/runner/work/openblock-desktop/openblock-desktop/scripts/electron-builder-wrapper.js:96
        throw new Error(`Child process returned status code ${result.status}`);
        ^

Error: Child process returned status code 1
    at runBuilder (/home/runner/work/openblock-desktop/openblock-desktop/scripts/electron-builder-wrapper.js:96:15)
    at main (/home/runner/work/openblock-desktop/openblock-desktop/scripts/electron-builder-wrapper.js:233:9)
    at Object.<anonymous> (/home/runner/work/openblock-desktop/openblock-desktop/scripts/electron-builder-wrapper.js:237:1)
    at Module._compile (node:internal/modules/cjs/loader:1198:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1252:10)
    at Module.load (node:internal/modules/cjs/loader:1076:32)
    at Function.Module._load (node:internal/modules/cjs/loader:911:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:22:47

zhengyangliu avatar May 05 '25 03:05 zhengyangliu

@zhengyangliu how big is your final target installer, did it successfully build even with the error?

Bug-Reaper avatar May 09 '25 01:05 Bug-Reaper

@zhengyangliu您的最终目标安装程序有多大,即使出现错误它是否成功构建?

The capacity before packaging is about 6.7G, and after packaging is about 1G. The build is actually successful, so I currently use a patch file to let the script ignore the error so that CI can continue.

The following is the error ci before the patch file is applyed: https://github.com/openblockcc/openblock-desktop/actions/runs/14821297515/job/41609407659

zhengyangliu avatar May 09 '25 14:05 zhengyangliu

This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment, or this will be closed in 30 days.

github-actions[bot] avatar Jun 09 '25 00:06 github-actions[bot]

Curious if upgrading fpm and portable ruby bundle in https://github.com/electron-userland/electron-builder/pull/9100 will resolve this issue.

mmaietta avatar Jun 09 '25 15:06 mmaietta

@mmaietta it sounds worth a shot.

Next build I'll give it a go 🤲!

Bug-Reaper avatar Jun 10 '25 01:06 Bug-Reaper

This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment, or this will be closed in 30 days.

github-actions[bot] avatar Jul 12 '25 00:07 github-actions[bot]

Still affected, will hopefully test within the next 30 days actions bot

Bug-Reaper avatar Jul 23 '25 02:07 Bug-Reaper

This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment, or this will be closed in 30 days.

github-actions[bot] avatar Aug 24 '25 00:08 github-actions[bot]

This issue was closed because it has been stalled for 30 days with no activity.

github-actions[bot] avatar Sep 24 '25 00:09 github-actions[bot]

Still affected here :(

"electron": "38.2.0", "electron-builder": "26.0.12"

Same: build + publish succeed, but the CI/CD job / action fails.

So there's no way to disable this autoupdate thing? Where's the documentation for this beta feature?

yphil-dev avatar Oct 02 '25 13:10 yphil-dev

Can you please try 26.0.20? fpm was upgraded in 26.0.18

mmaietta avatar Oct 02 '25 14:10 mmaietta