# Can't start IMAP



## xy16644 (Oct 8, 2011)

I have just updated all the ports on my server (after 6 months of not doing it) and now I can't start my Courier IMAP and IMAP-SSL service.

This is the error I get the in the /var/log/mailog:

```
Oct  8 16:47:34 alpha imapd: /libexec/ld-elf.so.1: Shared object "libgdbm.so.3" not found, required by "couriertcpd"
Oct  8 16:47:45 alpha imapd-ssl: /libexec/ld-elf.so.1: Shared object "libgdbm.so.3" not found, required by "couriertcp
```

Any ideas as to how I resolve this? I have had a look around but am still stumped :\


----------



## Abriel (Oct 8, 2011)

Reinstall 

databases/gdbm

and maybe IMAP too.


----------



## xy16644 (Oct 8, 2011)

I deinstalled and reinstalled:

databases/gdbm


and tried to start the IMAP and IMAPS services but am still getting the same error. 

If I deinstall/reinstall Courier IMAP will I lose my config?

Any other ideas? :e


----------



## Abriel (Oct 8, 2011)

xy16644 said:
			
		

> If I deinstall/reinstall Courier IMAP will I lose my config?


You should not lose it. I was using IMAP too, and many times i reinstalled it.


----------



## Carpetsmoker (Oct 8, 2011)

The problem is that databases/gdbm got updated, and their library version got increased (That's the number after the .so). However, your Courier IMAP probably didn't get updated, or got updated BEFORE you updated gdbm, and tries to use the old version of gdbm -- Which is no longer present.

Reinstall courier IMAP and you should be fine. Make sure you run a [cmd=]make clean[/cmd] first so that all previous build files of courier imap are removed. How exactly did you reinstall all ports? If you use portmaster or portupgrade this should, in theory, not happen. There's also a chance you got other ports that don't properly work.

From my pesonal collection, here's a script that should find these


```
#!/bin/sh

libraries()
{
  localbase="/usr/local"
  libdirs="/bin /sbin /libexec /lib /usr/bin /usr/sbin /usr/lib /usr/libexec \
  ${localbase}/bin ${localbase}/sbin ${localbase}/lib ${localbase}/libexec"

  echo "===> Checking for unresolvable libraries"

  for d in ${libdirs}; do
    echo "${d}"
    for f in $(find ${d} -type f); do
      ldd "${f}" 2>&1 | grep -v "not a dynamic" | grep "found"
    done
  done
}
libraries
```



> If I deinstall/reinstall Courier IMAP will I lose my config?



Ports _should_ not override config files, but there's always a possibility. Backing up /etc/ and /usr/local/etc/ is *always* a good idea. I personally prefer to use rdiff-backup and backup to /var/backups/ on a daily basis.


----------



## xy16644 (Oct 8, 2011)

I didn't reinstall all my ports, I just updated them with:

```
portmanager -u
```

I've always done it this way although there are a few ports that haven't/won't update. So is the next step to run:

```
make deinstall clean
```

in:
/usr/ports/mail/courier-imap


----------



## xy16644 (Oct 8, 2011)

PS: I ran your script (thanks!) and it said:

```
===> Checking for unresolvable libraries
/bin
/sbin
/libexec
/lib
/usr/bin
/usr/sbin
/usr/lib
/usr/libexec
/usr/local/bin
        libgdbm.so.3 => not found (0x0)
/usr/local/sbin
/usr/local/lib
        libperl.so => not found (0x0)
        libperl.so => not found (0x0)
/usr/local/libexec
        libgdbm.so.3 => not found (0x0)
        libgdbm.so.3 => not found (0x0)
)
```

I've also made a backup (copy) of my imapd and imaps-ssl config file.


----------



## Carpetsmoker (Oct 9, 2011)

Right, it doesn't show the files it found problems at. Oops :r I never ran into the condition where I had a problem so, well ... :\

Thanks for testing, here's an updated version:


```
#!/bin/sh
localbase="/usr/local"
libdirs="/bin /sbin /libexec /lib /usr/bin /usr/sbin /usr/lib /usr/libexec \
  ${localbase}/bin ${localbase}/sbin ${localbase}/lib ${localbase}/libexec"

  echo "===> Checking for unresolvable libraries"

  for d in ${libdirs}; do
    echo "Checking ${d}..."
    for f in $(find ${d} -type f); do
      check=$(ldd "${f}" 2>&1 | grep -v "not a dynamic" | grep "found")
      if [ $? -eq 0 ]; then
        echo "Found a problem in ${f}"
        echo "${check}"
      fi
    done
  done
```


----------



## wblock@ (Oct 9, 2011)

See pkg_libchk(1) from sysutils/bsdadminscripts.


----------



## DutchDaemon (Oct 9, 2011)

See also http://forums.freebsd.org/showthread.php?t=26871 for why this happens to begin with.


----------



## xy16644 (Oct 9, 2011)

Thanks to all for your help. I reinstalled Courier IMAP this morning and its all working fine now. I will be sure to update my ports more frequently!


----------

