LinuxCommandLibrary

haveged

random number generator daemon that feeds the Linux kernel's entropy pool

TLDR

Start haveged daemon

$ sudo haveged
copy
Run haveged in foreground
$ sudo haveged -F
copy
Set file path for output
$ sudo haveged -f [path/to/file]
copy
Set run level for daemon
$ sudo haveged -r [runlevel]
copy
Set collection buffer size in KiB words
$ sudo haveged -b [buffersizeinKW]
copy
Set cache size in KiB words
$ sudo haveged -d [cachesizeinKW]
copy
Set number of bytes to write to output file
$ sudo haveged -n [byteamount]
copy

SYNOPSIS

haveged [options]

DESCRIPTION

haveged is a random number generator daemon that feeds the Linux kernel's entropy pool (/dev/random). It uses the HAVEGE (HArdware Volatile Entropy Gathering and Expansion) algorithm, which harvests entropy from CPU timing variations.
The daemon is particularly useful for:
- Headless servers lacking traditional entropy sources (keyboard, mouse)
- Virtual machines with limited hardware entropy
- Systems requiring high-throughput random number generation
- Preventing /dev/random blocking during cryptographic operations
haveged monitors the kernel entropy pool and automatically feeds it when levels drop.

PARAMETERS

-F, --Foreground

Run in foreground (don't daemonize)
-f, --file PATH
Write random data to file instead of /dev/random
-r, --run LEVEL
Set run level (0=run as daemon, 1=display results)
-b, --buffer SIZE
Collection buffer size in KiB words
-d, --data SIZE
Cache size in KiB words
-n, --number BYTES
Number of bytes to write to output
-w, --write BYTES
Write BYTES to /dev/random at a time
-v, --verbose LEVEL
Verbosity level

CAVEATS

Some security researchers debate HAVEGE's entropy quality on virtualized or modern CPUs with consistent timing. Consider using hardware RNG (rngd) when available. On modern kernels, /dev/random no longer blocks, reducing the need for haveged.

HISTORY

haveged was developed by Gary Wuertz based on the HAVEGE algorithm created by André Seznec and Nicolas Sendrier. It became popular for addressing entropy starvation on Linux servers and VMs.

SEE ALSO

rngd(8), random(4), getrandom(2)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community