Rebuild Pynq image failed

My goal is to simply rebuild the PYNQ image for Pynq-Z1. I have cloned the PYNQ repo but I don’t know what version of PYNQ is it (perhaps 2.3). The Vivado, SDx and Petalinux version is 2018.3 and I’m using Ubuntu 16.04 in an VMware environment. Before everything I ran the setup_host.sh script. And finally I ran make BOARDS=Pynq-Z1 command in the sdbuild directory. After some time I came up with the following error:

+ mount_points=($(sudo kpartx -av $image_file | cut -d ' ' -f 3))
++ sudo kpartx -av /home/user/Desktop/PYNQ/sdbuild/build/bionic.arm.stage1.img
++ cut -d ' ' -f 3
+ echo loop2p1
loop2p1
+ echo loop2p2
loop2p2
+ root_part=/dev/mapper/loop2p2
+ boot_part=/dev/mapper/loop2p1
+ sleep 1
+ sudo chroot / mkfs -t fat /dev/mapper/loop2p1
mkfs.fat 3.0.28 (2015-05-16)
/dev/mapper/loop2p1: No such file or directory
Makefile:299: recipe for target '/home/user/Desktop/PYNQ/sdbuild/build/bionic.arm.stage1.img' failed
make: *** [/home/user/Desktop/PYNQ/sdbuild/build/bionic.arm.stage1.img] Error 1

How can I solve this issue?

I have seen this problem before. It is related to the actual speed when you mount/unmount the image.
You need some patch like this:

2 Likes

Thanks Rock!
Where should I apply sleep command?

if you follow the link it will open the gitHub page and you have four modified lines in three files.
In particular you must change:

  • sleep 2 → sleep 5 [/sdbuild/scripts/resize_umount.sh@line15]
  • sleep 1 → sleep 5 [/sdbuild/scripts/create_mount_img.sh@line18]
  • sleep 2 → sleep 5 [/sdbuild/scripts/create_mount_img.sh@line26]
  • sleep 1 → sleep 5 [/sdbuild/scripts/unmount_image.sh@line10]

I believe Rock is not GMT time, so it may take some time to reply

I made the suggested changes and it failed again. The latest output is saved in attachment.
new 1.txt (124.8 KB)
I understand it goes:

  • all the way down to line#1931- the makefile line#263 is being executed
  • #1932 - makefile line#264 i.e. run mount_images.sh
  • #1933/34 - echo of the mount_points from inside mount_image.sh
  • #1935 - makefile line#265 i.e run install_packages.sh
    then, after set -x, it start listing install_package.sh, and anything else called by it, while executing until line #2021, when pynq/qemu.sh line#31 spits an output about invalid user…

and then I lose it :rage: I can’t follow it after “unmount special
A function called by trap in install_packages.sh…
I would say there s some problem installing packages?
Please help!
Best regards

The failure looks better than last time. At least you got pandas and sigrok built successfully.

The error seems to be invalid user for chown command. Let me clarify a few things: 1. are you using a prebuilt rootfs image, or building the rootfs image from scratch? 2. did you run make clean before you run any make?

I followed your instruction, but my problem differs from that of gpcus!
I also unmounted every image the previous process made and did a make clean before performing the new make.
Now the error is:

cp --sparse=always /home/user/Desktop/PYNQ/sdbuild/build/bionic.arm.stage1.img 
/home/user/Desktop/PYNQ/sdbuild/build/bionic.arm.stage2.img
/home/user/Desktop/PYNQ/sdbuild/scripts/mount_image.sh 
/home/user/Desktop/PYNQ/sdbuild/build/bionic.arm.stage2.img 
/home/user/Desktop/PYNQ/sdbuild/build/bionic.arm
loop0p1
loop0p2
mount: special device /dev/mapper/loop0p2 does not exist
mount: mount point /home/user/Desktop/PYNQ/sdbuild/build/bionic.arm/boot does not exist
QEMU_EXE=/opt/qemu/bin/qemu-arm-static PYNQ_BOARD=Unknown ARCH=arm / 
home/user/Desktop/PYNQ/sdbuild/scripts/install_packages.sh 
/home/user/Desktop/PYNQ/sdbuild/build/bionic.arm gcc-mb python_packages_bionic libsds 
jupyter phantomjs-fix pandas sigrok
+ target=/home/user/Desktop/PYNQ/sdbuild/build/bionic.arm
+ shift
+ fss='proc run dev'
+ for fs in '$fss'
+ sudo mount -o bind /proc /home/user/Desktop/PYNQ/sdbuild/build/bionic.arm/proc
mount: mount point /home/user/Desktop/PYNQ/sdbuild/build/bionic.arm/proc does not exist
Makefile:299: recipe for target ' 
/home/user/Desktop/PYNQ/sdbuild/build/bionic.arm.stage2.img' failed
make: *** [/home/user/Desktop/PYNQ/sdbuild/build/bionic.arm.stage2.img] Error 32

By the way, addressing your first question, I’m using make command instead of image_from_prebuilt.sh so I think I’m building the Pynq-Z1 image from scratch (which should be a trivial task!).

Hello Rock, unfortunately we are on different time, I am based in UK, so there is always a significant slack between replies.

  1. I believe I am building from scratch.
  • I set up the VM as instructed
  • I am running make BOARDDIR=myBoardPath
  1. I run make clean before

xilinx user is added in create_rootfs.sh. I am now looking at it… it is run at makefile#271.
unfortunately it must be so far back that nothing of it was logged…
I attach a new, longer log, showing xilinx user being added at an earlier stage.
putty.1st.log (3.4 MB)

Best regards

Can you check if you have enough disk space on your VM? It seems that when you mount stage 2 image, there is an error.

For this type of error, it looks similar to https://github.com/Xilinx/PYNQ/issues/643

One thing to make sure, is to unmount all the images before running a make clean. So before running make again, make sure sudo losetup -a returns nothing. If there is an image mounted, use

sudo umount build/bionic.<board>/boot
sudo umount build/bionic.<board>
sudo kpartx -d <image_file>

The disk to unmount depends on at which stage you failed. Did you do that?

Hi Rock,
Can you point me to where, in the log file attached in the previous reply, I got an error mounting the stage 2 image?
I have no disk space problem, the VM is 200GB on a server, not on my workstation
Thanks

Hello there,
I normally do a build on clean machine after power up, there is nothing mounted and there is no build/bionic.arm/boot, no build/bionic.arm. The link you mention above is of interest, though, exactly the same error! On monday I’ll see if I can progress further. Do you think the four chmod lines in pynq qemu.sh where the make fails are of paramount importance? Worth to comment it out and see where how far it goes?
Best regards

By the way, should I create a new issue and attach the complete make log to the GitHub repository? Or you have already done that?
Regards

No need to open that issue. I am curious about how it failed. It looks pretty normal when you finished installing pynq package, then you unmount all the disks, that error message is not clear to me how it failed.

One thing to try, is to manually go through those package installation to see why the package failed. I think you can leverage the mount_image.sh, install_package.sh, and unmount_image.sh, just like what the Makefile is doing.

Ok. Now I understand your environment. How did you setup passwordless sudo on your VM?

I didn’t do it myself. The VM was setup from IT, I only installed software, run setup_host.sh, cloned GitHub and installed few bits and bobs setup_host miss (cython and dlibz:i386)
The fact that I can sudo without having to enter a password seems sufficient to say it is ok.

The relevant part of your log:

+ hostname DL-POC-TBI-366-PYNQ
+ rm -rf pynq_git
+ rm -rf jupyter_notebooks_2019_05_24_13_17_04 jupyter_notebooks_2019_05_24_13_17_16
+ cd /root
++ pip3 show pynq
++ cut -d : -f 2
++ grep '^Location'
+ pynq_dir=' /usr/local/lib/python3.6/dist-packages/pynq'
+ '[' '!' -e /home/xilinx/pynq ']'
+ ln -s /usr/local/lib/python3.6/dist-packages/pynq /home/xilinx/pynq
+ chown xilinx:xilinx /home/xilinx/REVISION
/bin/chown: invalid user: ‘xilinx:xilinx’
+ unmount_special
+ for fs in '$fss'
+ sudo umount -l /home/guido/PYNQ/sdbuild/build/bionic.arm/proc
+ for fs in '$fss'
+ sudo umount -l /home/guido/PYNQ/sdbuild/build/bionic.arm/run
+ for fs in '$fss'
+ sudo umount -l /home/guido/PYNQ/sdbuild/build/bionic.arm/dev
+ sudo umount -l /home/guido/PYNQ/sdbuild/build/bionic.arm/ccache
+ rmdir /home/guido/PYNQ/sdbuild/build/bionic.arm/ccache
Makefile:299: recipe for target '/home/guido/PYNQ/sdbuild/output/bionic.arm.2.4.img' failed
make: *** [/home/guido/PYNQ/sdbuild/output/bionic.arm.2.4.img] Error 1

If you follow your log, it is the first time when you install pynq where the make flow failed. https://github.com/Xilinx/PYNQ/blob/master/sdbuild/ubuntu/bionic/arm/config#L3
You can see your pandas and sigrok have been installed successfully.

The only suspicious thing I see is this line:

/bin/chown: invalid user: ‘xilinx:xilinx’

in your log file. One thing to try quickly, is to disable those 4 chown commands (for some reasons they failed, and you only see the first chown command)

Is there any restrictions on your sudo rights? Also, if you know how to chroot to your image, you can do a quick try of chown call by itself. I think it might be related to your environment.

P.S. to chroot to your image, when the make fails, do not unmount it or delete it, just do this command immediately:

sudo -E chroot /home/guido/PYNQ/sdbuild/build/bionic.arm/ bash

This will bring you onto the QEMU environment. You can exit it by typing exit anytime. While in the QEMU environment, try to make a folder somewhere and chown xilinx:xilinx <your_folder> to see if it works.

I have 30GB left for whole this process, and upon failing (on mounting stage2) the VM has 17GB disk space. Do you this might cause the issue?

This is fine. Keep in mind that you will have to unmount all the old images before you run a make. Easier way might be restart your VM, run a make clean, then run make.

Hi Rock,

Unfortunately I could not achieve any further progress in running make BOARDS=Pynq-Z1 command. However, as my final goal is to rebuild the PYNQ image for ZC706 board, I used the image_from_prebuilt.sh script to make an image from a prebuilt generic arm image.
Fortunately this script finished successfully. The problem is I cannot connect to the board via ethernet port (I communicate with board through serial port). When I run ifconfig command in the Pynq running on the ZC706 board I just see the lo (loopback):

xilinx@pynq:~$ ifconfig
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
inet 127.0.0.1  netmask 255.0.0.0
inet6 ::1  prefixlen 128  scopeid 0x10<host>
loop  txqueuelen 1000  (Local Loopback)
RX packets 90  bytes 6376 (6.3 KB)
RX errors 0  dropped 0  overruns 0  frame 0
TX packets 90  bytes 6376 (6.3 KB)
TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

and when I run ifconfig -a I get:

eth0: flags=4098<BROADCAST,MULTICAST>  mtu 1500
    ether 52:5d:af:d7:69:03  txqueuelen 1000  (Ethernet)
    RX packets 0  bytes 0 (0.0 B)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 0  bytes 0 (0.0 B)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    device interrupt 28  base 0xb000

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
    inet 127.0.0.1  netmask 255.0.0.0
    inet6 ::1  prefixlen 128  scopeid 0x10<host>
    loop  txqueuelen 1000  (Local Loopback)
    RX packets 444  bytes 35260 (35.2 KB)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 444  bytes 35260 (35.2 KB)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

sit0: flags=128<NOARP>  mtu 1480
    sit  txqueuelen 1000  (IPv6-in-IPv4)
    RX packets 0  bytes 0 (0.0 B)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 0  bytes 0 (0.0 B)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

How can make the ethernet of board functional?

Thanks