-
Notifications
You must be signed in to change notification settings - Fork 9.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Workaround - Terraform client hangs (reproducible): Waiting for randomness from kernel. #24375
Comments
It appears that is this particular setup the entropy on startup is very low. On fresh boot: # cat /proc/sys/kernel/random/entropy_avail
16 So just how much randomness does terraform require to run? |
Hi @bbros-dev, Thanks for the extra info. Running in a container without enough entropy to provide random data is not something we had planned on for terraform, and indeed nearly all systems will have a functional CSPRNG with enough entropy to seed it by default. Terraform needs a significant amount of random data for TLS connections between the client, plugins, and numerous external services. Most of the linked issues are unrelated to this, as they are hanging in other parts of the code aside from key generation. Since a system that can provide adequate cryptographically secure random data is a prerequisite for terraform to run, there's not much we can do here to prevent the situation. It may be useful to get the stack trace while it's hanging to see exactly where the Go code is blocked, since it's not likely in Terraform's code at all. It's possible that we could provide some way to at least error or crash if this situation arises. |
Closing. Working as intended. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Terraform Version
Terraform Configuration Files
Not relevant. The issue is observed with the command
terraform
andterraform -version
Debug Output
TF_LOG=TRACE terraform
actually returned nothing. Ever.apt install strace
strace terraform
Bingo:Then some time later the last line becomes:
The
terraform
command is still hanging there.Crash Output
Never crashes, just hangs.
Expected Behavior
Actual Behavior
See
strace terraform
output aboveSteps to Reproduce
sudo ignite --interactive run --config tf-issue.json
wheretf-issue.json
is:terraform
Workaround
apt install haveged rng-tools
vi /etc/default/rng-tools
HRNGDEVICE=/dev/urandom
/etc/init.d/rng-tools start
terraform
References
Many other users have reported intermittent issues, which were difficult to reproduce. I'm hoping the workaround provided above helps remove the hang behavior.
#24061
#23976
#23015
#23458
#23974
#22774
#22722
#22343
#20190
#21876
#21194
#19337
The text was updated successfully, but these errors were encountered: