How to start dovecot?
Asked Answered
B

5

5

I'm building a web server to host multiple websites. I got everything working except the mail server. I'm using linode to host my vps and I've been following their tutorials. FYI, I'm using Ubuntu 11.10.

Here is the link I've been following, http://library.linode.com/email/postfix/dovecot-mysql-ubuntu-10.04-lucid. I got up to the part where it tells me to restart dovecot, so I tried "service dovecot restart". But then I get this "restart: Unknown instance:". I'm logged in as root, so I'm not using sudo.

Since that didn't work I tried "/etc/init.d/dovecot restart" and I get "dovecot start/running, process 4760". So I try "/etc/init.d/dovecot status" and I get "dovecot stop/waiting".

So I tried "service dovecot start" and I get "dovecot start/running, process 4781". So I tried to get the status, so I tired "service dovecot status" and got "dovecot stop/waiting"

Then I tired "/etc/init.d/dovecot start" and I get "dovecot start/running, process 4794". So I tired to get the status, so I tired "/etc/init.d/dovecot status" and got "dovecot stop/waiting"

Just for kicks and giggles I tired to kill the process, I used the PID that I got when I did "service dovecot start", this was the command "kill -9 4444" and I get this "bash: kill: (4805) - No such process"

Am I doing something wrong?

--EDIT 1--

The following are logs that were found in /var/log/syslog that involved dovecot

dovecot: master: Dovecot v2.0.13 starting up (core dumps disabled)
dovecot: ssl-params: Generating SSL parameters
dovecot: ssl-params: SSL parameters regeneration completed
dovecot: master: Warning: Killed with signal 15 (by pid=1 uid=0 code=kill)
dovecot: config: Warning: Killed with signal 15 (by pid=1 uid=0 code=kill)
dovecot: anvil: Warning: Killed with signal 15 (by pid=1 uid=0 code=kill)
dovecot: log: Warning: Killed with signal 15 (by pid=1 uid=0 code=kill)
kernel: init: dovecot main process (10276) terminated with status 89
kernel: init: dovecot main process (10289) terminated with status 89
kernel: init: dovecot main process (10452) terminated with status 89
kernel: init: dovecot main process (2275) terminated with status 89
kernel: init: dovecot main process (3028) terminated with status 89
kernel: init: dovecot main process (3216) terminated with status 89
kernel: init: dovecot main process (3230) terminated with status 89
kernel: init: dovecot main process (3254) terminated with status 89
kernel: init: dovecot main process (3813) terminated with status 89
kernel: init: dovecot main process (3845) terminated with status 89
kernel: init: dovecot main process (4664) terminated with status 89
kernel: init: dovecot main process (4760) terminated with status 89
kernel: init: dovecot main process (4781) terminated with status 89
kernel: init: dovecot main process (4794) terminated with status 89
kernel: init: dovecot main process (4805) terminated with status 89

--Edit 2 (/etc/dovecot/dovecot.conf)--

The following is the dovecot.conf file

protocols = imap imaps pop3 pop3s
log_timestamp = "%Y-%m-%d %H:%M:%S "
mail_location = maildir:/home/vmail/%d/%n/Maildir

ssl_cert_file = /etc/ssl/certs/dovecot.pem
ssl_key_file = /etc/ssl/private/dovecot.pem

namespace private {
    separator = .
    prefix = INBOX.
    inbox = yes
}

protocol lda {
    log_path = /home/vmail/dovecot-deliver.log
    auth_socket_path = /var/run/dovecot/auth-master
    postmaster_address = postmaster@[mydomainname.com]
    mail_plugins = sieve
    global_script_path = /home/vmail/globalsieverc
}

protocol pop3 {
    pop3_uidl_format = %08Xu%08Xv
}

auth default {
    user = root

    passdb sql {
        args = /etc/dovecot/dovecot-sql.conf
    }

    userdb static {
        args = uid=5000 gid=5000 home=/home/vmail/%d/%n allow_all_users=yes
    }

    socket listen {
        master {
            path = /var/run/dovecot/auth-master
            mode = 0600
            user = vmail
        }

        client {
            path = /var/spool/postfix/private/auth
            mode = 0660
            user = postfix
            group = postfix
        }
    }
}

-- Edit 3 (/var/log/mail.log) --

The following is what is in /var/log/mail.log

dovecot: master: Dovecot v2.0.13 starting up (core dumps disabled)
dovecot: ssl-params: Generating SSL parameters
postfix/master[9917]: daemon started -- version 2.8.5, configuration /etc/postfix
dovecot: ssl-params: SSL parameters regeneration completed
postfix/master[9917]: terminating on signal 15
postfix/master[10196]: daemon started -- version 2.8.5, configuration /etc/postfix
dovecot: master: Warning: Killed with signal 15 (by pid=1 uid=0 code=kill)
dovecot: config: Warning: Killed with signal 15 (by pid=1 uid=0 code=kill)
dovecot: anvil: Warning: Killed with signal 15 (by pid=1 uid=0 code=kill)
dovecot: log: Warning: Killed with signal 15 (by pid=1 uid=0 code=kill)
postfix/master[2435]: daemon started -- version 2.8.5, configuration /etc/postfix
postfix/master[2435]: terminating on signal 15
postfix/master[2965]: daemon started -- version 2.8.5, configuration /etc/postfix
Bygone answered 29/11, 2011 at 23:19 Comment(3)
I followed the same tutorial, and I have the same problem, do you have found a solution ?Grapher
But I'm also wondering... in the tutorial they speak of the dovecot-sql.conf but there is only a dovecot-sql.conf.ext (is this an example file or the new place to put the configuration lines to?)Grapher
And what does this have to do with programming?Sporophore
S
3

That means it starts, tries to parse the config and fails. Look in /var/log for the log that accumulates dovecot logging to determine what the problem is. Which log it is, will depend on the Linux distro you're using.

-- EDIT --

Status 89 means there's an error in the config, related to parser. Please have a look first whether you have terminated all {} curly bracers. This would be my first hunch.

Stonedeaf answered 29/11, 2011 at 23:22 Comment(5)
I'm running Ubuntu 11.10. The log is too big so I added it the original post.Bygone
I added my conf file in the original post, its again too big. From what I can see I have all my brackets.Bygone
Dovecot sucks majorly in error reporting to be honest.. Check permissions for the /home/vmail, /var/run/dovecot, /var/spool/postfix/private/auth. That's another error that generates no usable verbal output.Stonedeaf
Also, do you use sql as per example you provided in your question? If so, are you sure dovecot-sql.conf contains proper data? It's very difficult to say without having a look on the system itself, but my biggest hunch here - permissions and/or mis-configuration somewhere.Stonedeaf
So how did you fix this ?? @BygoneChoirmaster
P
22

As a general tip, try running dovecot directly in the foreground:

dovecot -F

The reason is the foreground will often output loadup error messages directly to the console, which will often allow you to quickly track down errors that are not usually logged (such as config parsing errors).

Psychopharmacology answered 24/5, 2013 at 15:13 Comment(3)
Dovecot would just die and not show anything in the logs, it almost drove me crazy! This simple trick made it spit a misspelled certificate path error to the console.Electrojet
Upstart uses the -F option IIRC, so you can just check the contents of /var/log/upstart/dovecot.logAylesbury
This and the comment by @Aylesbury were spot on for me. It help pinpoint the specific config file that was having an issue. Thanks.Linen
S
3

That means it starts, tries to parse the config and fails. Look in /var/log for the log that accumulates dovecot logging to determine what the problem is. Which log it is, will depend on the Linux distro you're using.

-- EDIT --

Status 89 means there's an error in the config, related to parser. Please have a look first whether you have terminated all {} curly bracers. This would be my first hunch.

Stonedeaf answered 29/11, 2011 at 23:22 Comment(5)
I'm running Ubuntu 11.10. The log is too big so I added it the original post.Bygone
I added my conf file in the original post, its again too big. From what I can see I have all my brackets.Bygone
Dovecot sucks majorly in error reporting to be honest.. Check permissions for the /home/vmail, /var/run/dovecot, /var/spool/postfix/private/auth. That's another error that generates no usable verbal output.Stonedeaf
Also, do you use sql as per example you provided in your question? If so, are you sure dovecot-sql.conf contains proper data? It's very difficult to say without having a look on the system itself, but my biggest hunch here - permissions and/or mis-configuration somewhere.Stonedeaf
So how did you fix this ?? @BygoneChoirmaster
G
0

The tutorial is from May 9th, 2010.
Looking at dovecots changelog you see...
v1.2.6 2009-10-05 The last dovecot version before that date
v2.0.rc1 2010-07-02 The next dovecot version after that date

So the tutorial probably will use a 1.x configuration, while nowadays we will use dovecot 2.x.

Now I found this http://wiki2.dovecot.org/Upgrading/2.0
Next to some other info, it provides a way to convert the config from 1.2 to 2.0.

Here's even more about upgrading http://wiki2.dovecot.org/Upgrading

I have no solution though (yet)

Edit: (Solution)

First of all, you need to install also:

apt-get install dovecot-sieve  
apt-get install dovecot-managesieved  
apt-get install dovecot-mysql

if you like, read the hints on upgrading the old 1.x config http://wiki2.dovecot.org/Upgrading

My dovecot.conf:

log_timestamp = "%Y-%m-%d %H:%M:%S "
mail_location = maildir:/home/vmail/%d/%n/Maildir
namespace {
  inbox = yes
  location = 
  prefix = INBOX.
  separator = .
  type = private
}
passdb {
  args = /etc/dovecot/dovecot-sql.conf.ext
  driver = sql
}
protocols = imap pop3
service auth {
  unix_listener /var/spool/postfix/private/auth {
    group = postfix
    mode = 0660
    user = postfix
  }
  unix_listener auth-master {
    mode = 0600
    user = vmail
  }
  user = root
}
ssl_cert = </etc/ssl/certs/dovecot.pem
ssl_key = </etc/ssl/private/dovecot.pem
#userdb {
#  args = uid=5000 gid=5000 home=/home/vmail/%d/%n allow_all_users=yes
#  driver = static
#}
userdb {
  args = /etc/dovecot/dovecot-sql.conf.ext
  driver = sql
}
protocol lda {
  auth_socket_path = /var/run/dovecot/auth-master
  log_path = /home/vmail/dovecot-deliver.log
  mail_plugins = sieve
  postmaster_address = [email protected]
  plugin {
    sieve_global_path = /var/vmail/globalsieverc
    # The include extension fetches the :personal scripts from this 
    # directory. When ManageSieve is used, this is also where scripts 
    # are uploaded.

    sieve_dir = ~/sieve

    # The location of the user's active script:

    sieve = ~/.dovecot.sieve

    # Directory for :global include scripts (for v1.1 include extension)

    sieve_global_dir = /var/vmail/sieve

    sieve_maxscriptsize = 128
  }
}
protocol pop3 {
  pop3_uidl_format = %08Xu%08Xv
}

My dovecot-db.conf.ext

driver = mysql
connect = host=127.0.0.1 dbname=mail user=mail_admin password=your_password
default_pass_scheme = PLAIN-MD5
#password_query = SELECT email as user, password FROM users WHERE email='%u';
#user_query = SELECT email as user, password, 5000 as uid, 5000 as gid, '/var/vmail/%d/%n' as home FROM view_users WHERE email='%u';
password_query = SELECT email AS user, password, 5000 AS userdb_uid, 5000 AS userdb_gid, '/var/vmail/%d/%n' AS userdb_home FROM users WHERE email = '%u';
user_query = SELECT email AS user, password, 5000 AS uid, 5000 AS gid, '/var/vmail/%d/%n' AS home FROM users WHERE email = '%u';

Also edit your /etc/postfix/master.cf so it includes smtps (smtp using SSL/TLS on 465). I had to activate it to reach the smtp from my home, because port 25 was blocked from my isp (it's common). Also I prefer smtp with transport layer security.

smtps     inet  n       -       -       -       -       smtpd

and run service postfix restart


Sources:
I've gathered all infos about this by googling, and don't know where I was everywhere, but the last problem

2013-01-03 16:43:27 lda: Error: userdb lookup([email protected]): Disconnected unexpectedly
2013-01-03 16:43:27 lda: Fatal: Internal error occurred. Refer to server log for more information.

I solved reading some of http://workaround.org/ispmail/lenny/configure-dovecot
Basically, I found that you get good results when you google whatever error output you get in here:

/home/vmail/dovecot-deliver.log
/var/log/mail.log
/var/log/mail.err
/var/log/syslog
Grapher answered 3/1, 2013 at 12:52 Comment(0)
L
0

If no relevant messages appear in syslog, and dovecot is running under Upstart, configuration errors may be found in /var/log/upstart/dovecot.log.

All credit to comment by CameronNemo.

Lepido answered 22/2, 2016 at 18:49 Comment(0)
S
-2

try to delete dovecot-postfix package and /etc/dovecot/conf.d/99-*.conf file it`s help for me

Safranine answered 7/10, 2013 at 14:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.