I’m having an issue I can’t explain when using ‘snap refresh’ related to the state of boot.sel.
First, I’m using a Nitrogen i.MX 8M Plus platform with those 2 snaps:
Yesterday I made an update to the kernel (6) and generated a new core20 using ‘ubuntu-image’ as defined here:
The resulting image is working fine.
The previous image I had with the previous kernel (5) is also working fine.
However, when trying to ‘snap refresh’ on a system that had the previous kernel (5) installed, the system fails to boot because of a “bad CRC”:
error: fallback kernel snap unusable: cannot open "/run/mnt/ubuntu-boot/uboot/ubuntu/boot.sel": bad CRC 4101280109 != 950455135
When looking into the boot.sel generated by snapd during the refresh, it does include a CRC32 of 4101280109 (0xf474916d) which I can compute again myself:
However, it looks like the original boot.sel generated so not use the same method to generate the CRC and clearly snapd computes it differently too.
I’m unclear what needs to be done at this stage to fix the corrupted boot.sel but I don’t know where to go from here as snapd should be the one generating the boot.sel in all cases.
I think there should be one more byte for the flags. See what you get if you skip 5 instead of 4 bytes. If you then get 38a6cb5f, then it means the file is fine but u-boot is not reading the flag as a flag.
Have you configured your u-boot with CONFIG_SYS_REDUNDAND_ENVIRONMENT=n?
When does it fail? Where do you get the “bad CRC” error message? Is that snapd that gives this error?
I wonder if the file is being written somewhere by u-boot and snapd cannot read it. I think it needs to read kernel_status, snap_kernel and snap_try_kernel.