| while building some rpi disk images, i discovered ext4 images generated by nixos/lib/make-ext4-fs.nix not being reproducible
using debugfs on the images, and running show_super_stats, i found the following difference:
Directory Hash Seed: 153a13f8-fd63-4dec-9295-e702caea9421
Directory Hash Seed: 7ab5f8a0-ae47-4beb-a549-b32270a9ee1d
2021-08-30 11:15:54 < slyfox> e2fsprogs' tests force UUID to a constant to get stable output: tests/t_change_uuid_mcsum/script:$MKE2FS -O metadata_csum,^metadata_csum_seed -U 6b33f586-a183-4383-921d-30da3fef2e5c -F $TMPFILE > /dev/null 2>&1
but when applying that to nixpkgs:
diff --git a/nixos/lib/make-ext4-fs.nix b/nixos/lib/make-ext4-fs.nix
index 416beeb32f2..179ab5998e3 100644
--- a/nixos/lib/make-ext4-fs.nix
+++ b/nixos/lib/make-ext4-fs.nix
@@ -64,7 +64,7 @@ pkgs.stdenv.mkDerivation {
truncate -s $bytes $img
- faketime -f "1970-01-01 00:00:01" fakeroot mkfs.ext4 -L ${volumeLabel} -U ${uuid} -d ./rootImage $img
+ faketime -f "1970-01-01 00:00:01" fakeroot mkfs.ext4 -O metadata_csum,^metadata_csum_seed -L ${volumeLabel} -U ${uuid} -d ./rootImage $img
export EXT2FS_NO_MTAB_OK=yes
# I have ended up with corrupted images sometimes, I suspect that happens when the build machine's disk gets full during the build.
the build fails with:
ext4-fs.img> Creating journal (8192 blocks): done
ext4-fs.img> Copying files into the device: ext2fs_mkdir: Directory block checksum does not match directory block while creating directory "lib"
ext4-fs.img> __populate_fs: Directory block checksum does not match directory block while making dir "lib"
ext4-fs.img> mkfs.ext4: Directory block checksum does not match directory block while populating file system
ext4-fs.img> builder for '/nix/store/i6y239h646p67l6pa9qyzw2v50cyf432-ext4-fs.img.drv' failed with exit code 1
|