# Error no device found when loading overlay

**URL:** <https://discuss.pynq.io/t/error-no-device-found-when-loading-overlay/2989>\
**Category:** Support\
**Created:** [September 5, 2021, 3:09pm UTC](https://discuss.pynq.io/t/error-no-device-found-when-loading-overlay/2989 "2021-09-05T15:09:38Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Poly\_Morph](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/poly_morph/32/2345_2.png) [@Poly\_Morph](https://discuss.pynq.io/u/Poly_Morph)\
**Post date:** [September 5, 2021, 3:09pm UTC](https://discuss.pynq.io/t/error-no-device-found-when-loading-overlay/2989/1 "2021-09-05T15:09:38Z")

</div>

I am following the step of from [Overlay Tutorial — Python productivity for Zynq (Pynq) v1.0](https://pynq.readthedocs.io/en/v2.0/overlay_design_methodology/overlay_tutorial.html)

Currently I’m using Jupyter Notebook on the Ultra96 v2 through ssh tunnel and I encountered the following error when trying to load the overlay.

```auto
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-4-6407a7cc4fde> in <module>()
      1 from pynq import Overlay
----> 2 ol = Overlay('/home/xilinx/pynq/overlays/adder/adder.bit')

/usr/local/lib/python3.6/dist-packages/pynq/overlay.py in __init__ (self, bitfile_name, dtbo, download, ignore_version, device)
    335 
    336 """
--> 337 super(). __init__ (bitfile_name, dtbo, partial=False, device=device)
    338 
    339 self._register_drivers()

/usr/local/lib/python3.6/dist-packages/pynq/bitstream.py in __init__ (self, bitfile_name, dtbo, partial, device)
    109 if device is None:
    110 from .pl_server.device import Device
--> 111 device = Device.active_device
    112 self.device = device
    113 

/usr/local/lib/python3.6/dist-packages/pynq/pl_server/device.py in active_device(cls)
     94 if not hasattr(cls, '_active_device'):
     95 if len(cls.devices) == 0:
---> 96 raise RuntimeError("No Devices Found")
     97 cls._active_device = cls.devices[0]
     98 return cls._active_device

RuntimeError: No Devices Found

```

Does anyone know how do I fix this?

---

<div class="post-metadata">

**Author:** ![PeterOgden](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/peterogden/32/55_2.png) [@PeterOgden](https://discuss.pynq.io/u/PeterOgden)\
**Post date:** [September 6, 2021, 8:27am UTC](https://discuss.pynq.io/t/error-no-device-found-when-loading-overlay/2989/2 "2021-09-06T08:27:36Z")

</div>

This error is usually a result of `/dev/xlnk` not existing. Can you check if the device is there? What image are you running?

Peter

---

<div class="post-metadata">

**Author:** ![haroic2021](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/haroic2021/32/2349_2.png) [@haroic2021](https://discuss.pynq.io/u/haroic2021)\
**Post date:** [September 7, 2021, 3:54pm UTC](https://discuss.pynq.io/t/error-no-device-found-when-loading-overlay/2989/3 "2021-09-07T15:54:17Z")

</div>

Hi peter,

I am facing the same issue as well, I have check and dev/xink is there, how do I proceed?

 ![image](https://us1.discourse-cdn.com/flex019/uploads/pynq1/original/2X/a/a4add825c5c5215504f25a47831d7b1f2b12f01c.png)

---

<div class="post-metadata">

**Author:** ![thepipa](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/thepipa/32/2444_2.png) [@thepipa](https://discuss.pynq.io/u/thepipa)\
**Post date:** [October 11, 2021, 4:27pm UTC](https://discuss.pynq.io/t/error-no-device-found-when-loading-overlay/2989/4 "2021-10-11T16:27:18Z")

</div>

Hello. Im having the same issue on my Zybo using pynq 2.6 as base.

```auto
from pynq.overlays.base import BaseOverlay
ol = BaseOverlay("base.bit")

RuntimeError: No Devices Found

```

```auto
xilinx@pynq:~$ ls /dev/xlnk
ls: cannot access '/dev/xlnk': No such file or directory
xilinx@pynq:~$ ls /sys/class/fpga_manager/
ls: cannot access '/sys/class/fpga_manager/': No such file or directory

```

Any ideas @PeterOgden ? I used [this files](https://github.com/altuSemi/PYNQ4Zybo) (kernel) to the boot partition of the sd.

The board appears to boot correctly but cant load any bitfile.

Some extra info, not sure if relevant:

```auto
xilinx@pynq:~$ sudo systemctl start xilinx-apf-driver.service
[sudo] password for xilinx: 
Job for xilinx-apf-driver.service failed because the control process exited with error code.
See "systemctl status xilinx-apf-driver.service" and "journalctl -xe" for details.
xilinx@pynq:~$ systemctl status xilinx-apf-driver.service
● xilinx-apf-driver.service - Xilinx APF Driver Service.
   Loaded: loaded (/etc/systemd/system/xilinx-apf-driver.service; disabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Mon 2021-10-11 22:37:24 UTC; 7s ago
  Process: 1632 ExecStart=/sbin/modprobe xlnk-eng (code=exited, status=1/FAILURE)
 Main PID: 1632 (code=exited, status=1/FAILURE)
xilinx@pynq:~$ sudo depmod
depmod: ERROR: could not open directory /lib/modules/3.17.0-xilinx-dirty: No such file or directory
depmod: FATAL: could not search modules: No such file or directory

```

---

<div class="post-metadata">

**Author:** ![Roua\_Zaied](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/roua_zaied/32/2863_2.png) [@Roua\_Zaied](https://discuss.pynq.io/u/Roua_Zaied)\
**Post date:** [February 18, 2022, 9:09am UTC](https://discuss.pynq.io/t/error-no-device-found-when-loading-overlay/2989/5 "2022-02-18T09:09:54Z")

</div>

* * *

RuntimeError Traceback (most recent call last)  
 in ()  
1 from pynq.overlays.base import BaseOverlay  
----\> 2 base = BaseOverlay(“base.bit”)

/usr/local/lib/python3.6/dist-packages/pynq/overlays/base/base.py in **init** (self, bitfile, \*\*kwargs)  
84  
85 def **init** (self, bitfile, \*\*kwargs):  
—\> 86 super(). **init** (bitfile, \*\*kwargs)  
87 if self.is\_loaded():  
88 self.iop\_pmoda.mbtype = “Pmod”

/usr/local/lib/python3.6/dist-packages/pynq/overlay.py in **init** (self, bitfile\_name, dtbo, download, ignore\_version, device)  
334  
335 “”"  
 → 336 super(). **init** (bitfile\_name, dtbo, partial=False, device=device)  
337  
338 self.\_register\_drivers()

/usr/local/lib/python3.6/dist-packages/pynq/bitstream.py in **init** (self, bitfile\_name, dtbo, partial, device)  
109 if device is None:  
110 from .pl\_server.device import Device  
 → 111 device = Device.active\_device  
112 self.device = device  
113

/usr/local/lib/python3.6/dist-packages/pynq/pl\_server/device.py in active\_device(cls)  
92 if not hasattr(cls, ‘\_active\_device’):  
93 if len(cls.devices) == 0:  
—\> 94 raise RuntimeError(“No Devices Found”)  
95 cls.\_active\_device = cls.devices[0]  
96 return cls.\_active\_device

RuntimeError: No Devices Found

the same 🤒 !

---

<div class="post-metadata">

**Author:** ![haipnh](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/haipnh/32/4439_2.png) [@haipnh](https://discuss.pynq.io/u/haipnh)\
**Post date:** [June 27, 2022, 9:18am UTC](https://discuss.pynq.io/t/error-no-device-found-when-loading-overlay/2989/6 "2022-06-27T09:18:51Z")

</div>

I have the same problem.

I logged in via SSH to my PYNQ-ZU board. Then ran

```nohighlight
sudo -s 
source /etc/profile.d/pynq_venv.sh 
python3

```

In Python prompt, I ran some lines of code and get the following error:

```python
>>> from pynq.overlays.base import BaseOverlay
>>> from pynq.lib.video import *
>>> base = BaseOverlay("base.bit")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/xilinx/pynq/overlays/base/base.py", line 48, in __init__
    super(). __init__ (*args, **kwargs)
  File "/home/xilinx/pynq/overlay.py", line 336, in __init__
    super(). __init__ (bitfile_name, dtbo, partial=False, device=device)
  File "/home/xilinx/pynq/bitstream.py", line 111, in __init__
    device = Device.active_device
  File "/home/xilinx/pynq/pl_server/device.py", line 94, in active_device
    raise RuntimeError("No Devices Found")
RuntimeError: No Devices Found

```

---

<div class="post-metadata">

**Author:** ![skalade](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/skalade/32/686_2.png) [@skalade](https://discuss.pynq.io/u/skalade)\
**Post date:** [June 27, 2022, 10:38am UTC](https://discuss.pynq.io/t/error-no-device-found-when-loading-overlay/2989/7 "2022-06-27T10:38:41Z")

</div>

Hi there,

Looks like this is happening because when you login as root you enter a new environment, and lose the XILINX\_XRT environment variable. This is usually set by calling xrt\_setup.sh on startup along with pynq\_venv.sh in /etc/profile.d/, which is why we don’t see these errors in jupyter lab.

Running

```auto
export XILINX_XRT=/usr

```

before your python call should resolve this.

Thanks  
Shawn

---

<div class="post-metadata">

**Author:** ![haipnh](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/haipnh/32/4439_2.png) [@haipnh](https://discuss.pynq.io/u/haipnh)\
**Post date:** [June 27, 2022, 11:04am UTC](https://discuss.pynq.io/t/error-no-device-found-when-loading-overlay/2989/8 "2022-06-27T11:04:02Z")

</div>

Thank you for spotting the problem. It can work in the terminal now.  
If I don’t change to root user, it will print out the following error message when loading a bitstream.

```auto
>>> base = BaseOverlay("base.bit")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/xilinx/pynq/overlays/base/base.py", line 48, in __init__
    super(). __init__ (*args, **kwargs)
  File "/home/xilinx/pynq/overlay.py", line 354, in __init__
    self.download()
  File "/home/xilinx/pynq/overlays/base/base.py", line 91, in download
    super().download()
  File "/home/xilinx/pynq/overlay.py", line 416, in download
    Clocks.set_pl_clk(i, div0, div1)
  File "/home/xilinx/pynq/ps.py", line 331, in set_pl_clk
    cls._instance.set_pl_clk(clk_idx, div0, div1, clk_mhz)
  File "/home/xilinx/pynq/ps.py", line 339, in _instance
    cls._real_instance = _ClocksUltrascale()
  File "/home/xilinx/pynq/ps.py", line 491, in __init__
    self._crf_mmio = MMIO(self.CRF_APB_ADDRESS, 0x100)
  File "/home/xilinx/pynq/mmio.py", line 100, in __init__
    self.array = self.device.mmap(base_addr, length)
  File "/home/xilinx/pynq/pl_server/embedded_device.py", line 527, in mmap
    raise EnvironmentError('Root permissions required.')
OSError: Root permissions required.

```

---

<div class="post-metadata">

**Author:** ![skalade](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/skalade/32/686_2.png) [@skalade](https://discuss.pynq.io/u/skalade)\
**Post date:** [June 27, 2022, 12:04pm UTC](https://discuss.pynq.io/t/error-no-device-found-when-loading-overlay/2989/9 "2022-06-27T12:04:15Z")

</div>

Unfortunately that’s expected behavior! We run everything on pynq as root – you’ll notice that the jupyter terminal is the root user by default. PYNQ touches a lot of devices and memories that require elevated privileges. There’s a nice [explanation](https://discuss.pynq.io/t/pynq-overlay-without-root-privileges/212) by Peter from a while back on why pynq works this way.

Thanks  
Shawn

---

<div class="post-metadata">

**Author:** ![haipnh](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/haipnh/32/4439_2.png) [@haipnh](https://discuss.pynq.io/u/haipnh)\
**Post date:** [June 27, 2022, 1:18pm UTC](https://discuss.pynq.io/t/error-no-device-found-when-loading-overlay/2989/10 "2022-06-27T13:18:48Z")

</div>

I got it and appreciate that.

Hai
