Problems connecting to USB serialport from container

I need my raspberry to connect to an Arduino via the USB serialport. I have managed to do this smoothly in a traditional RPi environment (with Raspbian) with nodejs (using johhny-five or plain firmata/serialport npm modules) BUT I have not been able to connect to the serialport from a Resin container.

For example with this basic node program

var five = require("johnny-five"),
  board = new fiveBoard();

board = new five.Board();
board.on("ready", function() {
    (new five.Led(13)).strobe();

I just get the message:

root@raspberrypi:/home/test# node server.js                       
1425982101921 Looking for connected device   

(And I have an Arduino with Firmata in one of the USB ports … even tried with 2 Arduinos on each of the USB ports and cannot get the serialport to work).

It seems that the container “sees” the usb ports

root@raspberrypi:/dev# ls ttyACM*                                               
ttyACM0  ttyACM1

But it is not able to connect/open them

Do you know if there is any restriction for connection to USB serial ports from a Resin container? Is there any way around this issue?


I have found that the serial ports (/dev/ttyACM0 & /dev/ttyACM1) are active and work if I connect to them from the container using a serialport terminal such as minicom.

The problem is that the npm package serialport.js expects to get the list of available ports reading the dirs:

BUT the containers does not have those dirs (no /dev/serial in the container).

Other packages that work on top of serialport,js (such as johnny-five) expect the serialport.list() method to work properly in order to identify available ports, but it is failing to find the ports.

Not sure about how resin works … but could it be that when the resin software creates the container, it should map the /dev/serial dirs from the host into the container and it is not doing so?

Any idea on how to solve this is welcomed.

Hi elaval,

Sincere apologies for taking so long to respond, we are keeping a much closer eye on this forum now and future responses should be far more rapid!

You can resolve this issue by triggering udev to detect new devices and place the appropriate files in the /dev directory using udevadm.

To do this for a node project, you can simply update your package.json to run udevadm trigger on application start by changing the start field, e.g.:-


  "scripts": {
    "start": "node app.js"


  "scripts": {
    "start": "udevadm trigger && node app.js"

Let us know if you have any further issues!

Best, Lorenzo

Hi again,

After discussing this with my colleagues I realise I’ve missed an important step - you need to start udevd first before triggering the udev update. At this point it makes sense to use a separate start script, e.g.:-

  "scripts": {
    "start": "bash"

Where looks like:-

udevd &
udevadm trigger
node app.js

Best, Lorenzo

Thanks Lorenzo!

I does work now :smile:

1 Like