Skip to content

Fix E2E SSH and post-boot sudo: pi shell + NOPASSWD sudoers in prepare-image#273

Open
guysoft wants to merge 4 commits into
develfrom
bugfix/e2e
Open

Fix E2E SSH and post-boot sudo: pi shell + NOPASSWD sudoers in prepare-image#273
guysoft wants to merge 4 commits into
develfrom
bugfix/e2e

Conversation

@guysoft
Copy link
Copy Markdown
Owner

@guysoft guysoft commented May 19, 2026

Summary

Fixes the shared E2E test framework SSH stage and post-boot sudo, which were both broken by the combination of Raspberry Pi OS Trixie defaults and the headless userconfig.service removal we do in prepare-image.sh.

Root causes

  1. SSH login failed for pi. RPi OS Trixie ships the pi user with /usr/sbin/nologin as the default shell. The first-boot userconfig.service would normally rewrite it, but src/distro_testing/scripts/prepare-image.sh removes that service. Result: SSH authenticates but every session prints This account is currently not available. and exits 1, timing out the wait-for-ssh stage. Reproduced in FullPageOS run 24418025784.

  2. sudo from the pi user required a password. userconfig.service is also what normally drops /etc/sudoers.d/010_pi-nopasswd. With that service removed, sudo apt-get install ... and similar calls from post-boot hooks fail over non-TTY SSH (sudo: a terminal is required to read the password). This was previously masked by the SSH timeout above.

Fix

In src/distro_testing/scripts/prepare-image.sh:

  • Download /etc/passwd alongside /etc/shadow, sed-replace :/usr/sbin/nologin -> :/bin/bash for the pi user, re-upload.
  • Add a guestfish write /etc/sudoers.d/010_pi-nopasswd "pi ALL=(ALL) NOPASSWD: ALL\n" with chmod 0440.

Verification

Built ghcr.io/guysoft/custompios:bugfix-e2e from this branch, pointed FullPageOS test/e2e-bugfix at it. FullPageOS run 26096890001 is fully green:

  • SSH is ready (took 98s) (previously: 600s timeout)
  • test_boot.sh -> PASSED
  • test_chromium.sh -> PASSED (matchbox window detected, chromium kiosk running)
  • test_lighttpd.sh -> PASSED
  • ALL TESTS PASSED

Commits in this PR

  • 2a87cfb Fix E2E SSH: set pi user shell to /bin/bash in prepare-image (cherry-picked from feature/e2e).
  • 4f055f3 Seed /etc/sudoers.d/010_pi-nopasswd in prepare-image.
  • 3b7827d Add reusable E2E workflow, SSH helpers, and CI trigger for feature/e2e (cherry-picked from feature/e2e; needed because distros source ssh-helpers.sh from the docker image).
  • 82c0ebf ci: build docker image for bugfix/e2e branch (can be reverted on merge if desired, or left as a no-op once this branch is gone).

guysoft added 4 commits May 19, 2026 15:12
Raspberry Pi OS Trixie ships the pi user with /usr/sbin/nologin as
the default shell. Since we remove userconfig.service (which normally
handles first-boot user setup), the shell stays nologin and SSH
sessions fail with "This account is currently not available."

Download /etc/passwd alongside /etc/shadow and replace nologin with
/bin/bash for the pi user.
- Add feature/e2e to docker-build.yml branch triggers so CI produces
  a custompios:feature-e2e container tag for development
- Create shared ssh-helpers.sh with canonical ssh_cmd/scp_cmd functions
  to replace duplicated SSH boilerplate across distro test scripts
- Create reusable e2e-test.yml workflow that distros can call with
  uses: guysoft/CustomPiOS/.github/workflows/e2e-test.yml@ref
- Update test_boot.sh to source ssh-helpers.sh
userconfig.service is what normally creates this file on first boot;
since we remove that service for headless QEMU testing, pi sudo
requires a password and breaks post-boot hooks that try to install
packages or start services over non-TTY SSH.

Write the canonical 'pi ALL=(ALL) NOPASSWD: ALL' rule directly via
guestfish so 'sudo apt-get install ...' and similar work from
ssh_cmd "sudo ..." calls.
@guysoft guysoft changed the title Fix E2E SSH: set pi user shell to /bin/bash in prepare-image Fix E2E SSH and post-boot sudo: pi shell + NOPASSWD sudoers in prepare-image May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant