balena-io / etcher

Flash OS images to SD cards & USB drives, safely and easily.
https://etcher.io/
Apache License 2.0
29.64k stars 2.1k forks source link

[Request] Please support newer electron. #4087

Closed sukanka closed 10 months ago

sukanka commented 1 year ago

Note: This is a custom-rebuilt version with electron25, as electron19 has been dropped in archlinux official repo, I tried to rebuild etcher with newer electron (namely electron 22 to 25). All builds succeded but failed to flash any image.


update: with 1.18.13 I still cannot flash any image. When I select an image, it pops image And I see the logs in console says

index.css:1     Failed to load resource: net::ERR_FILE_NOT_FOUND
gui.js:320  _____ _       _
|  ___| |     | |
| |__ | |_ ___| |__   ___ _ __
|  __|| __/ __| '_ \ / _ \ '__|
| |___| || (__| | | |  __/ |
\____/ \__\___|_| |_|\___|_|

Interested in joining the Etcher team?
Drop us a line at join+etcher@balena.io

Version = 1.18.13, Type = local
node:events:491 Uncaught Error: spawn /usr/lib/balena-etcher/generated/etcher-util ENOENT
    at __node_internal_captureLargerStackTrace (node:internal/errors:490:5)
    at __node_internal_errnoException (node:internal/errors:620:12)
    at ChildProcess._handle.onexit (node:internal/child_process:283:19)
    at onErrorNT (node:internal/child_process:476:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
gui.js:3 Electron Security Warning (Insecure Content-Security-Policy) This renderer process has either no Content Security
  Policy set or a policy with "unsafe-eval" enabled. This exposes users of
  this app to unnecessary security risks.

For more information and help, consult
https://electronjs.org/docs/tutorial/security.
This warning will not show up
once the app is packaged.
(anonymous) @ gui.js:3
gui.js:3 TypeError: requestMetadata is not a function
    at gui.js:278:1759
    at SourceSelector.selectSource (gui.js:278:2719)
    at SourceSelector.openImageSelector (gui.js:278:3117)
(anonymous) @ gui.js:3

But etcher built with electron19 works fine.

My build script: github gist

After the password is entered, the following error occurs.

image

text version for copy and paste:

 _____ _       _
|  ___| |     | |
| |__ | |_ ___| |__   ___ _ __
|  __|| __/ __| '_ \ / _ \ '__|
| |___| || (__| | | |  __/ |
\____/ \__\___|_| |_|\___|_|

Interested in joining the Etcher team?
Drop us a line at join+etcher@balena.io

Version = 1.18.8, Type = local
gui.js:37 Electron Security Warning (Insecure Content-Security-Policy) This renderer process has either no Content Security
  Policy set or a policy with "unsafe-eval" enabled. This exposes users of
  this app to unnecessary security risks.

For more information and help, consult
https://electronjs.org/docs/tutorial/security.
This warning will not show up
once the app is packaged.
(anonymous) @ gui.js:37
gui.js:37 Elevating command: /usr/lib/electron25/electron /usr/lib/balena-etcher/generated/child-writer.js
gui.js:37 Error: Error invoking remote method 'disable-screensaver': Error: No handler registered for 'disable-screensaver'
    at a.invoke (node:electron/js2c/renderer_init:2:7723)
(anonymous) @ gui.js:37
gui.js:35  0 devices, 0% at 0.00 MB/s (total 0.00 MB/s)  with 0 failed devices
gui.js:37 Message from SafeWebview: %cElectron Security Warning (Insecure Content-Security-Policy) font-weight: bold; This renderer process has either no Content Security
  Policy set or a policy with "unsafe-eval" enabled. This exposes users of
  this app to unnecessary security risks.

For more information and help, consult
https://electronjs.org/docs/tutorial/security.
This warning will not show up
once the app is packaged.
gui.js:37 Successfully connected to IPC server: etcher-server-482706, socket root /run/user/1000/
gui.js:37 Image: /home/sukanka/Downloads/chrome/archlinux-2023.07.01-x86_64.iso
gui.js:37 Devices: /dev/sdb
gui.js:37 Auto blockmapping: true
gui.js:37 Decompress first: true
gui.js:37 error Error: Command failed: cd "/home/sukanka"; "/usr/bin/pkexec" --disable-internal-agent /bin/bash -c "echo SUDOPROMPT; bash '/tmp/etcher/balena-etcher-electron-7987c7e8d67d.cmd'"
electron: ../binding.c:595: get_aligned_buffer: Assertion `(napi_create_external_buffer(env, size, ptr, free_aligned, ((void *)0), &buffer)) == napi_ok' failed.
/tmp/etcher/balena-etcher-electron-7987c7e8d67d.cmd: line 91: 482888 Aborted                 (core dumped) '/usr/lib/electron25/electron' '/usr/lib/balena-etcher/generated/child-writer.js'

    at __node_internal_genericNodeError (node:internal/errors:867:15)
    at ChildProcess.exithandler (node:child_process:430:12)
    at ChildProcess.emit (node:events:513:28)
    at maybeClose (node:internal/child_process:1091:16)
    at Socket.<anonymous> (node:internal/child_process:449:11)
    at Socket.emit (node:events:513:28)
    at Pipe.<anonymous> (node:net:322:12)
gui.js:37 Terminating IPC server
gui.js:37 Flash results Object
gui.js:37 Error: The elevated process died unexpectedly
    at createError (gui.js:37:221570)
    at Object.createUserError (gui.js:37:221783)
    at gui.js:341:5180
    at async withTmpFile (gui.js:1:720152)
    at async elevateCommand (gui.js:341:4411)
    at async Server.<anonymous> (gui.js:341:8515)
(anonymous) @ gui.js:37
gui.js:37 Error: Error invoking remote method 'enable-screensaver': Error: No handler registered for 'enable-screensaver'
    at a.invoke (node:electron/js2c/renderer_init:2:7723)
(anonymous) @ gui.js:37

output from terminal

libva error: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null)
Language changed to: en
packageUpdatable false
ready-to-show: 1.562s

(electron:482616): Gtk-WARNING **: 21:13:02.747: Failed to measure available space: ???????
Error occurred in handler for 'disable-screensaver': Error: No handler registered for 'disable-screensaver'
    at EventEmitter.<anonymous> (node:electron/js2c/browser_init:2:88977)
    at EventEmitter.emit (node:events:513:28)
    at EventEmitter.emit (node:domain:489:12)
(node:482616) Warning: No such label 'ready-to-show' for console.timeEnd()
(Use `electron --trace-warnings ...` to show where the warning was created)
Error occurred in handler for 'enable-screensaver': Error: No handler registered for 'enable-screensaver'
    at EventEmitter.<anonymous> (node:electron/js2c/browser_init:2:88977)
    at EventEmitter.emit (node:events:513:28)
    at EventEmitter.emit (node:domain:489:12)

(electron:482616): Gtk-WARNING **: 21:13:19.846: Failed to measure available space: ???????

(electron:482616): Gtk-WARNING **: 21:13:20.023: Failed to measure available space: ???????
(node:482616) Warning: No such label 'ready-to-show' for console.timeEnd()

Interested in joining the Etcher team? Drop us a line at join+etcher@balena.io

Version = 1.18.8, Type = local gui.js:37 Electron Security Warning (Insecure Content-Security-Policy) This renderer process has either no Content Security Policy set or a policy with "unsafe-eval" enabled. This exposes users of this app to unnecessary security risks.

For more information and help, consult https://electronjs.org/docs/tutorial/security. This warning will not show up once the app is packaged. (anonymous) @ gui.js:37 gui.js:37 Elevating command: /usr/lib/electron19/electron /usr/lib/balena-etcher/generated/child-writer.js gui.js:37 Error: Error invoking remote method 'disable-screensaver': No handler registered for 'disable-screensaver' at o.invoke (node:electron/js2c/renderer_init:57:526) (anonymous) @ gui.js:37 gui.js:35 0 devices, 0% at 0.00 MB/s (total 0.00 MB/s) with 0 failed devices gui.js:37 Successfully connected to IPC server: etcher-server-496098, socket root /run/user/1000/ gui.js:37 Image: /home/sukanka/Downloads/chrome/archlinux-2023.07.01-x86_64.iso gui.js:37 Devices: /dev/sdb gui.js:37 Auto blockmapping: true gui.js:37 Decompress first: true gui.js:35 Flashing 1 device, 2% at 16.70 MB/s (total 16.70 MB/s) eta in 50s with 0 failed devices gui.js:35 Flashing 1 device, 5% at 20.40 MB/s (total 20.40 MB/s) eta in 40s with 0 failed devices ... (flash succeded)


terminal:
```bash
➜  ~ balena-etcher-electron
libva error: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null)
[496011:0708/212850.125976:ERROR:backend_impl.cc(2020)] Invalid file version or magic
Language changed to: en
packageUpdatable false
ready-to-show: 1.678s

(electron19:496011): Gtk-WARNING **: 21:28:52.139: Failed to measure available space: ???????

(electron19:496011): Gtk-WARNING **: 21:28:56.245: Failed to measure available space: ???????
Error occurred in handler for 'disable-screensaver': No handler registered for 'disable-screensaver'
[496011:0708/212902.878360:ERROR:backend_impl.cc(2020)] Invalid file version or magic
[496011:0708/212902.878474:ERROR:backend_impl.cc(2020)] Invalid file version or magic
(node:496011) Warning: No such label 'ready-to-show' for console.timeEnd()
(Use `electron19 --trace-warnings ...` to show where the warning was created)

(electron19:496011): Gtk-WARNING **: 21:29:10.285: Failed to measure available space: ???????
(node:496011) Warning: No such label 'ready-to-show' for console.timeEnd()

(electron19:496011): Gtk-WARNING **: 21:30:55.384: Failed to measure available space: ???????

(electron19:496011): Gtk-WARNING **: 21:30:55.555: Failed to measure available space: ???????
Error occurred in handler for 'enable-screensaver': No handler registered for 'enable-screensaver'
(node:496011) Warning: No such label 'ready-to-show' for console.timeEnd()
aethernet commented 1 year ago

We know it can't run on electron 20 and up due to security related changes in electron and chromium. This is a good thing as it makes it harder for random dev to shoot themself in the foot. But it broke legitimate use case as ours. We're currently working to work around the new limitations.