Warning, /pim/kmail/doc/kmail2/troubleshooting.docbook is written in an unsupported language. File is not indexed.
0001 <chapter id="troubleshooting"> 0002 0003 <chapterinfo> 0004 <authorgroup> 0005 <author> 0006 <personname> 0007 <firstname>Portions of this chapter were converted from the KDE UserBase <ulink 0008 url="https://userbase.kde.org/Special:MyLanguage/KMail/FAQs_Hints_and_Tips">KMail/FAQs Hints and Tips</ulink> page in 2012.</firstname> 0009 </personname> 0010 </author> 0011 <author> 0012 &David.Bryant; 0013 &David.Bryant.mail; 0014 </author> 0015 <!-- TRANS:ROLES_OF_TRANSLATORS --> 0016 </authorgroup> 0017 <date>2021-08-08</date> 0018 <releaseinfo>5.14.2 (Applications 20.04.2)</releaseinfo> 0019 </chapterinfo> 0020 0021 <title>&kmail; Troubleshooting</title> 0022 0023 <sect1 id="introduction-to-akonadi"> 0024 <title>Introduction to &akonadi;</title> 0025 0026 <para>&kmail; has been under active development since 1997. A lot of bugs have cropped up over the years. 0027 Many of these have been resolved. If you are curious about any of those old bugs, please see the <ulink 0028 url="https://userbase.kde.org/Special:MyLanguage/KMail/FAQs_Hints_and_Tips">KMail/FAQs Hints and Tips</ulink> 0029 in the &kde; UserBase Wiki. Or visit <ulink url="https://bugs.kde.org">&kde;'s main bug tracking page</ulink> 0030 to learn about bugs of a more recent vintage.</para> 0031 0032 <para>At the present time (2021), many of the problems people are experiencing with &kmail; involve the &akonadi; 0033 server. &akonadi; is an auxiliary program that functions as an intermediary between &kmail; (plus all the other &PIM; 0034 applications) and a general purpose database daemon (most commonly "mysqld"). It also facilitates inter-process 0035 communications among the various pieces of the &PIM; applications. Depending on the way your system is configured, 0036 &akonadi; may be started during the bootup / login process. Or it may not start until you invoke a &PIM; 0037 application program (like &kmail;, or &kaddressbook;, or &kontact;).</para> 0038 0039 <para> There are two application programs that permit one to interact with the &akonadi; server directly: <code>akonadictl</code> 0040 (a terminal-oriented control program), and <code>akonadiconsole</code> (a GUI application). Here is a little information about 0041 those two programs.</para> 0042 <para> </para><!-- add whitespace --> 0043 0044 <sect2 id="intro-to-akonadictl"> 0045 <title>The Akonadictl Control Program</title> 0046 <screenshot> 0047 <screeninfo>&akonadi; status report</screeninfo> 0048 <mediaobject> 0049 <imageobject> 0050 <imagedata fileref="akonadictl.png" format="PNG"/> 0051 </imageobject> 0052 <textobject> 0053 <phrase>&akonadi; status report</phrase> 0054 </textobject> 0055 <caption> 0056 <para>Akonadictl Status Report, 32 Agents Running</para> 0057 </caption> 0058 </mediaobject> 0059 </screenshot> 0060 <para> </para><!-- add whitespace --> 0061 0062 <para>The preceding screenshot illustrates one of the commands one may use with the <code>akonadictl</code> program. Here 0063 are all the commands <code>akonadictl</code> recognizes.</para> 0064 0065 <para><screen>~$ akonadictl start</screen> Starts the &akonadi; server.</para> 0066 <para><screen>~$ akonadictl stop</screen> Stops the &akonadi; server.</para> 0067 <para><screen>~$ akonadictl restart</screen> Stops the &akonadi; server, then launches it anew.</para> 0068 <para><screen>~$ akonadictl status</screen> Produces the status report illustrated in the preceding screenshot.</para> 0069 <para><screen>~$ akonadictl instances</screen> Lists the &akonadi; server instances (more than one can 0070 be running at the same time).</para> 0071 <para><screen>~$ akonadictl vacuum</screen> Cleans up &akonadi;'s storage, or at least tries to do that.</para> 0072 <para><screen>~$ akonadictl fsck</screen> Performs a file consistency check. The output from this 0073 command can be quite voluminous, especially if you have added your own folders to &kmail;. Use this 0074 version of the command (piping the output through grep) to verify that your &akonadi; database is healthy, 0075 without producing a lot of extraneous output.</para> 0076 <para> 0077 0078 <screen>~ $ akonadictl fsck 2>&1 | grep ^Found 0079 Found 0 external files. 0080 Found 0 external parts. 0081 Found no unreferenced external files. 0082 Found 0 parts to be moved to external files 0083 Found 0 parts to be moved to database 0084 Found 6 collections without RID. 0085 Found 0 items without RID. 0086 Found 0 dirty items.</screen> <!-- Can't indent here ... messes up the output. --> 0087 0088 RID stands for RemoteId, a named field in the mysql database tables. If there are more than 0 items 0089 without RID, you have a minor problem that should be corrected. If there are more than 0 dirty items 0090 you may have a major problem that <emphasis>must</emphasis> be corrected. See <link 0091 linkend="resource-conflict-error">"Unable to Fetch Item ..."</link> and also <link 0092 linkend="dealing-with-dirt">Correcting &kmail;'s "Dirty" Items</link>, below. 0093 </para> 0094 <para> </para><!-- add whitespace --> 0095 </sect2> 0096 0097 <sect2 id="intro-to-akonadiconsole"> 0098 <title>The Akonadiconsole Program</title> 0099 <screenshot> 0100 <screeninfo>What akonadiconsole looks like</screeninfo> 0101 <mediaobject> 0102 <imageobject> 0103 <imagedata fileref="akonadiconsole.png" format="PNG"/> 0104 </imageobject> 0105 <textobject> 0106 <phrase>What akonadiconsole looks like</phrase> 0107 </textobject> 0108 <caption> 0109 <para>Akonadiconsole in action</para> 0110 </caption> 0111 </mediaobject> 0112 </screenshot> 0113 <para> </para><!-- add whitespace --> 0114 0115 <para>The <code>akonadiconsole</code> program provides twelve different "windows" into the inner 0116 workings of the &PIM; applications. Here is a brief summary of the available views.</para> 0117 0118 <variablelist> 0119 <varlistentry id="ak-console-agents"> 0120 <term><guilabel>Agents</guilabel> tab.</term> 0121 <listitem><para>Here you can see a list of the user agents (processors).</para></listitem> 0122 </varlistentry> 0123 0124 <varlistentry id="ak-console-browser"> 0125 <term><guilabel>Browse</guilabel> tab.</term> 0126 <listitem><para>This tab provides an overview of the various collections of data &akonadi; 0127 is maintaining, organized as a hierarchical tree that shows how many items reside in each 0128 collection.</para></listitem> 0129 </varlistentry> 0130 0131 <varlistentry id="ak-console-debugger"> 0132 <term><guilabel>Debugger</guilabel> tab.</term> 0133 <listitem><para>Here you can turn debugging on and off, and view the debug message log.</para></listitem> 0134 </varlistentry> 0135 0136 <varlistentry id="ak-console-logging"> 0137 <term><guilabel>Logging</guilabel> tab.</term> 0138 <listitem><para>This tab lets you view messages emitted by various &akonadi; components.</para></listitem> 0139 </varlistentry> 0140 0141 <varlistentry id="ak-console-db-browser"> 0142 <term><guilabel>DB Browser</guilabel> tab.</term> 0143 <listitem><para>Use this tab to peek inside the mysql database. There are many different tables.</para></listitem> 0144 </varlistentry> 0145 0146 <varlistentry id="ak-console-db-console"> 0147 <term><guilabel>DB Console</guilabel> tab.</term> 0148 <listitem><para>Here you can query the mysql database.</para></listitem> 0149 </varlistentry> 0150 0151 <varlistentry id="ak-console-query"> 0152 <term><guilabel>Query Debugger</guilabel> tab.</term> 0153 <listitem><para>Use this tab to turn database query debugging on and off. &kmail; queries the mysql 0154 database many times in just a few seconds; output can be voluminous.</para></listitem> 0155 </varlistentry> 0156 0157 <varlistentry id="ak-console-tracker"> 0158 <term><guilabel>Job Tracker</guilabel> tab.</term> 0159 <listitem><para>The &PIM; applications perform various functions by initiating "jobs". Use 0160 this tab to toggle job tracking on and off.</para></listitem> 0161 </varlistentry> 0162 0163 <varlistentry id="ak-console-scheduler"> 0164 <term><guilabel>Resources Schedulers</guilabel> tab.</term> 0165 <listitem><para>Here you can see which resources are needed when a particular &PIM; function is 0166 invoked. You can see a list of all the &akonadi; resources in your system in the 0167 <filename>~/.config/akonadi/</filename> directory.</para></listitem> 0168 </varlistentry> 0169 0170 <varlistentry id="ak-console-notif-monitor"> 0171 <term><guilabel>Notification Monitor</guilabel> tab.</term> 0172 <listitem><para>Use this tab to monitor notifications sent by various &akonadi; resources.</para></listitem> 0173 </varlistentry> 0174 0175 <varlistentry id="ak-console-search"> 0176 <term><guilabel>Item Search</guilabel> tab.</term> 0177 <listitem><para>This tab provides a generic search function. Searches can be restricted to Calendar, Contact, 0178 Email, or Note.</para></listitem> 0179 </varlistentry> 0180 0181 <varlistentry id="ak-console-monitors"> 0182 <term><guilabel>Monitors</guilabel> tab.</term> 0183 <listitem><para>Here you can see a list of all the monitors running under &akonadi;, and also view 0184 their properties. Agents, resources, and even some application programs are monitored.</para></listitem> 0185 </varlistentry> 0186 </variablelist> 0187 0188 </sect2> 0189 0190 </sect1> 0191 0192 <!-- <sect1 id="kmail2-doesnt-send-mail"> 0193 <title>KMail doesn't send mail</title> 0194 <para>Some users find that mail does not go out, and it appears that &SMTP; is missing, even though the 0195 <guilabel>Settings</guilabel> page looks correct. It has been reported that this is cured by opening 0196 <application>akonadiconsole</application> and adding Mail Dispatcher Agent.</para>ttps://bugs.kde.org/show_bug.cgi?id=283682 0197 <para>If the computer was suddenly turned off in suspend mode (⪚ by a power cut) sometimes e-mails simply 0198 stay in the outbox without being sent, but no error message is generated either. This may be due to the fact 0199 that the Mail Dispatcher Agent is set to <quote>offline</quote> in the configuration file during suspend and 0200 is not changed back due to the crash. Edit the following file:</para> 0201 <para><filename>~/.config/akonadi/agent_config_akonadi_maildispatcher_agent</filename> and change</para> 0202 <para><screen>[Agent] Online=false</screen></para> 0203 <para>to</para> 0204 <para><screen>[Agent] Online=true</screen></para> 0205 </sect1> --> <!-- This section removed 8/8/2021. --> 0206 0207 <!-- <sect1 id="clean-start-after-a-failed-migration"><title>Clean start after a failed migration</title> 0208 <para>In case migration from &kmail; 1 to &kmail; 2 fails or you have weird problems after it, you can try to do a clean import of your data, instead of migrating the existing settings. Be warned, this needs more manual setup, so do only if you are confident of setting up your &kmail; accounts again; it can generate a large amount of network traffic for &IMAP; resources. 0209 </para> 0210 <orderedlist> 0211 <listitem><para>Stop Akonadi and related applications</para> 0212 <para>quit &kmail;/&kontact;/&korganizer;, and issue this command: 0213 </para> 0214 <para><userinput><command>akonadictl stop</command></userinput> 0215 </para> 0216 <para>Make sure no <application>Akonadi</application> or <application>MySQL</application> process is running: 0217 </para> 0218 <para><userinput><command>ps ux | grep mysql</command></userinput> 0219 </para> 0220 <para><userinput><command>ps ux | grep akonadi</command></userinput> 0221 </para> 0222 <para>They should not show anything else but the <application>grep</application> process itself. 0223 </para> 0224 </listitem> 0225 <listitem><para>Remove old Akonadi database and config</para> 0226 <para>Delete the following folders 0227 </para> 0228 <itemizedlist> 0229 <listitem> 0230 <para> 0231 <filename role="directory">~/.local/share/akonadi</filename> 0232 </para> 0233 </listitem> 0234 <listitem> 0235 <para> 0236 <filename role="directory">~/.config/akonadi</filename> 0237 </para> 0238 </listitem> 0239 </itemizedlist> 0240 <para>Delete also the files starting with <emphasis>akonadi</emphasis> from <filename role="directory">~/.kde4/share/config</filename> 0241 </para> 0242 </listitem> 0243 <listitem>ttps://bugs.kde.org/show_bug.cgi?id=283682 0244 <para>Restart Akonadi server 0245 </para> 0246 <para><userinput><command>akonadictl start</command></userinput> 0247 </para> 0248 </listitem> 0249 <listitem> 0250 <para>Add back the accounts 0251 </para> 0252 <para>Now it is time to add your account back. You can use &kmail; (&kontact;) for it, or you can use the <application>akonadiconsole</application> tool. 0253 </para> 0254 <para>In &kmail;: <menuchoice><guimenu>Settings</guimenu><guisubmenu>Configure KMail</guisubmenu><guimenuitem>Accounts</guimenuitem></menuchoice> and use <guilabel>Add</guilabel>. 0255 </para> 0256 <para>If you use &IMAP;, add a new <guimenuitem>&IMAP; E-Mail server</guimenuitem>. If you want disconnected mode (so you can read the mails offline), enable it on the <guilabel>Advanced</guilabel> tab. Be sure to check that you are subscribed to all your important folders. 0257 </para> 0258 <para>You might already see a <guilabel>Local folder</guilabel> resource. This points to a local maildir folder. You can either modify this to point to your existing maildir folders or you can add a new resource for local mails. 0259 </para> 0260 <para>When adding a maildir resource you can choose between <guilabel>&kmail; Mail Folder</guilabel> or <guilabel>Maildir</guilabel>. Unless you have a mixed folder containing <emphasis>both</emphasis> maildir folders and mbox files, you should choose <guilabel>Maildir</guilabel>. For independent mbox files, like the one in the <filename role="directory">/var/spool/mail</filename>, you can set up a new <emphasis>MBox</emphasis> folder. 0261 </para> 0262 <para>Add the POP3 accounts as well. If you have multiple Local Folders set up, on the <guilabel>Advanced</guilabel> tab, choose the destination folder where the newly downloaded mails are put. 0263 </para> 0264 <para>For all accounts, configure the mail check interval. For Local folders disable interval checking and also disable <guilabel>Include in manual mail check</guilabel> in the <guilabel>Retrieval options</guilabel>. 0265 </para> 0266 <para>Add the sending (SMTP) accounts. 0267 </para> 0268 </listitem> 0269 <listitem> 0270 <para>Fix your filters, identities and favorite folders 0271 </para> 0272 <para>If you have client side filtering (common with POP3 mails), go to <menuchoice><guimenu>Settings</guimenu><guimenuitem>Configure Filters</guimenuitem></menuchoice> and fix the destination folder for the filters, they most probably are wrong. Otherwise mails will end up in folders you don't expect. 0273 </para> 0274 <para>Spam filter (at least in version 4.7.3 and earlier) does not work as expected in that the rule that the wizard creates does not send spam to the folder you have defined. 0275 </para> 0276 <para>The workaround for this is to change the <quote>spam</quote> and <quote>spam unsure</quote> (if the spam filter you use supports that) from looking at Status-fields in the header <literal>X-Spam-Status</literal> to look <guimenuitem>Anywhere in headers</guimenuitem> for X-<replaceable>your spam filter</replaceable>-Classification: <quote>SPAM or unsure</quote>. Look at the filters the wizard creates and copy the <quote>contains</quote> part. Example for <application>Spambayes</application>: <quote>X-Spambayes-Classification: spam</quote> and <quote>X-Spambayes-Classification: unsure</quote>. 0277 </para> 0278 <para>You also need to verify the identity settings and set the sent-mail, drafts and templates folders to point to the right folders. To do that go to <menuchoice><guimenu>Settings</guimenu><guisubmenu>Configure KMail</guisubmenu><guimenuitem>Identities</guimenuitem></menuchoice>, modify the identity, go to the <guilabel>Advanced</guilabel> tab and modify the above mentioned folder settings. 0279 </para> 0280 <para>Check also that your <guilabel>Favorite Folders</guilabel> are the ones you have chosen before. 0281 </para> 0282 </listitem> 0283 <listitem> 0284 <para>Initiate a mail check 0285 </para> 0286 <para>Start a mail check for your accounts. It is suggested doing it per account. 0287 </para> 0288 <para>First check for &IMAP;, if you have it. 0289 </para> 0290 <para>Next check (import) your local mails. One solution is to do a full check in one go <menuchoice><guimenu>File</guimenu><guimenuitem>Check Mail In</guimenuitem></menuchoice> and select the local account; the other is to click one by one on the folders, that should initiate the check for that folder (alternatively right click on the folder name and select <guilabel>Update Folder</guilabel>). 0291 </para> 0292 <para>The initial import might be slow and could use a lot of memory, especially if you have folders with a large amount of mail. In that case per-folder check is preferred. If the check (complete or for one folder) is finished and the memory usage is still high, you could restart the Akonadi server — as seen above — or just the maildir agent, if you use <varname>akonadiconsole</varname>. Do not worry, this high memory usage is <emphasis>only</emphasis> for initial import. 0293 </para> 0294 <para>Initiate a check mail for POP3 resources. 0295 </para> 0296 </listitem> 0297 </orderedlist> 0298 <para>Hopefully after these steps, you will have a much nicer &kmail; experience. 0299 </para> 0300 </sect1> --> <!-- This section removed 8/8/2021. --> 0301 0302 <!-- <sect1 id="local-folders-is-added-over-and-over"><title>Local Folders is added over and over</title> 0303 <para>In some cases you might end up with a maildir account pointing to a certain place (like <filename>$HOME/Mail</filename>), but you still see a <guilabel>Local Folders</guilabel> folder in the folder list with Inbox/Outbox/Trash/Drafts/&etc; subfolders and &kmail; keeps putting mails there, especially sent mails. 0304 </para> 0305 <para>The problem is that certain folders are marked as special folders (system folders) and if you don't have them, &kmail; cannot operate correctly. That is the reason why it keeps re-creating that folder. 0306 </para> 0307 <para>At this time there is no easy way to change this in the UI for all types of special folders. Here is what you can do: 0308 </para> 0309 <orderedlist> 0310 <listitem><para>The <emphasis>Sent-Mail, Drafts and Templates</emphasis> folder is configurable for each identity. Go to <menuchoice><guimenu>Settings</guimenu><guisubmenu>Configure KMail</guisubmenu><guimenuitem>Identities</guimenuitem></menuchoice>, select your identity, click on <guilabel>Modify</guilabel>, go to the <guilabel>Advanced</guilabel> tab and set the folders to point to the right place.</para></listitem> 0311 <listitem><para>The default <emphasis>Inbox</emphasis> is configurable for each POP3 account. Go to <menuchoice><guimenu>Settings</guimenu><guisubmenu>Configure KMail</guisubmenu><guimenuitem>Account</guimenuitem></menuchoice>, select your POP3 account, click on <guilabel>Modify</guilabel> go to the <guilabel>Advanced</guilabel> tab and set the <guilabel>Destination folder</guilabel>.</para></listitem> 0312 <listitem><para>For IMAP accounts you can configure the <emphasis>Trash</emphasis> folder. Do as above. The setting name is <emphasis>Trash folder</emphasis>.</para></listitem> 0313 <listitem><para>The most problematic part is the <emphasis>Outbox</emphasis>. First, locate <filename>specialmailcollectionsrc</filename> in your &kde; configuration directory (<filename>$HOME/.kde4/share/config</filename> or similar). It contains something like this:</para></listitem> 0314 </orderedlist> 0315 <para><userinput> 0316 [SpecialCollections] 0317 DefaultResourceId=akonadi_maildir_resource_0</userinput> 0318 </para> 0319 <para>Now start <application>akonadiconsole</application>, on the <guilabel>Agents</guilabel> tab locate your local account for your <emphasis>Outbox</emphasis> folder, click on it and note the identifier that appears in the lower part (<replaceable>akonadi_maildir_resource_XXX</replaceable> or similar). Put this identifier in the above shown <filename>specialmailcollectionsrc</filename>, by replacing the existing one. 0320 </para> 0321 <para>After that restart <application>akonadi</application> (you can do from the <application>akonadiconsole</application>, <menuchoice><guimenu>Server</guimenu><guimenuitem>Restart Server</guimenuitem></menuchoice> or from command line with: 0322 </para> 0323 <para><userinput>akonadictl restart</userinput> 0324 </para> 0325 <para>Now remove the <guilabel>Local Folders</guilabel> that you don't want to use anymore. 0326 </para> 0327 <para>If it keeps reappearing and the <guilabel>Mail Dispatcher Agent</guilabel> still crashes, you need to do one more thing in <application>akonadiconsole</application>. Go to the <guilabel>Browser</guilabel> tab, find the outbox you <emphasis>want</emphasis> to use, right click on it, select <guilabel>Folder Properties</guilabel>, <guilabel>Attributes</guilabel> tab, enter <userinput>SpecialCollectionAttribute</userinput> then click <guilabel>Add</guilabel>, double click on the <guilabel>Value</guilabel> near the <guilabel>SpecialCollectionAttribute</guilabel> and enter <userinput>outbox</userinput>. Add also another attribute, the attribute name has to be <guilabel>ENTITYDISPLAY</guilabel> and the value <userinput>("outbox" "mail-folder-outbox" "" ())</userinput> (just copy paste from here). Restart <application>akonadi</application> and now you should be able to remove completely the unneeded local folder account. 0328 </para> 0329 </sect1> --> <!-- This section removed 8/8/2021. --> 0330 0331 <sect1 id="unable-to-fetch-item-from-backend"> 0332 <title>"Unable to Fetch Item from Backend" When Entering &IMAP; Folder</title> 0333 0334 <para>There are at least two possible reasons for this. Here are some workarounds.</para> 0335 0336 <variablelist> 0337 <varlistentry> 0338 <term>Workaround 1</term> 0339 <listitem> 0340 <itemizedlist> 0341 <listitem><para>edit <filename>~/.local/share/akonadi/mysql.conf</filename></para></listitem> 0342 <listitem><para>Under the <guilabel>[mysql]</guilabel> section, add: <userinput>binlog_format=row</userinput></para></listitem> 0343 </itemizedlist> 0344 <para>If this does not work, try workaround 2 (below).</para> 0345 </listitem> 0346 </varlistentry> 0347 0348 <varlistentry> 0349 <term>Workaround 2</term> 0350 <listitem> 0351 <para>This one is a matter of restarting so &kmail; can fetch those pesky items. Some possible steps include:</para> 0352 <para>Use <keycombo>&Alt;<keycap>F2</keycap></keycombo> (&krunner;) or &konsole; to type <userinput><command>kquitapp 0353 kmail</command></userinput> , then wait a minute, then <userinput><command>akonadictl stop</command></userinput> . Wait 0354 a minute, type <userinput><command>akonadictl start</command></userinput> , wait a minute, then type <userinput> 0355 <command>kmail</command></userinput> . This stops &kmail; (closing <emphasis>all</emphasis> windows), stops the &kmail; 0356 backend, restarts the &kmail; backend, and restarts &kmail;. Having a working internet connection increases the chances 0357 of success. Sometimes, you can also just do <userinput><command>kquitapp kmail</command></userinput> , wait a minute, and 0358 then start &kmail; again. Often, a few restarts seem to be needed. It is unclear what causes this error, but on bad 0359 network connections it is more likely to happen. 0360 </para> 0361 </listitem> 0362 </varlistentry> 0363 </variablelist> 0364 <para>See also <link linkend="your-mails-are-not-being-sent">the next topic</link> to learn how 0365 <application>akonadiconsole</application> can be helpful.</para> 0366 </sect1> 0367 0368 <sect1 id="your-mails-are-not-being-sent"> 0369 <title>Your Emails Are Not Being Sent, Without Error Messages</title> 0370 0371 <para>If &kmail; does not send mail without saying anything, the <quote>agent</quote> responsible for dispatching 0372 messages may be stuck. Of course, you should first verify you have proper network connectivity so mail can be sent!</para> 0373 0374 <para>To remedy this, it might help to abort the current action and restart it. First, quit &kmail; by using &krunner; 0375 (<keycombo>&Alt;<keycap>F2</keycap></keycombo>) or &konsole; and typing: <userinput><command>kquitapp kmail</command></userinput> . 0376 Note that a normal <keycombo>&Alt;<keycap>F4</keycap></keycombo> or <menuchoice><guimenu>File</guimenu><guimenuitem>Quit</guimenuitem> 0377 </menuchoice> does <emphasis>not</emphasis> do the trick! Wait a minute, then start &kmail; again. Now start 0378 <application>akonadiconsole</application> using &krunner; (<keycombo>&Alt;<keycap>F2</keycap></keycombo>) or &konsole;. Go to the 0379 <guilabel>Mail Dispatcher Agent</guilabel> (under the <guilabel>Agents</guilabel> tab), do a right-click, and abort the current action. 0380 You will most likely get some error messages popping up. Now go back to &kmail; and choose <menuchoice><guimenu>File</guimenu> 0381 <guimenuitem>Send Queued Messages</guimenuitem></menuchoice>. Now it might work. If not, instead of aborting the current action, 0382 try toggling the offline/online status of the <guilabel>Mail Dispatcher Agent</guilabel> (same context menu) or restarting things 0383 as mentioned in workaround 2 of <link linkend="unable-to-fetch-item-from-backend"> the previous topic</link>.</para> 0384 0385 <para><note><para>akonadiconsole can be quite helpful for a number of situations because it shows all the <quote>agents</quote>, 0386 the separate components of the &kmail; backend. You can stop and start them, put them in offline mode, abort ongoing actions &etc;. 0387 It can be very helpful when &kmail; is acting cranky.</para></note></para> 0388 0389 <para>Sometimes the <guilabel>Mail Dispatcher Agent</guilabel> fails to function because the dbus daemon (a system-level 0390 facility for inter-process communications) is not functioning correctly. Your best bet in this circumstance is simply to 0391 reboot the system. The dbus daemon is one of the first processes started when you log in to the &kde; desktop, so it 0392 cannot be easily stopped and restarted. The whole &plasma; environment depends on it.</para> 0393 0394 </sect1> 0395 0396 <sect1 id="resource-conflict-error"> 0397 <title>"Unable to Fetch Item from Backend ... [LRCONFLICT]"</title> 0398 0399 <para>This problem is directly related to <ulink url="https://bugs.kde.org/show_bug.cgi?id=283682">&akonadi; bug #283682</ulink>, 0400 which has been a thorn in the side of &kmail; since October, 2011. There is a timing / co-ordination problem with asynchronous 0401 processing of message filters. Once in a while, a filter rule that moves messages to a different folder "hiccups", and produces 0402 more than one database entry for a message that has been moved. When you try to open the second copy of such a message, the error 0403 message "Unable to fetch item from backend ...[LRCONFLICT]" appears. Such phantom messages cannot be deleted or moved to trash 0404 using &kmail;'s built-in functions. But you <emphasis>can</emphasis> get rid of them. Here's how you do it.</para> 0405 0406 <procedure> 0407 <step><para>First, exit the &kmail; program. This may not be necessary, but better safe than sorry.</para></step> 0408 0409 <step><para>You can learn how many corrupted messages are present by using <code>akonadictl</code>. 0410 <screen>~ $ akonadictl fsck 2>&1 | grep ^Found 0411 Found 6 external files. 0412 Found 6 external parts. 0413 Found no unreferenced external files. 0414 Found 0 parts to be moved to external files 0415 Found 0 parts to be moved to database 0416 Found 6 collections without RID. 0417 Found 9 items without RID. 0418 Found 0 dirty items.</screen> <!-- Can't indent here ... messes up the output. --> 0419 In this instance, there are nine duplicated messages (without RID).</para> 0420 <para> </para><!-- add whitespace --></step> 0421 0422 <step><para>You need to know how to connect directly to the mysql server. Use the <code>ps</code> and 0423 <code>grep</code> commands to do this. 0424 <screen>~ $ ps ux | grep mysql 0425 david 8788 0.2 0.9 3736292 153936 ? Sl 06:45 0:16 /usr/sbin/mysqld 0426 --defaults-file=/home/david/.local/share/akonadi/mysql.conf 0427 --datadir=/home/david/.local/share/akonadi/db_data/ 0428 --socket=/run/user/1000/akonadi/mysql.socket 0429 --pid-file=/run/user/1000/akonadi/mysql.pid 0430 david 24275 0.0 0.0 8056 2144 pts/1 S+ 08:24 0:00 grep --colour=auto mysql</screen></para> 0431 <para> </para><!-- add whitespace --></step> 0432 0433 <step><para>Invoke the mysql server program using the socket information from step 3 and issue three mysql 0434 commands, as illustrated below. 0435 <screen>~ $ mysql --socket=/run/user/1000/akonadi/mysql.socket <== 0436 Welcome to the MariaDB monitor. Commands end with ; or \g. 0437 Your MariaDB connection id is 114 0438 Server version: 10.5.10-MariaDB Source distribution 0439 0440 Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. 0441 0442 Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. 0443 0444 MariaDB [(none)]> use akonadi; <== 0445 Reading table information for completion of table and column names 0446 You can turn off this feature to get a quicker startup with -A 0447 0448 Database changed 0449 MariaDB [akonadi]> delete from pimitemtable where remoteid is NULL; <== 0450 Query OK, 9 rows affected (0.003 sec) 0451 0452 MariaDB [akonadi]> \q <== 0453 Bye</screen> 0454 The three mysql commands are "use akonadi;", "delete from pimitemtable where remoteid is NULL;", and "\q". After you 0455 say "mysql --socket= ..." you will be in a dialog with the mysql server (aka "MariaDB"), which provides a > prompt. 0456 The entire dialog is presented here, for clarity. User input lines are marked with <== in the preceding 0457 illustration.</para></step> 0458 0459 </procedure> 0460 0461 <para>When you restart &kmail;, those pesky duplicate messages will be gone. They were merely phantoms caused by the NULL 0462 pointers in the mysql database tables.</para> 0463 0464 </sect1> 0465 0466 <sect1 id="cleaning-aux-storage"> 0467 <title>Keeping &kmail;'s Auxiliary Storage Areas Clean</title> 0468 0469 <para>&kmail; stores data in several different places on your machine. Most of these places are inside the 0470 <filename>~/.local/share/</filename> directory somewhere. For instance, on most Linux distros, your 0471 <guilabel>Local Folders</guilabel> are in <filename>~/.local/share/local-mail/</filename> . &akonadi; stores 0472 most of its data in <filename>~/.local/share/akonadi/</filename> . 0473 <screen>~ $ cd .local/share/akonadi 0474 ~/.local/share/akonadi $ ls 0475 Akonadi.error db_data file_db_data mysql.conf socket-localhost-default 0476 Akonadi.error.old db_misc file_lost+found search_db 0477 </screen></para> 0478 0479 <para><filename>Akonadi.error</filename> and <filename>Akonadi.error.old</filename> are log files that are created 0480 whenever &akonadi; stops and restarts. Text file <filename>mysql.conf</filename> is a configuration file for 0481 the mysqld daemon that serves as &akonadi;'s backend. The two directories <filename>db_data</filename> and 0482 <filename>search_db</filename> contain the actual mysql database tables. There are also a couple of mysql 0483 log files in <filename>db_data</filename> that might be helpful if and when &akonadi; acts up.</para> 0484 0485 <para>The two directories <filename>file_db_data</filename> and <filename>file_lost+found</filename> contain auxiliary 0486 data associated with asynchronous processing. &akonadi; does not automatically clean out the 0487 <filename>file_lost+found</filename> directory, so you may wish to clean those files up manually from time to time 0488 (⪚, with &dolphin;). &akonadi; does try to clean the <filename>file_db_data</filename> directory out after it has merged 0489 everything into the main database files, but sometimes junk piles up in there. Use this command 0490 <screen>find .local/share/akonadi/file_db_data/ -type f | xargs rm</screen> to fix this when it happens. (If the directory 0491 <filename>file_db_data</filename> is already clean, the "find" command shown above will return an error.)</para> 0492 0493 </sect1> 0494 0495 <sect1 id="dealing-with-dirt"> 0496 <title>Correcting &kmail;'s "Dirty" Items</title> 0497 0498 <para>This problem is directly related to <ulink url="https://bugs.kde.org/show_bug.cgi?id=436550">&akonadi; bug #436550</ulink>, 0499 which was reported in April, 2021. It results from the "dirty" items occasionally found by <code>akonadictl fsck</code>. 0500 <screen>~ $ akonadictl fsck 2>&1 | grep ^Found 0501 Found 5 external files. 0502 Found 5 external parts. 0503 Found no unreferenced external files. 0504 Found 0 parts to be moved to external files 0505 Found 0 parts to be moved to database 0506 Found 6 collections without RID. 0507 Found 0 items without RID. 0508 Found 750 dirty items.</screen> <!-- Can't indent here ... messes up the output. --> 0509 </para> 0510 0511 <para>The "dirty" flag on an item in pimitemtable (one of the tables in the &akonadi; database) is used to control certain 0512 aspects of asynchronous processing. It is set true when there are operations pending for a particular email message. Most 0513 of the time, the "dirty" flag is cleared one or two seconds later, when the once pending operation finishes up.</para> 0514 0515 <para>Occasionally, for reasons that are not entirely clear, the "dirty" flag can get set on dozens or even hundreds of 0516 messages all at once, as illustrated above. When this happens, the automatic clearing mechanism gets stuck, and is unable 0517 to repair itself automatically. The primary reason for a "dirty" item in this circumstance is that the field "remoteid" 0518 is not set correctly, making retrieval of a "dirty" message impossible in &kmail;. The message still exists on the disk. 0519 But &kmail; can't find it.</para> 0520 0521 <para>There ought to be a better way to correct this problem. If you think of a better way, please let the authors know about 0522 it, so this documentation can be improved. The following procedure will at least correct the database errors. But it does 0523 entail a lot of work.</para> 0524 0525 <procedure> 0526 <step><para>Exit &kmail; and stop the &akonadi; server with a terminal command: <code>akonadictl stop</code> .</para></step> 0527 0528 <step><para>Make a backup copy of all your email messages. You may be able to use <ulink url="help:/pimdataexporter">PIM 0529 Data Exporter</ulink> for this purpose. Or you may use &ark; to make an archive, or &dolphin; to make a second copy of 0530 <filename>~/.local/share/local-mail/</filename> somewhere else on your hard disk. If you're adventurous, you might just 0531 rename your local folders directory to something like <filename>local-mail-save</filename> . But it's safer to be sure 0532 you have a backup copy of your messages before you proceed.</para></step> 0533 0534 <step><para>You should also make a backup copy of any filters you have created, and make sure you know how to restore any 0535 custom <guilabel>Sent mail folder</guilabel>, <guilabel>Drafts folder</guilabel>, or <guilabel>Templates folder</guilabel> 0536 entries associated with your &kmail; identities. The next step will remove all your personally customized mail folders, 0537 and you will need to patch some stuff up after &akonadi; rebuilds its database tables.</para></step> 0538 0539 <step><para>Now delete all the folders inside of the directory <filename>local-mail</filename>, or rename that directory 0540 to something like <filename>local-mail-save</filename> . Then start the &kmail; program. This will force &akonadi; to 0541 erase all the database table entries associated with email messages. You will see your old folder names, briefly, but these 0542 will disappear when &akonadi; finishes deleting all the "dirty" items (and all the clean ones, too).</para></step> 0543 0544 <step><para>Exit &kmail; and stop the &akonadi; server as explained in step 1, then restore the backup copy of your messages 0545 (created in step 2) to the <filename>~/.local/share/local-mail/</filename> directory.</para></step> 0546 0547 <step><para>Start &kmail; up again, and force &akonadi; to re-sync the database. The easiest way to do this is to <menuchoice> 0548 <shortcut><keycombo action="simul">&Ctrl;<keycap>L</keycap></keycombo></shortcut><guimenu>File</guimenu><guimenuitem>Check 0549 Mail</guimenuitem></menuchoice>; &akonadi; automatically re-syncs all the folders when it fetches mail. This will take several 0550 minutes to complete, depending on how many messages you have saved in your &kmail; folders. But when the process is complete 0551 all the "dirty" items will be gone.</para></step> 0552 0553 <step><para>Finally, you will want to restore your mail filter rules backed up in step 3, and check that all the custom folder 0554 items (<guilabel>Sent mail folder</guilabel>, &etc;) for your identities are set the way you want them. You will also need 0555 to reset any custom folder properties you had set up, and you will probably have a bunch of spurious "Unread Message" 0556 notifications to deal with. But your &akonadi; database tables will be all clean and shiny once again!</para></step> 0557 0558 </procedure> 0559 0560 0561 </sect1> 0562 0563 0564 </chapter>