# Apache2 mod_auth_digest.so hangs

## rburcham

I am pretty regularly seeing Apache2 hang on startup.  Relevant detail to follow:

# uname -a

```
Linux monkeysparc1 2.4.21-sparc-r0 #8 SMP Tue Jul 8 19:57:54 CDT 2003 sparc64 sun4u TI UltraSparc II  (BlackBird) GNU/Linux

```

# emerge -s apache

```
*  net-www/apache

      Latest version available: 2.0.48-r1

      Latest version installed: 2.0.48-r1

      Size of downloaded files: 6,111 kB

      Homepage:    http://www.apache.org/

      Description: Apache Web Server, Version 2.0.x

```

# /etc/init.d/apache2 start

```
 * Starting apache2...

apache2: Could not determine the server's fully qualified domain name, using 192.168.100.31 for ServerName                                                                                            [ ok ]
```

# tail /etc/apache2/logs/error_log

```
[Mon Dec 01 10:59:51 2003] [notice] Digest: generating secret for digest authentication ...

```

Note that it never says "Done."  Also, the process table only shows a single apache process:

# ps ax | grep apache

```
28963 ?        S      0:00 /usr/sbin/apache2 -k start

```

# netstat -tupan | grep apache

```
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      28963/apache2

```

However any connecting clients just hang.  I did a search here on the forums and found another fellow who had the same problem on Nov 1.  He indicated he was able to get apache to start if he commented out the loading of the module in apache2.conf.  I did this and I was able to get apache to start.

We should get this fixed though.  I searched the bugs site and found no references.  If someone can confirm my observations I will log a bug.

----------

## dholm

I have the exact same problem  :Sad: 

Please bugreport it as it's very serious.

----------

## meyerm

 *rburcham wrote:*   

> We should get this fixed though.  I searched the bugs site and found no references.  If someone can confirm my observations I will log a bug.

 

Search further  :Wink:  The only bug found at bugs.gentoo.org searching for "apache2" and "mod_auth_digest" ist the following:

https://bugs.gentoo.org/show_bug.cgi?id=37039

The more practical resolution than commenting out the module is compiling apache like that: MY_BUILTINS="--with-devrandom=/dev/urandom" emerge apache

hth

	Marcel

----------

## dholm

Thank you for the help. I really should find someone to talk care of all my server stuff for me  :Wink: .

----------

## starachna

hello all, many thanks for this post,  i was about to really, really, brake my pc  :Smile: 

has this been resolved yet ?

----------

## Deebster

I had this problem a while back.  The problem isn't with apache as such, more that your system isn't random enough...

At start, apache reads /dev/random to get data to generate the digest for mod_auth_digest.  If /dev/random hasn't got enough random data in it, it blocks until it does, which is why apache appears to hang.

/dev/random gets data from entropy in the machine (random events like interrupts).  I was running downstairs to the machine and mashing the keyboard to give it enough data until I just commented out the mod_auth_digest module.

The reason why "MY_BUILTINS="--with-devrandom=/dev/urandom" emerge apache" works is that /dev/urandom does not block, so it will return the contents even if less than requested, at a cost to randomness.

----------

## pvincent

Thanks for this post.

I was wondering why my apache could not start.

I'm busing re-emerging apache with 

```
MY_BUILTINS="--with-devrandom=/dev/urandom" emerge apache
```

Hoping it works...

Anyway it makes sense, I was able to launch apache2 before.

Then, I stored the machine into a bay, deconnecting the mouse and keyboard and trying launching apache2 from a SSH connection.

Trouble into /var/log/apache2/error.log 

 *Quote:*   

> Digest: generating secret for digest authentication ...

 

and never done...

I suppose /dev/random could not get enough entropy and then hangs due to mouse and keyboard off.

Does it sound right ?

I'm not pretty sure...

----------

## geta

Thanks for that posting. Explains my problem. Same symptoms. Haven't re-emerged yet and probably won't.

But I will try those methods explained in the bug. Seems fairly interesting that a "du -h /anypath" can produce some entropy for the digest key...   :Razz: 

Greetz, geta

----------

## HaloBoy

I had the same problem and the /dev/urandom fixed it!

----------

## meyerm

 *geta wrote:*   

> Seems fairly interesting that a "du -h /anypath" can produce some entropy for the digest key... 

 

The random source uses all "almost random" events on your computer to generate new values. These events are everything a user can cause: keyboard or mouse, disk access and even network traffic.

----------

## Roderik

i had the same symptoms described here. After trying eveything discussed here it still didn't work. 

Fixed it though  :Smile:  for ppl with the same problem, i emerged php 4.3.7 yesterday and it broke after reboot. without php it worked fine. Seems you have to re-emerge turcks-mmcache if you have that installed. Probaby dbg also if used.

----------

## zsek

Hello all,

I had the same problem. I had already installed apache and I got the problem with the apr package. I solved the problem with the folloing:

USE="urandom" emerge apr

Regards,

zsek

----------

