Systemd random seed service constantly fails

I get this build error every other nixos-rebuild, anyone know why? And how to fix it?

Could it be related to using bcachefs as a root file system?

● systemd-random-seed.service - Load/Save Random Seed
     Loaded: loaded (/nix/store/caz5k18ar764161b0amywc002cp39lgx-systemd-247.3/example/systemd/system/systemd-random-seed.service; enabled; vendor preset: enabled)
    Drop-In: /nix/store/k47048dwbi17hqq37wrrfsh50f5yypkv-system-units/systemd-random-seed.service.d
             └─overrides.conf
     Active: failed (Result: exit-code) since Thu 2021-03-25 17:15:58 NZDT; 138ms ago
       Docs: man:systemd-random-seed.service(8)
             man:random(4)
    Process: 16336 ExecStart=/nix/store/caz5k18ar764161b0amywc002cp39lgx-systemd-247.3/lib/systemd/systemd-random-seed load (code=exited, status=1/FAILURE)
   Main PID: 16336 (code=exited, status=1/FAILURE)
         IP: 0B in, 0B out
        CPU: 2ms

I’m having the same issue, also using bcachefs as root…

Complete guess but presumably it has a problem writing back the new random seed? I wonder if it’s done before bcachefs has initialized the COW layer (not sure how it works). Perhaps you could give the output of

sudo journalctl -eu systemd-random-seed

Seems like it needs both read and write permissions

$ /run/current-system/sw/lib/systemd/systemd-random-seed load
Failed to open /var/lib/systemd/random-seed for writing: Permission denied
Failed to open /var/lib/systemd/random-seed for reading: Permission denied

Updating to a newer version of bcachefs fixed it, the official packages I think are currently broken, they’re a good 8 months out of date, and corrupted a few VM images, and the nixstore was corrupt.

I’m looking at making a more robust patchset instead of the current unsupported 5.9.0 kernel.