Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 76630 - bestcrypt-1.5_p9-r1 emerges, modules get loaded, but bctool says "Kernel modules not loaded"
Summary: bestcrypt-1.5_p9-r1 emerges, modules get loaded, but bctool says "Kernel modu...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: x86 Linux
: High normal
Assignee: Daniel Black (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-01-04 05:59 UTC by Stefan Behte (RETIRED)
Modified: 2005-01-26 00:50 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Behte (RETIRED) gentoo-dev Security 2005-01-04 05:59:13 UTC
I emerged bestcrypt-1.5_p9-r1 and started it. The modules get loaded, but bctools says "Kernel modules not loaded"

[root@haq /usr/portage/app-crypt/bestcrypt]# strace bctool
execve("/usr/bin/bctool", ["bctool"], [/* 47 vars */]) = 0
uname({sys="Linux", node="haq", ...})   = 0
brk(0)                                  = 0x8060000
open("/etc/ld.so.preload", O_RDONLY)    = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY)      = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=69048, ...}) = 0
mmap2(NULL, 69048, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7fdb000
close(3)                                = 0
open("/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.4/libstdc++.so.5", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\340\376"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=808072, ...}) = 0
mmap2(NULL, 822580, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb7f12000
mmap2(0xb7fd1000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xbf) = 0xb7fd1000
mmap2(0xb7fd6000, 19764, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb7fd6000
close(3)                                = 0
open("/lib/libm.so.6", O_RDONLY)        = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0`3\0\000"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=157656, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f11000
mmap2(NULL, 139424, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb7eee000
mmap2(0xb7f0f000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x20) = 0xb7f0f000
close(3)                                = 0
open("/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.4/libgcc_s.so.1", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\220\26"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0644, st_size=37056, ...}) = 0
mmap2(NULL, 35216, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb7ee5000
mmap2(0xb7eed000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x7) = 0xb7eed000
close(3)                                = 0
open("/lib/libc.so.6", O_RDONLY)        = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0PM\1\000"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=1190488, ...}) = 0
mmap2(NULL, 1121292, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb7dd3000
mmap2(0xb7edf000, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x10b) = 0xb7edf000
mmap2(0xb7ee3000, 7180, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb7ee3000
close(3)                                = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7dd2000
mprotect(0xb7edf000, 8192, PROT_READ)   = 0
set_thread_area({entry_number:-1 -> 6, base_addr:0xb7dd2070, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0
munmap(0xb7fdb000, 69048)               = 0
brk(0)                                  = 0x8060000
brk(0x8081000)                          = 0x8081000
open("/dev/urandom", O_RDONLY)          = 3
read(3, "%?\233\260", 4)                = 4
close(3)                                = 0
getuid32()                              = 0
geteuid32()                             = 0
open("/dev/bcrypt/disc0/disc", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/dev/bcrypt0", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
close(-1)                               = -1 EBADF (Bad file descriptor)
write(2, "Kernel modules not loaded\n", 26Kernel modules not loaded
) = 26
exit_group(-1)                          = ?
[root@haq /usr/portage/app-crypt/bestcrypt]#


I remember that I read somewhere about something with mknod /dev/bcrypt/disc0/disc to fix this issue...I think it was even on bugs.gentoo.org but I cannot find it...

Reproducible: Always
Steps to Reproduce:
1. ebuild bestcrypt-1.5_p9-r1.ebuild merge
2. /etc/init.d/bcrypt start
3. lsmod
4. bctool
Actual Results:  
1. it emerged fine
2. it started up fine
3. it lists the kernel modules with lsmod
4. BUT bctool says "Kernel modules not loaded"

Expected Results:  
Hmm - work! ;)

Portage 2.0.51-r3 (default-linux/x86/2004.3, gcc-3.3.4, glibc-2.3.4.20040808-r1,
2.6.9-gentoo-r13 i686)
=================================================================
System uname: 2.6.9-gentoo-r13 i686 Pentium III (Coppermine)
Gentoo Base System version 1.4.16
distcc 2.16 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled]
Autoconf: sys-devel/autoconf-2.59-r5
Automake: sys-devel/automake-1.8.5-r1
Binutils: sys-devel/binutils-2.15.90.0.1.1-r3
Headers:  sys-kernel/linux26-headers-2.6.8.1-r1
Libtools: sys-devel/libtool-1.5.2-r7
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CFLAGS="-O3 -march=pentium3 -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
COMPILER=""
CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config
/usr/kde/3.2/share/config /usr/kde/3.3/env /usr/kde/3.3/share/config
/usr/kde/3.3/shutdown /usr/kde/3/share/config /usr/share/config /var/bind
/var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O3 -march=pentium3 -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs autoconfig ccache distlocks sandbox sfperms"
GENTOO_MIRRORS="ftp://sunsite.informatik.rwth-aachen.de/pub/Linux/gentoo
ftp://gd.tuwien.ac.at/opsys/linux/gentoo/
ftp://ftp.tu-clausthal.de/pub/linux/gentoo/
ftp://ftp.uni-erlangen.de/pub/mirrors/gentoo/
ftp://ftp.join.uni-muenster.de/pub/linux/distributions/gentoo/
ftp://linux.rz.ruhr-uni-bochum.de/gentoo-mirror/"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY=""
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="x86 3dfx 3dnow X acl acpi apm arts avi berkdb bitmap-fonts cdr crypt cups
curl encode esd ethereal fam flac foomaticdb fortran ftp gd gdbm gif gpm gtk
gtk2 icq imagemagick imlib ipv6 java jpeg libwww mad mikmod mmx motif mpeg mtrr
ncurses nls nptl oggvorbis opengl oss pam pdflib perl png python qt quicktime
readline samba scanner sdl slang snmp socks5 spell sse ssl svga tcpd tiff
truetype usb xinerama xml xml2 xmms xv zlib"
Comment 1 Daniel Black (RETIRED) gentoo-dev 2005-01-04 12:23:00 UTC
bug 67487?

I've really got to look at if automatic registration of nodes and weither bestcrypt does it.

The init script creating nodes I think is very messy.
Comment 2 Daniel Black (RETIRED) gentoo-dev 2005-01-05 01:12:25 UTC
are you using devfs? Are you interested in the transition to udev? bestcrypt seems to have good sysfs support which is the basis for udev. Looking into a solution now.

A good reference I found in the mean time:
http://www.reactivated.net/udevrules.php
Comment 3 Daniel Black (RETIRED) gentoo-dev 2005-01-05 04:33:43 UTC
note to self - need honour CFLAGS and append-flags  fno-stack-protector-all (cause hardened stuff in kernels is bad)
Comment 4 Stefan Behte (RETIRED) gentoo-dev Security 2005-01-05 11:55:20 UTC
That bestcrypt error appears on two of my PCs with kernel 2.6.
So I decided to installed udev as described in http://www.gentoo.org/doc/en/udev-guide.xml on one of them.

It's already running, "udevinfo -s" works fine :)
Even my nvidia card didn't panic, X is running without any changes.

So now I can test bestcrypt ebuilds with and without udev.
Comment 5 Stefan Behte (RETIRED) gentoo-dev Security 2005-01-05 11:56:19 UTC
Oh and BTW: bctool still spits out the same error.
Comment 6 Daniel Black (RETIRED) gentoo-dev 2005-01-05 12:08:05 UTC
with http://www.reactivated.net/udevrules.php I/(or you) should be able to write a /etc/udev/rules.d/44-bestcrypt file that describes the rules to create the nodes with udev.

I'm working on it now. Pop by irc irc://dragonheart@irc.freenode.org:6667/gentoo-ppc to say hi  or for any other input you think of.
Comment 7 Stefan Behte (RETIRED) gentoo-dev Security 2005-01-05 16:39:13 UTC
You were not online any more...

But I searched...on Kernel 2.4 bestcrypt works find...there the /dev/bcrypt/disc0/disc file is created. So I asked my friends on irc.euirc.net #gentoo how I could create that file on my PC with Kernel 2.6:
Streusalz said:
mknod file b 188 0

Now bctool works fine!!
So this litte bash script will fix it:

#!/bin/bash
# fix for bestcrypt /dev files by Craig [at] Haquarter.de
mkdir /dev/bcrypt
for i in `seq 0 15`
do
 if [ ! -e /dev/bcrypt/disc${i} ]
 then
  mkdir /dev/bcrypt/disc${i}
  mknod /dev/bcrypt/disc${i}/disc b 188 0
 fi
done

After running it, bctool works on both Kernel-2.6 machines!
Now you only need to add that fix to the ebuild. I am sorry, but I don't know much about creating/changing ebuilds, so I can't do it!
There sure is a tutorial somewhere but right now I am too lazy, I want to sleep :)
Comment 8 Stefan Behte (RETIRED) gentoo-dev Security 2005-01-05 16:53:37 UTC
Uhm, I missed checking if /dev/bcrypt exists.
Here my final version! :)

#!/bin/bash
# fix for bestcrypt /dev files by Craig [at] Haquarter.de
if [ ! -e /dev/bcrypt ]
then
 mkdir /dev/bcrypt
fi

for i in `seq 0 15`
do
 if [ ! -e /dev/bcrypt/disc${i} ]
 then
  mkdir /dev/bcrypt/disc${i}
  mknod /dev/bcrypt/disc${i}/disc b 188 0
 fi
done
Comment 9 Daniel Black (RETIRED) gentoo-dev 2005-01-06 01:00:59 UTC
an ebuild is basicly a bash script. 
http://www.gentoo.org/proj/en/devrel/handbook/handbook.xml?part=2&chap=1
is basically the howto + man 5 ebuild

Thanks for the scripting - I'll add it to the init.d script in a form that checks udev and devfsd first.

Note /etc/modules.d/bc contains a couple of kernel args.

Note a 2.6.10 kernel wont work as they took away an API that bestcrypt uses.
(I'll probably report this to the bestcrypt devs)

I wasn't online for long earlier - it was my before work time. On now for a bit.

udev should handle node creation without the need for mknod.
Comment 10 Stefan Behte (RETIRED) gentoo-dev Security 2005-01-06 02:43:31 UTC
There is a problem, if you used the fix, lilo says:
/proc/partitions does not match /dev/ directory structure.
Name change: /dev/bcrypt0 -> /dev/bcrypt/disc0/disc

when a bestcrypt container is mounted and you /sbin/lilo.
Comment 11 Daniel Black (RETIRED) gentoo-dev 2005-01-07 01:17:35 UTC
Craig - note bestcrypt-1.5_p10.ebuild added. It's ment to work with 2.6.10 but I'm not convinced. Good luck with the devfs script. Changed current init.d script to not create noted in udev. C{XX}FLAGS respected in ebuild.

Getting there.
Comment 12 Stefan Behte (RETIRED) gentoo-dev Security 2005-01-09 09:22:53 UTC
It still does not work with devfsd:

open("/dev/bcrypt/disc0/disc", O_RDONLY|O_LARGEFILE) = -1 ELOOP (Too many levels of symbolic links)
open("/dev/bcrypt0", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)

[root@haq ~]# ls -l "/dev/bcrypt/disc0/disc"
lr-xr-xr-x  1 root root 22  9. Jan 18:12 /dev/bcrypt/disc0/disc -> /dev/bcrypt/disc0/disc

Thats wrong! The disc file to be created (see my script).

I'll be online tomorrow (in about 23 hours), so we can finally fix this!
Comment 13 Stefan Behte (RETIRED) gentoo-dev Security 2005-01-09 09:44:55 UTC
Oh, wait, my fault!
Because of the line in /etc/devfsd.conf the symlinks got created instead of the files. I forgot to comment out the line.

Sorry for the wrong info.

Then I deleted everything, re-emerged again, and started bcrypt. There were no files in /dev!
Then I ran my script, and bctool worked.

Why not just add it (with a check for devfsd) into the /etc/init.d/bcrypt script?!
Comment 14 Daniel Black (RETIRED) gentoo-dev 2005-01-09 11:57:57 UTC
Probably cause I'm being a perfectionist and saying that devfs is ment to manage device nodes and not init scripts.

The prefered solution is to add a /etc/devfs.d/bcrypt file that contains the rules for devfs to autoload and create nodes.

Keep in mind my TZ - +9.5 - I'm normally around for between 2200-2300 UTC or 0800-1100 UTC sometime.
Comment 15 Stefan Behte (RETIRED) gentoo-dev Security 2005-01-12 09:24:03 UTC
Yea, I've done it! This time with the fix you want ;)
Use this as /etc/devfs.d/bcrypt:

LOOKUP   ^bcrypt/disc0/disc  EXECUTE /bin/mknod /dev/bcrypt/disc0/disc b 188 0
LOOKUP   ^bcrypt/disc1/disc  EXECUTE /bin/mknod /dev/bcrypt/disc1/disc b 188 0
LOOKUP   ^bcrypt/disc2/disc  EXECUTE /bin/mknod /dev/bcrypt/disc2/disc b 188 0
LOOKUP   ^bcrypt/disc3/disc  EXECUTE /bin/mknod /dev/bcrypt/disc3/disc b 188 0
LOOKUP   ^bcrypt/disc4/disc  EXECUTE /bin/mknod /dev/bcrypt/disc4/disc b 188 0
LOOKUP   ^bcrypt/disc5/disc  EXECUTE /bin/mknod /dev/bcrypt/disc5/disc b 188 0
LOOKUP   ^bcrypt/disc6/disc  EXECUTE /bin/mknod /dev/bcrypt/disc6/disc b 188 0
LOOKUP   ^bcrypt/disc7/disc  EXECUTE /bin/mknod /dev/bcrypt/disc7/disc b 188 0
LOOKUP   ^bcrypt/disc8/disc  EXECUTE /bin/mknod /dev/bcrypt/disc8/disc b 188 0
LOOKUP   ^bcrypt/disc9/disc  EXECUTE /bin/mknod /dev/bcrypt/disc9/disc b 188 0
LOOKUP   ^bcrypt/disc10/disc  EXECUTE /bin/mknod /dev/bcrypt/disc10/disc b 188 0
LOOKUP   ^bcrypt/disc11/disc  EXECUTE /bin/mknod /dev/bcrypt/disc11/disc b 188 0
LOOKUP   ^bcrypt/disc12/disc  EXECUTE /bin/mknod /dev/bcrypt/disc12/disc b 188 0
LOOKUP   ^bcrypt/disc13/disc  EXECUTE /bin/mknod /dev/bcrypt/disc13/disc b 188 0
LOOKUP   ^bcrypt/disc14/disc  EXECUTE /bin/mknod /dev/bcrypt/disc14/disc b 188 0
LOOKUP   ^bcrypt/disc15/disc  EXECUTE /bin/mknod /dev/bcrypt/disc15/disc b 188 0

Files will be created just when you do try to access them, try "ls -l /dev/bcrypt/disc0/disc" :)
Please add this to the ebuild!

It was nice to work with you!
Comment 16 Stefan Behte (RETIRED) gentoo-dev Security 2005-01-12 09:37:04 UTC
Oh, BTW: The fix was working well on two 2.6 machines!
I'll check if the ebuild works, then upgrade to Kernel 2.6.10 and try if it works.
I hope I don't cause too much work ;)
Comment 17 Daniel Black (RETIRED) gentoo-dev 2005-01-26 00:50:01 UTC
Craig - thanks for testing and you patience. Yes this was getting to be a lot of work however the work will pay off with fewer bugs in the future (cross fingers, touch wood and other good luck things).

I've finally added the devfs stuff. Anything bad with 2.6.10 kernels let me know.

PS I think its time for a new bug if something new comes up.