Is this a dev kit (which uses an SD card)? If so, then it is a trivial matter to mount the partition on a host PC and comment out the
nofile entries (which would make testing a lot simpler than cloning or reinstalling to fix and continue work).
At some point when you can log in be sure to post the output of “
ls -l /usr/bin/sudo”, and also report the exact error when trying to use
sudo (sorry, assumes you can log in again, so you might need to fix this from a PC, boot up, log in, purposely cause the problem again, and then run that command before rebooting to see what it says).
Tip: If you have a second terminal already open, and if that terminal is already in a root shell with “
sudo -s”, then you could in theory just comment out those lines before rebooting to skip the step of editing from a PC.