All mail accounts lost in mail app

REPRODUCIBILITY: 100% (always)
OSVERSION: 4.6.0.15
HARDWARE: Sony Xperia 10 II - Dual SIM - xqau52 - xqau52 - 1.0.0.16 - aarch64
UI LANGUAGE: Deutsch (user: de_DE, os: de_DE.utf8)
REGRESSION: not specified

DESCRIPTION:

Suddenly the mail app claims that no mail account is created, even all three accounts are still visible in the settings app and I still get notifications for new mails. I tried a reboot but after that even the notifications are missing now. If I start the mail app I see the following in journalctl:

Jan 03 13:44:07 Xperia10II-DualSIM jolla-email[7677]: _ag_manager_exec_query: runtime error while executing "SELECT key, type, value FROM Settings W
HERE account = 19 AND service = 0": database disk image is malformed
Jan 03 13:44:07 Xperia10II-DualSIM jolla-email[7677]: _ag_manager_exec_query: runtime error while executing "SELECT DISTINCT Services.name FROM Serv
ices JOIN Settings ON Settings.service = Services.id WHERE Settings.key='enabled' AND Settings.value='true' AND Settings.account='19' AND Services.t
ype = 'e-mail';": database disk image is malformed
Jan 03 13:44:07 Xperia10II-DualSIM jolla-email[7677]: _ag_manager_exec_query: runtime error while executing "SELECT key, type, value FROM Settings W
HERE account = 15 AND service = 0": database disk image is malformed
Jan 03 13:44:07 Xperia10II-DualSIM jolla-email[7677]: _ag_manager_exec_query: runtime error while executing "SELECT DISTINCT Services.name FROM Serv
ices JOIN Settings ON Settings.service = Services.id WHERE Settings.key='enabled' AND Settings.value='true' AND Settings.account='15' AND Services.t
ype = 'e-mail';": database disk image is malformed
Jan 03 13:44:07 Xperia10II-DualSIM jolla-email[7677]: _ag_manager_exec_query: runtime error while executing "SELECT key, type, value FROM Settings W
HERE account = 13 AND service = 0": database disk image is malformed
Jan 03 13:44:07 Xperia10II-DualSIM jolla-email[7677]: _ag_manager_exec_query: runtime error while executing "SELECT DISTINCT Services.name FROM Serv
ices JOIN Settings ON Settings.service = Services.id WHERE Settings.key='enabled' AND Settings.value='true' AND Settings.account='13' AND Services.t
ype = 'e-mail';": database disk image is malformed

PRECONDITIONS:

STEPS TO REPRODUCE:

  1. Start the mail app from the app grid

EXPECTED RESULTS:

All mail accounts are visible in the mail app

ACTUAL RESULTS:

No mail accounts are visible in the mail app

MODIFICATIONS:

  • Patchmanager: yes
  • OpenRepos: yes
  • Chum: yes
  • Other: none specified

ADDITIONAL INFORMATION:

Device Owner User: defaultuser
Home Encryption: enabled

the initial version of this bug report was created using Bugger 0.9.13+git2

I investigated further: the database in this case can be found in /home/defaultuser/.local/share/system/privileged/Accounts/libaccounts-glib/accounts.db, you have to be privileged (devel-su -p) to get access to it. Opening it with sqlite3 (zypper install sqlite) I get the same error message then accessing the table Settings.

I followed roughly the sqlite documentation for such cases, so I created a dump of the database and then trying to import it into a new database I see a problem with a unique index for that table. I commented that index creation in the dump, analyzed the content and noticed that for one account enabled is set two times and name even three times (select account, service, key, count(*) as c from Settings group by account, service, key having c > 1;). After removing the duplicates and uncommenting the index creation I could import the dump successfully, so I removed the accounts.db* files from the libaccounts-glib folder and used sqlite3 to create a new database importing the dumb. After rebooting the phone the mail app started to work again.

Without SQL knowledge and developer mode I wouldn’t be able to fix such a problem, so there should be a possibility to recover from such a state in an easy way.

1 Like

It looks like you’re not alone: [4.4] Lost all mail accounts