GoAdmio

troubleshoot

Repair email accounts: relink mailboxes to their domain and owner, recreate missing accounts from mail folders, and fix mailbox ownership

On this page: Overview · Quick start · Syntax · Options · Output · Examples · Troubleshooting · Details · See also


Overview

/go/troubleshoot fixes common email problems in one run, for one domain or for every domain on the server. For each domain it:

  1. links the domain's email accounts in the GoAdmio database to the right domain and account owner
  2. creates any email accounts that exist as mailbox folders on disk but are missing from GoAdmio
  3. gives the vmail user ownership of the domain's mail folder

It is useful after a migration or restore, or when mailboxes are missing from the panel or can't be read.

The command doesn't need sudo. If you aren't root, it runs itself again with sudo.


Quick start

# Fix one domain
/go/troubleshoot example.com

# Fix every domain on the server
/go/troubleshoot

Syntax

/go/troubleshoot [<domain>]

Options

Argument Required Default Notes
<domain> No All domains The hosting account's domain. /home/<domain>/www must exist.

With no argument, the command goes through every folder in /home that contains a www folder. The word all is not recognized. Use no argument instead.


Output

The command prints nothing when it works. Any output comes from the mail command it calls.

Outcome What you get
Domain fixed No output. Exit status 1.
All domains processed No output. Exit status is that of the last command.
Domain not found Domain <domain> does not exist. Exit status 0.

[!NOTE] When you pass a domain, the exit status is 1 even on success. Don't treat it as an error.

Every run is logged to /var/log/go/troubleshoot.log with a timestamp and the arguments used.


Examples

# Fix the email accounts of example.com
/go/troubleshoot example.com
# Fix every domain (can take a while on servers with a lot of mail)
/go/troubleshoot

Troubleshooting

Symptom Likely cause Fix
Domain <domain> does not exist There is no /home/<domain>/www folder, or the name is wrong. Check the domain name. Pass the name of a hosting account, not an email address.
Domain all does not exist The command doesn't treat all as a keyword. Run it with no argument.
The command is slow It changes the ownership of every file in each mail folder. Fix one domain at a time, or wait.
The owner of a domain's mail accounts is now empty The domain isn't in the Site table of GoAdmio, so the owner lookup found nothing. Create or fix the account with create or domain, then run the command again.
Mail accounts are still missing The mailbox folders aren't in /home/<domain>/mail. Restore the folders, or use restoremail.
Mail can't be delivered or logins fail after the fix The Postfix or Dovecot mail maps are out of date. Run vmail and doveconf.

Details

What it does for each domain

flowchart TD
    A["/go/troubleshoot [domain]"] --> B{"Domain given?"}
    B -- "No" --> C["Each folder in /home that has a www folder"]
    B -- "Yes" --> D{"/home/domain/www exists?"}
    D -- "No" --> X["Domain does not exist"]
    D -- "Yes" --> E
    C --> E["Find the account's username in site.db"]
    E --> F["Update Domain and Username on the mail accounts in mail.db"]
    F --> G["mail --domain domain --action create"]
    G --> H["chown -R vmail:vmail /home/domain/mail"]
  1. Looks up the account's username in /var/lib/sqlite/site.db.
  2. In /var/lib/sqlite/mail.db, sets the Domain and Username of every mail account whose address ends in @<domain>.
  3. Runs /go/mail --domain <domain> --action create, which creates the email accounts that exist only as folders.
  4. Sets the owner and group of /home/<domain>/mail and everything in it to vmail.

Files and requirements

Item Used for
/var/lib/sqlite/site.db Finding the account's username.
/var/lib/sqlite/mail.db The email accounts.
/home/<domain>/mail The mailboxes.
/var/log/go/troubleshoot.log The command log.
sqlite3, the vmail user Database updates and mailbox ownership.

See also

Command Description
mail Create an email address in GoAdmio via the command line
restoremail Recreate mail accounts from folders on disk
vmail Rebuild the Postfix/Dovecot vmail maps
doveconf Rebuild the Dovecot configuration
mailpwd Bulk-change passwords for all email accounts of a single domain
mailtop Check the most active email accounts in GoAdmio
checkmail Check if your server provider supports mail port 25 (SMTP)
fix Fix GoAdmio file and folder permissions