balena-os / meta-balena

A collection of Yocto layers used to build balenaOS images
https://www.balena.io/os
966 stars 115 forks source link

balena-image-bootloader-initramfs.bb: Add fsck module #3360

Closed floion closed 7 months ago

floion commented 7 months ago

The balena bootloader initramfs contains the rootfs module and that will get the rootfs mounted but not checked first for errors. This is problematic because at first boot with network connectivity available, time will sync but the rootfs will still have the last mount time in

  1. If at that point the rootfs gets corrupted then at next boot the rootfs' initramfs module from balena-bootloader will try to mount the rootfs without checking it first and then after that the filesystem check triggered by the fsck module from the actual kernel initramfs will fail like this:

[init][INFO] Running filesystem checks on partition resin-rootA (/dev/disk/by-state/resin-rootA) resin-rootA contains a file system with errors, check forced. resin-rootA: Inodes that were part of a corrupted orphan linked list found.

resin-rootA: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY. (i.e., without -a or -p options)

This commit will add the fsck module to balena bootloader's initramfs which will trigger filesystem checks before the rootfs module runs.

Change-type: patch


Contributor checklist

Reviewer Guidelines

mtoman commented 7 months ago

lgtm

mtoman commented 7 months ago

@resin-jenkins retest this please

mtoman commented 7 months ago

@resin-jenkins retest this please

floion commented 7 months ago

@resin-jenkins test this please