Change WiFi network within modified resin-wpe image


#1

I am using running resin-wpe but modified for my purposes using the instructions within their base-image folder: https://github.com/resin-io-playground/resin-wpe/tree/master/base-image . I added apache, php, wireless-tools, wpa_supplicant, and a few other items to the docker image. The image works perfectly for almost everything I need, except I need my end users to choose and connect to a wireless network of their own choice. I know that I can typically use wireless-tools and wpa_supplicant to accomplish this but those options are not working, even though I included them in the build.

I also know about resin-wifi-connect but that won’t work in tandem with resin-wpe. Is there any way I can give my non-technical client the ability to select and connect to a wireless network and what do I need to install to accomplish this?

I know connman can connect as well as wpa_supplicant but I’m not as familiar and I’d like to know the proper way to accomplish this within resin.


#4

Hey there,

resin-wifi-connect is the “proper” way to accomplish this with resin.io. Can you explain in more detail what kind of clashes do you get?

We maintain an application template called resin-electronjs (https://github.com/resin-io/resin-electronjs) which provides a full screen browser based on Chromium/Electron.

You should be able to base your application on that, and install resin-wifi-connect without any issues.


#5

Hi!

resin-wpe doesn’t include any installer packages, so all the commands within the dockerfile failed immediately. Also, not all my users will have access to a smart mobile or tablet device to run the exchange required from resin-wifi-connect.

Also, we tried another application template that ran Chromium and we found that it doesn’t support HTML5 video, which is a requirement for our project. Will resin-electronjs have the same issue? One of the main reasons we went with resin-wpe was because it supports HTML5 video, with slight modification can run a local web server and php files, and the hardware acceleration support running high definition video quality, all important for our tasks.


#6

Hey there,

I believe resin-electronjs should support HTML5 video just fine, and if you have any issues, it’d be something we can help you with.

The cool thing about Electron is that it provides access to the underlying system through its Node.js integration. This means you could build a HTML interface (assuming you have some kind of input interface, like a touchscreen) to tweak the network settings by talking to NetworkManager directly.

Would that be an option?


#7

Hi!

Our interface needs are for a keyboard and mouse, but I imagine that’s already supported. The only other thing I need to know is can I modify resin-electronjs to install and run a local web server and serve php files? We can’t afford to rewrite our entire application into Node.js.


#8

Yeah, you can use resin-electronjs as the base of your project, and add any other things you need on top. You can add a PHP server, and then point the Electron URL to it, and it should all just work.


#9

Well that’s amazing to hear! I’ll give this a shot. One more question. My knowledge and experience with resin is limited but I’m a quick learner. Would you be able to provide some insight on a proper way to combine resin-wifi-connect and resin-electronjs?


#10

You should be able to start from the resin-electronjs template project, and then add the pieces from the resin-wifi-connect repo that you need. For example, the Dockerfile has some sections that install resin-wifi-connect that you might want to copy paste (https://github.com/resin-io/resin-wifi-connect/blob/master/Dockerfile.template#L14). The start script has a basic example to run the project, which you can also put somewhere in your own project: https://github.com/resin-io/resin-wifi-connect/blob/master/start#L5.

resin-wifi-connect opens a captive portal that you can access (maybe from within your application itself, presenting it on the screen?). Notice that resin-wifi-connect communicates with NetworkManager to perform its job, so another option is to bypass resin-wifi-connect and talk to NetworkManager directly, as suggested above.


#11

Thank you very much for all your help. I’ll get to work on this right away. If I come across any issues with the wifi connection or the HTML5 video playback, should I start a fresh post or return to this one?


#12

No worries! A fresh post should be the way to go. Good luck


#13

wowow i love resin io


#14

So we should start a process that executes that does the bash scripts


#15

Hi there,

You mentioned here I can add a PHP server but all attempts of installing PHP through apt-get aren’t working. Could you provide any help?


#16

hello,

what is the exact issue with apt-get and php?
Have you performed an apt-get update first?

Best,
ilias


#17

Well when I try to run apt-get and php, it fails, plain and simple. Here is the contents of my dockerfile:

RUN apt-get update && apt-get upgrade && apt-get install -y \
  apache2 \
  apache2-utils \
  cron \
  curl \
  libapache2-mod-php7.0 \
  php7.0 \
  php7.0-cli \
  php7.0-curl \
  wireless-tools \
  dnsmasq \
  apt-utils \
  clang \
  xserver-xorg-core \
  xserver-xorg-input-all \
  xserver-xorg-video-fbdev \
  xorg \
  libdbus-1-dev \
  libgtk2.0-dev \
  libnotify-dev \
  libgnome-keyring-dev \
  libgconf2-dev \
  libasound2-dev \
  libcap-dev \
  libcups2-dev \
  libxtst-dev \
  libxss1 \
  libnss3-dev \
  fluxbox \
  libsmbclient \
  libssh-4 \
  fbset \
  libexpat-dev && apt-get clean && rm -rf /var/lib/apt/lists/*

Here is the error I get when I try to push that to resin:

[Build]    E: Unable to locate package libapache2-mod-php7.0
[Build]    E: Couldn't find any package by regex 'libapache2-mod-php7.0'
[Build]    E: Unable to locate package php7.0
[Build]    E: Couldn't find any package by regex 'php7.0'
[Build]    E: Unable to locate package php7.0-cli
[Build]    E: Couldn't find any package by regex 'php7.0-cli'
[Build]    E: Unable to locate package php7.0-curl
[Build]    E: Couldn't find any package by regex 'php7.0-curl'

I tried every variation of php that I know. Ultimately, I ran apt-cache search php and nothing came up, which suggests that the package installer doesn’t contain any php libraries.


#18

Did you run apt-cache search after running apt-get update? Without the package index, the search will not work.


#19

I did and got nothing.


#20

Is there another way to change Wifi credentials on my Resin device? I am seeing this error in the logs: wlan0: link is not ready


#21

I’ve taken the instructions from https://www.stewright.me/2016/03/turn-raspberry-pi-3-php-7-powered-web-server/ (the top duckduckgo result for rpi php 7, so decide trust levels for yourself) and dockerfied them into the following two directives

RUN echo "deb http://repozytorium.mati75.eu/raspbian jessie-backports main contrib non-free" >> /etc/apt/sources.list \
    && gpg --keyserver pgpkeys.mit.edu --recv-key CCD91D6111A06851 \
    && gpg --armor --export CCD91D6111A06851 | apt-key add -

RUN apt-get update \
    && apt-get install \
        php7.0 \
        php7.0-cli \
        php7.0-curl \
        libapache2-mod-php7.0 \
    && rm -rf /var/lib/apt/lists/*

and when I add these to the dockerfile from https://github.com/resin-io/resin-electronjs they seem to install fine.