The question have been asked in here http://www.gossamer-threads.com/lists/linux/kernel/1210167 but I don't see an answer.
AFAIK /proc/sys/kernel/random/entropy_avail should return the size of available entropy but should not consume it. At least I don't see any reason for that.
However, I have been noticing the same thing as OP for at least a year and now I executed in quick succession
% cat /proc/sys/kernel/random/entropy_avail
3918
% cat /proc/sys/kernel/random/entropy_avail
3447
% cat /proc/sys/kernel/random/entropy_avail
2878
% cat /proc/sys/kernel/random/entropy_avail
2377
% cat /proc/sys/kernel/random/entropy_avail
1789
% cat /proc/sys/kernel/random/entropy_avail
1184
% cat /proc/sys/kernel/random/entropy_avail
577
% cat /proc/sys/kernel/random/entropy_avail
161
% cat /proc/sys/kernel/random/entropy_avail
133
% cat /proc/sys/kernel/random/entropy_avail
171
a while later I did the same with the same result, so I'm pretty sure the depletion of entropy is caused by the cat command.
Can anyone explain why this happens?
cat
consuming the entropy, not reading the file.python -c "$(echo -e "import time\nwhile True:\n time.sleep(1)\n print open('/proc/sys/kernel/random/entropy_avail', 'rb').read(),")"
. I'd love to write it in multiple lines as it should be, but can't find a way to format the comment. This will start just one process.