Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 325541

Summary: New package: frandom (to sys-apps?)
Product: Gentoo Linux Reporter: Joel <joel>
Component: New packagesAssignee: Default Assignee for New Packages <maintainer-wanted>
Status: RESOLVED FIXED    
Severity: enhancement CC: bugzie, fedja, gef.kornflakes, kripton, zerochaos
Priority: Lowest Keywords: EBUILD
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: ebuild proposal for frandom-1.0.ebuild as sys-apps/frandom
ebuild proposal for frandom-1.0.ebuild as sys-apps/frandom
frandom-1.0.ebuild
frandom/frandom-1.0.ebuild
frandom/files/60-frandom.rules
Working ebuild for version 1.1
frandom-1.1.ebuild
Updated; changed to install udev rules to /lib/udev/rules.d

Description Joel 2010-06-25 18:43:15 UTC
Frandom is a fast random number generator. Is there a chance that gentoo includes it in portage? Thanks

Reproducible: Always
Comment 1 Samuli Suominen (RETIRED) gentoo-dev 2010-06-25 18:50:34 UTC
Are you talking about http://sourceforge.net/projects/frandom/ which had last release more than 1200 days ago, with version 1.0 and release highlight being Linux 2.6.19 support?

I think you might want to reconsider your request...
Comment 2 Joel 2010-06-25 19:09:17 UTC
(In reply to comment #1)
> Are you talking about http://sourceforge.net/projects/frandom/ which had last
> release more than 1200 days ago, with version 1.0 and release highlight being
> Linux 2.6.19 support?
> 
> I think you might want to reconsider your request...
> 
That version, yes :) I've tried it on a 2.6.33 kernel and works, and the algorithm is based on RC4 so I don't see a reason for not supporting it.
Of course, you may not agree with this, and in that case I'll write an ebuild for my personal use.
The only thing that fails on my ebuild attempt is that if I put emake (or make), it's translated to 'make -C /lib/modules/2.6.33-gentoo-r2/build SUBDIRS=/var/tmp/portage/sys-kernel/frandom-1.0/work/frandom-1.0 modules' (which fails) and I don't know how to do that 'make' means 'make'. Is there any documentation that I can read? Thanks.
PS: Sorry for my English.
Comment 3 Samuli Suominen (RETIRED) gentoo-dev 2010-06-25 19:53:46 UTC
(In reply to comment #2)
> (In reply to comment #1)
> > Are you talking about http://sourceforge.net/projects/frandom/ which had last
> > release more than 1200 days ago, with version 1.0 and release highlight being
> > Linux 2.6.19 support?
> > 
> > I think you might want to reconsider your request...
> > 
> That version, yes :) I've tried it on a 2.6.33 kernel and works, and the
> algorithm is based on RC4 so I don't see a reason for not supporting it.
> Of course, you may not agree with this, and in that case I'll write an ebuild
> for my personal use.

Ah, I didn't know you had tested it on something new... it's ok then!


Comment 4 Gef 2010-06-25 23:39:19 UTC
(In reply to comment #3)
> (In reply to comment #2)
> > (In reply to comment #1)
> > > Are you talking about http://sourceforge.net/projects/frandom/ which had last
> > > release more than 1200 days ago, with version 1.0 and release highlight being
> > > Linux 2.6.19 support?
> > > 
> > > I think you might want to reconsider your request...
> > > 
> > That version, yes :) I've tried it on a 2.6.33 kernel and works, and the
> > algorithm is based on RC4 so I don't see a reason for not supporting it.
> > Of course, you may not agree with this, and in that case I'll write an ebuild
> > for my personal use.
> 
> Ah, I didn't know you had tested it on something new... it's ok then!
> 
I was unable to load the lkm, but it seems to compile fine.

Comment 5 Joel 2010-06-25 23:46:58 UTC
I've installed it by hand doing this:

install -D frandom.ko /lib/modules/$(uname -r)/kernel/drivers/misc/frandom.ko
depmod -a
modprobe frandom
mknod /dev/frandom c 235 11
mknod /dev/erandom c 235 12
chmod 444 /dev/frandom /dev/erandom

I've based the execution on the AUR (from Archlinux) frandom package. Thank you very much for doing this :)
Comment 6 Gef 2010-06-26 00:36:15 UTC
Created attachment 236567 [details]
ebuild proposal for frandom-1.0.ebuild as sys-apps/frandom

Well I was bored, so I read linux-mod.eclass, and here is an ebuild. It compiles, install, merges fine, repoman likes it. Uses mirror:// to fetch. I added the necessary udev rules for the lkm.

/dev/frandom is really damn fast on my system, able to generate 1GB of pseudo-random data at 188MB/s.
Comment 7 Gef 2010-06-26 01:01:18 UTC
Created attachment 236577 [details]
ebuild proposal for frandom-1.0.ebuild as sys-apps/frandom

New improved version:
* use ${KV_FULL} rather than the Makefile's uname -r invocation
* a few other changes
Comment 8 Joel 2010-06-26 01:32:15 UTC
(In reply to comment #7)
> Created an attachment (id=236577) [details]
> ebuild proposal for frandom-1.0.ebuild as sys-apps/frandom
> 
> New improved version:
> * use ${KV_FULL} rather than the Makefile's uname -r invocation
> * a few other changes
> 

I've tried the first version of the ebuild, and no frandom nor erandom devices are created. Does the ebuild need to call mknod?
Comment 9 Gef 2010-06-26 01:38:15 UTC
I *think* you might just have to restart udev and then modprove the module. Or modprobe and restart.
Comment 10 Joel 2010-06-26 01:42:12 UTC
(In reply to comment #9)
> I *think* you might just have to restart udev and then modprove the module. Or
> modprobe and restart.
> 

I've rebooted the machine and I've done a modprobe and a "/etc/init.d/udev restart" with no luck... Anyway, thank you very much for the good job, doing a mknod by hand doesn't hurt :)
Comment 11 Piotr Szymaniak 2010-08-08 22:08:57 UTC
Created attachment 241895 [details]
frandom-1.0.ebuild

(In reply to comment #10)
> (In reply to comment #9)
> > I *think* you might just have to restart udev and then modprove the module. Or
> > modprobe and restart.
> > 
> 
> I've rebooted the machine and I've done a modprobe and a "/etc/init.d/udev
> restart" with no luck... Anyway, thank you very much for the good job, doing a
> mknod by hand doesn't hurt :)

Got the same issue. Devices are missing, so I just made myself a little udev rule for this. Don't know if those magic lines under "vboxdrv" comment should do the trick, but looks like they don't.
Comment 12 Piotr Szymaniak 2010-08-08 22:11:27 UTC
Created attachment 241897 [details]
frandom/frandom-1.0.ebuild

This is the correct attachment. (:
Comment 13 Piotr Szymaniak 2010-08-08 22:11:56 UTC
Created attachment 241899 [details]
frandom/files/60-frandom.rules

And udev rules.
Comment 14 Chris Slycord 2011-09-03 18:51:52 UTC
Created attachment 285447 [details]
Working ebuild for version 1.1

Just needed to change the URI from earlier ebuild...
Comment 15 Piotr Szymaniak 2011-09-03 21:08:33 UTC
Created attachment 285461 [details]
frandom-1.1.ebuild

I did some more changes. We should use .rules file from the tarball as it seems to work fine.
Comment 16 Piotr Szymaniak 2012-01-27 22:08:50 UTC
Don't know if that's the reason, but looks like i found a bug in frandom. Kernel configured with CONFIG_SLUB=y works fine, but with CONFIG_SLAB=y (changing SLAB allocator) loading the module ends like this:

insmod: error inserting '/lib/modules/3.2.1/misc/frandom.ko': -1 Unknown symbol in module

dmesg gives a hint:
[  635.150632] frandom: Unknown symbol kmalloc_caches (err 0)

Could someone try it? (if frandom has some users hereā€¦ ;)
Comment 17 Chris Slycord 2012-06-25 08:23:34 UTC
Created attachment 316223 [details]
Updated; changed to install udev rules to /lib/udev/rules.d
Comment 18 Miroslav Rovis 2012-09-19 19:20:54 UTC
The package works still with the current kernels.
There are two things to fix about it though.

Firstly, installing into
/etc/udev/rules.d/10-frandom.rules
should be replaced by 
/lib/udev/rules.d/10-frandom.rules
(the new location, as I got a message in that sense on booting).

Secondly and, possibly, most importantly, I got my 3.5.4-hardened kernel at booting today complain that:

udev[1044]: Name="%k" is ignored because it breaks kernel supplied names, please remove it from /etc/udev/rules.d/10-frandom.rules:8

I currently have not time to study the matter and possibly learn how to do it, but I hope someone of you big Gentoo guys can do it in a matter of few minutes.
Hopefully!

(and if I am not asking too much, I had to copy manually the message of today. Turning on debugging would be too much output, esp. because grsec.log itself carries much, but how do I get the messages at booting, without too much output, just those that I see at booting, written down in some logs. Is there a simple way? Of course, if I am not asking too much. Thanx!)
I used this unsigned ebuild to make a page on building ebuilds for absolute beginners:
http://en.gentoo-wiki.com/wiki/Talk:Writing_Ebuilds
Cheers!
Comment 19 jannis 2013-10-26 19:13:38 UTC
Works fine here with linux 3.12.0-rc5. The only thing is a QA notice:
 * QA Notice: udev rules should be installed in /lib/udev/rules.d:
 *   etc/udev/rules.d/10-frandom.rules

Speed comparison on my "Intel(R) Core(TM)2 Duo CPU     P9500  @ 2.53GHz":
/dev/urandom: ~ 13MByte/s
/dev/frandom: ~200MByte/s

Thanks for the ebuild, awesome piece of software!
Comment 20 Fedja Beader 2016-03-25 18:31:07 UTC
Works fine on Linux 4.0.9.

This module is so useful that it deserves to be made part of the default patches applied to the kernel, not as a separate package (though this option should not be excluded).
Comment 21 Fedja Beader 2016-03-25 18:33:13 UTC
^ I installed it by following instructions in the frandom package, not by using the ebuild.
Comment 22 Fedja Beader 2016-04-06 17:45:46 UTC
ebuild is working, too.
Comment 23 Rick Farina (Zero_Chaos) gentoo-dev 2016-04-06 18:16:08 UTC
I honestly have no idea why anyone wants this, but it's in portage now.