Pynq Throwing Boost Exception, /dev/dri/by-path/is missing

Pynq version:
Board: ZCU208
Tools: PetaLinux/Vivado 2022.1

I have built an image with Pynq and jupyter-notebook on it. The image has no display device.
The build succeeds but invoking pynq throws an error.
When I import pynq into python, I throw a boost exception.

import pynq
ERROR: Unknown command: ‘dump’
terminate called after throwing an instance of ‘boost::filesystem::filesystem_error’
what(): boost::filesystem::directory_iterator::construct: No such file or directory: “/dev/dri/by-path/”

(The same occurs if I explicitly run /usr/bin/pynq)

From what I can tell, this indicates that I do not have the Direct Rendering Infrastructure installed.

I have tried to import the mesa and wayland packages but I never see the /dev/dri path instantiate.

Any ideas as to what packages install this?
Do I need to have a graphics device defined for this?
(I currently have no display port in this build.)

Regards,
Doug Bailey

Hi Doug,

Could you share your .spec file that you used to generate the image? And what version of PYNQ are you using?

The /dev/dri/by-path directory is related to the zocl driver, it is responsible for accelerator memory allocation (kinda like OpenCL), which is why it appears in the path usually associated with graphics cards.

My guess is your .spec is either missing the xrt package or there’s some version mismatch between pynq and xrt.

Thanks
Shawn

1 Like

I am running Pynq 2.5.1.

I am building pynq by adding
IMAGE_INSTALL:append = " python3-pynq "
IMAGE_INSTALL:append = " python3-pynq-notebooks "
IMAGE_INSTALL:append = " pynq-overlay "
into my petalinux image. (Along a with a number of other python3 recipes.)

This builds fine but is obviously less than the whole solution. I have not done any customization to the image that gets built via Yocto in so obviously I am missing something. (I was not aware of Pynq’s need for the HW definition file.)

I have found the petalinux section in the “Python Productivity for Zynq (Pynq)” manual. I need to read through it and determine what I need to add to my build. At that time I may come back with more questions.

Until that time, it’s RTFM.

Thanks,
Doug Bailey

I’m curious what is the reason you want to use the pure petalinux flow instead of using a prebuilt ZCU208 PYNQ image?

I don’t believe PYNQ v2.5.1 has been verified with the latest version of petalinux (2022.1), you might run into weird xrt/zocl version issues, which could explain one of the errors you gave in the original post:

ERROR: Unknown command: ‘dump’.

one reason this could be happening could be because v2.5.1 pynq is using the old way of finding the xrt version – with xbutil dump, which has been deprecated in later releases of XRT. If you are using petalinux 2022.1 it could be that the newer xrt version and zocl driver are being compiled.

You might also have zocl available as a loadable kernel module, but for whatever reason it hasn’t been loaded, in which case you could try to run

insmod zocl

and see if that fixes some of the errors.

Thanks
Shawn

Sorry so late in responding, I got pulled from my efforts.

PetaLinux 2022.1 uses the /meta-xilinx/meta-xilinx-pynq/recipes-devtool/python/python3-pynq_2.5.1.bb recipe. Hence the version that I am running.

I did notice that the zcol.ko kernel module was not being loaded so I loaded it via depmod/modprobe. Alas, the behavior did not change.

I did run the xbutil to get the following information about the board.
root@xilinx-zcu208-LD-2022-alex-oct27:~# xbutil examine
System Configuration
OS Name : Linux
Release : 5.15.19-xilinx-v2022.1
Version : #1 SMP Mon Apr 11 17:52:14 UTC 2022
Machine : aarch64
CPU Cores : 4
Memory : 3929 MB
Distribution : PetaLinux 2022.1_release_S04190222 (honister)
GLIBC : 2.34
Model : ZynqMP ZCU208 RevA

XRT
Version : 2.13.0
Branch : 2022.1
Hash : 2a6dc026480914ea1c9f02977a6ab4b57e8a3c8d
Hash Date : 2022-04-12 14:31:55
ZOCL : 2.13.0, 2a6dc026480914ea1c9f02977a6ab4b57e8a3c8d

Devices present
0 devices found
BDF : Shell Platform UUID Device ID Device Ready*

Running an strace on a simple pynq call, I end with:

openat(AT_FDCWD, “/lib/libgcc_s.so.1”, O_RDONLY|O_CLOEXEC) = 3
read(3, “\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0\267\0\1\0\0\0\200.\0\0\0\0\0\0”…, 832) = 832
newfstatat(3, “”, {st_mode=S_IFREG|0644, st_size=83872, …}, AT_EMPTY_PATH) = 0
mmap(NULL, 148168, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xffff7d10a000
mprotect(0xffff7d11e000, 61440, PROT_NONE) = 0
mmap(0xffff7d12d000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x13000) = 0xffff7d12d000
close(3) = 0
mprotect(0xffff7d12d000, 4096, PROT_READ) = 0
mprotect(0xffff7d338000, 53248, PROT_READ) = 0
mprotect(0xffff7d35d000, 4096, PROT_READ) = 0
mprotect(0xffff7d38e000, 4096, PROT_READ) = 0
mprotect(0xffff7d3a5000, 4096, PROT_READ) = 0
mprotect(0xffff7d4fd000, 20480, PROT_READ) = 0
mprotect(0xffff7d5be000, 20480, PROT_READ) = 0
uname({sysname=“Linux”, nodename=“xilinx-zcu208-LD-2022-alex-oct27”, …}) = 0
futex(0xffff7d346588, FUTEX_WAKE_PRIVATE, 2147483647) = 0
futex(0xffff7d34658c, FUTEX_WAKE_PRIVATE, 2147483647) = 0
munmap(0xffff7faf9000, 23783) = 0
newfstatat(AT_FDCWD, “/usr/lib/python3.9/site-packages/pynq”, {st_mode=S_IFDIR|0755, st_size=4096, …}, 0) = 0
newfstatat(AT_FDCWD, “/usr/lib/python3.9/site-packages/pynq/ert.py”, {st_mode=S_IFREG|0644, st_size=11115, …}, 0) = 0
newfstatat(AT_FDCWD, “/usr/lib/python3.9/site-packages/pynq/ert.py”, {st_mode=S_IFREG|0644, st_size=11115, …}, 0) = 0
openat(AT_FDCWD, “/usr/lib/python3.9/site-packages/pynq/pycache/ert.cpython-39.pyc”, O_RDONLY|O_CLOEXEC) = 3
newfstatat(3, “”, {st_mode=S_IFREG|0644, st_size=7270, …}, AT_EMPTY_PATH) = 0
ioctl(3, TCGETS, 0xffffed91a758) = -1 ENOTTY (Inappropriate ioctl for device)
lseek(3, 0, SEEK_CUR) = 0
lseek(3, 0, SEEK_CUR) = 0
newfstatat(3, “”, {st_mode=S_IFREG|0644, st_size=7270, …}, AT_EMPTY_PATH) = 0
read(3, “a\r\r\n\3\0\0\0N\360v\263\314ug\30\343\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0”…, 7271) = 7270
read(3, “”, 1) = 0
close(3) = 0
openat(AT_FDCWD, “/usr/lib/python3.9/site-packages/pynq/ert.py”, O_RDONLY|O_CLOEXEC) = 3
newfstatat(3, “”, {st_mode=S_IFREG|0644, st_size=11115, …}, AT_EMPTY_PATH) = 0
ioctl(3, TCGETS, 0xffffed91a758) = -1 ENOTTY (Inappropriate ioctl for device)
lseek(3, 0, SEEK_CUR) = 0
lseek(3, 0, SEEK_CUR) = 0
newfstatat(3, “”, {st_mode=S_IFREG|0644, st_size=11115, …}, AT_EMPTY_PATH) = 0
read(3, “"""\n Copyright (C) 2018 Xilinx, “…, 11116) = 11115
read(3, “”, 1) = 0
close(3) = 0
pipe2([3, 4], O_CLOEXEC) = 0
newfstatat(3, “”, {st_mode=S_IFIFO|0600, st_size=0, …}, AT_EMPTY_PATH) = 0
ioctl(3, TCGETS, 0xffffed91b478) = -1 ENOTTY (Inappropriate ioctl for device)
lseek(3, 0, SEEK_CUR) = -1 ESPIPE (Illegal seek)
ioctl(3, TCGETS, 0xffffed91b518) = -1 ENOTTY (Inappropriate ioctl for device)
pipe2([5, 6], O_CLOEXEC) = 0
clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xffff7faf50e0) = 753
close(6) = 0
close(4) = 0
read(5, “”, 50000) = 0
close(5) = 0
lseek(3, 0, SEEK_CUR) = -1 ESPIPE (Illegal seek)
newfstatat(3, “”, {st_mode=S_IFIFO|0600, st_size=0, …}, AT_EMPTY_PATH) = 0
read(3, ERROR: Unknown command: ‘dump’
“\33[38;5;3m\nDESCRIPTION: \33[38;5;11”…, 8192) = 1411
read(3, “”, 6781) = 0
— SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=753, si_uid=0, si_status=0, si_utime=0, si_stime=0} —
close(3) = 0
wait4(753, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 753
mmap(NULL, 262144, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xffff7d0ca000
newfstatat(AT_FDCWD, “/dev/xlnk”, 0xffffed91d828, 0) = -1 ENOENT (No such file or directory)
statx(AT_FDCWD, “”, AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT, STATX_TYPE|STATX_MODE, 0xffffed91d098) = -1 ENOENT (No such file or directory)
statx(AT_FDCWD, “”, AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT, STATX_TYPE|STATX_MODE, 0xffffed91d098) = -1 ENOENT (No such file or directory)
readlinkat(AT_FDCWD, “/proc/self/exe”, “/usr/bin/python3.9”, 4096) = 18
statx(AT_FDCWD, “/usr/bin/xrt.ini”, AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT, STATX_TYPE|STATX_MODE, 0xffffed91cfd8) = -1 ENOENT (No such file or directory)
statx(AT_FDCWD, “/usr/bin/sdaccel.ini”, AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT, STATX_TYPE|STATX_MODE, 0xffffed91cfd8) = -1 ENOENT (No such file or directory)
getcwd(”/home/root”, 1024) = 11
statx(AT_FDCWD, “/home/root/xrt.ini”, AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT, STATX_TYPE|STATX_MODE, 0xffffed91cfd8) = -1 ENOENT (No such file or directory)
statx(AT_FDCWD, “/home/root/sdaccel.ini”, AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT, STATX_TYPE|STATX_MODE, 0xffffed91cfd8) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, “/dev/dri/by-path/”, O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = -1 ENOENT (No such file or directory)
futex(0xffff7d12e0a4, FUTEX_WAKE_PRIVATE, 2147483647) = 0
write(2, "terminate called after throwing “…, 48terminate called after throwing an instance of ‘) = 48
write(2, “boost::filesystem::filesystem_er”…, 35boost::filesystem::filesystem_error) = 35
write(2, "’\n”, 2’
) = 2
write(2, " what(): ", 11 what(): ) = 11
write(2, “boost::filesystem::directory_ite”…, 96boost::filesystem::directory_iterator::construct: No such file or directory: “/dev/dri/by-path/”) = 96
write(2, “\n”, 1
) = 1
rt_sigprocmask(SIG_UNBLOCK, [ABRT], NULL, 8) = 0
gettid() = 751
getpid() = 751
tgkill(751, 751, SIGABRT) = 0
— SIGABRT {si_signo=SIGABRT, si_code=SI_TKILL, si_pid=751, si_uid=0} —
+++ killed by SIGABRT +++
Aborted

I obviously am missing a large piece of the equation on what is required to setup/initialize pynq. I would love a reference as to what is needed.

Regards,
Doug