OSError: [Errno 19] No such device in demo

Hello everyone,
I am pretty new to all this and I am trying to get my hands on things by playing with the demo.
Unfortunately I ran into an obstacle and I have no clue about where to begin to solve this issue.
I am on linux, I think I have set-up everything according to the tutorial but I am having this issue when trying to launch the python script :

~/git/uavcan-test/demo$ python3 demo_app.py
Traceback (most recent call last):
  File "demo_app.py", line 170, in <module>
    app = DemoApp()
  File "demo_app.py", line 63, in __init__
    self._node = pyuavcan.application.make_node(node_info, DemoApp.REGISTER_FILE)
  File "/home/louis-nicolas/.local/lib/python3.8/site-packages/pyuavcan/application/_node_factory.py", line 199, in make_node
    node = SimpleNode(pyuavcan.presentation.Presentation(init_transport()), info, registry)
  File "/home/louis-nicolas/.local/lib/python3.8/site-packages/pyuavcan/application/_node_factory.py", line 172, in init_transport
    out = make_transport(registry, reconfigurable=reconfigurable_transport)
  File "/home/louis-nicolas/.local/lib/python3.8/site-packages/pyuavcan/application/_transport_factory.py", line 215, in make_transport
    transports = list(itertools.chain(*(f(registers, node_id) for f in _SPECIALIZATIONS)))
  File "/home/louis-nicolas/.local/lib/python3.8/site-packages/pyuavcan/application/_transport_factory.py", line 284, in _make_can
    media = SocketCANMedia(iface.split(":")[-1], mtu=mtu)
  File "/home/louis-nicolas/.local/lib/python3.8/site-packages/pyuavcan/transport/can/media/socketcan/_socketcan.py", line 68, in __init__
    self._sock = _make_socket(iface_name, can_fd=self._is_fd)
  File "/home/louis-nicolas/.local/lib/python3.8/site-packages/pyuavcan/transport/can/media/socketcan/_socketcan.py", line 295, in _make_socket
    s.bind((iface_name,))
OSError: [Errno 19] No such device

I have seen that it was an error message that has occurred to other people in different context but the solution does not seem systematic. If you have any idea of the potential mistake I have made or where I should dig in it would be greatly appreciated thank you !

It would appear that you don’t have that network interface available. Please post the output of ip link show here. You should see something like this:

$ ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
<...snip...>
5: vcan0: <NOARP,UP,LOWER_UP> mtu 72 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/can

As you appear to be using UAVCAN/CAN, you should have at least one interface with the link type can available.

Thank you for answer Pavel !

ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp0s31f6: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN mode DEFAULT group default qlen 1000
    link/ether 48:2a:e3:38:d2:1f brd ff:ff:ff:ff:ff:ff
3: wlp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DORMANT group default qlen 1000
    link/ether a4:c3:f0:5c:b2:b9 brd ff:ff:ff:ff:ff:ff
4: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default 
    link/ether 02:42:0b:d5:b1:28 brd ff:ff:ff:ff:ff:ff
5: vcan0: <NOARP,UP,LOWER_UP> mtu 72 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/can 

So it seems that indeed I don’t have at least one interface with the link type can available.
So if I am correct I should change something somewhere to make the demo uses the vcan interface or set up a can interface (Sorry if my latest statement does not make any sens) ?

By default, the demo assumes that you run it with UAVCAN/UDP. If you want UAVCAN/CAN, you have to make sure that your CAN interfaces are available (you already have vcan0 so that’s a start) and the script is configured to use them (this is done via registers like UAVCAN__CAN__IFACE=vcan0).

If you were using the demo with a different transport configuration before doing this, consider removing the register file to make sure there are no obsolete options remaining from the previous run: rm *.db.

1 Like

Ok thank you really much it worked by removing the *.db !

I am also having a similar issue that only occurred after I ran yakut compile ~/custom_data_types/sirius_cyber_corp and yakut compile ~/public_regulated_data_types/uavcan ~/public_regulated_data_types/reg in my terminal. Running demo_app.py resulted in the following:

python demo_app.py                   
Traceback (most recent call last):
  File "demo_app.py", line 181, in <module>
    asyncio.run(main())
  File "/home/hilsamum/.pyenv/versions/3.8.13/lib/python3.8/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/home/hilsamum/.pyenv/versions/3.8.13/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "demo_app.py", line 171, in main
    app = DemoApp()
  File "demo_app.py", line 63, in __init__
    self._node = pycyphal.application.make_node(node_info, DemoApp.REGISTER_FILE)
  File "/local/home/hilsamum/OpenCyphal/pycyphal/pycyphal/application/_node_factory.py", line 199, in make_node
    node = SimpleNode(pycyphal.presentation.Presentation(init_transport()), info, registry)
  File "/local/home/hilsamum/OpenCyphal/pycyphal/pycyphal/application/_node_factory.py", line 172, in init_transport
    out = make_transport(registry, reconfigurable=reconfigurable_transport)
  File "/local/home/hilsamum/OpenCyphal/pycyphal/pycyphal/application/_transport_factory.py", line 221, in make_transport
    transports = list(itertools.chain(*(f(registers, node_id) for f in _SPECIALIZATIONS)))
  File "/local/home/hilsamum/OpenCyphal/pycyphal/pycyphal/application/_transport_factory.py", line 290, in _make_can
    media = SocketCANMedia(iface.split(":")[-1], mtu=mtu)
  File "/local/home/hilsamum/OpenCyphal/pycyphal/pycyphal/transport/can/media/socketcan/_socketcan.py", line 82, in __init__
    self._sock = _make_socket(iface_name, can_fd=self._is_fd)
  File "/local/home/hilsamum/OpenCyphal/pycyphal/pycyphal/transport/can/media/socketcan/_socketcan.py", line 325, in _make_socket
    s.bind((iface_name,))
OSError: [Errno 19] No such device

The output of ip link show for me is the following:

ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9001 qdisc mq state UP mode DEFAULT group default qlen 1000
    link/ether 06:8d:93:1a:f9:85 brd ff:ff:ff:ff:ff:ff
3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default 
    link/ether 02:42:06:72:bf:c9 brd ff:ff:ff:ff:ff:ff

It says that you don’t have any CAN interfaces, so look into that first.