etcher: "Error: No polkit authentication agent found" when trying to flash an image as non-root

  • Etcher version: 1.0.0-beta.19
  • Operating system and architecture:
$ uname -a
Linux patamushka 4.9.0-997-generic #201612270045 SMP Tue Dec 27 05:47:01 UTC 2016 x86_64 GNU/Linux

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Debian
Description:	Debian GNU/Linux 9.0 (stretch)
Release:	9.0
Codename:	stretch

What I do

  • open Etcher via CLI by running etcher-electron (as my normal system user)
  • select an image I’ve just downloaded from resin.io
  • (the disk autopopulates with my SD card)
  • click “Flash”

What I expect to happen

For the image to be written to the card

What actually happens

I get the following popup:

image

{ Error: No polkit authentication agent found.
    at /usr/share/etcher-electron/resources/app.asar/node_modules/sudo-prompt/index.js:132:23
    at ChildProcess.exithandler (child_process.js:225:5)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:877:16)
    at Socket.<anonymous> (internal/child_process.js:334:11)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at Pipe._handle.close [as _onclose] (net.js:493:12)
  cause: 
   Error: No polkit authentication agent found.
       at /usr/share/etcher-electron/resources/app.asar/node_modules/sudo-prompt/index.js:132:23
       at ChildProcess.exithandler (child_process.js:225:5)
       at emitTwo (events.js:106:13)
       at ChildProcess.emit (events.js:191:7)
       at maybeClose (internal/child_process.js:877:16)
       at Socket.<anonymous> (internal/child_process.js:334:11)
       at emitOne (events.js:96:13)
       at Socket.emit (events.js:188:7)
       at Pipe._handle.close [as _onclose] (net.js:493:12),
  isOperational: true }
    at Socket.child.stderr.on (/usr/share/etcher-electron/resources/app.asar/lib/child-writer/index.js:129:17)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at readableAddChunk (_stream_readable.js:176:18)
    at Socket.Readable.push (_stream_readable.js:134:10)
    at Pipe.onread (net.js:543:20)

After I click OK, another popup appears:

Attention
Oops, seems something went wrong.
[Retry]

Retrying produces the same result.

At the same time as the “Attention” popup, this appears in my system logs:

Mar 11 10:42:30 patamushka dunst[7910]: g_variant_unref: assertion 'value->ref_count > 0' failed
Mar 11 10:42:30 patamushka dunst[7910]: g_variant_unref: assertion 'value->ref_count > 0' failed
Mar 11 10:42:30 patamushka dunst[7910]: g_variant_unref: assertion 'value->ref_count > 0' failed

And this in my auth.log:

Mar 11 10:42:24 patamushka sudo:       aj : a password is required ; TTY=pts/1 ; PWD=/home/aj ; USER=root ; COMMAND=/usr/bin/env ELECTRON_RUN_AS_NODE=1 IPC_SERVER_ID=etcher-server-9763 IPC_CLIENT_ID=etcher-client-9763 SKIP=1 /usr/share/etcher-electron/etcher /usr/share/etcher-electron/resources/app.asar/lib/child-writer/writer-proxy.js /usr/share/etcher-electron/resources/app.asar /home/aj/Downloads/resin-blinky-1.24.1-2.8.3-eef8cf4afe02.img --drive /dev/mmcblk0 --unmount --check

Workaround

By sheer chance, I noticed that if I run a command with sudo–any command, e.g. sudo ls–I’m then able to flash successfully, even though I’m not running etcher-electron with sudo.

If I run via sudo etcher-electron everything works.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 18
  • Comments: 30 (11 by maintainers)

Commits related to this issue

Most upvoted comments

I got this error on i3. Running AppImage using sudo seems to work.

@jviotti Thanks for the explanation, makes sense now. I’m using i3. FYI, I already had policykit-1-gnome installed (not the two others though). I installed mate-polkit-bin and it works perfectly now after a reboot.

Just check what kind of agent is on your system and actually run it. For example I’m using i3, but I still have a polkit agent on my system. It just hasn’t started.

Run it in a different shell:

/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1

Place it in ~/.xinitrc if you like to have it always run, otherwise just remember to actually run the agent. 😃

No need to use sudo.

I’m getting the same issue on Ubuntu 18.04. Polkit is installed:

ii  libpolkit-agent-1-0:amd64                     0.105-20ubuntu0.18.04.5                             amd64        PolicyKit Authentication Agent API
ii  libpolkit-backend-1-0:amd64                   0.105-20ubuntu0.18.04.5                             amd64        PolicyKit backend API
ii  libpolkit-gobject-1-0:amd64                   0.105-20ubuntu0.18.04.5                             amd64        PolicyKit Authorization API
ii  libpolkit-qt-1-1:amd64                        0.112.0-5                                           amd64        PolicyKit-qt-1 library
ii  libpolkit-qt5-1-1:amd64                       0.112.0-5                                           amd64        PolicyKit-qt5-1 library
ii  polkit-kde-agent-1                            4:5.12.7-0ubuntu0.1build1~ubuntu18.04~ppa1          amd64        KDE dialogs for PolicyKit

I’d guess that because this program runs from an AppImage it’s somehow not able to find or use the ‘system’ polkit? Anyway, it’s definitely still a bug

Running with sudo works around it, e.g: sudo ./balenaEtcher-1.5.109-x64.AppImage

Actually, let’s keep this open and send a PR that improves such unfriendly error message.

I’m getting the same error when trying to write Debian AMD-64 to a standard 64 gig flash drive.

The only work around is to elevate to sudo user, and then run Etcher.

I’ve found myself back at this thread after running into this issue again (Debian 12 and i3) and I can confirm that @mrquincle’s suggestion to manually start polkit results in my being able to run the AppImage without requiring sudo.

I want to also leave a note for myself that Balena Etcher is on the list of not recommended programs in the Arch Wiki and to instead use other options.

Wish the error message was a bit more clear, sudo worked for me after finding this thread

I just got this on Arch/i3. As @sidml mentioned, elevating privileges worked.