Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix FAT32 partition issues on sd-image-based images #51158

Merged
merged 2 commits into from Nov 28, 2018

Conversation

samueldr
Copy link
Member

@samueldr samueldr commented Nov 28, 2018

Motivation for this change

Fixes #51150.

The main issue:

[...]
  Bad short file name (.).
  Auto-renaming it.
  Renamed to FSCK0000.000

Is already fixed using mtools-4.0.21. For release-18.09 its update will need to be backported (#51159).


This fixes the seemingly-always-existing issue where the FAT32 partition was subtly broken by mtools. It wouldn't pass an fsck, even when freshly made. See #51150 for investigation details, and see commit messages for fixes details.

To ensure no regression with regards to the integrity of the boot partition, an fsck pass is now made just after copying the files. This will add a negligible amount of time to the whole build process, but will ensure tools will be able to manipulate the boot partition with success.

Things done
  • ✔️ Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • ✔️ NixOS
    • ⬜ macOS
    • ⬜ other Linux distributions
  • ⬜ Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • ✔️ Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • ⬜ Tested execution of all binary files (usually in ./result/bin/)
  • ⬜ Determined the impact on package closure size (by running nix path-info -S before and after)
  • ✔️ Assured whether relevant documentation is up to date
  • ✔️ Fits CONTRIBUTING.md.

cc @dezgeg @tilpner @bennofs

This is to ensure `mtools`-based operations don't wreck the FS.
```
       b      Batch mode. Optimized for huge recursive copies, but less secure if a crash happens during the copy.
```

It seems the "less secure if a crash happens" does not need a crash to
happen.

With batch mode:

```
/[...]/.
  Start (0) does not point to parent (___)
```

For pretty much everything copied in.

Without batch mode, everything passes `fsck`.

See NixOS#51150
@dezgeg
Copy link
Contributor

dezgeg commented Nov 28, 2018

Ah cool. I had noticed the Start (0) does not point to parent errors at some point last year but since no real world driver actually cares about those fields and as the mtools project didn't have much activity back then, I had ignored the problem.

Might be worth to report the problem with -b if the project is active nowadays.

@dezgeg dezgeg merged commit 1b6a4d3 into NixOS:master Nov 28, 2018
@dezgeg
Copy link
Contributor

dezgeg commented Nov 28, 2018

Also this where this was copy-pasted from should be fixed as well:

nixos/modules/installer/cd-dvd/iso-image.nix:      mcopy -bpsvm -i "$out" ./* ::

@samueldr
Copy link
Member Author

Do you think it should also include the fsck pass to validate the FS?

@dezgeg
Copy link
Contributor

dezgeg commented Nov 28, 2018

Yeah, it would be a good idea to have it there as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[aarch64] The sd-image-aarch64 FAT32 partition does not pass fsck
3 participants