Add e2fsck to the initrd and use it when mounting stowaways #26
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This builds a statically linked e2fsck binary and adds it to
/bin
.mount_stowaways
is changed to mount, then unmount, then fsck/data
before using it for anything important. The mount of/data
is performed withdata=journal
. This will cause a performance hit, but should also mean less file corruption in the long run.Side note, the mount-unmount-fsck pattern causes the kernel to replay the ext4 journal rather than e2fsck. Canonical engineers stated that the kernel was faster at this task.
Pros:
This is almost exactly how Canonical solved issues with file corruption breaking AppArmor profiles on Ubuntu Phone devices in the very early days of the project: launchpad #1387214
Only adds a small amount of time to the boot process, normally one second or less.
Cons:
This will cause the RW reference and Plasma Mobile rootfs's to be deleted slightly more often as fsck will realize that something is wrong with them. I experienced this while testing. I feel that this is better than allowing silent corruption to the image, but the result is undesirable.
The boot.img is now > 8MB on my device, sitting at 9.2MB. This shouldn't be a concern except for very old devices with ridiculously small boot partitions.
To test this:
Just pull the branch for this PR and build hybris-boot or hybris-recovery. Flash them to the device's
boot
partition. You'll find the fsck output after[...]## mounting stowaways
in the logs. Boot the device.