[
    {
        "role": "user",
        "content": "I%27m%20running%20exim%204.9%20and%20when%20I%20send%20a%20mail%20to%20root%20using%20the%20mail%20command%2C%20the%20mail%20just%20disappears.%20how%20can%20i%20trace%20the%20ail%20through%20exim%20to%20see%20what%20went%20wrong%3F"
    },
    {
        "role": "assistant",
        "content": "Here\u2019s how to trace what happens in **Exim 4.9** when you send mail to *root* using the `mail` command and it seems to just disappear. I\u2019ll walk you through enabling tracing, searching the logs, and common issues specific to root delivery.\n\n---\n\n## 1. Check Where Exim Logs Messages\n\nExim keeps multiple log files in `/var/log/` (or `/var/log/exim/` depending on distro). The key ones are:\n\n- `exim_mainlog` \u2014 tracks nearly every mail transaction (receival, delivery attempts, rejections) ([kb.acenet.us](https://kb.acenet.us/Exim_Mail_Logs?utm_source=openai))  \n- `exim_rejectlog` \u2014 records rejected recipients or mails rejected early in SMTP conversation ([kb.acenet.us](https://kb.acenet.us/Exim_Mail_Logs?utm_source=openai))  \n- `exim_paniclog` \u2014 for internal/exim program errors (e.g. config errors) ([kb.acenet.us](https://kb.acenet.us/Exim_Mail_Logs?utm_source=openai))  \n\n---\n\n## 2. Search the Logs for the Mail Message\n\nWhen you send a message to root, it should generate an entry in `exim_mainlog`. You\u2019ll want to look for entries relating to:\n\n- `<= root@server` \u2014 Exim Saying it \u201creceived\u201d mail to root  \n- `=> root@server` \u2014 Exim delivering mail to root  \n- \u201cCompleted\u201d entries confirming success, or errors if it failed or bounced ([support.cpanel.net](https://support.cpanel.net/hc/en-us/articles/5528247629463-How-to-use-exigrep-to-search-the-Exim-logs?utm_source=openai))  \n\nYou can use tools like:\n\n```bash\ngrep root /var/log/exim_mainlog\n```\n\nor better yet:\n\n```bash\nexigrep 'root@' /var/log/exim_mainlog\n```\n\n`exigrep` finds the lines related to that address, then lets you follow the message through via its message-ID. ([support.cpanel.net](https://support.cpanel.net/hc/en-us/articles/5528247629463-How-to-use-exigrep-to-search-the-Exim-logs?utm_source=openai))\n\n---\n\n## 3. Enable Debug / Verbose Output in Exim\n\nSometimes the regular logs don\u2019t show enough detail. You can increase verbosity:\n\n- Run Exim in debug mode manually for a specific message. Using the Exim binary:\n\n  ```bash\n  exim -d -M <message-id>\n  ```\n\n  This prints routing, ACL decisions, transport picks, etc. ([exim.org](https://www.exim.org/exim-pdf-4.66/doc/spec.pdf?utm_source=openai))\n\n- While starting Exim (daemon), add the `-d` flag plus specific debug-categories:\n\n  ```bash\n  exim -bd -q1h -d+route+transport+acl\n  ```\n\n  This causes Exim to stay in the foreground, with more detailed debugging. Replace categories as needed (for routing, local delivery, address mapping). ([exim.org](https://www.exim.org/exim-html-current/doc/html/spec_html/ch-the_exim_command_line.html?utm_source=openai))\n\n- Modify `log_selector` in the Exim configuration to include more detail (e.g. `+all` or specific selectors) so you can see more info in `exim_mainlog`. ([exim.org](https://www.exim.org/exim-html-current/doc/html/spec_html/ch-log_files.html?utm_source=openai))\n\n---\n\n## 4. Specific Issues with Root Delivery\n\nMessage might indeed fail silently if you haven\u2019t configured root properly; here are known pitfalls:\n\n- There's a setting `never_users = root` (or build-time `FIXED_NEVER_USERS`) in many Exim configs that forbids delivery *as* root ([exim.org](https://www.exim.org/exim-html-4.66/doc/html/FAQ-html/FAQ_0.html?utm_source=openai)). This means Exim will decline to run a delivery transport that would mean delivering to `root` user in a way that it executes as root.  \n\n- On systems like Debian, root\u2019s mail is typically aliased to another local account in `/etc/aliases` so that root mail goes to a non-privileged account. If that alias is missing or misconfigured, delivery to root might be silently dropped or bounced internally with no notification. ([lists.debian.org](https://lists.debian.org/debian-release/2008/07/msg00559.html?utm_source=openai))\n\n- File permissions: Local delivery usually writes to something like `/var/mail/root` or `/var/spool/mail/root`. If those permissions are wrong (directory not writable by the mail delivery user), Exim may fail quietly or defer. Look for messages in the log about \u201cpermission denied\u201d or \u201ccannot create lock file\u201d etc. ([exim.org](https://www.exim.org/exim-html-4.66/doc/html/FAQ-html/FAQ_0.html?utm_source=openai))\n\n---\n\n## 5. Checklist to Trace What\u2019s Happening\n\nHere\u2019s what you should do in order:\n\n1. Send a test mail to root:\n\n   ```bash\n   echo \"Test body\" | mail -s \"Test subject\" root\n   ```\n\n2. Immediately grep the mainlog for entries containing \u201croot\u201d or \u201c<root@\u2026\u201d or even \u201c<= localhost\u201d etc.:\n\n   ```bash\n   grep '[<=>].*root' /var/log/exim_mainlog | tail -n 20\n   ```\n\n3. If you find a message ID, use `exigrep`:\n\n   ```bash\n   exigrep '1aBcD-000xYz-12' /var/log/exim_mainlog\n   ```\n\n   Follow the chain: received \u2192 routed \u2192 attempted delivery \u2192 success or failure.\n\n4. If no log entries appear, increase log verbosity (via `log_selector` or run Exim with `-d` debug), then try again. Also check whether Exim is running at all, whether there are full disks, or other system issues.\n\n5. Check `/etc/aliases` (or whatever alias file your system uses) for root\u2019s alias entry; make sure root mail isn't redirected somewhere unexpected. Also confirm mailbox file for root exists and is writable.\n\n---\n\nIf you want, I can help you compose specific commands based on your distro (Ubuntu, Debian, CentOS, etc.), or even help interpret your log excerpt if you post it. Do you want to go that route?"
    }
]