uboot fails to save env after core18 refresh
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
snap-core18 |
New
|
Undecided
|
Unassigned | ||
u-boot (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned | ||
Bionic |
Fix Released
|
Undecided
|
Unassigned | ||
Focal |
Fix Released
|
Undecided
|
Unassigned | ||
Groovy |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
Attempts to refresh the core18 snap on some ARM devices (Raspberry Pi Model 3B/3B+/4B) fails during the post-refresh hook.
## Expected behavior
The snap should refresh without issues.
## Actual behavior
The refresh is rolled back after the reboot during post-refresh. Snap tasks <change-id> shows that the refresh errors out at “Automatically connect eligible plugs and slots of snap "core18"”.
Upon zyga's request, I checked the boot logs via serial connection:
Regular boot → https:/
Reboot after core18 refresh => https:/
Note the help outputs for `env` and `save`, which suggests an error in the `env export` command from https:/
## Context
Custom gadget snap based on pi-gadget 18-armhf branch: https:/
My repository includes this commit from upstream that changed `saveenv` to a custom `export_env` macro: https:/
snap version:
snap 2.48.1
snapd 2.48.1
series 16
kernel 5.3.0-1036-raspi2
Discussion in #snappy: https:/
Maybe related to https:/
CVE References
tags: | added: uc20 |
tags: | removed: uc20 |
Changed in u-boot (Ubuntu Focal): | |
milestone: | none → ubuntu-20.04.2 |
Changed in u-boot (Ubuntu): | |
status: | New → Fix Released |
Tracked this down to the u-boot version currently used in the gadget snap having a limit of 16 args per hush command (hush being the intrepreter in u-boot). I have a nasty feeling I must've verified the original patch with a custom u-boot build accidentally as 16 is the default (sorry!).
I've uploaded patched builds of u-boot (which bump the arg limit to 64) to the following PPA (with variants for bionic, focal, groovy, and hirsute):
https:/ /launchpad. net/~waveform/ +archive/ ubuntu/ uboot/+ packages
These also build on the recent patches for CM4, and the Pi4 8Gb patches which are currently in -proposed so I'll try and chase down an archive-admin to reject the current -proposed versions and get these sponsored. In the meantime, if you wish to verify the patch yourself, you can grab the u-boot-rpi package from the above PPA (the bionic release would be the one used in building the gadget), and replace uboot_rpi_*.bin on boot partition of your image with the corresponding usr/lib/ u-boot/ rpi_*/u- boot.bin.
I've done this locally and confirmed the resulting image still boots, is capable of serializing its state to uboot.env (excluding serial#, ethaddr, and usbethaddr), and successfully reboots afterward on several different pi models but obviously it'd good to verify this with your customized gadget too.