What does haveged do?

ron.alan

Well-Known Member
Joined
Dec 24, 2023
Messages
568
Reaction score
479
Credits
3,985
So a long time ago, for a reason I cannot remember, I had to install haveged on my system. I seem to recall it might of had something to do with the boot sequence? But I could be wrong.

Anyway with the last few installs I haven't noticed a difference either having it installed or not (so currently I don't have it installed). Can someone explain to me in layman terms what it does?
 


So a long time ago, for a reason I cannot remember, I had to install haveged on my system. I seem to recall it might of had something to do with the boot sequence? But I could be wrong.

Anyway with the last few installs I haven't noticed a difference either having it installed or not (so currently I don't have it installed). Can someone explain to me in layman terms what it does?
Okay :-) . This is my take on it: A linux system relies on a random number generator which is used for a number of system utilities like those that use encryption: gpg, openssl, password creation, and apps that need to generate unique numbers for whatever purpose. Some games need random numbers to use to make the game interesting and challenging rather than predictable. I don't have much experience with games, but those who do will understand this and maybe add some info.

The system collects random data from the largely unpredictable events on the machine like keyboard strokes, mouse events, hardware events. The apps that need to use random data use that from /dev/random to get random numbers.

The haveged package description says:
Code:
haveged uses HAVEGE (HArdware Volatile Entropy Gathering and Expansion)
to maintain a 1M pool of random bytes used to fill /dev/random
whenever the supply of random bits in dev/random falls below the low
water mark of the device.

So, if there isn't enough randomness created on the system from the events like those mentioned above, haveged supplies more randomness capability. That's it so far as I understand it. The package is not on any machines here and I can't recall ever having any errors or warnings associated with problems in generating randomness which might have been alleviated by this package. Hope that helps.
 
Hmm, sounds like I never really needed it. I must be confusing it with something else I needed. I don't know why I ever had haveged installed. :rolleyes:

Thanks for the explanation.
 
I don't know why I ever had haveged installed.
There was a time when randomness in the kernel was scarce. One reason was systemd suddenly starting to deplete it by using it for secondary purposes, like UUIDS, at boot time. At this point some distros started installing haveged to supplement the kernel's internal randomness generation. Fast-forward a few years and the kernel randomness functionality was updated to a CSPRNG, which is in essence a cryptographic stream-derivation of randomness. The kernel generates plenty randomness since, not needing a supplement like haveged anymore.

You may still see some use of haveged in low-power systems (like routers or some SBC) that don't have adequate CPU instructions and power for the cryptographic stream to be produced. But if you have seen it on x86, this will have been prior to the kernel updating its internal infrastructure to generate randomness. Even a very old x86 CPU is fast enough to feed the kernel's new infrastructure at boot.
 
I did some poking online and switched this up a little.

for x in $(ls -1t /var/log/dpkg.log*); do zcat -f $x |tac |grep -e " install " -e " upgrade "; done |awk -F ":a" '{print $1 " :a" $2}' |column -t > installed.txt

Next, open your file manager (to your home directory) and open installed.txt.

If the logs haven't been rotated, you can CTRL + F to find the application's name. That should have a date attached to it.

Then, you can see when you installed it -- and it might jog your memory, reminding you why you installed it.
 
Then, you can see when you installed it -- and it might jog your memory, reminding you why you installed it.
I don't currently have it installed. But when I first needed it was all the way back in 2018, and it wasn't for the booting process, but the logging in process. I went back to Devuan's forums and found my posts about this. Man that feels like a lifetime ago. In any event, it seems I no longer need it.

The person who came up with the solution to install haveged guessed the answer by the fact that when I moved the mouse, the log in process was quicker. Go figure.
 
Last edited:


Follow Linux.org

Staff online

Members online


Top