The fortune(6) / random problem (again)

Alexander Leidinger Alexander at Leidinger.net
Sat Jun 24 14:33:18 UTC 2006


Quoting Doug Barton <dougb at freebsd.org> (Fri, 23 Jun 2006 16:34:52 -0700):

> Alexander Leidinger wrote:
> > Hi,
> > 
> > this was discussed a while ago (and I don't remember the ...
> > status-quo), but with a recent current I see non-random output of
> > fortune when using non standard files:
> 
> I do something vaguely similar to what you're doing, which is to point
> fortune at a directory of symlinks to various fortune files (see man page
> for why that works). My -current is as of 6/19 and I'm not seeing this
> behavior, FYI. (I'd actually be sort of interested to see if you get the
> same results using this method as you do specifying files on the command line.)

As stated in the initial post, when I specify directories instead of
files, I get more random output, but still get one long quote very
often (and the long quote should not appear, since I use "-s").

To summarize:
 - "-s" prints long quotes (more than 25 lines) while it shouldn't
 - fortune is not very random in choosing a quote

> FWIW, I did see problems back when this last came up, but for an entirely
> different reason. It turns out that there were stale fortune files in
> /usr/share/games/fortune that were causing problems. Depending on your
> upgrading habits, you might try something like:
> 
> find /usr/share/games/fortune/ -type f ! -newer /usr/src/README
> 
> and see if anything interesting turns up. Not sure about your other
> directories though.

I have some old files there. And they don't come with the basesystem, I
copied them there. Does this mean that the format of the .dat file (or
whatever) changed in fortune?

I recreated the .dat files now and it seems that the issue with "-s" is
gone now.

> Finally, the obvious thing to check would be that your /dev/random device is
> being properly seeded. Check 'sysctl kern.random.sys.harvest' and make sure
> at least one of those is set to 1. You can also run:

% sysctl kern.random.sys.harvest
kern.random.sys.harvest.ethernet: 1
kern.random.sys.harvest.point_to_point: 1
kern.random.sys.harvest.interrupt: 1
kern.random.sys.harvest.swi: 0

Can the swi one be enabled now? I think I remember that it may not
provide randomness.

> rndc-confgen -b512 -c ./rndc-key -a -r/dev/random
> multiple times to see if you've got a good supply of random bits. You should
> be able to run that command at least 10 times without it blocking. If you
> can't, you've got /dev/random issues.

Works without problems, I tried more than 10 times. But I'm running a
buildkernel in the background ATM, so I should see a lot of interrupts
for the random device. I will test later with an idle system.

But testing with files instead of directories still gives only one
quote. So there's still something wrong.

Thanks,
Alexander.

-- 
      ...and that is how we know the Earth to be banana-shaped.
http://www.Leidinger.net  Alexander @ Leidinger.net: PGP ID = B0063FE7
http://www.FreeBSD.org     netchild @ FreeBSD.org  : PGP ID = 72077137


More information about the freebsd-current mailing list