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

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
kpanic
Hi everyone, I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding. I sta...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
asweet-confluent
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
ryanwinchester
apply_graft/2 doesn’t rewrite an add_many sub-workflow’s deps on an add step. Grafted jobs cancel with “upstream job was deleted” Version...
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
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
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
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New

Latest on Elixir Forum

Elixir Forum

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews