Score:1

email not working after upgrade

in flag

After upgrading from Ubuntu 20.04 to 22.04 my email server in not working:

Feb 18 20:15:20 mail.xxxxxxxxxxxx.nz dovecot[3577198]: auth: Debug: Loading modules from directory: /usr/lib/dovecot/modules/auth
Feb 18 20:15:20 mail.xxxxxxxxxxxx.nz dovecot[3577198]: auth: Debug: Module loaded: /usr/lib/dovecot/modules/auth/lib20_auth_var_expand_crypt.so
Feb 18 20:15:20 mail.xxxxxxxxxxxx.nz dovecot[3577198]: auth: Debug: Module loaded: /usr/lib/dovecot/modules/auth/libdriver_mysql.so
Feb 18 20:15:20 mail.xxxxxxxxxxxx.nz dovecot[3577198]: auth: Debug: Read auth token secret from /run/dovecot/auth-token-secret.dat
Feb 18 20:15:20 mail.xxxxxxxxxxxx.nz dovecot[3577198]: auth: Debug: auth client connected (pid=2161995)
Feb 18 20:15:20 mail.xxxxxxxxxxxx.nz dovecot[3577198]: auth: Debug: client in: AUTH        1        PLAIN        service=imap        secured        session=IeZcMfT0Fqx/AAAB        lip=127.0.0.1        rip=127.0.0.1        lport=143        rport=44054        resp=<hidden>
Feb 18 20:15:20 mail.xxxxxxxxxxxx.nz dovecot[3577198]: auth: Debug: pam(postmaster@xxxxxxxxxxxx.nz,127.0.0.1,<IeZcMfT0Fqx/AAAB>): Performing passdb lookup
Feb 18 20:15:20 mail.xxxxxxxxxxxx.nz dovecot[3577198]: auth-worker(2161997): Debug: Loading modules from directory: /usr/lib/dovecot/modules/auth
Feb 18 20:15:20 mail.xxxxxxxxxxxx.nz dovecot[3577198]: auth-worker(2161997): Debug: Module loaded: /usr/lib/dovecot/modules/auth/lib20_auth_var_expand_crypt.so
Feb 18 20:15:20 mail.xxxxxxxxxxxx.nz dovecot[3577198]: auth-worker(2161997): Debug: Module loaded: /usr/lib/dovecot/modules/auth/libdriver_mysql.so
Feb 18 20:15:20 mail.xxxxxxxxxxxx.nz dovecot[3577198]: auth-worker(2161997): Debug: conn unix:auth-worker (pid=2161996,uid=130): Server accepted connection (fd=13)
Feb 18 20:15:20 mail.xxxxxxxxxxxx.nz dovecot[3577198]: auth-worker(2161997): Debug: conn unix:auth-worker (pid=2161996,uid=130): Sending version handshake
Feb 18 20:15:20 mail.xxxxxxxxxxxx.nz dovecot[3577198]: auth-worker(2161997): Debug: conn unix:auth-worker (pid=2161996,uid=130): auth-worker<1>: Handling PASSV request
Feb 18 20:15:20 mail.xxxxxxxxxxxx.nz dovecot[3577198]: auth-worker(2161997): Debug: conn unix:auth-worker (pid=2161996,uid=130): auth-worker<1>: pam(postmaster@xxxxxxxxxxxx.nz,127.0.0.1,<IeZcMfT0Fqx/AAAB>): Performing passdb lookup
Feb 18 20:15:20 mail.xxxxxxxxxxxx.nz dovecot[3577198]: auth-worker(2161997): Debug: conn unix:auth-worker (pid=2161996,uid=130): auth-worker<1>: pam(postmaster@xxxxxxxxxxxx.nz,127.0.0.1,<IeZcMfT0Fqx/AAAB>): lookup service=dovecot
Feb 18 20:15:20 mail.xxxxxxxxxxxx.nz dovecot[3577198]: auth-worker(2161997): Debug: conn unix:auth-worker (pid=2161996,uid=130): auth-worker<1>: pam(postmaster@xxxxxxxxxxxx.nz,127.0.0.1,<IeZcMfT0Fqx/AAAB>): #1/1 style=1 msg=Password:
Feb 18 20:15:22 mail.xxxxxxxxxxxx.nz dovecot[3577198]: auth-worker(2161997): conn unix:auth-worker (pid=2161996,uid=130): auth-worker<1>: pam(postmaster@xxxxxxxxxxxx.nz,127.0.0.1,<IeZcMfT0Fqx/AAAB>): pam_authenticate() failed: Authentication failure (Password mismatch?)
Feb 18 20:15:22 mail.xxxxxxxxxxxx.nz dovecot[3577198]: auth-worker(2161997): Debug: conn unix:auth-worker (pid=2161996,uid=130): auth-worker<1>: pam(postmaster@xxxxxxxxxxxx.nz,127.0.0.1,<IeZcMfT0Fqx/AAAB>): Finished passdb lookup
Feb 18 20:15:22 mail.xxxxxxxxxxxx.nz dovecot[3577198]: auth-worker(2161997): Debug: conn unix:auth-worker (pid=2161996,uid=130): auth-worker<1>: Finished: password_mismatch
Feb 18 20:15:22 mail.xxxxxxxxxxxx.nz dovecot[3577198]: auth: Debug: pam(postmaster@xxxxxxxxxxxx.nz,127.0.0.1,<IeZcMfT0Fqx/AAAB>): Finished passdb lookup
Feb 18 20:15:22 mail.xxxxxxxxxxxx.nz dovecot[3577198]: auth: Debug: auth(postmaster@xxxxxxxxxxxx.nz,127.0.0.1,<IeZcMfT0Fqx/AAAB>): Auth request finished
Feb 18 20:15:24 mail.xxxxxxxxxxxx.nz dovecot[3577198]: auth: Debug: client passdb out: FAIL        1        user=postmaster@xxxxxxxxxxxx.nz
Feb 18 20:15:24 mail.xxxxxxxxxxxx.nz dovecot[3577198]: imap-login: Disconnected: Connection closed (auth failed, 1 attempts in 4 secs): user=<postmaster@xxxxxxxxxxxx.nz>, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, secured, session=<IeZcMfT0Fqx/AAAB>
Feb 18 20:16:20 mail.xxxxxxxxxxxx.nz dovecot[3577198]: auth-worker(2161997): Debug: conn unix:auth-worker (pid=2161996,uid=130): Disconnected: Connection closed (fd=-1)

root@mail:~# doveconf -n
# 2.3.16 (7e2e900c1a): /etc/dovecot/dovecot.conf
# Pigeonhole version 0.5.16 (09c29328)
# OS: Linux 5.15.0-60-generic x86_64 Ubuntu 22.04.1 LTS 
# Hostname: mail.xxxxxxxxxxxx.nz
auth_debug = yes
auth_mechanisms = plain login
auth_username_format = %{if;%d;eq;mail.xxxxxxxxxxxx.nz;%Ln;%Lu}
listen = *, ::
mail_debug = yes
mail_location = mbox:~/mail:INBOX=/var/mail/%u
mail_privileged_group = mail
managesieve_notify_capability = mailto
managesieve_sieve_capability = fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date index ihave duplicate mime foreverypart extracttext
namespace inbox {
  inbox = yes
  location = 
  mailbox Drafts {
    special_use = \Drafts
  }
  mailbox Junk {
    special_use = \Junk
  }
  mailbox Sent {
    special_use = \Sent
  }
  mailbox "Sent Messages" {
    special_use = \Sent
  }
  mailbox Trash {
    special_use = \Trash
  }
  prefix = 
}
passdb {
  driver = pam
}
plugin {
  sieve = file:~/sieve;active=~/.dovecot.sieve
}
protocols = " imap lmtp sieve pop3"
service stats {
  unix_listener stats-reader {
    group = vmail
    mode = 0660
    user = vmail
  }
  unix_listener stats-writer {
    group = vmail
    mode = 0660
    user = vmail
  }
}
ssl_cert = </etc/dovecot/private/dovecot.pem
ssl_cipher_list = EECDH+CHACHA20:EECDH+AESGCM:EDH+AESGCM:AES256+EECDH
ssl_client_ca_dir = /etc/ssl/certs
ssl_dh = # hidden, use -P to show it
ssl_key = # hidden, use -P to show it
userdb {
  args = blocking=no
  driver = passwd
}

root@mail:~# doveadm user -f 'username' '*'
nobody
mike
systemd-coredump
sogo
vmail
mlmmj
iredadmin
iredapd
snapd-range-524288-root
snap_daemon
Error: auth-master: userdb list: User listing returned failure
Fatal: user listing failed

root@mail:~# doveadm index -A -q \*
doveadm(nobody): Error: mkdir(/nonexistent/mail/.imap) failed: Permission denied (euid=65534(nobody) egid=65534(nogroup))
doveadm(systemd-coredump): Error: mkdir(//mail/.imap) failed: Permission denied (euid=999(systemd-coredump) egid=999(systemd-coredump) missing +w perm: /, dir owned by 0:0 mode=0755)
doveadm(snapd-range-524288-root): Error: mkdir(/nonexistent/mail/.imap) failed: Permission denied (euid=524288(snapd-range-524288-root) egid=524288(snapd-range-524288-root))
doveadm(snap_daemon): Error: mkdir(/nonexistent/mail/.imap) failed: Permission denied (euid=584788(snap_daemon) egid=584788(snap_daemon))
doveadm(3015804): Error: auth-master: userdb list: User listing returned failure
doveadm: Error: Failed to iterate through some users

Contents of /etc/dovecot/conf.d/10-auth.conf with all comments removed:

auth_username_format=%{if;%d;eq;mail.xxxxxxxxxxxx.nz;%Ln;%Lu}
#https://serverfault.com/questions/260488/dovecot-user-lookup-fails-when-using-usernamedomain-format
auth_mechanisms = plain login
!include auth-system.conf.ext

Contents of /etc/dovecot/conf.d/auth-system.conf.ext with all comments removed:

passdb {
  driver = pam
  }

userdb {
    driver = passwd
    ##https://doc.dovecot.org/configuration_manual/authentication/passwd/#authentication-passwd
    args = blocking=no  
}

It says "Authentication failure (Password mismatch?)" but its definitely the correct password.

root@mail:/home/mike# doveadm log errors
Feb 22 02:43:48 Error: auth: passwd(postmaster@xxxxxxxxxxxx.nz): getpwnam() failed: Address family not supported by protocol

Don't know what this error means.

root@mail:~# doveadm user postmaster@xxxxxxxxxxxx.nz
doveadm(postmaster@xxxxxxxxxxxx.nz)<536525><>: Error: auth-master: userdb lookup(postmaster@xxxxxxxxxxxx.nz): Auth USER lookup failed
field   value

root@mail:~# tail /var/log/mysql/error.log
2023-04-08 16:01:01 12277 [Warning] Aborted connection 12277 to db: 'iredadmin' user: 'iredadmin' host: 'localhost' (Got an error reading communication packets)
2023-04-08 16:02:18 12280 [Warning] Aborted connection 12280 to db: 'iredapd' user: 'iredapd' host: 'localhost' (Got an error reading communication packets)
2023-04-08 17:01:01 12398 [Warning] Aborted connection 12398 to db: 'iredapd' user: 'iredapd' host: 'localhost' (Got an error reading communication packets)
2023-04-08 17:01:01 12399 [Warning] Aborted connection 12399 to db: 'vmail' user: 'vmailadmin' host: 'localhost' (Got an error reading communication packets)
2023-04-08 17:01:01 12400 [Warning] Aborted connection 12400 to db: 'iredadmin' user: 'iredadmin' host: 'localhost' (Got an error reading communication packets)
2023-04-08 17:02:22 12402 [Warning] Aborted connection 12402 to db: 'iredapd' user: 'iredapd' host: 'localhost' (Got an error reading communication packets)
2023-04-08 18:01:01 12521 [Warning] Aborted connection 12521 to db: 'iredapd' user: 'iredapd' host: 'localhost' (Got an error reading communication packets)
2023-04-08 18:01:01 12523 [Warning] Aborted connection 12523 to db: 'vmail' user: 'vmailadmin' host: 'localhost' (Got an error reading communication packets)
2023-04-08 18:01:01 12522 [Warning] Aborted connection 12522 to db: 'iredadmin' user: 'iredadmin' host: 'localhost' (Got an error reading communication packets)
2023-04-08 18:02:18 12525 [Warning] Aborted connection 12525 to db: 'iredapd' user: 'iredapd' host: 'localhost' (Got an error reading communication packets)

root@mail:/etc/dovecot# grep -v ‘^ *\(#.*\)\?$’ dovecot-mysql.conf
grep: *(#.*)?$’: No such file or directory
dovecot-mysql.conf:driver = mysql
dovecot-mysql.conf:default_pass_scheme = CRYPT
dovecot-mysql.conf:connect = host=127.0.0.1 port=3306 dbname=vmail user=vmail password=yf3dsQM2I2HIixrXwfjBpL1AeLWXiP2h
dovecot-mysql.conf:
dovecot-mysql.conf:# Required by doveadm tools which require to list all mail users.
dovecot-mysql.conf:iterate_query = SELECT username AS user FROM mailbox
dovecot-mysql.conf:
dovecot-mysql.conf:password_query = SELECT mailbox.password, mailbox.allow_nets \
dovecot-mysql.conf:        FROM mailbox,domain \
dovecot-mysql.conf:       WHERE mailbox.username='%u' \
dovecot-mysql.conf:             AND mailbox.`enable%Ls%Lc`=1 \
dovecot-mysql.conf:             AND mailbox.active=1 \
dovecot-mysql.conf:             AND mailbox.domain=domain.domain \
dovecot-mysql.conf:             AND domain.backupmx=0 \
dovecot-mysql.conf:             AND domain.active=1
dovecot-mysql.conf:
dovecot-mysql.conf:user_query = SELECT \
dovecot-mysql.conf:            LOWER('%u') AS master_user, \
dovecot-mysql.conf:            LOWER(CONCAT(mailbox.storagebasedirectory, '/', mailbox.storagenode, '/', mailbox.maildir)) AS home, \
dovecot-mysql.conf:            CONCAT(mailbox.mailboxformat, ':~/', mailbox.mailboxfolder) AS mail, \
dovecot-mysql.conf:            CONCAT('*:bytes=', mailbox.quota*1048576) AS quota_rule \
dovecot-mysql.conf:        FROM mailbox,domain \
dovecot-mysql.conf:       WHERE mailbox.username='%u' \
dovecot-mysql.conf:             AND mailbox.`enable%Ls%Lc`=1 \
dovecot-mysql.conf:             AND mailbox.active=1 \
dovecot-mysql.conf:             AND mailbox.domain=domain.domain \
dovecot-mysql.conf:             AND domain.backupmx=0 \
dovecot-mysql.conf:             AND domain.active=1
NK_ avatar
ng flag
NK_
Can you past the contents of /etc/dovecot/conf.d/10-auth.conf file pls. Also some more information could be helpful. Do you have postfix as smtp server? What is your user authentication method etc.
Jedi avatar
in flag
I have edited my question to include the requested information. The email server was installed following the directions here: https://www.linuxbabe.com/mail-server/ubuntu-20-04-iredmail-server-installation
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.