I’ve been playing around with resinOS (not resin.io), trying to deploy a simple project that uses node.js and Johnny-Five to light up some LEDs on a Raspberry Pi 2 Model B.
This usually works really well on Raspbian Jessie on the Raspberry Pi but on ResinOS I get a modprobe error when the container starts:
?modprobe: ERROR: could not insert 'i2c_dev': Exec format error
Pushing the container using rdt push --source . seems to build fine. But, once built the container continually restarts.
$ rdt logs
(node:42141) DeprecationWarning: Using Buffer without `new` will soon stop working. Use `new Buffer()`, or preferably `Buffer.from()`, `Buffer.allocUnsafe()` or `Buffer.alloc()` instead.
Reporting discovered devices
? select a device resin.local (192.168.178.45)
? Select a container /resin-johnny-five-example (3134aee1361) - Restarting (1) About a minute ago
?modprobe: ERROR: could not insert 'i2c_dev': Exec format error
I read here that modprobe i2c-dev was necessary and I’ve added that to the RUN command in my Dockerfile.
Can anyone give me some pointers on what I’m doing wrong?
This is a known issue with the current resinOS beta release, which will be fixed in the upcoming betas that will be soon available for download. In the meantime, the easiest workaround would be to use an alpine base image, which in your case should be resin/raspberrypi2-alpine-node.
First a thought, you should not add modprobe i2c-dev to your Dockerfile, but into your start script, as it’s a run-time command, not a build-time one.
Then there is a wiringpi Alpine package that you might try (might need to use one of the edge tags for the alpine image, e.g. 5-edge), for example installing in the Dockerfile with
RUN apk add --no-cache wiringpi
What are the issues when you are trying to install raspi-io?
Will try these out tomorrow, see if we hit any issues that can be resolved.
Working on the new builds for resinOS, but don’t have an ETA yet. It’s very near the top of our list, though, just sorting out some internal build processes to make it happen well.
I’ve seen how you’ve added the modprobe command to the CMD command in the Dockerfile (not to RUN as you mentioned), so that would actually be good place to do that (regarding my previous commit).
Been testing it a bit today, but run out of time, will continue tomorrow
@andrewn I have hit this problem as well. My current work around is to just modprobe from the hostOS via an SSH connection. It’s not idea, but it gets the job done and even if you have something like CMD modprobe i2c-dev && python main.py it won’t fail after you have the module already loaded, so you can keep your code the same for both resinOS and resin.io. I am hoping we can get the updated resinOS beta soon.
Installing wiringpi via apk works fine. Afterwards, I have the gpio binary installed and can turn on/off an LED connected to GPIO using gpio write 1 1.
However, I think Raspi-io uses node-gyp to link against the wiringpi headers?
First, the log output was complaining about not finding the wiringpi headers: ../src-native/init.cc:25:22: fatal error: wiringPi.h: No such file or directory
@shaunmulligan Yeah, using rdt ssh --host and runnning modprobe i2c-dev, then restarting the container seems to bring things up. I guess I could get the host to run modprobe i2c-dev on startup?