3

I am working on creating an electron appimage for my raspberry pi 4 to use in my car. I want to be able to use auto-updates from electron-builder so that I wont have to take apart the R-PI every time I want to update it.

I have come across many articles,

https://itsfoss.com/use-appimage-linux/

https://www.youtube.com/watch?v=KiehhZ6Wb-4

saying that you can go to the file properties and check "execute file as program" but this is not the case for raspbian. Raspbian does not have this option in its file properties.

It could be how I am building and releasing my program. For more information, here is the project I am working on: https://github.com/bomeers/Piro/releases/tag/v0.0.3

and here is the source code: https://github.com/bomeers/Piro/tree/dev

Is it even worth using electron? Should I choose Qt (python) instead? Anything helps, thanks!

bocodes
  • 387
  • 1
  • 4
  • 12

1 Answers1

12

I have been building and running Electron Apps in AppImage format on Raspbian for quite a while and it (mostly) works without any issues. Some advice however:

  • If possible use the latest Raspbian "Buster" as previous versions can not properly build recent versions of Electron due to a glibc issue
  • Set the proper target armv7l, this (currently) still applies to the RPI 4
  • Use at least Electron version 5.0.10 as previous versions of the 5.x branch had a weird issue of AppImage format Apps crashing when you clicked any menu item
  • If you build your App using electron-builder you may need to manually add a working version of mksquashfs as described here

Other than that I never found any issues and it works just fine on Raspberry 3 / 3+ and 4.

* Edit *

An example how to configure the build target for Linux / Raspberry 4 in package.json:

linux: {
    target: {
        target: 'appimage',
        arch: ['armv7l']
    }
}
andypotato
  • 703
  • 5
  • 10
  • 1
    When you say, "Set the proper target arm7l", I set it in the electron package.json correct? – bocodes Sep 06 '19 at 04:06
  • Yes that's correct. I added an example to my answer. – andypotato Sep 06 '19 at 04:10
  • Okay, thanks, I will try it out real quick without the working version of "mksquashfs" to see if it is needed. in the mean time, I would change "arm7l" to "armv7l" in your bullet point. – bocodes Sep 06 '19 at 04:15
  • Thanks for spotting this typo - I fixed it! – andypotato Sep 06 '19 at 04:18
  • What is the proper way to install the appimage since raspbian doesn't have the "execute file as program" option? Also where do I install it? – bocodes Sep 06 '19 at 04:38
  • If you install Raspbian with the standard Gnome desktop all you need to do is double-click the appImage file. – andypotato Sep 06 '19 at 04:59
  • And [this is the standard gnome desktop](https://img.purch.com/raspbianbuster-desktop-png/w/755/aHR0cDovL21lZGlhLmJlc3RvZm1pY3JvLmNvbS9QL1MvODQzMzI4L29yaWdpbmFsL3Jhc3BiaWFuYnVzdGVyLWRlc2t0b3AucG5n) correct? – bocodes Sep 06 '19 at 05:05
  • Hmm... I have the standard setup already (upgraded to buster). Maybe I do need mksquashfs to install it. – bocodes Sep 06 '19 at 05:08
  • `mksquashfs` is only required to build the App if you build directly on the Pi. It's not required to run an appImage – andypotato Sep 06 '19 at 05:09
  • 1
    Understood. the only thing that happens for me is the mouse sits and spins a bit. Nothing else. Is there a certain folder the appimage needs to be in? I just added another release [here](https://github.com/bomeers/Piro/releases/tag/v0.0.4) if you want to try it yourself. – bocodes Sep 06 '19 at 05:12
  • Okay I solved it! I had to right click the file, go to `Properties > Permissions > Execute` and set it to `Anyone` and save. I double click the file one more time and select `Execute` and it worked! Moving on to the auto-updates now to see if they work too. – bocodes Sep 06 '19 at 05:33
  • Great, then please mark this answer as accepted and create a new question in case you run into any issues with auto-updates – andypotato Sep 06 '19 at 05:55
  • you got it! Thank you for the quick replies and the help! – bocodes Sep 06 '19 at 05:58
  • 1
    `arch` in the target is not documented and didn't work for me. instead place it in the command `electron-builder --armv7l` – Yigal Jul 21 '21 at 10:22