PYNQ Linux sudo permissions

I’m building a PYNQ 3.0.1 image for the Digilent Cora-Z7, and I’ve run into an issue with using sudo while booting using a USB rootfs. I’m actually developing a PYNQ image for a custom Zynq-7000 board that does not have SD card storage, and I’m using the Cora-Z7 to test out the USB boot process in the meantime. The boot and login process via USB seem to be successful, but when I try to run a command using sudo, I get the following error:

(pynq-venv) xilinx@pynq:/$ sudo
sudo: /etc/sudo.conf is owned by uid 1001, should be 0
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set

The sudo permissions are set as:

-rwxr-xr-x  1 1001 1001    177492 Feb 14  2022 sudo

However, when I boot the same PYNQ image from an SD card, sudo has these permissions:

-rwsr-xr-x 1 root root 177492 Feb 14  2022 /bin/sudo

The UID/groups information for both USB and SD boot is the same:

xilinx@pynq:~$ echo $UID
1000
xilinx@pynq:~$ groups
xilinx adm sudo

When I try to switch to the root user to correct the permissions using the default password “xilinx”, I get an authentication failure:

(pynq-venv) xilinx@pynq:/$ su -
Password: 
su: Authentication failure

Is there any reason why booting using a USB rootfs would change the sudo permissions? Any tips for solving this problem?

Thanks!

I solved my issue, but wanted to post the solution here in case anybody else runs into this issue in the future. The entire rootfs was assigned ownership of my account on my host pc, which broke a lot of stuff. When extracting the rootfs on the USB drive, run sudo tar -xpzf <YOUR_ROOTFS.tar.gz to prevent the ownership from changing.

1 Like

Thank you for contributing the solution back.

Mario