Generating a bookworm image for my RPI Zero 2W i was missing sudo rights.
The script in pi-gen/stage2/01-sys-tweaks/01-run.sh tries to update the /etc/sudoers.d/010_pi-nopasswd file with the updated FIRST_USER_NAME :
if [ -f "${ROOTFS_DIR}/etc/sudoers.d/010_pi-nopasswd" ]; then
sed -i "s/^pi /$FIRST_USER_NAME /" "${ROOTFS_DIR}/etc/sudoers.d/010_pi-nopasswd"
fi
but this file doesnt exist yet.
As far as i can see, this file isnt generated until export-image/01-rename-user task:
Begin /home/USER/pi-gen/export-image/01-user-rename/00-packages
...
Setting up raspberrypi-sys-mods (20250930~bookworm) ...
...
End /home/USER/pi-gen/export-image/01-user-rename/00-packages
if the first user is not renamed using:
DISABLE_FIRST_BOOT_USER_RENAME=1
Then the user will not be granted sudo privilidges.
I moved the script to /home/USER/pi-gen/export-image/01-user-rename/01-run.sh which seem to work.
Generating a bookworm image for my RPI Zero 2W i was missing sudo rights.
The script in pi-gen/stage2/01-sys-tweaks/01-run.sh tries to update the /etc/sudoers.d/010_pi-nopasswd file with the updated FIRST_USER_NAME :
if [ -f "${ROOTFS_DIR}/etc/sudoers.d/010_pi-nopasswd" ]; then
sed -i "s/^pi /$FIRST_USER_NAME /" "${ROOTFS_DIR}/etc/sudoers.d/010_pi-nopasswd"
fi
but this file doesnt exist yet.
As far as i can see, this file isnt generated until export-image/01-rename-user task:
Begin /home/USER/pi-gen/export-image/01-user-rename/00-packages
...
Setting up raspberrypi-sys-mods (20250930~bookworm) ...
...
End /home/USER/pi-gen/export-image/01-user-rename/00-packages
if the first user is not renamed using:
DISABLE_FIRST_BOOT_USER_RENAME=1
Then the user will not be granted sudo privilidges.
I moved the script to /home/USER/pi-gen/export-image/01-user-rename/01-run.sh which seem to work.