Skip to content

Commit 95e2c43

Browse files
committed
fix(yocto): force NFSv4.1 for the shared Yocto cache
NFSv4.2's READ_PLUS corrupts large-file reads over the shared download/ sstate cache: multi-GB BitBake git pack mirrors (linux, u-boot) come back with mangled bytes, so `do_unpack` / `devtool modify` fail with zlib "inflate: data stream error" / "pack checksum mismatch" at varying offsets. Cloning the same repo to local disk is bit-perfect, isolating the NFSv4.2 read path as the cause. Cap nfsd at 4.1 on the hyper server (disables READ_PLUS for all clients) and pin nfsvers=4.1 on the client mounts as belt-and-suspenders.
1 parent 8c4247a commit 95e2c43

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

nix/hosts/features/shared-state-yocto/default.nix

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,18 @@
1616
mkdir -p /srv/yocto/sstate-cache
1717
'';
1818

19+
# Pin NFSv4.1 on both shares. NFSv4.2's READ_PLUS corrupts large-file reads,
20+
# so multi-GB BitBake git pack mirrors come back mangled and do_unpack /
21+
# devtool modify fail with zlib "inflate: data stream error". The hyper server
22+
# also disables 4.2, but pinning here keeps clients on 4.1 regardless.
1923
fileSystems."/srv/yocto/sstate-cache" = {
2024
device = "10.5.3.187:/srv/nfs/yocto/sstate-cache";
2125
fsType = "nfs";
2226
options = [
2327
"auto"
2428
"rw"
2529
"defaults"
30+
"nfsvers=4.1"
2631
"_netdev"
2732
"x-systemd.automount"
2833
];
@@ -35,6 +40,7 @@
3540
"auto"
3641
"rw"
3742
"defaults"
43+
"nfsvers=4.1"
3844
"_netdev"
3945
"x-systemd.automount"
4046
];

nix/hosts/hyper/configuration.nix

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,15 @@ in
6868
'';
6969
};
7070

71+
# Cap the server at NFSv4.1. NFSv4.2's READ_PLUS (sparse-aware reads) corrupts
72+
# large multi-GB files read back over this share: BitBake's git pack mirrors
73+
# (linux/u-boot, >4GB) come back with mangled bytes, so do_unpack / devtool
74+
# modify fail with zlib "inflate: data stream error / pack checksum mismatch"
75+
# at varying offsets, while a clone of the same repo to local disk is
76+
# bit-perfect. Disabling 4.2 makes clients negotiate down to 4.1 (no
77+
# READ_PLUS), which the shared Yocto cache doesn't otherwise need.
78+
services.nfs.settings.nfsd."vers4.2" = false;
79+
7180
services.bitbake = {
7281
enable = true;
7382
versions = {

0 commit comments

Comments
 (0)