jjcarstens

jjcarstens

Nerves Core Team

I was having issues using the mix firmware.push to send new fw to my device, so I followed the guide and ran mix firmware.gen.script and have be using the upload.sh it generated which has worked great. Firmware deploys great and all seemed well.

So, I started scripting this process and ended up getting warnings and failures in scripts. After investigating, it looks like the last line of generated upload.sh script returns 255, but technically it did what it was supposed to.

jonjon@ 📂 {grub} $ MIX_ENV=dev MIX_TARGET=rpi3 ./upload.sh
Uploading ./_build/rpi3/dev/nerves/images/grub.fw to grub-dev.local...
X11 forwarding request failed on channel 0
Running fwup...
fwup: Upgrading partition A
|====================================| 100% (30.31 / 30.31) MB
Success!
Elapsed time: 5.925 s
Rebooting...
jonjon@ 📂 {grub} $ echo $?
255

ssh man pages state that it will exit with remote command status or 255 on an error. In this case, I believe the remote exits -1 and shell transposes to 255 which is the code to use with an “out of range” status (which are expected to be 0-255)

Anyone know why it might be completing successfully but returning an error? I basically have no idea what to look for with ssh or nerves_firmware_ssh, so any help would be appreciated.

I’ll even supply some ssh -v output :wink:¬

jonjon@ 📂 {grub} $ MIX_ENV=dev MIX_TARGET=rpi3 ./upload.sh grub-dev.local
Uploading ./_build/rpi3/dev/nerves/images/grub.fw to grub-dev.local...
OpenSSH_7.6p1, LibreSSL 2.6.2
debug1: Reading configuration data /Users/jonjon/.ssh/config
debug1: /Users/jonjon/.ssh/config line 5: Applying options for grub*.local
debug1: /Users/jonjon/.ssh/config line 57: Applying options for *.local
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug1: /etc/ssh/ssh_config line 52: Applying options for *
debug1: Connecting to grub-dev.local port 8989.
debug1: Connection established.
debug1: identity file /Users/jonjon/.ssh/mx type 0
debug1: key_load_public: No such file or directory
debug1: identity file /Users/jonjon/.ssh/mx-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.6
debug1: Remote protocol version 2.0, remote software version aqxe
debug1: no match: aqxe
debug1: Authenticating to grub-dev.local:8989 as 'jonjon'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: ecdh-sha2-nistp256
debug1: kex: host key algorithm: rsa-sha2-512
debug1: kex: server->client cipher: aes128-ctr MAC: hmac-sha2-256 compression: none
debug1: kex: client->server cipher: aes128-ctr MAC: hmac-sha2-256 compression: none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-rsa SHA256:s6rDEVL9YH3LaEDRxRX4qStknwY3560Vs5wkQ4wQMmA
debug1: Host '[grub-dev.local]:8989' is known and matches the RSA host key.
debug1: Found key in /Users/jonjon/.ssh/known_hosts:694
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ecdsa-sha2-nistp256,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,keyboard-interactive,password
debug1: Next authentication method: publickey
debug1: Offering public key: RSA SHA256:jNF/Vgr6H6cxSehszXW5cmb3TM6E3oZCNOxp4NklsoA /Users/jonjon/.ssh/mx
debug1: Server accepts key: pkalg rsa-sha2-512 blen 279
debug1: Authentication succeeded (publickey).
Authenticated to grub-dev.local ([10.0.1.67]:8989).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: pledge: exec
debug1: Requesting X11 forwarding with authentication spoofing.
debug1: Requesting authentication agent forwarding.
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
debug1: Sending subsystem: nerves_firmware_ssh
X11 forwarding request failed on channel 0
Running fwup...
fwup: Upgrading partition B
|====================================| 100% (30.31 / 30.31) MB
Success!
Elapsed time: 5.869 s
Rebooting...
debug1: channel 0: free: client-session, nchannels 1
debug1: fd 0 clearing O_NONBLOCK
Transferred: sent 28187168, received 13960 bytes, in 6.4 seconds
Bytes per second: sent 4422327.5, received 2190.2
debug1: Exit status -1

Showing Posts 1 to 2

fhunleth

fhunleth

Co-author of Nerves

Good catch. I reproduced this. It turns out that nerves_firmware_ssh is missing a call to :ssh_connection.exit_status to send the return code. I’ll PR it tomorrow morning.

Thanks,
Frank

fhunleth

fhunleth

Co-author of Nerves

Jon - Justin Schneck and I released nerves_firmware_ssh v0.3.3 that fixes the exit code issue and a includes a couple minor changes since the previous release. (Details on the Github project) Thanks again for letting me know about it.

— All posts loaded —

Where Next? Top

Trending in Questions Top

stjefim
Hello! Suppose you are building workflow (order / task / payment) processing system with the following requirements: Each workflow con...
New
jonnycharles
I’m in search of an Elixir library that offers PDF generation capabilities similar to Ruby’s Prawn. While there have been discussions abo...
New
spammy
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
dli
Before I dive in myself, did anyone successfully sprinkle Hologram into their existing LiveView app? Looking for hints regarding: Addi...
New
roeland
Kia ora, We have been using elixir-google-api to connect to Google Drive. However, with the updates to Tesla due to CVEs this is now bro...
New
bottlenecked
Hi all, I wanted to ask how the community is dealing with post-release steps. Today we have Ecto migrations, which make sure that the db...
New
rahultumpala
Hello, I have an Elixir backend that implements a custom protocol over TCP. I want to load test the backend and assess the performance o...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge &amp; Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
ausimian
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews