Resin Wifi Connect only works if I plug in ethernet first

Hey guys, I’ve been working with resin for about a week and am LOVING it. I’ve built out our prototype and am preparing to have them test it back at HQ.

My ideal workflow would be:

  1. Send them an * file that they can burn to the SD using Etcher
  2. Have it boot to and have them enter SSID/PSK

Right now I’ve been downloading the IMG file from the dashboard but it doesn’t seem to boot the portal until I connect it to wifi and it downloads a bunch of other stuff. These are the first few lines from the logs when it provisions for the first time:

27.02.18 18:44:26 (+0100) Applying configuration change {"RESIN_SUPERVISOR_NATIVE_LOGGER":"false"}
27.02.18 18:44:27 (+0100) Creating network 'default'
27.02.18 18:44:27 (+0100) Creating volume 'resin-data'
27.02.18 18:44:27 (+0100) Downloading image ''

I’ve tried combinations on the cli of resin init, resin-build, resin-deploy but it still hasn’t booted as I was hoping.

I have a feeling I’m fundamentally misunderstanding how the code/build/deploy process works and need to build the host and container images first locally so I can burn that IMG to an SD card but I’m a little stuck and hoping you guys can help.

Thanks in advance!


FROM resin/%%RESIN_MACHINE_NAME%%-node:6-slim

RUN apt-get update && apt-get install -yq --no-install-recommends \
    curl cron iperf3 jq bc speedtest-cli python git wireless-tools vim dnsmasq \
    && apt-get clean && rm -rf /var/lib/apt/lists/*

#switch on systemd init system in container

COPY . /usr/src/app
COPY package.json package.json
WORKDIR /usr/src/app

# pip install python deps from requirements.txt on the build server
RUN JOBS=MAX npm install --production --unsafe-perm && npm cache clean && rm -rf /tmp/*
RUN curl | python
RUN pip install git+
RUN pip install pingparsing

# -- Start of resin-wifi-connect section -- #

# Set the device type environment variable using Dockerfile templates

RUN curl -s \
    | grep -hoP 'browser_download_url": "\K.*%%RESIN_ARCH%%\.tar\.gz' \
    | xargs -n1 curl -Ls \
    | tar -xvz -C /usr/src/app/

# -- End of resin-wifi-connect section -- #

# Provision device to Rails App

RUN sh

# Load environment variables into crontab (not working - WIP)
# RUN (crontab -l ; cat /etc/docker.env)| crontab -

# Load cronjobs from crontab file
RUN (crontab -l; cat cronjobs)| crontab -

# will run when container starts up on the device

CMD ["bash", ""]

#!/usr/bin/env bash

export DBUS_SYSTEM_BUS_ADDRESS=unix:path=/host/run/dbus/system_bus_socket

# Choose a condition for running WiFi Connect according to your use case:

# 1. Is there a default gateway?
# ip route | grep default

# 2. Is there Internet connectivity?
# nmcli -t g | grep full

# 3. Is there Internet connectivity via a google ping?
# wget --spider 2>&1

# 4. Is there an active WiFi connection?
iwgetid -r

if [ $? -eq 0 ]; then
    printf 'Skipping WiFi Connect\n'
    printf 'Starting WiFi Connect\n'
    ./wifi-connect --portal-ssid sec-perfmon

npm start

Props to @shaunmulligan - I shot him an email with this link and he suggested the following:

resin preload resin-perfmon-2.12.3+rev1-dev-v7.1.14.img

I then burnt the same file “resin preload resin-perfmon-2.12.3+rev1-dev-v7.1.14.img” to my SD card and it booted as I was hoping!

Perhaps it would make sense to update the instructions on so complete noobs can get this up and running!

Thanks guys :slight_smile:

1 Like

@majorz Perhaps we want to mention this use case on the wifi-connect repo?

1 Like

I included this forum thread in a pending WiFi Connect ticket about improving the docs for running on top of resinOS.

1 Like