• Info
  • Repair your mailboxes

The explanation and the script are in the 2nd post, so we can mark this post as "Best Answer", and the forum search will find this post better. Thanks to @crpb for the tip.

  • grommunio has a tool gromox-mbck to repair the mailboxes. However, this tool is difficult to use because you have to specify the database directory for each check / repair. So I wrote a script that checks all mailboxes and repairs them with the parameter -p. It is important to know that the script does not delete anything, it only repairs the mapping in the ICS, so this repair is safe to use.

    • Installation:
      The explanation of how to install the script is at the beginning of the script.

    • Check and repair:
      Run the script without parameters if you get similar messages like:

      == /var/lib/gromox/user/X/Y/exmdb/exchange.sqlite3 ==
       ck_allocated_eids: f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15 f16 f17 f18 f19 f20 f21 f22 f23 f24 f25 f26 f27 f28 f29 [29 issues]
       ck_indices_present:
       /var/lib/gromox/user/X/Y/exmdb/exchange.sqlite3: 29 problems total

      Run the script with the -p parameter and repair all mailboxes.

    • I hope this helps some grommunio administrators.

    • Disclaimer:
      Use at your own risk.

    • The script:

      #!/bin/bash
      #
      # Check or repair all mailboxes with gromox-mbck
      #
      # Script to check or repair the ICS properties in all mailboxes
      # First, run this script without parameters, only if you see messages like:
      #
      #   == /var/lib/gromox/user/X/Y/exmdb/exchange.sqlite3 ==
      #   ck_allocated_eids: f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15 f16 f17 f18 f19 f20 f21 f22 f23 f24 f25 f26 f27 f28 f29 [29 issues]
      #   ck_indices_present:
      #   /var/lib/gromox/user/X/Y/exmdb/exchange.sqlite3: 29 problems total
      #
      # Launch the script with the parameter -p to fix the issues.
      #
      #
      # (c) 2025 by Walter@Hofstaedtler.com
      #
      # 17.02.2025 WH, V 1.0, First release
      #
      #
      # Installation:
      # 1. Put this script in /scripts/manual/ as g_mbck.sh
      # 2. Convert the script to Linux LF with:
      #    dos2unix /scripts/manual/g_mbck.sh
      # 3. Make the script executable with:
      #    chmod +x /scripts/manual/g_mbck.sh
      #
      # Run the script and specify the required parameter, just -p.
      #
      #
      CYA="\033[0;36m"; YEL="\033[0;33m"; NORM="\033[0m"
      #
      MSG="Check"
      echo
      echo -e "${CYA}Check or repair all grommunio mailboxes on this system with gomox-mbck.${NORM}"
      echo -e "Use parameter ${YEL}-p${NORM} to start the repair, without -p the mailbox is only checked."
      if [ "$1" == "-p" ]; then
          echo -e "${YEL}-p is set, repair all mailboxes ...${NORM}"
          MSG="${YEL}Repair"
      fi
      echo
      #
      # Read all mailboxes in a variable
      mailboxes=$(grommunio-admin user query username maildir | grep "/user/" | grep "@" | awk '{print $1}')
      
      # Now iterate through all mailboxes
      # shellcheck disable=SC2068
      for mailbox in ${mailboxes[@]}; do
          maildir=$(gromox-mbop -u "$mailbox" echo-maildir)
          if ! [ -d "$maildir" ]; then
              echo "Error: No Maildir/Access: $mailbox" >/dev/stderr
              err_dir=$((err_dir+1))
              continue
          fi
          #
          echo -e "$MSG mailbox: ${CYA}$mailbox${NORM} ..."
          # shellcheck disable=SC2086
          /usr/sbin/gromox-mbck "$maildir"/exmdb/exchange.sqlite3 $1
          echo
          #
      done
      echo "Done."
      #
      # eof
      #

grommunio has a tool gromox-mbck to repair the mailboxes. However, this tool is difficult to use because you have to specify the database directory for each check / repair. So I wrote a script that checks all mailboxes and repairs them with the parameter -p. It is important to know that the script does not delete anything, it only repairs the mapping in the ICS, so this repair is safe to use.

  • Installation:
    The explanation of how to install the script is at the beginning of the script.

  • Check and repair:
    Run the script without parameters if you get similar messages like:

    == /var/lib/gromox/user/X/Y/exmdb/exchange.sqlite3 ==
     ck_allocated_eids: f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15 f16 f17 f18 f19 f20 f21 f22 f23 f24 f25 f26 f27 f28 f29 [29 issues]
     ck_indices_present:
     /var/lib/gromox/user/X/Y/exmdb/exchange.sqlite3: 29 problems total

    Run the script with the -p parameter and repair all mailboxes.

  • I hope this helps some grommunio administrators.

  • Disclaimer:
    Use at your own risk.

  • The script:

    #!/bin/bash
    #
    # Check or repair all mailboxes with gromox-mbck
    #
    # Script to check or repair the ICS properties in all mailboxes
    # First, run this script without parameters, only if you see messages like:
    #
    #   == /var/lib/gromox/user/X/Y/exmdb/exchange.sqlite3 ==
    #   ck_allocated_eids: f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15 f16 f17 f18 f19 f20 f21 f22 f23 f24 f25 f26 f27 f28 f29 [29 issues]
    #   ck_indices_present:
    #   /var/lib/gromox/user/X/Y/exmdb/exchange.sqlite3: 29 problems total
    #
    # Launch the script with the parameter -p to fix the issues.
    #
    #
    # (c) 2025 by Walter@Hofstaedtler.com
    #
    # 17.02.2025 WH, V 1.0, First release
    #
    #
    # Installation:
    # 1. Put this script in /scripts/manual/ as g_mbck.sh
    # 2. Convert the script to Linux LF with:
    #    dos2unix /scripts/manual/g_mbck.sh
    # 3. Make the script executable with:
    #    chmod +x /scripts/manual/g_mbck.sh
    #
    # Run the script and specify the required parameter, just -p.
    #
    #
    CYA="\033[0;36m"; YEL="\033[0;33m"; NORM="\033[0m"
    #
    MSG="Check"
    echo
    echo -e "${CYA}Check or repair all grommunio mailboxes on this system with gomox-mbck.${NORM}"
    echo -e "Use parameter ${YEL}-p${NORM} to start the repair, without -p the mailbox is only checked."
    if [ "$1" == "-p" ]; then
        echo -e "${YEL}-p is set, repair all mailboxes ...${NORM}"
        MSG="${YEL}Repair"
    fi
    echo
    #
    # Read all mailboxes in a variable
    mailboxes=$(grommunio-admin user query username maildir | grep "/user/" | grep "@" | awk '{print $1}')
    
    # Now iterate through all mailboxes
    # shellcheck disable=SC2068
    for mailbox in ${mailboxes[@]}; do
        maildir=$(gromox-mbop -u "$mailbox" echo-maildir)
        if ! [ -d "$maildir" ]; then
            echo "Error: No Maildir/Access: $mailbox" >/dev/stderr
            err_dir=$((err_dir+1))
            continue
        fi
        #
        echo -e "$MSG mailbox: ${CYA}$mailbox${NORM} ..."
        # shellcheck disable=SC2086
        /usr/sbin/gromox-mbck "$maildir"/exmdb/exchange.sqlite3 $1
        echo
        #
    done
    echo "Done."
    #
    # eof
    #

© 2020-2024 grommunio GmbH. All rights reserved. | https://grommunio.com | Data Protection | Legal notice