運行gpg --gen-key生成key時出現卡住的問題


背景

  在搭建Ubuntu16.04的本地apt源時,需要運行“gpg --gen-key”命令,但是在執行該命令時,出現了:“Not enough random bytes available. Please do some other work to give the OS a chance to collect more ”的提示,而且一直卡住。

分析

  更詳細的提示,參加:

We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.

  根據提示,該命令生成key時,需要kernel為該程序生成足夠多的隨機數,因此,我們只需要為kernel生成隨機數即可。

解決方法:

  安裝rng-tools工具,該工具可以像指定文件生成隨機數。這里,我們不需要退出原正在執行gpg --gen-key命令的console,新建一個終端,執行如下命令。命令執行完成后,原來卡住的界面就恢復運行了。

$ apt-get install rng-tools
$ rng -r /dev/urandom


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM