我收到一个间歇性错误,指出在尝试生成表单例份验证 token 时伪随机数生成器未播种。我已经复制了下面堆栈跟踪的相关部分。
这是我所知道/看到的: - 重启 passenger 似乎暂时解决了这个问题 - 从控制台运行相同的代码按预期工作 -/dev/urandom 存在所以它应该能够使用它来播种 - 这发生在 ubuntu 10.04 上,openssl 0.9.8k,ree 1.8.7 p253 和 passenger 3.0.3。 - 我已经读到关于 unicorn 的一个问题,听起来有点像重新启动 worker 时发生的问题,但没有看到 passenger 上描述的类似内容。
SessionsController#new (ActionView::TemplateError) "PRNG not seeded"
/usr/local/lib/ruby/1.8/securerandom.rb:53:in `random_bytes'
/usr/local/lib/ruby/1.8/securerandom.rb:53:in `random_bytes'
/usr/local/lib/ruby/1.8/securerandom.rb:105:in `base64'
vendor/bundle/ruby/1.8/gems/actionpack-2.3.14/lib/action_controller/request_forgery_protection.rb:109:in `form_authenticity_token'
(eval):2:in `send'
(eval):2:in `form_authenticity_token'
非常难过。非常感谢任何帮助。
最佳答案
假设 /dev/random
和 /dev/urandom
都是可读/可写的并且您仍然收到此错误,也许您需要运行/安装一个熵生成器像 prngd
吗?
尝试:
$ sudo /etc/init.d/prngd start
如果失败,请先安装 prngd
:
$ sudo apt-get install prngd
关于ruby-on-rails - PRNG 未播种错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11382600/