Score:0

Dovecot gz trailer has wrong CRC

lu flag

Installed hestia with dovecot+exim4+roundcube. Setted up gzip by adding

  zlib_save = gz
  zlib_save_level = 6

in config.

Added loading module in imap conf. Im using thunderbird to read and sent messages but some messages in maildir were broken and thunderbird cannot finish downloading sent folder.

read /path/to/message failed. gz trailer has wrong CRC value at 8192 (read reason=mail stream)

UPDATE: Yes just dovecot writing to dir (except mozilla thunderbird). I checked one message with gunzip -C and can read it, but at the end of file was attached png image and when i do

gunzip -c /home/$$$/.Sent/cur/1664802400.M298227P1667779.<mydomain>,S=6509045:2,S

I see part of message at beginning like this:

Content-Type: multipart/mixed; boundary="------------egJdRmaVhjH2gk4jyDoim1xN"
Message-ID: <$$$>
Date: Mon, 3 Oct 2022 16:06:17 +0300
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
 Thunderbird/91.13.1
Subject: =?UTF-8?B?UmU6INGC0LDQsdC70LjRhtCwINC6INC30LDQv9C+0LvQvdC10L3QuNGO?=
 =?UTF-8?B?INGB0LXQvdGC0Y/QsdGA0YwgMjAyMg==?=
Content-Language: ru
To: Marina Nikitina <M*ru>
References: <[email protected]>
From: =?UTF-8?B?0JrQsNGI0YLQsNC90L7QstCwINCQ0L3QsNGB0YLQsNGB0LjRjyDQrtGA0Yw=?=
 =?UTF-8?B?0LXQstC90LA=?= <*>
In-Reply-To: <*>

This is a multi-part message in MIME format.
--------------egJdRmaVhjH2gk4jyDoim1xN
Content-Type: multipart/alternative;
 boundary="------------88BmI04frXCThbnk1baIR4WJ"

--------------88BmI04frXCThbnk1baIR4WJ
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

and base64 code of attached png at the end. And finally this error:

gzip: /home/$$$/.Sent/cur/1664802400.M298227P1667779.<mydomain>,S=6509045:2,S: invalid compressed data--format violated

UPDATE: I think my problem was trying to move folders and messages from mozilla thunderbird not localy in dovecot. But how can i repair it now? I tried to move broken messages but main problem dovecot logs only first borken message. After moving i have to delete index files and wait for the next found broken message.

anx avatar
fr flag
anx
Is Dovecot the only software writing to that maildir? ([edit] your question to include more configuration if in doubt)
Павел Шаффер avatar
lu flag
On the server just dovecot can write to directory but external mail client can too
Score:0
lu flag

In general, I got out of the situation as follows. One person helped write a script that:

  1. Runs through folders recursively, determines whether the file is compressed.
  2. If the file is compressed, decompress it and check if there are any errors. If there are no errors, skip.
  3. If the file was with an error, it unpacks the file into a temporary folder "as is", after which it compresses it again and moves it back to the message folder. This helped to rid dovecot of errors and the mail client now working fine. It is possible that some of the messages are not readable, but this does not play a big role for me and broken mail stored backed up in folder. In any case, it was not possible to do something else with them. Perhaps the next script will be useful to someone in the future.
#/bin/sh
MAIL_DIR='/home/user/mail/domain/'
BACKUP_DIR='/home/user/broken'
TMP_FILE='/tmp/dovecot_move_broken.tmp'

[ -e "$BACKUP_DIR" ] || mkdir -p "$BACKUP_DIR" || exit 1

find "$MAIL_DIR" -iname '[0-9]*.M*.*' -printf '%s:%p\n'| while IFS="" read -r p; do
    size=${p%%:*}
    file=${p#*:/home/}
    path=${file%/*}
    file=${file##*/}

    # пропускаем файлы размер которых равен указанному в флагах
    [ "${file%,S=$size,*}" != "$file" ] && continue

    # пропускаем файлы распакованные без ошибок
    gunzip -c "/home/$path/$file" 2>/dev/null >"$TMP_FILE" && rm "$TMP_FILE" && continue

    # пропускаем если файл не был сжат (пустой выходной файл)
    [ -s "$TMP_FILE" ] || continue

    echo "$path/$file"

    dir="$BACKUP_DIR/$path"
    [ -e "$dir" ] || mkdir -p "$dir"

    # копируем файл в бэкап, затем записываем в него заново сжатые данные
    cp -p "/home/$path/$file" "$BACKUP_DIR/$path/" && cat "$TMP_FILE" | gzip >"/home/$path/$file"

    rm "$TMP_FILE"
done
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.