Distros : Prep - Etcher: Install

balenaEtcher is an electron app, a GUI alternative to dd to Flash OS images to SD cards and USB drives, safely and easily.

Etcher is built on Web Technology: Javascript, HTML and CSS, and is cross platform working on Windows, Apple and Linux.

Etcher for Windows, Apple and Linux

Midway down the Etcher home page is the Download Section with links to install Etcher on various platforms, I use Debian so I clicked on the Debian (.deb) packages link which brought me midway down on the Etcher GitHub page.

Etcher GitHub Page: Debian and Ubuntu Instructions

First step is to add Etcher to the Debian repository by using:
curl -1sLf \ 'https://dl.cloudsmith.io/public/balena/etcher/setup.deb.sh' \
| sudo -E bash

To break down that command use curl to download the bash script setup.deb.sh and then run that script as root sudo -E bash. I felt a bit uneasy running a script as root, If this was malicious code what harm would I do to my system and files???, however Etcher is constantly mentioned as a preferred way to burn images rather than use dd so I took the chance!!!!!

$ curl -1sLf 
\'https://dl.cloudsmith.io/public/balena/etcher/setup.deb.sh' \
| sudo -E bash

Executing the  setup script for the 'balena/etcher' repository ...

   OK: Checking for required executable 'curl' ...
(On the first run of the script I discovered I hadn't curl installed opps
had to run the command sudo apt-get install curl and then rerun the script.)
   OK: Checking for required executable 'apt-get' ...
   OK: Detecting your OS distribution and release using system methods ...
 ^^^^: ... Detected/provided for your OS/distribution, version and architecture:
 >>>>:
 >>>>: ... distro=debian  version=10  codename=buster  arch=i686  
 >>>>:
 NOPE: Checking for apt dependency 'apt-transport-https' ...
   OK: Updating apt repository metadata cache ...
   OK: Attempting to install 'apt-transport-https' ...
   OK: Checking for apt dependency 'ca-certificates' ...
   OK: Checking for apt dependency 'gnupg' ...
   OK: Importing 'balena/etcher' repository GPG key into apt ...
   OK: Checking if upstream install config is OK ...
   OK: Installing 'balena/etcher' repository via apt ...
   OK: Updating apt repository metadata cache ...
   OK: The repository has been installed successfully - You're ready to rock!

Great, so far so good, now for the second step to Update and Install.

sudo apt-get update and sudo apt-get install balena-etcher-electron
$ sudo apt-get update
Hit:1 http://security.debian.org/debian-security buster/updates InRelease
Hit:2 http://deb.debian.org/debian buster InRelease                       
Hit:3 http://deb.debian.org/debian buster-updates InRelease               
Get:4 https://dl.cloudsmith.io/public/balena/etcher/deb/debian buster InRelease [5,056 B]
Fetched 5,056 B in 2s (2,209 B/s)
Reading package lists... Done

Then to Install Etcher...

$ sudo apt-get install balena-etcher-electron
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  gconf-service gconf2 gconf2-common libgconf-2-4
Suggested packages:
  gconf-defaults-service
The following NEW packages will be installed:
  balena-etcher-electron gconf-service gconf2 gconf2-common libgconf-2-4
0 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Need to get 87.3 MB of archives.
After this operation, 222 MB of additional disk space will be used.
Do you want to continue? [Y/n]
(I just hit Enter to continue)

Everything seemed to go ok until apt started to set up etcher, the error is highlighted.

....
Creating config file /etc/gconf/2/path with new version
Setting up libgconf-2-4:i386 (3.2.6-5) ...
Setting up gconf-service (3.2.6-5) ...
Setting up gconf2 (3.2.6-5) ...
Setting up balena-etcher-electron (1.5.117) ...
chmod: cannot access '/opt/balena-etcher-electron/chrome-sandbox': 
No such file or directory
Processing triggers for desktop-file-utils (0.23-4) ...
Processing triggers for mime-support (3.62) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Processing triggers for libc-bin (2.28-10) ...
Processing triggers for man-db (2.8.5-2) …

The Installation completed, using Mate Desktop I found the Link to Etcher Applications»Accessories»balenaEtcher which I clicked and NOTHING HAPPENED.

To Start Etcher: Applications, Accessories, balenaEtcher.

When an application fails to start try putting the command in a terminal and see will any errors pop up. To see what the Etcher command is: I Right Clicked the Etcher Icon in the Accessories Menu and choose to Add this launcher to the desktop. I then Right Clicked its desktop icon to see its properties.

Mate: Creating a Desktop Shortcut

I then Copied the command /opt/balenaEtcher/balena-etcher-electron %U and Pasted it into a terminal..

Etcher: Copy the command and Paste into a terminal.
$ /opt/balenaEtcher/balena-etcher-electron %U
[2809:0713/224918.698959:FATAL:setuid_sandbox_host.cc(158)] 
The SUID sandbox helper binary was found, but is not configured correctly. 
Rather than run without sandboxing I'm aborting now. You need to make sure 
that /opt/balenaEtcher/chrome-sandbox is owned by root and has mode 4755.
Trace/breakpoint trap

The error that occurred when installing has come back to bite me, time for some more commands!!!

(First go to the /opt/balenaEtcher and see 
all the details on chrome-sandbox)
$ cd  /opt/balenaEtcher/
$ ls -l chrome-sandbox
-rwxr-xr-x 1 755 root 1263840 Apr  2 15:12 chrome-sandbox

(OK, root owns chrome-sandbox, if not run the following command....)

$ chown root chrome-sandbox

(However the mode aka permissions are wrong, so the next command sorts that.) 

$ sudo chmod 4755 chrome-sandbox
(the 4 is the Set User Id SUID which allows a user to 
run a command as the owner of that command, in this case as root)

$ ls -l chrome-sandbox 
-rwsr-xr-x 1 755 root 1263840 Apr  2 15:12 chrome-sandbox
(Now the owners permissions has changed, the x is replaced by an s)
The command line is the best way to do stuff, you use sudo to run commands as root, so making changes that a normal user can't, chown changes the ownership of a file or folder and chmod changes the mode permissions of the file or folder, this affects who has access to and what they can do with them.

Now when I click on the Etcher Icon it starts.

Etcher starts, ready to Flash!!!