summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSerge Schneider <serge@raspberrypi.com>2026-03-02 17:15:06 +0000
committerSerge Schneider <serge@raspberrypi.com>2026-03-02 17:15:06 +0000
commitd5516a11139097da8e739f1ed13238316f17cd5a (patch)
treeca2777b5109f7ae41b759a8a3fac2afb8af7f223
parent4997bf4e4e49bc3305eb182a4a08bd023529da04 (diff)
parent21bc9efbcc859640ab2c3cef20da4d772d2b2aad (diff)
Merge branch 'master' into arm64
-rw-r--r--.gitignore1
-rw-r--r--README.md10
-rwxr-xr-xbuild-docker.sh8
-rwxr-xr-xbuild.sh1
-rw-r--r--depends2
-rw-r--r--scripts/dependencies_check2
-rwxr-xr-xstage1/01-sys-tweaks/00-run.sh3
-rw-r--r--stage2/01-sys-tweaks/00-packages2
-rwxr-xr-xstage2/01-sys-tweaks/01-run.sh6
9 files changed, 24 insertions, 11 deletions
diff --git a/.gitignore b/.gitignore
index f01ee89..b214c47 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,3 +6,4 @@ SKIP
SKIP_IMAGES
.pc
*-pc
+.vscode/
diff --git a/README.md b/README.md
index 6361199..0f74059 100644
--- a/README.md
+++ b/README.md
@@ -20,7 +20,7 @@ below.
To install the required dependencies for `pi-gen` you should run:
```bash
-apt install coreutils quilt parted qemu-user-static debootstrap zerofree zip \
+apt install coreutils quilt parted qemu-user-binfmt debootstrap zerofree zip \
dosfstools e2fsprogs libarchive-tools libcap2-bin grep rsync xz-utils file git curl bc \
gpg pigz xxd arch-test bmap-tools kmod
```
@@ -186,6 +186,14 @@ The following environment variables are supported:
stays activated. `FIRST_USER_PASS` must be set for this to work. Please be aware of the implied
security risk of defining a default username and password for your devices.
+ * `PASSWORDLESS_SUDO` (Default: `0`)
+
+ Setting to `1` will enable passwordless sudo for the first user. This allows
+ the user to run commands with sudo without entering a password. Note that
+ this is a security risk and should only be enabled if you understand the
+ implications. The user will still be able to use sudo with a password even
+ when this is set to `0`.
+
* `WPA_COUNTRY` (Default: unset)
Sets the default WLAN regulatory domain and unblocks WLAN interfaces. This should be a 2-letter ISO/IEC 3166 country Code, i.e. `GB`
diff --git a/build-docker.sh b/build-docker.sh
index 53f8cf7..39ab673 100755
--- a/build-docker.sh
+++ b/build-docker.sh
@@ -105,10 +105,10 @@ case $(uname -m) in
;;
esac
-# Check if qemu-aarch64-static and /proc/sys/fs/binfmt_misc are present
+# Check if qemu-aarch64 and /proc/sys/fs/binfmt_misc are present
if [[ "${binfmt_misc_required}" == "1" ]]; then
- if ! qemu_arm=$(which qemu-aarch64-static) ; then
- echo "qemu-aarch64-static not found (please install qemu-user-static)"
+ if ! qemu_arm=$(which qemu-aarch64) ; then
+ echo "qemu-aarch64 not found (please install qemu-user-binfmt)"
exit 1
fi
if [ ! -f /proc/sys/fs/binfmt_misc/register ]; then
@@ -141,7 +141,7 @@ time ${DOCKER} run \
$DOCKER_CMDLINE_POST \
pi-gen \
bash -e -o pipefail -c "
- dpkg-reconfigure qemu-user-static &&
+ dpkg-reconfigure qemu-user-binfmt &&
# binfmt_misc is sometimes not mounted with debian trixie image
(mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc || true) &&
cd /pi-gen; ./build.sh ${BUILD_OPTS} &&
diff --git a/build.sh b/build.sh
index efd5c4d..c29a790 100755
--- a/build.sh
+++ b/build.sh
@@ -207,6 +207,7 @@ export TARGET_HOSTNAME=${TARGET_HOSTNAME:-raspberrypi}
export FIRST_USER_NAME=${FIRST_USER_NAME:-pi}
export FIRST_USER_PASS
export DISABLE_FIRST_BOOT_USER_RENAME=${DISABLE_FIRST_BOOT_USER_RENAME:-0}
+export PASSWORDLESS_SUDO="${PASSWORDLESS_SUDO:-0}"
export WPA_COUNTRY
export ENABLE_SSH="${ENABLE_SSH:-0}"
export PUBKEY_ONLY_SSH="${PUBKEY_ONLY_SSH:-0}"
diff --git a/depends b/depends
index 752ba79..0aa89cb 100644
--- a/depends
+++ b/depends
@@ -1,7 +1,7 @@
quilt
parted
realpath:coreutils
-qemu-arm-static:qemu-user-static
+qemu-arm:qemu-user-binfmt
debootstrap
zerofree
zip
diff --git a/scripts/dependencies_check b/scripts/dependencies_check
index 32c42ef..fb709e4 100644
--- a/scripts/dependencies_check
+++ b/scripts/dependencies_check
@@ -3,7 +3,7 @@
#
# Each dependency is in the form of a tool to test for, optionally followed by
# a : and the name of a package if the package on a Debian-ish system is not
-# named for the tool (i.e., qemu-user-static).
+# named for the tool (i.e., qemu-user-binfmt).
dependencies_check()
{
local depfile deps missing
diff --git a/stage1/01-sys-tweaks/00-run.sh b/stage1/01-sys-tweaks/00-run.sh
index b7e5b5e..df07d41 100755
--- a/stage1/01-sys-tweaks/00-run.sh
+++ b/stage1/01-sys-tweaks/00-run.sh
@@ -4,11 +4,12 @@ install -v -m 644 files/fstab "${ROOTFS_DIR}/etc/fstab"
on_chroot << EOF
if ! id -u ${FIRST_USER_NAME} >/dev/null 2>&1; then
- adduser --disabled-password --gecos "" ${FIRST_USER_NAME}
+ adduser --disabled-login --gecos "" ${FIRST_USER_NAME}
fi
if [ -n "${FIRST_USER_PASS}" ]; then
echo "${FIRST_USER_NAME}:${FIRST_USER_PASS}" | chpasswd
+ usermod -s /bin/bash "${FIRST_USER_NAME}"
fi
echo "root:root" | chpasswd
EOF
diff --git a/stage2/01-sys-tweaks/00-packages b/stage2/01-sys-tweaks/00-packages
index e8d9594..d56626b 100644
--- a/stage2/01-sys-tweaks/00-packages
+++ b/stage2/01-sys-tweaks/00-packages
@@ -38,5 +38,5 @@ python3-venv
bluez bluez-firmware
rpi-keyboard-config
rpi-keyboard-fw-update
-rpi-usb-gadget
+rpi-usb-gadget modemmanager-
rpi-connect-lite
diff --git a/stage2/01-sys-tweaks/01-run.sh b/stage2/01-sys-tweaks/01-run.sh
index 6da2876..a3d8729 100755
--- a/stage2/01-sys-tweaks/01-run.sh
+++ b/stage2/01-sys-tweaks/01-run.sh
@@ -38,8 +38,10 @@ on_chroot <<- EOF
done
EOF
-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"
+if [ "${PASSWORDLESS_SUDO}" = "1" ]; then
+ on_chroot <<- EOF
+ SUDO_USER="${FIRST_USER_NAME}" raspi-config do_sudo_pass 0
+ EOF
fi
on_chroot << EOF