# Courier-IMAP Problems

## twam

Hi,

Just emerged Courier-IMAP, but it won't start. 

```
pluto /usr/lib/courier-imap # /etc/init.d/courier-pop3d start

 * Starting courier-authlib: authdaemond ...                                                                   [ ok ]

 * Starting courier-pop3d ...                                                                                  [ !! ]
```

A can't see any hints in /var/log/mail/* and /var/log/everything/*. pop3d-ssl, imap und imap-ssl are acting the same way. Any suggestions?

Regards Tobias

----------

## nixnut

any messages in /var/log/messages?

----------

## twam

No, absolutely not.  :Sad: 

----------

## twam

Nobody any hints?

----------

## peppy

i would re-emerge it, if you are configuring it with ssl check to see that you didn't mess anything up in the pop3d.cnf and imapd.cnf files, make sure that your network is up and you haven an internet access.  :Confused:   ehh sorry I am having problems with courier-imap as well.

----------

## twam

I already reemerged it. The pop3d.cnf and imapd.cnf files are the original ones. Network and Internet is working well.

----------

## twam

Maybe the start scripts are wrong. In /etc/init.d/courier-pop3d i find

```
start() {

        checkconfig || return 1

        ebegin "Starting courier-pop3d"

        start-stop-daemon --quiet --start --exec /usr/bin/env - /usr/lib/courier-imap/gentoo-pop3d.rc \

                --pidfile $PIDFILE

        eend $?

}
```

When I start /usr/lib/courier-imap/gentoo-pop3d.rc by hand, the pop-service is listening on port 110, but the script fails!

----------

## twam

Installed an older baselayout. Now it's working.

----------

## UberLord

 *twam wrote:*   

> Installed an older baselayout. Now it's working.

 

Um - you didn't install baselayout-1.12.0-alpha1 by chance did you?

It's package masked for a good reason (although there's not that much breakage with it) - and you just found one of the reasons.

courier-imap init scripts abuse the use of start-stop-daemon and cause this error. Here's their current logic

start-stop-daemon calls env calls shell script.

Cookies to anyone who can see the flaw

(hint shell scripts cannot be daemons - a daemon can call a shell script though)

In summary - it's a problem with the courier-imap init scripts!

----------

## twam

I did install the 1.12.0alpha because I hat problems with my old 1.9 regarding VLAN. Now I'm running 1.11 and both is working fine. 

Thanks for your explanation!

----------

## rolweber

I updated to the new baselayout-1.12.4-r2 and now courier-imap won't start.

This thread explains the problem (broken init script of courier-imap), but how do I fix it?

Patch something in the init script? Unpatch something that came with the new baselayout?

Any help will be appreciated.

cheers,

  Roland

----------

## rolweber

Ok, I found the bug in the init script after reading

https://forums.gentoo.org/viewtopic-t-371375-start-2-highlight-courierimap+baselayout.html

It's not exactly the one described there, but almost. The command in my /etc/init.d/courier-imap looked like:

```
   start-stop-daemon --quiet --start --exec /usr/bin/env - /usr/lib/courier-imap/gentoo-imapd.rc \

      --pid=$PIDFILE

```

and I changed the single dash "-" after /usr/bin/env to a double dash "--"

```
   start-stop-daemon --quiet --start --exec /usr/bin/env -- /usr/lib/courier-imap/gentoo-imapd.rc \

      --pid=$PIDFILE

```

I've checked once more, "emerge -uD world" does not want to update anything. I hope the next version of courier-imap fixes this problem.

cheers,

  Roland

----------

## amigafan

 *rolweber wrote:*   

> 
> 
> and I changed the single dash "-" after /usr/bin/env to a double dash "--"
> 
> ```
> ...

 

This fix doesn't work here - is there something more I have to do after adding a second "-" ?

----------

## amigafan

 *amigafan wrote:*   

>  *rolweber wrote:*   
> 
> and I changed the single dash "-" after /usr/bin/env to a double dash "--"
> 
> ```
> ...

 

My solution was to use the unstable 4.0.6 build of courier-imap. They really should mark this one as stable.

----------

## hanj

I wanted to chime in with a 'me too'. Double dash didn't fix the init script for me.

```
[ebuild   R   ] sys-apps/baselayout-1.12.4-r2  USE="-bootstrap -build -static -unicode" 0 kB 

[ebuild   R   ] net-mail/courier-imap-4.0.1  USE="berkdb gdbm -debug -fam -ipv6 -nls" 2,961 kB 
```

Thanks

hanji

----------

## fcgreg

FYI:  This bug on Bugzilla appears to be related and is being referenced by other threads in the forums.  Apparently this is a known bug in the init-scripts that was fixed in (testing) version 4.0.4 or Courier-IMAP.  The bug has been reopened due to the many problems we are all having.

In my case, I upgraded to the latest testing version (4.0.6) and it is working well.  Hope that helps...

----------

## hanj

Hello

I was worried with introducing additional problems by upgrading to 4.0.4. Based off of the bug, it appears to be an issue with baselayout and just the init scripts. I'm not sure if version 4.0.4 only addresses this.. or has other changes. I thought I'd try modifying the start/stop using the 4.0.4 templates.. and it works. For those that don't want to upgrade.. but just change the existing init scripts.. here is what I changed.

/etc/init.d/courier-pop3d-ssl

```
start() {

        checkconfig || return 1

        ebegin "Starting courier-pop3d over SSL"

        /usr/bin/env - /usr/lib/courier-imap/gentoo-pop3d-ssl.rc \

                --pidfile $SSLPIDFILE

        eend $?

}

stop() {

        ebegin "Stopping courier-pop3d over SSL"

        start-stop-daemon --quiet --stop --pidfile $SSLPIDFILE

        eend $?

}

```

/etc/init.d/courier-pop3d

```
start() {

        checkconfig || return 1

        ebegin "Starting courier-pop3d"

        /usr/bin/env - /usr/lib/courier-imap/gentoo-pop3d.rc \

                --pidfile $PIDFILE

        eend $?

}

stop() {

        ebegin "Stopping courier-pop3d"

        start-stop-daemon --quiet --stop --pidfile $PIDFILE

        eend $?

}

```

I'm not currently running imap, but if you needed to grab the right values look at the following files

```
/usr/portage/net-mail/courier-imap/files/courier-imap-4.0.4-courier-imapd-ssl.rc6

/usr/portage/net-mail/courier-imap/files/courier-imap-4.0.4-courier-imapd.rc6
```

Hope this helps.

hanji

----------

## Quincy

I was wondering why people complain about using gentoo on a production server...these "stable" updates are surely a reason. I can't understand why these things have to become clear in the forums after a packet has marked stable and all known bugs concerning this were ignored...

Thanks hanj....

----------

## Biffen

Had same problem with the new latest stable: (using courier-imap-ssl)

[ebuild   R   ] sys-apps/baselayout-1.12.4-r2  USE="-bootstrap -build -static -unicode" 0 kB 

[ebuild   R   ] net-mail/courier-imap-4.0.1  USE="berkdb gdbm nls -debug -fam -ipv6" 0 kB

I modifyed the:

/etc/init.d/courier-imapd-ssl

Copied the start/stop part from:

/usr/portage/net-mail/courier-imap/files/courier-imap-4.0.4-courier-imapd-ssl.rc6

Works fine now, thanks hanj!

----------

## mobian

This is ridiculous !!  Why is stable baselayout breaking things like this?

----------

## mrness

the broken thing is the courier init script, not the new baselayout.

----------

## MrNugget

Always funny when my stable gentoo system is broken and i need to look in these forums...

But i fixed it, thanks to hanj. Just copied the start/stop-sections of those files, that did it.

----------

## ShALLaX

Absolutely terrible.  I think a new Gentoo specific definition of "Stable" needs to be added to the dictionary.

----------

## DJEMiVT

Agreed,

This is the kind of stuff that makes me want to switch to freebsd or debian. It really shouldn't matter if it's the packages fault, or baselayouts fault, or whatever. As it stands my initscripts are still broken, and I have had to write my own scripts to start and stop the services. This is very frustrating...  :Confused: 

----------

