Score:1

MDA broken pipe with fetchmail / dovecot

us flag

I have set up a home mail server with dovecot to download and archive email from multiple webmail accounts via IMAP. The goal is to do this automatically every week with a cron job.

I'm not sure if I should use dovecot sync/backup or fetchmail, but the latter being popular I tried fetchmail first. However, it doesn't seem to work, I get this:

user@mail:~$ fetchmail
38081 messages for [email protected] at imap.fastmail.com (folder Archive).
fetchmail: Error writing to MDA: Broken pipe
reading message [email protected]@imap.fastmail.com:1 of 38081 (2100 header octets) (726 body octets) not flushed
reading message [email protected]@imap.fastmail.com:2 of 38081 (4404 header octets) (6082 body octets)fetchmail: error writing message text
fetchmail: MDA error while fetching from [email protected]@imap.fastmail.com
fetchmail: Query status=6 (IOERR)

~/.fetchmailrc looks like this:

poll imap.fastmail.com protocol IMAP
     user "[email protected]" is "user@localhost" here
     folder Archive
     ssl fetchall
     mda "/usr/lib/dovecot/deliver -d user@localhost -m .fastmail.Archive"

The .fastmail.Archive folder is at the root of ~/Maildir. I am using Maildir in my dovecot config.

in ~/.netrc I have the following:

machine imap.fastmail.com
login [email protected]
password <secret>

I also ran deliver manually using strace as root, and I am not getting any message delivered when I check my ~/Maildir afterwards. Here is the output, not sure what to make of it.

root@mail:/home/user/fastmail# strace /usr/lib/dovecot/deliver -d user@localhost < 'test.eml'
execve("/usr/lib/dovecot/deliver", ["/usr/lib/dovecot/deliver", "-d", "user@localhost"], 0x7ffcd6f61be0 /* 12 vars */) = 0
brk(NULL)                               = 0x5593bc6d8000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/dovecot/tls/x86_64/x86_64/libdovecot-lda.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/dovecot/tls/x86_64/x86_64", 0x7fffbb1506b0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/dovecot/tls/x86_64/libdovecot-lda.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/dovecot/tls/x86_64", 0x7fffbb1506b0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/dovecot/tls/x86_64/libdovecot-lda.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/dovecot/tls/x86_64", 0x7fffbb1506b0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/dovecot/tls/libdovecot-lda.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/dovecot/tls", 0x7fffbb1506b0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/dovecot/x86_64/x86_64/libdovecot-lda.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/dovecot/x86_64/x86_64", 0x7fffbb1506b0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/dovecot/x86_64/libdovecot-lda.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/dovecot/x86_64", 0x7fffbb1506b0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/dovecot/x86_64/libdovecot-lda.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/dovecot/x86_64", 0x7fffbb1506b0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/dovecot/libdovecot-lda.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\3206\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=34968, ...}) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f99e4722000
mmap(NULL, 37136, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f99e4718000
mmap(0x7f99e471b000, 12288, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x7f99e471b000
mmap(0x7f99e471e000, 8192, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x6000) = 0x7f99e471e000
mmap(0x7f99e4720000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x7000) = 0x7f99e4720000
close(3)                                = 0
openat(AT_FDCWD, "/usr/lib/dovecot/libdovecot-storage.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0000\332\3\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=1436376, ...}) = 0
mmap(NULL, 1439128, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f99e45b8000
mprotect(0x7f99e45ee000, 1167360, PROT_NONE) = 0
mmap(0x7f99e45ee000, 856064, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x36000) = 0x7f99e45ee000
mmap(0x7f99e46bf000, 307200, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x107000) = 0x7f99e46bf000
mmap(0x7f99e470b000, 53248, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x152000) = 0x7f99e470b000
close(3)                                = 0
openat(AT_FDCWD, "/usr/lib/dovecot/libdovecot.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\300\337\3\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=1619272, ...}) = 0
mmap(NULL, 1632856, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f99e4429000
mmap(0x7f99e4460000, 909312, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x37000) = 0x7f99e4460000
mmap(0x7f99e453e000, 450560, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x115000) = 0x7f99e453e000
mmap(0x7f99e45ac000, 36864, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x182000) = 0x7f99e45ac000
mmap(0x7f99e45b5000, 10840, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f99e45b5000
close(3)                                = 0
openat(AT_FDCWD, "/usr/lib/dovecot/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=35918, ...}) = 0
mmap(NULL, 35918, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f99e4420000
close(3)                                = 0
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\260A\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1824496, ...}) = 0
mmap(NULL, 1837056, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f99e425f000
mprotect(0x7f99e4281000, 1658880, PROT_NONE) = 0
mmap(0x7f99e4281000, 1343488, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x22000) = 0x7f99e4281000
mmap(0x7f99e43c9000, 311296, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x16a000) = 0x7f99e43c9000
mmap(0x7f99e4416000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1b6000) = 0x7f99e4416000
mmap(0x7f99e441c000, 14336, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f99e441c000
close(3)                                = 0
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0000\21\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=14592, ...}) = 0
mmap(NULL, 16656, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f99e425a000
mmap(0x7f99e425b000, 4096, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1000) = 0x7f99e425b000
mmap(0x7f99e425c000, 4096, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7f99e425c000
mmap(0x7f99e425d000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7f99e425d000
close(3)                                = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f99e4258000
arch_prctl(ARCH_SET_FS, 0x7f99e4259000) = 0
mprotect(0x7f99e4416000, 16384, PROT_READ) = 0
mprotect(0x7f99e425d000, 4096, PROT_READ) = 0
mprotect(0x7f99e45ac000, 32768, PROT_READ) = 0
mprotect(0x7f99e470b000, 28672, PROT_READ) = 0
mprotect(0x7f99e4720000, 4096, PROT_READ) = 0
mprotect(0x5593baf97000, 4096, PROT_READ) = 0
mprotect(0x7f99e474b000, 4096, PROT_READ) = 0
munmap(0x7f99e4420000, 35918)           = 0
getuid()                                = 0
geteuid()                               = 0
getrandom("\x1c\x75\x34\x6d", 4, 0)     = 4
brk(NULL)                               = 0x5593bc6d8000
brk(0x5593bc6f9000)                     = 0x5593bc6f9000
uname({sysname="Linux", nodename="mail", ...}) = 0
getpid()                                = 7234
openat(AT_FDCWD, "/dev/null", O_WRONLY) = 3
fcntl(3, F_GETFD)                       = 0
fcntl(3, F_SETFD, FD_CLOEXEC)           = 0
rt_sigaction(SIGPIPE, {sa_handler=SIG_IGN, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7f99e4296840}, NULL, 8) = 0
rt_sigaction(SIGALRM, {sa_handler=0x7f99e4520210, sa_mask=[], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x7f99e4296840}, NULL, 8) = 0
geteuid()                               = 0
rt_sigaction(SIGINT, {sa_handler=0x7f99e4520c20, sa_mask=[], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x7f99e4296840}, NULL, 8) = 0
pipe([4, 5])                            = 0
fcntl(4, F_GETFL)                       = 0 (flags O_RDONLY)
fcntl(4, F_SETFL, O_RDONLY|O_NONBLOCK)  = 0
fcntl(5, F_GETFL)                       = 0x1 (flags O_WRONLY)
fcntl(5, F_SETFL, O_WRONLY|O_NONBLOCK)  = 0
fcntl(4, F_GETFD)                       = 0
fcntl(4, F_SETFD, FD_CLOEXEC)           = 0
fcntl(5, F_GETFD)                       = 0
fcntl(5, F_SETFD, FD_CLOEXEC)           = 0
epoll_create(128)                       = 6
fcntl(6, F_GETFD)                       = 0
fcntl(6, F_SETFD, FD_CLOEXEC)           = 0
epoll_ctl(6, EPOLL_CTL_ADD, 4, {EPOLLIN|EPOLLPRI|EPOLLERR|EPOLLHUP, {u32=3161333872, u64=94093009887344}}) = 0
rt_sigaction(SIGTERM, {sa_handler=0x7f99e4520c20, sa_mask=[], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x7f99e4296840}, NULL, 8) = 0
umask(077)                              = 022
socket(AF_UNIX, SOCK_STREAM, 0)         = 7
fcntl(7, F_GETFL)                       = 0x2 (flags O_RDWR)
fcntl(7, F_SETFL, O_RDWR|O_NONBLOCK)    = 0
connect(7, {sa_family=AF_UNIX, sun_path="/var/run/dovecot/config"}, 110) = 0
fcntl(7, F_GETFL)                       = 0x802 (flags O_RDWR|O_NONBLOCK)
fcntl(7, F_SETFL, O_RDWR)               = 0
write(7, "VERSION\tconfig\t2\t0\nREQ\tmodule=ld"..., 70) = 70
fstat(7, {st_mode=S_IFSOCK|0777, st_size=0, ...}) = 0
fcntl(7, F_GETFL)                       = 0x2 (flags O_RDWR)
alarm(10)                               = 0
read(7, "\nmail_privileged_group=mail\nname"..., 8192) = 810
alarm(0)                                = 10
close(7)                                = 0
stat("/etc/resolv.conf", {st_mode=S_IFREG|0644, st_size=174, ...}) = 0
openat(AT_FDCWD, "/etc/host.conf", O_RDONLY|O_CLOEXEC) = 7
fstat(7, {st_mode=S_IFREG|0644, st_size=9, ...}) = 0
read(7, "multi on\n", 4096)             = 9
read(7, "", 4096)                       = 0
close(7)                                = 0
openat(AT_FDCWD, "/etc/resolv.conf", O_RDONLY|O_CLOEXEC) = 7
fstat(7, {st_mode=S_IFREG|0644, st_size=174, ...}) = 0
read(7, "# Dynamic resolv.conf(5) file fo"..., 4096) = 174
read(7, "", 4096)                       = 0
close(7)                                = 0
uname({sysname="Linux", nodename="mail", ...}) = 0
socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 7
connect(7, {sa_family=AF_UNIX, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
close(7)                                = 0
socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 7
connect(7, {sa_family=AF_UNIX, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
close(7)                                = 0
openat(AT_FDCWD, "/etc/nsswitch.conf", O_RDONLY|O_CLOEXEC) = 7
fstat(7, {st_mode=S_IFREG|0644, st_size=526, ...}) = 0
read(7, "# /etc/nsswitch.conf\n#\n# Example"..., 4096) = 526
read(7, "", 4096)                       = 0
close(7)                                = 0
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 7
fstat(7, {st_mode=S_IFREG|0644, st_size=35918, ...}) = 0
mmap(NULL, 35918, PROT_READ, MAP_PRIVATE, 7, 0) = 0x7f99e4420000
close(7)                                = 0
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libnss_files.so.2", O_RDONLY|O_CLOEXEC) = 7
read(7, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0003\0\0\0\0\0\0"..., 832) = 832
fstat(7, {st_mode=S_IFREG|0644, st_size=55792, ...}) = 0
mmap(NULL, 83768, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 7, 0) = 0x7f99e4243000
mprotect(0x7f99e4246000, 40960, PROT_NONE) = 0
mmap(0x7f99e4246000, 28672, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 7, 0x3000) = 0x7f99e4246000
mmap(0x7f99e424d000, 8192, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 7, 0xa000) = 0x7f99e424d000
mmap(0x7f99e4250000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 7, 0xc000) = 0x7f99e4250000
mmap(0x7f99e4252000, 22328, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f99e4252000
close(7)                                = 0
mprotect(0x7f99e4250000, 4096, PROT_READ) = 0
munmap(0x7f99e4420000, 35918)           = 0
openat(AT_FDCWD, "/etc/hosts", O_RDONLY|O_CLOEXEC) = 7
lseek(7, 0, SEEK_CUR)                   = 0
fstat(7, {st_mode=S_IFREG|0644, st_size=210, ...}) = 0
read(7, "127.0.0.1\tlocalhost\n192.168.1.24"..., 4096) = 210
lseek(7, 0, SEEK_CUR)                   = 210
read(7, "", 4096)                       = 0
close(7)                                = 0
access("/etc/ssl/certs", X_OK)          = 0
socket(AF_UNIX, SOCK_STREAM, 0)         = 7
fcntl(7, F_GETFL)                       = 0x2 (flags O_RDWR)
fcntl(7, F_SETFL, O_RDWR|O_NONBLOCK)    = 0
connect(7, {sa_family=AF_UNIX, sun_path="/var/run/dovecot/stats-writer"}, 110) = 0
fstat(7, {st_mode=S_IFSOCK|0777, st_size=0, ...}) = 0
fcntl(7, F_GETFL)                       = 0x802 (flags O_RDWR|O_NONBLOCK)
epoll_ctl(6, EPOLL_CTL_ADD, 7, {EPOLLIN|EPOLLPRI|EPOLLERR|EPOLLHUP, {u32=3161385712, u64=94093009939184}}) = 0
write(7, "VERSION\tstats-client\t3\t0\n", 25) = 25
epoll_ctl(6, EPOLL_CTL_DEL, 4, 0x7fffbb150b0c) = 0
epoll_create(128)                       = 8
fcntl(8, F_GETFD)                       = 0
fcntl(8, F_SETFD, FD_CLOEXEC)           = 0
epoll_ctl(8, EPOLL_CTL_ADD, 4, {EPOLLIN|EPOLLPRI|EPOLLERR|EPOLLHUP, {u32=3161395728, u64=94093009949200}}) = 0
epoll_ctl(8, EPOLL_CTL_ADD, 7, {EPOLLIN|EPOLLPRI|EPOLLERR|EPOLLHUP, {u32=3161395856, u64=94093009949328}}) = 0
epoll_ctl(6, EPOLL_CTL_DEL, 7, 0x7fffbb150b1c) = 0
epoll_wait(8, [{EPOLLIN, {u32=3161395856, u64=94093009949328}}], 2, -1) = 1
read(7, "VERSION\tstats-server\t3\t0\nFILTER\t"..., 8192) = 33
epoll_ctl(8, EPOLL_CTL_DEL, 4, 0x7fffbb150b2c) = 0
epoll_ctl(6, EPOLL_CTL_ADD, 4, {EPOLLIN|EPOLLPRI|EPOLLERR|EPOLLHUP, {u32=3161333872, u64=94093009887344}}) = 0
epoll_ctl(6, EPOLL_CTL_ADD, 7, {EPOLLIN|EPOLLPRI|EPOLLERR|EPOLLHUP, {u32=3161385712, u64=94093009939184}}) = 0
epoll_ctl(8, EPOLL_CTL_DEL, 7, 0x7fffbb150b1c) = 0
epoll_ctl(6, EPOLL_CTL_DEL, 4, 0x7fffbb150b2c) = 0
epoll_ctl(8, EPOLL_CTL_ADD, 4, {EPOLLIN|EPOLLPRI|EPOLLERR|EPOLLHUP, {u32=3161395728, u64=94093009949200}}) = 0
epoll_ctl(8, EPOLL_CTL_DEL, 4, 0x7fffbb150aec) = 0
epoll_ctl(6, EPOLL_CTL_ADD, 4, {EPOLLIN|EPOLLPRI|EPOLLERR|EPOLLHUP, {u32=3161333872, u64=94093009887344}}) = 0
close(8)                                = 0
socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0) = 8
connect(8, {sa_family=AF_UNIX, sun_path="/dev/log"}, 110) = 0
socket(AF_UNIX, SOCK_STREAM, 0)         = 9
fcntl(9, F_GETFL)                       = 0x2 (flags O_RDWR)
fcntl(9, F_SETFL, O_RDWR|O_NONBLOCK)    = 0
connect(9, {sa_family=AF_UNIX, sun_path="/var/run/dovecot/auth-userdb"}, 110) = 0
epoll_ctl(6, EPOLL_CTL_DEL, 4, 0x7fffbb150d5c) = 0
epoll_create(128)                       = 10
fcntl(10, F_GETFD)                      = 0
fcntl(10, F_SETFD, FD_CLOEXEC)          = 0
epoll_ctl(10, EPOLL_CTL_ADD, 4, {EPOLLIN|EPOLLPRI|EPOLLERR|EPOLLHUP, {u32=3161405440, u64=94093009958912}}) = 0
fstat(9, {st_mode=S_IFSOCK|0777, st_size=0, ...}) = 0
fcntl(9, F_GETFL)                       = 0x802 (flags O_RDWR|O_NONBLOCK)
lseek(9, 0, SEEK_CUR)                   = -1 ESPIPE (Illegal seek)
getsockname(9, {sa_family=AF_UNIX}, [28->2]) = 0
epoll_ctl(10, EPOLL_CTL_ADD, 9, {EPOLLIN|EPOLLPRI|EPOLLERR|EPOLLHUP, {u32=3161406112, u64=94093009959584}}) = 0
setsockopt(9, SOL_TCP, TCP_CORK, [1], 4) = -1 EOPNOTSUPP (Operation not supported)
write(9, "VERSION\t1\t0\nUSER\t1\tuser@loca"..., 50) = 50
epoll_wait(10, [{EPOLLIN, {u32=3161406112, u64=94093009959584}}], 2, 155000) = 1
read(9, "VERSION\t1\t1\nSPID\t7235\n", 8192) = 22
epoll_wait(10, [{EPOLLIN, {u32=3161406112, u64=94093009959584}}], 2, 154984) = 1
read(9, "NOTFOUND\t1\n", 8170)          = 11
epoll_ctl(10, EPOLL_CTL_DEL, 4, 0x7fffbb150c7c) = 0
epoll_ctl(6, EPOLL_CTL_ADD, 4, {EPOLLIN|EPOLLPRI|EPOLLERR|EPOLLHUP, {u32=3161333872, u64=94093009887344}}) = 0
epoll_ctl(6, EPOLL_CTL_DEL, 4, 0x7fffbb150c7c) = 0
epoll_ctl(10, EPOLL_CTL_ADD, 4, {EPOLLIN|EPOLLPRI|EPOLLERR|EPOLLHUP, {u32=3161405440, u64=94093009958912}}) = 0
epoll_ctl(10, EPOLL_CTL_DEL, 4, 0x7fffbb150d8c) = 0
epoll_ctl(6, EPOLL_CTL_ADD, 4, {EPOLLIN|EPOLLPRI|EPOLLERR|EPOLLHUP, {u32=3161333872, u64=94093009887344}}) = 0
epoll_ctl(6, EPOLL_CTL_DEL, 4, 0x7fffbb150d8c) = 0
epoll_ctl(10, EPOLL_CTL_ADD, 4, {EPOLLIN|EPOLLPRI|EPOLLERR|EPOLLHUP, {u32=3161405440, u64=94093009958912}}) = 0
epoll_ctl(10, EPOLL_CTL_DEL, 9, 0x7fffbb150dbc) = 0
epoll_ctl(10, EPOLL_CTL_DEL, 4, 0x7fffbb150d4c) = 0
epoll_ctl(6, EPOLL_CTL_ADD, 4, {EPOLLIN|EPOLLPRI|EPOLLERR|EPOLLHUP, {u32=3161333872, u64=94093009887344}}) = 0
close(10)                               = 0
close(9)                                = 0
epoll_ctl(6, EPOLL_CTL_DEL, 7, 0x7fffbb15105c) = 0
close(7)                                = 0
epoll_ctl(6, EPOLL_CTL_DEL, 4, 0x7fffbb15105c) = 0
close(4)                                = 0
close(5)                                = 0
close(6)                                = 0
close(3)                                = 0
exit_group(67)                          = ?
+++ exited with 67 +++

output of doveconf -n:

root@mail:/etc/dovecot# dovecot -n
# 2.3.4.1 (f79e8e7e4): /etc/dovecot/dovecot.conf
# Pigeonhole version 0.5.4 ()
# OS: Linux 4.19.0-17-amd64 x86_64 Debian 10.10
# Hostname: mail
mail_location = maildir:~/Maildir
mail_privileged_group = mail
namespace inbox {
  inbox = yes
  location =
  mailbox Archive {
    special_use = \Archive
  }
  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
}
protocols = " imap"
ssl = required
ssl_cert = </etc/letsencrypt/live/domain.com/fullchain.pem
ssl_client_ca_dir = /etc/ssl/certs
ssl_dh = # hidden, use -P to show it
ssl_key = # hidden, use -P to show it
userdb {
  driver = passwd
}

permissions of /var/run/dovecot/stat

root@mail:/etc/dovecot# ls -l /var/run/dovecot/*stat*
srw------- 1 root root    0 Aug  9 13:37 /var/run/dovecot/old-stats
prw------- 1 root root    0 Aug  9 13:37 /var/run/dovecot/old-stats-mail
prw------- 1 root root    0 Aug  9 13:37 /var/run/dovecot/old-stats-user
srw------- 1 root root    0 Aug  9 13:37 /var/run/dovecot/stats-reader
srw-rw---- 1 root dovecot 0 Aug  9 13:37 /var/run/dovecot/stats-writer

Any ideas what could be wrong, and would it be better to use dovecot sync/backup for this?

anx avatar
fr flag
anx
Please try piping a message to `deliver` separately, I suspect that will show you an error message you are not seeing when called via fetchmail. e.g. Is `deliver` called as the user owning the Maildir? (also, repeated `fetchall` sounds odd, if you can you really want to use the features Dovecot includes)
us flag
@anx my original idea was to use dsync (https://wiki2.dovecot.org/Migration/Dsync) but when I read more about it (https://wiki.dovecot.org/Tools/Doveadm/Sync) it seems like it doesn't really fit my usage scenario - I want to download email and remove copies from the server. I don't want to keep my local IMAP folders in sync with the folders on the remote IMAP server, I want to make sure I keep all my local copies even if they have been deleted from the remote server. So it would seem fetchmail is what I want? I piped a message into deliver and I do not get any error, but it doesn't work.
anx avatar
fr flag
anx
Did you use the `-e` flag to *print* errors, instead of sending a "bounce" notification? I believe either way, you should have something in your logs.
us flag
@anx I don't have /var/log/dovecot.log, I guess all logging is done to /var/log/syslog etc. Should I double check in dovecot config somewhere if all logging is enabled? I will use the -e flag and report back.
us flag
@anx adding -e makes no difference, I do not get any error output on the command line.
Alien Life Form avatar
ru flag
Trying to decode the strace(1) (cumbersome) I'd say it is trying to tell you tha user@localhost cannot be found. If so, it does not know either about 'user', localhost, or 'user@localhost'.
Score:1
us flag

It turns out that the line

     mda "/usr/lib/dovecot/deliver -d user@localhost -m .fastmail.Archive"

Doesn't work. When I removed @localhost, and fixed the folder name, it works:

     mda "/usr/lib/dovecot/deliver -d user -m fastmail.Archive"

What I still don't understand is why I was not getting any kind of error output, the command just acts like it worked, and I can't see anything in the dovecot logs either. At least not without turning on debug logging options. The above seek error in the output of strace is confusing, I don't understand what the relationship is between that and the removal of the @localhost fixing the problem.

anx avatar
fr flag
anx
Isn't fetchmail capable of delivering mail directly to the dovecot LMTP socket? You will usually get much more useful (error) feedback when you use the full protocol instead of a simple pipe to an lda binary.
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.