Fail to update udev rules

Hi

Trying to setup the Movidius NCSDK 2 API on resin io through a local push. Installation is going well until the install script tries to reload udev rules. This is the part of the script that fails

# Update udev rules
echo "Updating udev rules..."
$SUDO_PREFIX cp $SDK_DIR/udev/97-usbboot.rules /etc/udev/rules.d/
RC=0 
$SUDO_PREFIX udevadm control --reload-rules || RC=$?
if [ $RC -ne 0 ] ; then
    echo "Warning udevadm control --reload-rules reported an return code = ${RC}"
fi
RC=0 
$SUDO_PREFIX udevadm trigger || RC=$?
if [ $RC -ne 0 ] ; then
    echo "Warning udevadm trigger return code = ${RC}"
fi

This is the output I get

Successfully installed mvnc-2.5.0.2
NCS Python API has been installed in /opt/movidius, and PYTHONPATH environment variable updated
NCS Libraries have been installed in /usr/local/lib
Updating udev rules…
Warning udevadm control --reload-rules reported an return code = 2
Adding user ‘root’ to ‘users’ group

Installation is complete.
Please provide feedback in our support forum if you encountered difficulties.
—> 1c16a6a4ea5c
Removing intermediate container 22eade9a6145
Step 6/6 : RUN /bin/bash
—> Running in 0da0763e6f72
—> 7f30107897a3
Removing intermediate container 0da0763e6f72
Successfully built 7f30107897a3
Successfully tagged local-app:latest

  • Cleaning up previous image of ‘local-app’
  • Creating ‘local-app’ container
  • Starting ‘local-app’ container

Push completed successfully!

  • Streaming application logs…

I am getting a return code 2 not sure what this means. Anyone ran into something similar?

Ben

@bpecheux I actually built a little test project with the movidius and the RPI3, you can check it out here: https://github.com/resin-io-playground/movidius-rpi3-demo . I actually put together a base image with everything preinstalled for this project. You can see the repo for that here: https://github.com/resin-io-playground/movidius-rpi3-baseimage

Thanks Shaun

I had seen the image before but I was trying to built using the official github repo https://github.com/movidius/ncsdk which appears to be offline right since 08/08/2018. I will give it a try. I noticed that you are using your own fork of the ncsdk. Did you make changes to the Makefile?

Ben

Yeah i messed around with the install script here because resin.io base images identified as debian rather than raspbian, but I actually think with the latest built image that might not be the case anymore, so it might not actually be needed.

@shaunmulligan Ok I gave it a try and got a bit farther this time but not quite there yet. I used the movidius base image and I added the following lines at the end of dockerfile (after run pip3 install imutils …) to check if ncsdk was working by running one of the ncsdk hello world example.

WORKDIR /ncsdk/examples/apps/hello_ncs_py

CMD ["python3", "hello_ncs.py"]

and built it on my mac and deployed locally to a raspberry pi 3 model B with a movidius usb key plugged in running Resin OS 2.15.1+rev1 development (supervisor 7.16.6). I used the following command to push over wifi:

sudo resin local push 2d6ae06.local -s .

This is what I got the first time I ran it

Successfully built 11b89652086f
Successfully tagged local-app:latest
- Creating 'local-app' container
- Starting 'local-app' container

Push completed successfully!
* Streaming application logs..
D: [         0] ncDeviceCreate:307	ncDeviceCreate index 0

D: [         0] ncDeviceCreate:307	ncDeviceCreate index 1

D: [         0] ncDeviceOpen:501	File path /usr/local/lib/mvnc/MvNCAPI-ma2450.mvcmd

I: [         0] ncDeviceOpen:507	ncDeviceOpen() XLinkBootRemote returned success 0

W: [         0] ncDeviceOpen:533	failed to find device

Error - Could not open NCS device.

No luck. Does not look like the code is able to see the movidius key from the container. Here is what I got the second time I ran it.

Successfully built d5638c5d7066
Successfully tagged local-app:latest
- Cleaning up previous image of 'local-app'
- Creating 'local-app' container
- Starting 'local-app' container

Push completed successfully!
* Streaming application logs..
D: [         0] ncDeviceCreate:307	ncDeviceCreate index 0

D: [         0] resetAll:228	Found stalled device 1.2-

I: [         0] resetAll:251	Stalled devices found, Reseting...
E: [         0] dispatcherEventSend:730	Write failed -1

I: [         0] resetAll:275	...
I: [         0] resetAll:275	...
I: [         0] resetAll:275	...
I: [         0] resetAll:275	...
I: [         0] resetAll:275	...
I: [         0] resetAll:275	...
I: [         0] resetAll:275	...
I: [         0] resetAll:275	...
I: [         0] resetAll:275	...
I: [         0] resetAll:275	...
I: [         0] resetAll:275	...
I: [         0] resetAll:275	...
I: [         0] resetAll:275	...
I: [         0] resetAll:275	...
I: [         0] resetAll:275	...
I: [         0] resetAll:275	...
I: [         0] resetAll:275	...
I: [         0] resetAll:275	...
I: [         0] resetAll:275	...
I: [         0] resetAll:275	...
D: [         0] ncDeviceCreate:307	ncDeviceCreate index 1

D: [         0] ncDeviceOpen:501	File path /usr/local/lib/mvnc/MvNCAPI-.mvcmd

W: [         0] ncDeviceOpen:505	ncDeviceOpen() XLinkBootRemote returned error 3

Error - Could not open NCS device.

This time the movidius key appear to be stalled may be because it was not closed properly by the previously run and the ncsdk is attempting to reset it unsuccessfully.

Running lsusb on the host gave me this

root@2d6ae06:~# lsusb
Bus 001 Device 057: ID 03e7:f63b Intel
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. SMC9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Am I missing something on the resin os side? Do I need to enable something on the OS for the movidius key to be “seen”. Looks to me like I am back to where I was with the custom udev rules in the ncsdk install not working on the container.

Thanks

Ben

Just tried the movidius-rpi3-demo image and same thing

Successfully built 6b191a759a4d
Successfully tagged local-app:latest
- Creating 'local-app' container
- Starting 'local-app' container

Push completed successfully!
* Streaming application logs..
W: [         0] ncDeviceOpen:533	failed to find device

Traceback (most recent call last):
  File "live-image-classifier.py", line 191, in <module>
    main()
  File "live-image-classifier.py", line 132, in main
    device = open_ncs_device()
  File "live-image-classifier.py", line 40, in open_ncs_device
    device.open()
  File "/usr/local/lib/python3.5/dist-packages/mvnc/mvncapi.py", line 448, in open
    raise Exception(Status(status))
Exception: Status.ERROR