# Can't start Amavis service (related to BerkeleyDB)



## papatambo (Mar 8, 2013)

Hello All,
I have a problem in sending and receiving mail. I check maillog and found out that the problem is the Amavis service not running.
So I try to start it using command:

```
$ service amavisd start
```
And the message returned:

```
Starting amavisd.
/usr/local/etc/rc.d/amavisd: WARNING: failed to start amavisd
```
I tried re-installing amavisd, using steps described in /usr/local/share/doc/amavisd-new/INSTALL, and got stuck in step starting the program amavisd. When I entered this command:

```
$ /usr/local/sbin/amavisd -u vscan debug
```
It returned this error:

```
Problem in Amavis::DB or Amavis::DB::SNMP code: Can't locate BerkeleyDB.pm in @INC (@INC contains: /usr/local/lib/perl5/5.16.2/BSDPAN /usr/local/lib/perl5/site_perl/5.16.2/mach /usr/local/lib/perl5/site_perl/5.16.2 /usr/local/lib/perl5/5.16.2/mach /usr/local/lib/perl5/5.16.2) at (eval 104) line 21.
BEGIN failed--compilation aborted at (eval 104) line 21.
```
From digging around, it's said that I should install BerkeleyDB perl module.
So I tried to install it using cpan:

```
$ cpan install BerkeleyDB
```
But failed and got this message:

```
<snip>
Stop in /root/.cpan/build/BerkeleyDB-0.51-XSix_A.
  PMQS/BerkeleyDB-0.51.tar.gz
  /usr/bin/make -- NOT OK
Running make test
  Can't test without successful make
Running make install
  Make had returned bad status, install seems impossible
```
Digging again I found that supposedly that occurred because I don't have BerkeleyDB installed in my machine. But when I try list installed packages in my machine, I found that db41 and db47 already installed here. And when I try locate BerkeleyDB.pm required above, I found it in the wrong(?) directory (/usr/local/lib/perl5/site_perl/5.12.4/mach instead of /usr/local/lib/perl5/site_perl/5.16.2/mach). Moving the files didn't help of course. And I keep on installing db5 anyway. And it also didn't solve anything.

Anyone know what should I do now? Or where did I go wrong?

Judging from post maybe you can recognize that I am a noob in FreeBSD and even Linux 
So any kind of help highly appreciated.
Thanks.


----------



## SirDice (Mar 8, 2013)

Handbook: Chapter 5 Installing Applications: Packages and Ports

security/amavisd-new, security/amavisd-milter, security/amavis-stats, mail/amavis-logwatch.

And judging by the perl issues, you need to read /usr/ports/UPDATING too:

```
20120630:
  AFFECTS: users of lang/perl*
  AUTHOR: skv@FreeBSD.org

  lang/perl5.16 is out. If you want to switch to it from, for example
  lang/perl5.12, that is:

  Portupgrade users:
    0) Fix pkgdb.db (for safety):
        pkgdb -Ff

    1) Reinstall new version of Perl (5.16):
        env DISABLE_CONFLICTS=1 portupgrade -o lang/perl5.16 -f perl-5.12.\*

    2) Reinstall everything that depends on Perl:
        portupgrade -fr perl

  Portmaster users:
        portmaster -o lang/perl5.16 lang/perl5.12

        Conservative:
        portmaster p5-

        Comprehensive (but perhaps overkill):
        portmaster -r perl-

  Note: If the "perl-" glob matches more than one port you will need to
        specify the name of the Perl directory in /var/db/pkg explicitly.

  The default version for Perl has also been changed from 5.12 to 5.14.
```


----------

