crypto module not working

Bug #68163 reported by zeank
32
Affects Status Importance Assigned to Milestone
ejabberd (Ubuntu)
Invalid
Undecided
Unassigned
erlang (Debian)
Fix Released
Unknown
erlang (Ubuntu)
Fix Released
Medium
Raphaël Pinson

Bug Description

Though being included with the distribution the crypto module does not work as crypto_drv can not be found:

zeank@sz2:~/src/ejabberd111/src$ erl
Erlang (BEAM) emulator version 5.5.1 [source] [async-threads:0] [kernel-poll:false]

Eshell V5.5.1 (abort with ^G)
1> crypto:start().
exec: 1: ok
2> crypto_drv: not found

=ERROR REPORT==== 25-Oct-2006::12:57:02 ===
** Generic server crypto_server terminating
** Last message in was {'EXIT',#Port<0.96>,normal}
** When Server state == {#Port<0.96>,[]}
** Reason for termination ==
** {port_died,normal}
exec: 1: crypto_drv: not found

=ERROR REPORT==== 25-Oct-2006::12:57:02 ===
** Generic server crypto_server terminating
** Last message in was {'EXIT',#Port<0.98>,normal}
** When Server state == {#Port<0.98>,[]}
** Reason for termination ==
** {port_died,normal}
exec: 1: crypto_drv: not found

=ERROR REPORT==== 25-Oct-2006::12:57:02 ===
** Generic server crypto_server terminating
** Last message in was {'EXIT',#Port<0.99>,normal}
** When Server state == {#Port<0.99>,[]}
** Reason for termination ==
** {port_died,normal}
exec: 1: crypto_drv: not found

=ERROR REPORT==== 25-Oct-2006::12:57:02 ===
** Generic server crypto_server terminating
** Last message in was {'EXIT',#Port<0.100>,normal}
** When Server state == {#Port<0.100>,[]}
** Reason for termination ==
** {port_died,normal}
exec: 1: crypto_drv: not found

=ERROR REPORT==== 25-Oct-2006::12:57:02 ===
** Generic server crypto_server terminating
** Last message in was {'EXIT',#Port<0.101>,normal}
** When Server state == {#Port<0.101>,[]}
** Reason for termination ==
** {port_died,normal}
exec: 1: crypto_drv: not found

=ERROR REPORT==== 25-Oct-2006::12:57:02 ===
** Generic server crypto_server terminating
** Last message in was {'EXIT',#Port<0.102>,normal}
** When Server state == {#Port<0.102>,[]}
** Reason for termination ==
** {port_died,normal}
exec: 1: crypto_drv: not found

=ERROR REPORT==== 25-Oct-2006::12:57:02 ===
** Generic server crypto_server terminating
** Last message in was {'EXIT',#Port<0.103>,normal}
** When Server state == {#Port<0.103>,[]}
** Reason for termination ==
** {port_died,normal}
exec: 1: crypto_drv: not found

=ERROR REPORT==== 25-Oct-2006::12:57:02 ===
** Generic server crypto_server terminating
** Last message in was {'EXIT',#Port<0.104>,normal}
** When Server state == {#Port<0.104>,[]}
** Reason for termination ==
** {port_died,normal}
exec: 1: crypto_drv: not found

=ERROR REPORT==== 25-Oct-2006::12:57:02 ===
** Generic server crypto_server terminating
** Last message in was {'EXIT',#Port<0.105>,normal}
** When Server state == {#Port<0.105>,[]}
** Reason for termination ==
** {port_died,normal}
exec: 1: crypto_drv: not found

=ERROR REPORT==== 25-Oct-2006::12:57:02 ===
** Generic server crypto_server terminating
** Last message in was {'EXIT',#Port<0.106>,normal}
** When Server state == {#Port<0.106>,[]}
** Reason for termination ==
** {port_died,normal}
exec: 1: crypto_drv: not found

=ERROR REPORT==== 25-Oct-2006::12:57:02 ===
** Generic server crypto_server terminating
** Last message in was {'EXIT',#Port<0.107>,normal}
** When Server state == {#Port<0.107>,[]}
** Reason for termination ==
** {port_died,normal}

=INFO REPORT==== 25-Oct-2006::12:57:02 ===
    application: crypto
    exited: shutdown
    type: temporary

Revision history for this message
William Grant (wgrant) wrote :

This makes ejabberd completely unusable, as reported in bug #68801.

Changed in ejabberd:
status: Unconfirmed → Confirmed
Revision history for this message
puzza007 (puzza007) wrote :

I think this could be the same as a bug I submitted, bug #68933. Can anyone confirm?

Revision history for this message
Pete Savage (petesavage) wrote :

This seems to work fine on the amd64 version of edgy

Revision history for this message
Nick Moffitt (nick-moffitt) wrote :

This particular problem doesn't seem to manifest upstream in Debian. I had a friend try this on Debian Unstable:

 1> crypto:start().
 ** exited: {undef,[{crypto,start,[]},
                    {erl_eval,do_apply,5},
                    {shell,exprs,6},
                    {shell,eval_loop,3}]} **
 =ERROR REPORT==== 15-Dec-2006::23:16:27 ===
 Error in process <0.30.0> with exit value:
{undef,[{crypto,start,[]},{erl_eval,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]}
 2>

For reference, on my edgy system:

[nick@frotz(~)] dpkg -S crypto_drv.so
erlang-base: /usr/lib/erlang/lib/crypto-1.5/priv/lib/crypto_drv.so

And on my friend's Debian Unstable system:

erlang-base-hipe: /usr/lib/erlang/lib/crypto-1.5/priv/lib/crypto_drv.so

So it is in the same location as Debian's. Why then doesn't it load on Ubuntu?

Revision history for this message
zeank (steve-zeank) wrote :

Actually this proves only that crypto is broken at debian unstable too. Though in some different way.

If it were working you'd see this:

zeank@sz2:~$ erl
Erlang (BEAM) emulator version 5.4.9 [source] [threads:0]

Eshell V5.4.9 (abort with ^G)
1> crypto:start().
ok
2>

If you get

{undef,[{crypto,start,[]},{erl_eval,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]}

instead, this means that a matching call 'start' within module 'crypto' could not be found.

Revision history for this message
Nick Moffitt (nick-moffitt) wrote :

That said, the friend *was* able to fire up ejabberd and connect with a jabber client. Admittedly it was on powerpc, and I've seen some folks say that things work fine on amd64. This may be an i386-only bug, and I believe my friend is testing on his x86 Unstable box now.

Revision history for this message
Nick Moffitt (nick-moffitt) wrote :

zeank: turns out he didn't have erlang-nox installed. once he grabbed that, everything worked.

Revision history for this message
Ludvig Omholt (ludde) wrote :

I got it working by recompiling the erlang packages using gcc-4.0 instead of gcc-4.1 as hinted deep in this thread:

http://www.erlang.org/pipermail/erlang-questions/2006-November/023840.html

$ erl
Erlang (BEAM) emulator version 5.5.1 [source] [async-threads:0] [kernel-poll:false]

Eshell V5.5.1 (abort with ^G)
1> crypto:start().
ok
2> q().
ok

Revision history for this message
William Grant (wgrant) wrote : Re: [Bug 68163] Re: crypto module not working

Ludvig Omholt wrote:
> I got it working by recompiling the erlang packages using gcc-4.0
> instead of gcc-4.1 as hinted deep in this thread:

In that case, it's probably an issue with optimised optimisations in GCC
4.1... I'll look into it tonight, and hopefully get the package fixed as
well.

Revision history for this message
Nick Moffitt (nick-moffitt) wrote :

Did you see any results? Will there be a new package in feisty any time soon?

Revision history for this message
William Grant (wgrant) wrote :

Nick Moffitt wrote:
> Did you see any results? Will there be a new package in feisty any time
> soon?

I recompiled it 3 times over the past 48 hours, with different
optimisation settings and compilers. Building Erlang with GCC 4.1 always
generates this issue, even with optimisations turned off. GCC 4.0 works
fine. Unless we can work out what in particular is causing it to fail
(and fix it), I'll upload it soon to build using GCC 4.0 instead.

Revision history for this message
pdecat (pdecat) wrote :

Hi,

have you tried to add "-fno-stack-protector" to the CFLAGS, as suggested in this thread in the Erlang forum : http://forum.trapexit.org/viewtopic.php?t=6630&highlight=cryptodrv

Best Regards,
Patrick.

Revision history for this message
koniczynek (koniczynek) wrote :

I have tried it now and it works. You need to download erlang-base source, add "-fno-stack-protector" into CFLAGS in rules file in debian directory, run dpkg-buildpackage and install erlang-base and erlang-nox which you've build earlier. And ejabberd works like a charm :)

Revision history for this message
magilus (magilus) wrote :

This is a bug in erlang and not in ejabberd.

Changed in erlang:
assignee: nobody → pirast
status: Unconfirmed → Confirmed
Changed in ejabberd:
status: Confirmed → Rejected
Revision history for this message
magilus (magilus) wrote :

I just created a .debdiff for Feisty, which should fix the issue. Currently, I am recompiling erlang, which will take some time (it is huge). I will leave a note if it really fixes the issue.

Revision history for this message
magilus (magilus) wrote :

Works fine now:

Erlang (BEAM) emulator version 5.5.2 [source] [async-threads:0] [kernel-poll:false]

Eshell V5.5.2 (abort with ^G)
1> crypto:start().
ok
2>

Could anyone please sponsor the upload to Feisty?

Revision history for this message
Raphaël Pinson (raphink) wrote :

I applied the patch, built the package and tested the functionality. Everything is fine. Uploading.

Thank you for your work on this bug Martin.

magilus (magilus)
Changed in erlang:
status: Confirmed → Fix Committed
Changed in erlang:
assignee: pirast → raphink
importance: Undecided → Medium
magilus (magilus)
Changed in erlang:
status: Fix Committed → Fix Released
Changed in erlang:
status: Unknown → Fix Released
Revision history for this message
Stéphane Marguet (stemp) wrote :

Still the same problem here : crypto_drv: not found

Revision history for this message
magilus (magilus) wrote :

Note that this has only been fixed in the current development release
(Feisty) of Ubuntu.

On Fr, 2007-02-09 at 16:43 +0000, Stemp wrote:
> Still the same problem here : crypto_drv: not found
>
> ** Attachment added: "erl crypto:start()"
> http://librarian.launchpad.net/6371783/erl.txt
>

Revision history for this message
Narasimham (lakshmi-narasimham) wrote :

Hi,
 Me too faced the same problem but found the solution.
 When i tried to install first time, after ./configure CFLAGS="-fno-stack-protector"
 the following message has been displayed.
 **************************************
 crypto : No usable OpenSSL found
 jinterface : No Java compiler found
 odbc : ODBC library - link check failed
 orber : No C++ compiler found
 ssh : No usable OpenSSL found
 ssl : No usable OpenSSL found
 ***************************************
 i found openssl development environment is missing which is why "crypto" application is failed to start.

 then i installed it from
 ftp://ftp.openssl.org/snapshot/openssl-0.9.7-stable-SNAP-20080428.tar.gz

 now i reinstalled erlang as follows
 1. ./configure CFLAGS="-fno-stack-protector"
 2. make
 3. make install

 Happy day... crypto is working

 my gcc version is 4.2.3gcc (GCC) 4.2.3 (Debian 4.2.3-3)
 erlang src: otp_src_R12B-2
 emulator version : 5.6.2

Thanks & regards
M L Narasimham

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.