# imapd: authentication error: Connection refused

## Toady

I set my system to do a world update evry month....

I am now thinking this is a bad move  :Sad: 

In my logs every time I try and use IMAP mail I get :

```
Mar  2 19:37:00 hogarth imapd: Connection, ip=[10.x.x.x]

Mar  2 19:37:00 hogarth imapd: authdaemon: s_connect() failed: Connection refused

Mar  2 19:37:00 hogarth imapd: [Hint: perhaps authdaemond is not running?]

Mar  2 19:37:00 hogarth imapd: LOGIN FAILED, user=testuser, ip=[10.x.x.x]

Mar  2 19:37:00 hogarth imapd: authentication error: Connection refused
```

----------

## jkt

`/etc/init.d/authdaemon start; rc-update add authdaemon default`

----------

## jkt

 *Toady wrote:*   

> I set my system to do a world update evry month....
> 
> I am now thinking this is a bad move 

 

Always check manually what is about to be upgraded. But having cronjobs for `emerge --sync` is a Good Think (tm)

----------

## j-m

Are you using courier-imap?

```

rc-update del authdaemond

rc-update add courier-authlib default

/etc/init.d/authdaemond stop

/etc/init.d/authdaemond zap

rm /etc/init.d/authdaemond

/etc/init.d/courier-authlib start

```

The config files have also moved, you should read the ebuild instructions. Also solved many times here.

----------

## Toady

Yes I am running courier-imapd  :Wink: 

OK so I have done the above.. but now I cant connect and I also have nothing in the logs  :Sad:  grrrrr

----------

## j-m

Please search the forums and read the post-install instruction in the ebuild.

----------

## trossachs

Toady, I also did what you asked but when I try and restart courier-authlib, I get this:

```
* Stopping courier-imapd...                                                                          [ ok ]

* Stopping courier-authlib: authdaemond...

tart-stop-daemon: warning: failed to kill 11330: No such process                              [ ! ! ]
```

Any ideas?

----------

## jkt

 *JulesF wrote:*   

> Toady, I also did what you asked but when I try and restart courier-authlib, I get this:
> 
> ```
> * Stopping courier-imapd...                                                                          [ ok ]
> 
> ...

 

Yep. If the init file is correct (it should be) and bugfree, then something nasty happened to the authdaemond and it died. `/etc/init.d/authdaemond zap; /etc/init.d/authdaemond start` will restart it, but you should really figure out why had it died. Anything interesting in logs?

----------

## trossachs

Had to reboot the entire server to get this to work.  I hate having to do that. But of course now my Apache installation ov 2.0.53 is screwed and I am getting this segmentation error:

```
child pid 14313 exit signal Segmentation fault (11)
```

If it's not one thing it's the other... Anyone with similar woes?

----------

## jkt

 *JulesF wrote:*   

> 
> 
> ```
> child pid 14313 exit signal Segmentation fault (11)
> ```
> ...

 

segfaulting is neither normal nor common behaviour  :Smile: . Are you using correct CFLAGS/CXXFLAGS? Have you checked your memory with memtest?

----------

## trossachs

This started the moment I upgraded to Apache 2.0.53 everything was fine before then. If you look at the countless posts with this subject, I'm afraid it is VERY common behaviour. The only prob is that now I have reinstalled the system with Apache 2.0.50 and the same issue has arisen.

----------

## jkt

 *JulesF wrote:*   

> This started the moment I upgraded to Apache 2.0.53 everything was fine before then. If you look at the countless posts with this subject, I'm afraid it is VERY common behaviour. The only prob is that now I have reinstalled the system with Apache 2.0.50 and the same issue has arisen.

 

OK, it's cetrainly possible that one package has problems, but if suddenly "everything works crazy", it is probably not related to the upgrade of Apache. Did you upgraded something else during that time?

----------

## trossachs

Courier-imap got updated earlier in the day and then I did Apache. Courier is fine. Perhaps I should uninstall it? I have seen a post regarding gcc so I am upgrading that as my version was a some months old. I built the server new in December. The only original part was the CPU a 1.3Ghz Athlon. Man I am REALLY suffering. I host a few sites for people and they are screwing. Will be 24 hours soon. Postfix still works in the background so mail comes in ok and I am using a different client to check imap.

Courier must be working otherwise I could not use the client.

----------

## jkt

Maybe the problem with authdaemon was only that the daemons were killed in wrong order. So now you have only broken apache, right? What happens if you emerge another version? BTW, it could be easily caused by some apache module, for example. Have you recompiled mod_php (if you use PHP)?

----------

## trossachs

Well I have just manually compiled versio v50 of Apache and I get the same error. I have reseated the mem chips also, no avail. I am using:

```
mod_php

v4.3.10
```

----------

## jkt

 *JulesF wrote:*   

> Well I have just manually compiled versio v50 of Apache and I get the same error. I have reseated the mem chips also, no avail. I am using:
> 
> ```
> mod_php
> 
> ...

 

what happens if you select another MPM or disable extensions like PHP?

----------

## trossachs

Have taken php out of the equasion and I get the same Segmentation fault. I have also reinstalled Apache v52 which is what I had before all this. Same result. What is this all about, where does this problem lie? Segmentation can mean so many things, but the server does not, never has crashed. It is just with Apache.

----------

## jkt

can you select another MPM (prefork, worker,...)?

----------

## trossachs

Sorry, I don't quite understand. The fork part of my conf file:

```
Timeout 300

KeepAlive On

MaxKeepAliveRequests 100

KeepAliveTimeout 15

<IfModule prefork.c>

    StartServers         5

    MinSpareServers      5

    MaxSpareServers     10

    MaxClients         150

    MaxRequestsPerChild  0

</IfModule>

<IfModule worker.c>

    StartServers         2

    MaxClients         150

    MinSpareThreads     25

    MaxSpareThreads     75

    ThreadsPerChild     25

    MaxRequestsPerChild  0

</IfModule>

<IfModule perchild.c>

    NumServers          10

    StartThreads        10

    MinSpareThreads     10

    MaxSpareThreads     10

    MaxThreadsPerChild  20

    MaxRequestsPerChild  1

</IfModule>

<IfModule peruser.c>

    MinSpareServers        2

    MaxProcessors         10

    MaxClients           150

    MaxRequestsPerChild  100

    Multiplexer nobody nobody

    Processor user group /home/user

    # chroot dir is optional:

    # Processor user group

</IfModule>
```

What do you suggest?

----------

## jkt

Oops, using another MPM will require rebuild. So it breaks even after recompialtion of apache? Without any modules (PHP, mod_ssl,...)?

----------

## trossachs

Isn't there a bare minimum of modules that Apache needs to function with?

----------

## jkt

 *JulesF wrote:*   

> Isn't there a bare minimum of modules that Apache needs to function with?

 

AFAIK no "modules" loaded at runtime are required...

Is something interesting in logs? What about increasing the verbosity? (`/usr/sbin/apache2 -X -e level_of_debig_info`...)

----------

## trossachs

The only thing in the logs is this:

```
[Wed Apr 06 21:31:53 2005] [notice] child pid 1516 exit signal Segmentation fault (11)

[Wed Apr 06 21:32:59 2005] [notice] child pid 1517 exit signal Segmentation fault (11)

[Wed Apr 06 21:33:00 2005] [notice] child pid 1518 exit signal Segmentation fault (11)

[Wed Apr 06 21:33:11 2005] [notice] child pid 1520 exit signal Segmentation fault (11)

[Wed Apr 06 21:33:11 2005] [notice] child pid 1519 exit signal Segmentation fault (11)

[Wed Apr 06 21:33:31 2005] [notice] child pid 2203 exit signal Segmentation fault (11)

[Wed Apr 06 21:33:32 2005] [notice] child pid 2205 exit signal Segmentation fault (11)

[Wed Apr 06 21:33:47 2005] [notice] child pid 2207 exit signal Segmentation fault (11)

[Wed Apr 06 21:33:47 2005] [notice] child pid 2206 exit signal Segmentation fault (11)
```

----------

## jkt

you can alwasy compile apache with  `FEATURES=nostrip USE=debug emerge apache` and then use gdb debugger  :Smile: .

Are you really sure that you're compiling for correct CPU? Do you have sane CFLAGS? Isn't there somethign broken in apache's deps? (`emerge -epv world`)

----------

## trossachs

Why would I have changed the CPU type with my CFLAGS? Nothing has changed, I just upgraded to 2.0.53 and all this happened. I have even gone back down to v2.0.51/52 and it is the same. I have changed memory, reduced clock speed, all sorts.

----------

## jkt

 *JulesF wrote:*   

> Why would I have changed the CPU type with my CFLAGS? Nothing has changed, I just upgraded to 2.0.53 and all this happened. I have even gone back down to v2.0.51/52 and it is the same. I have changed memory, reduced clock speed, all sorts.

 

Try to have a look at /var/log/emerge.log, look for something which got upgraded/changed since your latest stable apache install. And have you tried with default configuration files of Apache?

----------

## trossachs

SOLUTION! I have finally worked out that v2.0.53 does not use ANY MODULES listed in httpd.conf! Most of us have got:

```
LoadModule php5_module                   modules/libphp5.so

#LoadModule frontpage_module              modules/mod_frontpage.so

LoadModule access_module                 modules/mod_access.so

LoadModule auth_module                   modules/mod_auth.so

LoadModule auth_anon_module              modules/mod_auth_anon.so

LoadModule auth_dbm_module               modules/mod_auth_dbm.so

LoadModule auth_digest_module            modules/mod_auth_digest.so

LoadModule include_module                modules/mod_include.so

LoadModule log_config_module             modules/mod_log_config.so

LoadModule env_module                    modules/mod_env.so

LoadModule mime_magic_module             modules/mod_mime_magic.so

LoadModule cern_meta_module              modules/mod_cern_meta.so
```

... and such like listed within our .conf files. Well, if you have got the php5 statement listed, it is this, which will cause the segmentation fault as Apache already has it loaded somewhere else!

I had install v2.0.53 from source code, not from emerge. I also installed php v5.0.4 at the same time. Only put:

```
AddType application/x-httpd-php .php .phtml

AddType  application/x-httpd-php         .php

AddType  application/x-httpd-php-source  .phps

```

...and any other specific modules you need. But DO NOT add any Apache modules as these are already in use. Where, I don't know yet!

Let me know if this works.

----------

## jonnevers

 *j-m wrote:*   

> Please search the forums and read the post-install instruction in the ebuild.

 

this thread got jacked hardcore so lets see whats up...

I was receiving the same error as the original poster. i guess i updated courier-imap, and didn't realize that it required a conf change, etc.

WELL, I did read the post-install instructions.. and guess what, they told me to configure courier-authlib for using a mysql backend. that is not only unhelpful but totally out of line to correcting the error i was receiving.

So solve my courier-imap problems:

```

1) /etc/init.d/authdaemond stop

2) vi /etc/courier/authlib/authdaemonrc

    and set the following line (notice that i totally remove the authmysql b.s.)

         authmodulelist="authpam authuserdb authshadow authcustom"

3) /etc/init.d/courier-authlib start

4) /etc/init.d/courier-imap

5) enjoy my working squirrelmail installation again...

```

this sets courier-authlib to use PAM, which allows my system defined users access to their .maildirs/

-JonLast edited by jonnevers on Tue Apr 12, 2005 3:52 am; edited 1 time in total

----------

## trossachs

What are you ranting about?

Do you still have a prob with courier? Why should I keep this advice to myself? I spent a long time getting to that stage and I want to spare as many Gentoo folk as possible the hassle that I went thru.

----------

