I am trying to start solana-test-validator
, but it closes unexpectedly with blockstore error
.
Error: failed to start validator: Failed to create ledger at test-ledger: blockstore error
How can I fix this?
it seems like something is not right with the tar
version in Mac OS 13. I could fix the issue by replacing tar with a homebrew gnu version:
brew install gnu-tar
# Put this in ~/.zshrc
export PATH="/opt/homebrew/opt/gnu-tar/libexec/gnubin:$PATH"
Hope that helps.
There is an open GitHub issue at Solana Labs to make the install experience better for macOS users with the default BSD tar installed.
Note: you might also have this error occur when you run anchor test
:
Unable to get latest blockhash. Test validator does not look started. Check ".anchor/test-ledger/test-ledger-log.txt" for errors. Consider increasing [test.startup_wait] in Anchor.toml.
Looking inside .anchor/test-ledger/test-ledger-log.txt
, you will see:
Error checking to unpack genesis archive: Archive error: extra entry found: "._genesis.bin" Regular
There are multiple versions of the 'tape archiver' (tar
) program.
MacOS comes with BSD tar by default:
% tar --help | grep bsdtar
tar(bsdtar): manipulate archive files
Which is a less popular version of tar than the GNU tar. solana-test-validator
expects GNU tar.
There is an issue to resolve the GNU tar dependendency. In the meantime, you can work around this issue by replacing BSD tar with a GNU version.
If you haven't installed homebrew, do that first. Then run:
brew install gnu-tar
# Put this in ~/.zshrc
export PATH="/opt/homebrew/opt/gnu-tar/libexec/gnubin:$PATH"
You will now have BSD tar installed.
And then re-run solana-test-validator
If you're facing the same error even after installing gnu-tar
. Try removing the test-ledger folder rm -rf test-ledger
and try again.
This is because the BSD tar program is not compatible with the GNU tar program.
To fix it: you need to install and export the executable path of your GNU tar program in your .zshrc file.
brew install gnu-tar
# Put this in ~/.zshrc
export PATH="/opt/homebrew/opt/gnu-tar/libexec/gnubin:$PATH"
brew install gnu-tar
# Put this in ~/.zshrc
export PATH="/usr/local/opt/gnu-tar/libexec/gnubin:$PATH"
the only reason there are separate exports for intel-based macs and macs with apple silicon is that, by default, homebrew executables are stored at different locations for macs with respective chipset.
./validator/solana-test-validator
?