Getting more entropy for Subversion on FreeBSD
I was trying to create a new Subversion repository today and noticed
to my dismay that it would hang during create. Totally
high-centered. My only recourse was kill -9. It was bad.
“Why is this?” I thought. I googled a little and found this entry in the Subversion FAQ. In a nutshell I have too little entropy (sources of randomness) and that I should configure the system to get more entropy from interrupts.
It recommended checking into rndcontrol about this. The rndcontrol
manpage was easy enough:
SYNOPSIS
rndcontrol [-q] [-s irq_no] [-c irq_no]
DESCRIPTION
The rndcontrol command is used to set which interrupts are used to
help randomise the ``pool of entropy'' maintained by the kernel.
The /dev/random and /dev/urandom devices are the user interface
to this source of randomness. Any changes take effect
immediately.
The following command line options are supported:
-q Turn off all output except errors.
-s n Allow IRQ n to be used as a source of randomness. This
option may be repeated for more than one IRQ.
-c n Stop IRQ n from being used as a source of randomness.
This option may be repeated for more than one IRQ.
The default is to have no IRQ's being used.
Ok. So I need some IRQs I can get some entropy from:
# /sbin/dmesg | grep -i irq
IOAPIC #0 intpin 2 -> irq 0
IOAPIC #0 intpin 19 -> irq 2
IOAPIC #0 intpin 21 -> irq 5
IOAPIC #0 intpin 20 -> irq 9
asr0: <Adaptec Caching SCSI RAID> mem 0xfc000000-0xfdffffff irq 9
at device 4.1 on pci2
ahc0: <Adaptec aic7896/97 Ultra2 SCSI adapter> port 0x2000-0x20ff
mem 0xf4100000-0xf4100fff irq 2 at device 12.0 on pci0
ahc1: <Adaptec aic7896/97 Ultra2 SCSI adapter> port 0x2400-0x24ff
mem 0xf4101000-0xf4101fff irq 2 at device 12.1 on pci0
fxp0: <Intel Pro 10/100B/100+ Ethernet> port 0x2800-0x283f mem
0xf4000000-0xf40fffff,0xf4102000-0xf4102fff irq 5 at device 14.0
on pci0
pci0: <Intel 82371AB/EB (PIIX4) USB controller> at 18.2 irq 5
sio0 at port 0x3f8-0x3ff irq 4 flags 0x30 on isa0
sio1 at port 0x2f8-0x2ff irq 3 on isa0
Ah, IRQ 9, 2, and 5 look great: hard drives, RAID adapters, network interfaces are all great entropy sources. Let’s change our random device now:
# rndcontrol -s 9 -s 2 -s 5
rndcontrol: setting irq 9
rndcontrol: setting irq 2
rndcontrol: setting irq 5
rndcontrol: interrupts in use: 2 5 9
(Meanwhile, in another terminal):
$ svnadmin create SVN_REPO
Wow, that was fast… er, I guess that’s what it’s like under normal conditions. Oh well. Better put things back the way they were:
# rndcontrol -c 9 -c 2 -c 5
rndcontrol: clearing irq 9
rndcontrol: clearing irq 2
rndcontrol: clearing irq 5
rndcontrol: interrupts in use:
That’s it.