If Kernel Page Size is different from Hardware Page Size OS fails to boot.
Issue description
If a partition is encrypted on a device that has a 16kb page size, but the kernel is utilizing a 4kb page size, the partition fails to unlock, rendering the device unusable.
Steps for reproducing the issue
- Image an NVME drive for a Raspberry Pi 5 with Raspberry Pi OS
- Utilizing sdm, encrypt the NVME drive utilizing the sdm-cryptconfig script
- After encrypting, switch the kernel from kernel_2172.img to kernel8.img (16k page size to 4k page size.)
- Reboot the pi
Additional info
The only device I have access to with this issue is a Raspberry Pi 5. The author of the sdm script has recommended opening this issue here, as he believes it is an upstream issue (cryptsetup). For the debug log I have attached what is present on boot. I am unsure how to run a debug command for this when I can't enter the password. If I can please let me know how and I will be happy to provide extra logs, or if any further information is needed I can provide that as well :)
Debug log
done.
Begin: Mounting root file system ... Begin: Running /scripts/local-top ... Cannot initialize device-mapper. Is dm_mod kernel module loaded?
Cannot use device cryptroot, name is invalid or still in use.
Please unlock disk cryptroot: ************
Cannot intialize device-mapper. Is dm_mod kernel module loaded?
Cannot use device cryptroot, name is invalid or still in use.
cryptsetup: ERROR: cryptroot: cryptsetup failed, bad password or options?
Cannot initialize device-mapper. Is dm_mod kernel module laoded?
Cannot use device cryptroot, name is invalid or still in use.
Please unlock disk cryptroot: