When systemd initrd is enabled, previous boot logs cannot be accessed normally

When I enabled boot.initrd.systemd.enable and list boot log via journalctl --list-boots only one entry is shown thus if I view the logs with journalctl -xb-1, the command returns with No such boot ID in journal. It was working before when boot.initrd.systemd.enable is disabled.
In order to view them, I need to append the following in journalctl command: -D /var/log/journal.
I tried adding the following config so that machine-id is also the same in initrd but it didn’t solve the problem:

boot.initrd.secrets = {
  "/etc/machine-id" = "/etc/machine-id";
};

The machine is Raspberry PI 4 and I am thinking if the date is messing up with this as the log always starts from Feb 16 before being corrected.

Are you seeing multiple machine ids listed in /var/log/journal/? This implies that systemd is creating /etc/machine-id. The journal should show that.

You might try

  environment.etc.machine-id = {
    text = ''
      12345678901234567890123456789012
    '';
  };

or something similar. The OS expects the text to be 32 hex digits unique among all machines. Probably you can read it from a file.