Open rcswift opened 2 months ago
Some further observations:
To apply OS Customization, Raspberry Pi Imager creates the script /boot/firstrun.sh
and modifies cmdline.txt
to tell systemd to run that script:
console=serial0,115200 console=tty1 root=PARTUUID=662b4900-02 rootfstype=ext4 fsck.repair=yes rootwait quiet init=/usr/lib/raspberrypi-sys-mods/firstboot cfg80211.ieee80211_regdom=CA systemd.run=/boot/firstrun.sh systemd.run_success_action=reboot systemd.unit=kernel-command-line.target
firstrun.sh
is supposed to delete itself and remove itself from the kernel command line when it runs:
...
rm -f /boot/firstrun.sh
sed -i 's| systemd.run.*||g' /boot/cmdline.txt
exit 0
When I take the card out of the Pi after it powers down and examine the /boot
partition, I find that firstrun.sh
is still there.
Per systemd:
systemd-run-generator is a generator that reads the kernel command line and understands three options:
If the systemd.run= option is specified and followed by a command line, a unit named kernel-command-line.service is generated for it and booted into. The service has Type=oneshot set, and has SuccessAction=exit and FailureAction=exit configured by default, thus ensuring that the system is shut down as soon as the command completes.
So if the script were to fail then systemd shuts down the system.
I've observed that adding the argument systemd.run_failure_action=reboot
to cmdline.txt
causes the system to boot-loop instead of powering down, which seems to confirm that this is the cause of the "power down" symptom.
However firstrun.sh
starts with +e
and ends with exit 0
so I don't see how it can fail in such a way that systemd will recognize it as a failure.
It seems like the problem is that the line auto_initramfs=1
is absent from the version of config.txt
in this repo. Adding this line back to the config file allows firstrun.sh
to run normally and OS Customization options to be applied.
We may add auto_initramfs=1
inside [pi0]
in config.txt
file. That should fix it.
I don't have a Pi Zero hardware to test. Let me know if the above change works for you and then we may include it in the repo.
I ran into the same issue as @rcswift and the auto_initramfs=1
fix is working. I built a PiZero2 image and it booted successfully after adding the entry under [pi02]
I am trying to create a kernel_rt image for a Raspberry Pi Zero W
After following the steps in this repo to create the image I am using the official Raspberry Pi Imager (v1.8.5) to write the microSD card.
When I try to to apply OS Customization to the image and load it, the Pi gets part way through the boot process and then aborts. The last line in the serial console is
[ 26.760122] reboot: Power down
.If I load the same image without applying OS Customization, the Pi boots normally and I can follow the prompts for first-time setup with a keyboard and monitor.
If I load the official "Raspberry Pi OS Lite (32-bit) 2024-03-15" image from Imager and apply the same OS Customization options it boots normally with the OS Customization settings applied as expected.
Why doesn't OS Customization work with this image?