Trying to build Etcher on Raspberry Pi 4

What’s the easier path here - to try to debug the install via gem, or to play with my apt sources or otherwise get it to install via apt?

the fpm site fpm installation suggests that certain prerequisites may be necessary

apt-get install ruby ruby-dev rubygems build-essential

I get this output:

sudo apt-get install ruby ruby-dev rubygems build-essential
Reading package lists… Done
Building dependency tree
Reading state information… Done
build-essential is already the newest version (12.6).
ruby is already the newest version (1:2.5.1+b1).
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
rubygems : Depends: ruby1.8 but it is not installable
Recommends: ruby1.8-dev but it is not installable
E: Unable to correct problems, you have held broken packages.

Assuming dependencies were met, they say I should be able to install fpm as follows:

sudo gem install --no-ri --no-rdoc fpm
Building native extensions. This could take a while…
ERROR: Error installing fpm:
ERROR: Failed to build gem native extension.
current directory: /var/lib/gems/2.5.0/gems/json-1.8.6/ext/json/ext/generator
/usr/bin/ruby2.5 -r ./siteconf20191102-1666-19q05s7.rb extconf.rb
mkmf.rb can’t find header files for ruby at /usr/lib/ruby/include/ruby.h

extconf failed, exit code 1

Gem files will remain installed in /var/lib/gems/2.5.0/gems/json-1.8.6 for inspection.
Results logged to /var/lib/gems/2.5.0/extensions/arm-linux/2.5.0/json-1.8.6/gem_make.out

Thoughts?

Just to cover our bases, have you tried running apt-get update before the apt-get install command?

try sudo apt install ruby-dev and try again

sudo apt-get install ruby ruby-dev rubygems build-essential
Reading package lists... Done
Building dependency tree       
Reading state information... Done   
build-essential is already the newest version (12.6).
ruby is already the newest version (1:2.5.1+b1).
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 rubygems : Depends: ruby1.8 but it is not installable
        Recommends: ruby1.8-dev but it is not installable 
E: Unable to correct problems, you have held broken packages.

@lucianbuzzo: Yes, this system is kept up to date.

It’s interesting that the error says that rubygems : Depends: ruby1.8.

Because I already have ruby 2.5.5:

pi@pi4:~ $ ruby --version
ruby 2.5.5p157 (2019-03-15 revision 67260) [arm-linux-gnueabihf]

Is the problem that rubygems is somehow needing ruby1.8 SPECIFICALLY?
Or that it’s not recognizing that I already have something more?

As you mentioned above, output of uname -a is Linux pi4 4.19.75-v7l+ #1270 SMP Tue Sep 24 18:51:41 BST 2019 armv7l GNU/Linux so I think you should build the electron for arm instead of arm64 since it’s armv7l.

Can you please try with: ./node_modules/.bin/electron-builder --arm --linux deb and let us know how it goes?

I tried

./node_modules/.bin/electron-builder --arm --linux deb

And it failed with the message:

Unknown argument: arm

It also dumped all the permitted commands, as if I had specified “–help”, and there are clearly only two arm-related choices, which are:

  --armv7l                 Build for armv7l                            [boolean]
  --arm64                  Build for arm64                             [boolean]

So, I’m going to try armv7l, just to see what happens.

When I try armv7l, I get the following, which seems like a lot of successful building followed by a failure to package, trying to run an x86 version of fpm on an arm machine.

pi@pi4:~/Documents/etcher $ ./node_modules/.bin/electron-builder --armv7l --linux deb
Configuring yargs through package.json is deprecated and will be removed in the next major release, please use the JS API instead.
Configuring yargs through package.json is deprecated and will be removed in the next major release, please use the JS API instead.
  • electron-builder version=20.40.2
  • loaded configuration file=/home/pi/Documents/etcher/electron-builder.yml
  • writing effective config file=dist/builder-effective-config.yaml
  • executing node-gyp rebuild arch=armv7l
  • rebuilding native production dependencies platform=linux arch=armv7l
  • packaging       platform=linux arch=armv7l electron=3.1.9 appOutDir=dist/linux-armv7l-unpacked
  • building        target=deb arch=armv7l file=dist/balena-etcher_1.5.60_armv7l.deb
Error: Exit code: 1. Command failed: /home/pi/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/fpm -s dir -t deb --architecture armv7l --name balena-etcher --force --after-install /tmp/t-Bew2la/0-after-install --after-remove /tmp/t-Bew2la/1-after-remove --description balenaEtcher is a powerful OS image flasher built with web technologies to ensure flashing an SDCard or USB drive is a pleasant and safe experience. It protects you from accidentally writing to your hard-drives, ensures every byte of data was written correctly and much more.
 Flash OS images to SD cards and USB drives, safely and easily. --version 1.5.60 --package /home/pi/Documents/etcher/dist/balena-etcher_1.5.60_armv7l.deb --maintainer Balena Inc. <hello@etcher.io> --url https://github.com/balena-io/etcher --vendor Balena Inc. <hello@etcher.io> --category utils --deb-compression xz --deb-priority optional --depends gconf2 --depends gconf-service --depends libappindicator1 --depends libasound2 --depends libatk1.0-0 --depends libc6 --depends libcairo2 --depends libcups2 --depends libdbus-1-3 --depends libexpat1 --depends libfontconfig1 --depends libfreetype6 --depends libgcc1 --depends libgconf-2-4 --depends libgdk-pixbuf2.0-0 --depends libglib2.0-0 --depends libgtk-3-0 --depends liblzma5 --depends libnotify4 --depends libnspr4 --depends libnss3 --depends libpango1.0-0 --depends libstdc++6 --depends libx11-6 --depends libxcomposite1 --depends libxcursor1 --depends libxdamage1 --depends libxext6 --depends libxfixes3 --depends libxi6 --depends libxrandr2 --depends libxrender1 --depends libxss1 --depends libxtst6 --depends polkit-1-auth-agent | policykit-1-gnome | polkit-kde-1 --license Apache-2.0 /home/pi/Documents/etcher/dist/linux-armv7l-unpacked/=/opt/balenaEtcher /home/pi/Documents/etcher/assets/iconset/16x16.png=/usr/share/icons/hicolor/16x16/apps/balena-etcher-electron.png /home/pi/Documents/etcher/assets/iconset/32x32.png=/usr/share/icons/hicolor/32x32/apps/balena-etcher-electron.png /home/pi/Documents/etcher/assets/iconset/48x48.png=/usr/share/icons/hicolor/48x48/apps/balena-etcher-electron.png /home/pi/Documents/etcher/assets/iconset/128x128.png=/usr/share/icons/hicolor/128x128/apps/balena-etcher-electron.png /home/pi/Documents/etcher/assets/iconset/256x256.png=/usr/share/icons/hicolor/256x256/apps/balena-etcher-electron.png /home/pi/Documents/etcher/assets/iconset/512x512.png=/usr/share/icons/hicolor/512x512/apps/balena-etcher-electron.png /tmp/t-Bew2la/2-balenaEtcher.desktop=/usr/share/applications/balena-etcher-electron.desktop
/home/pi/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/lib/ruby/bin/ruby: line 6: /home/pi/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/lib/ruby/bin.real/ruby: cannot execute binary file: Exec format error
/home/pi/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/lib/ruby/bin/ruby: line 6: /home/pi/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/lib/ruby/bin.real/ruby: Success

/home/pi/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/lib/ruby/bin/ruby: line 6: /home/pi/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/lib/ruby/bin.real/ruby: cannot execute binary file: Exec format error
/home/pi/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/lib/ruby/bin/ruby: line 6: /home/pi/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/lib/ruby/bin.real/ruby: Success

    at /home/pi/Documents/etcher/node_modules/builder-util/src/util.ts:126:16
    at ChildProcess.exithandler (child_process.js:301:5)
    at ChildProcess.emit (events.js:189:13)
    at maybeClose (internal/child_process.js:970:16)
    at Socket.stream.socket.on (internal/child_process.js:389:11)
    at Socket.emit (events.js:189:13)
    at Pipe._handle.close (net.js:600:12)
From previous event:
    at FpmTarget.build (/home/pi/Documents/etcher/node_modules/app-builder-lib/src/targets/fpm.ts:93:44)
    at /home/pi/Documents/etcher/node_modules/app-builder-lib/src/platformPackager.ts:131:24
From previous event:
    at AsyncTaskManager.add (/home/pi/Documents/etcher/node_modules/builder-util/src/asyncTaskManager.ts:14:20)
    at LinuxPackager.packageInDistributableFormat (/home/pi/Documents/etcher/node_modules/app-builder-lib/src/platformPackager.ts:123:17)
    at /home/pi/Documents/etcher/node_modules/app-builder-lib/src/platformPackager.ts:114:10
    at Generator.next (<anonymous>)
    at runCallback (timers.js:705:18)
    at tryOnImmediate (timers.js:676:5)
    at processImmediate (timers.js:658:5)
From previous event:
    at LinuxPackager.pack (/home/pi/Documents/etcher/node_modules/app-builder-lib/src/platformPackager.ts:111:95)
    at /home/pi/Documents/etcher/node_modules/app-builder-lib/src/packager.ts:430:24
    at Generator.next (<anonymous>)
    at xfs.stat (/home/pi/Documents/etcher/node_modules/fs-extra-p/node_modules/fs-extra/lib/mkdirs/mkdirs.js:56:16)
    at /home/pi/Documents/etcher/node_modules/graceful-fs/polyfills.js:285:20
    at FSReqWrap.oncomplete (fs.js:155:5)
From previous event:
    at Packager.doBuild (/home/pi/Documents/etcher/node_modules/app-builder-lib/src/packager.ts:396:24)
    at /home/pi/Documents/etcher/node_modules/app-builder-lib/src/packager.ts:366:57
    at Generator.next (<anonymous>)
    at /home/pi/Documents/etcher/node_modules/graceful-fs/graceful-fs.js:111:16
    at /home/pi/Documents/etcher/node_modules/graceful-fs/graceful-fs.js:45:10
    at FSReqWrap.oncomplete (fs.js:141:20)
From previous event:
    at Packager._build (/home/pi/Documents/etcher/node_modules/app-builder-lib/src/packager.ts:335:133)
    at /home/pi/Documents/etcher/node_modules/app-builder-lib/src/packager.ts:331:23
    at Generator.next (<anonymous>)
    at runCallback (timers.js:705:18)
    at tryOnImmediate (timers.js:676:5)
    at processImmediate (timers.js:658:5)
From previous event:
    at Packager.build (/home/pi/Documents/etcher/node_modules/app-builder-lib/src/packager.ts:288:14)
    at build (/home/pi/Documents/etcher/node_modules/app-builder-lib/src/index.ts:59:28)
    at build (/home/pi/Documents/etcher/node_modules/electron-builder/src/builder.ts:228:10)
    at then (/home/pi/Documents/etcher/node_modules/electron-builder/src/cli/cli.ts:46:19)

and, as previous posts have covered, so far I haven’t been able to get a proper fpm.

I’ve asked for help with this on the Raspberry Pi forum - perhaps they can help me get a working fpm installed, and then I can get back here to continue the build, trying @shaunmulligan’s tip about pointing to a local fpm.

Hello everyone,
It seems that another user successfully built a debian package for rpi4, you can check the forum thread here
@futurejones If you’re willing to give some feedback about the issues you encountered and how you overcame them, even if they made you switch to another path, that would be highly appreciated so we can hopefully enhance the documentation with the missing pieces and/or investigate more!

@thundron, I am working on that now. When I have successfully reproduced all the build steps I will post details.

In pursuit of getting a native fpm installed, I did the following:

It seemed that I couldn’t get rubygems via apt because the debian/apt dependencies were messed up, so I got it the ruby way:

sudo gems update --system

This got me RubyGems 3.0.6

Install ruby header files:

sudo apt install ruby-dev

This then allowed me to install fpm, the package tool I think I need to package the .deb:

sudo gem install fpm

Now trying the workaround to use the native fpm, that @shaunmulligan suggested:

USE_SYSTEM_FPM="true" ./node_modules/.bin/electron-builder --armv7l --linux deb

pi@pi4:~/Documents/etcher $ USE_SYSTEM_FPM="true" ./node_modules/.bin/electron-builder --armv7l --linux deb
Configuring yargs through package.json is deprecated and will be removed in the next major release, please use the JS API instead.
Configuring yargs through package.json is deprecated and will be removed in the next major release, please use the JS API instead.
  • electron-builder version=20.40.2
  • loaded configuration file=/home/pi/Documents/etcher/electron-builder.yml
  • writing effective config file=dist/builder-effective-config.yaml
  • executing node-gyp rebuild arch=armv7l
  • rebuilding native production dependencies platform=linux arch=armv7l
  • packaging       platform=linux arch=armv7l electron=3.1.9 appOutDir=dist/linux-armv7l-unpacked
  • building        target=deb arch=armv7l file=dist/balena-etcher_1.5.60_armv7l.deb


   ╭─────────────────────────────────────────────────╮
   │                                                 │
   │       Update available 20.40.2 → 22.1.0         │
   │   Run yarn upgrade electron-builder to update   │
   │                                                 │
   ╰─────────────────────────────────────────────────╯

Now, I’ll have to try that deb…

I get errors:

Installing /var/cache/apt/archives/partial/balena-etcher_1.5.60_armv7l.deb
tar: Archive is compressed. Use -J option
tar: Error is not recoverable: exiting now
dpkg-deb: error: tar subprocess returned error exit status 2
dpkg: error processing archive /var/cache/apt/archives/partial/balena-etcher_1.5.60_armv7l.deb (--install):
 dpkg-deb --control subprocess returned error exit status 2
Errors were encountered while processing:
 /var/cache/apt/archives/partial/balena-etcher_1.5.60_armv7l.deb

Looking up about tar and -J, I found the following in the tar man page:

-J, --xz
Filter the archive through xz(1).

But I don’t know how to filter such a command into the installation process.

Looks like https://github.com/jordansissel/fpm/issues/1612 to me. So it’s a fpm issue again :confused:

As @robertgzr said, this is a known fpm-1.11.0 problem
https://github.com/jordansissel/fpm/issues/1612

fix by rolling back fpm to 1.10.2
	see https://stackoverflow.com/questions/17026441/how-to-install-a-specific-version-of-a-ruby-gem#17026442
	gem uninstall fpm
	gem install fpm -v 1.10.2

That builds OK (but so did the newer fpm, it just wouldn’t install!)

pi@pi4:~/Documents/etcher $ USE_SYSTEM_FPM="true" ./node_modules/.bin/electron-builder --armv7l --linux deb
Configuring yargs through package.json is deprecated and will be removed in the next major release, please use the JS API instead.
Configuring yargs through package.json is deprecated and will be removed in the next major release, please use the JS API instead.
  • electron-builder version=20.40.2
  • loaded configuration file=/home/pi/Documents/etcher/electron-builder.yml
  • writing effective config file=dist/builder-effective-config.yaml
  • executing node-gyp rebuild arch=armv7l
  • rebuilding native production dependencies platform=linux arch=armv7l
  • packaging       platform=linux arch=armv7l electron=3.1.9 appOutDir=dist/linux-armv7l-unpacked
  • building        target=deb arch=armv7l file=dist/balena-etcher_1.5.60_armv7l.deb


   ╭─────────────────────────────────────────────────╮
   │                                                 │
   │       Update available 20.40.2 → 21.2.0         │
   │   Run yarn upgrade electron-builder to update   │
   │                                                 │
   ╰─────────────────────────────────────────────────╯

Well, that gets farther, at least it doesn’t complain as it did before. But…

pi@pi4:~/Documents/etcher/dist $ sudo apt install  /var/cache/apt/archives/partial/balena-etcher_1.5.60_armv7l.deb 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'balena-etcher:armv7l' instead of '/var/cache/apt/archives/partial/balena-etcher_1.5.60_armv7l.deb'
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 balena-etcher:armv7l : Depends: libappindicator1:armv7l but it is not installable
                        Depends: libasound2:armv7l but it is not installable
                        Depends: libatk1.0-0:armv7l but it is not installable
                        Depends: libc6:armv7l but it is not installable
                        Depends: libcairo2:armv7l but it is not installable
                        Depends: libcups2:armv7l but it is not installable
                        Depends: libdbus-1-3:armv7l but it is not installable
                        Depends: libexpat1:armv7l but it is not installable
                        Depends: libfontconfig1:armv7l but it is not installable
                        Depends: libfreetype6:armv7l but it is not installable
                        Depends: libgcc1:armv7l but it is not installable
                        Depends: libgconf-2-4:armv7l but it is not installable
                        Depends: libgdk-pixbuf2.0-0:armv7l but it is not installable
                        Depends: libglib2.0-0:armv7l but it is not installable
                        Depends: libgtk-3-0:armv7l but it is not installable
                        Depends: liblzma5:armv7l but it is not installable
                        Depends: libnotify4:armv7l but it is not installable
                        Depends: libnspr4:armv7l but it is not installable
                        Depends: libnss3:armv7l but it is not installable
                        Depends: libpango1.0-0:armv7l but it is not installable
                        Depends: libstdc++6:armv7l but it is not installable
                        Depends: libx11-6:armv7l but it is not installable
                        Depends: libxcomposite1:armv7l but it is not installable
                        Depends: libxcursor1:armv7l but it is not installable
                        Depends: libxdamage1:armv7l but it is not installable
                        Depends: libxext6:armv7l but it is not installable
                        Depends: libxfixes3:armv7l but it is not installable
                        Depends: libxi6:armv7l but it is not installable
                        Depends: libxrandr2:armv7l but it is not installable
                        Depends: libxrender1:armv7l but it is not installable
                        Depends: libxss1:armv7l but it is not installable
                        Depends: libxtst6:armv7l but it is not installable
E: Unable to correct problems, you have held broken packages.