akonadi
Contents
About
Upgrade Postgres
Trouble Shooting
collation version mismatch
If on akonadictl restart you receive the following error
1 WARNING: database "postgres" has a collation version mismatch
2 DETAIL: The database was created using collation version 2.36, but the operating system provides version 2.40.
3 TIP: Rebuild all objects in this database that use the default collation and run ALTER DATABASE postgres REFRESH COLLATION VERSION, or build PostgreSQL with the right library version.
Fix refresh collation version
1 % ls -l ~/.local/share/akonadi/socket-$HOSTNAME-default
2 lrwxrwxrwx 1 tobias tobias 22 27. Jan 09:52 /home/tobias/.local/share/akonadi/socket-libertas-default -> /run/user/1000/akonadi
3
4 % psql -h ~/.local/share/akonadi/socket-$HOSTNAME-default -d akonadi
5 psql (17.2 (Debian 17.2-1+b2), Server 16.6 (Debian 16.6-1.pgdg130+1))
6 Geben Sie »help« für Hilfe ein.
7
8 akonadi=# ALTER DATABASE postgres REFRESH COLLATION VERSION;
9 NOTICE: changing version from 2.36 to 2.40
10 ALTER DATABASE
11 akonadi=#
12 \q
13 %
Xapian error DatabaseCorruptError
If you cannot search your email, contacts, … there is probably a problem with the xapian indexes, which are located in the sub-directories of
~/.local/share/akonadi/search_db
Verify
To verify open akonadiconsole in a shell (to get the log information written to STDOUT). Chose tab "Item Search" and select the store in my case "Email" An error is risen and on clicking "OK" akonadiconsole terminates with SIGABRT (6).
DatabaseCorruptError: Expected block 512 to be level 2, not 0
The info logged to in the shell states
postlist.glass seems to be 32TiB in size. There may be something wrong.
1 % ls -lh ~/.local/share/akonadi/search_db/email
2 insgesamt 534M
3 -rw-r--r-- 1 tobias tobias 12M 22. Mär 2024 docdata.glass
4 -rw-r--r-- 1 tobias tobias 0 25. Jan 10:26 flintlock
5 -rw-r--r-- 1 tobias tobias 140 11. Mär 2024 iamglass
6 -rw-r--r-- 1 tobias tobias 32T 11. Mär 2024 postlist.glass
7 -rw-r--r-- 1 tobias tobias 257M 24. Mär 2024 termlist.glass
Fix
First make sure you have xapian-check available.
On Debian install
1 aptitude install xapian-tools
Stop akonadi
1 akonadictl stop
Create a backup
1 cp -pr ~/.local/share/akonadi/search_db/email{,_bak}
Analyze the database (no change)
1 % xapian-check ~/.local/share/akonadi/search_db/email
2 Database couldn't be opened for reading: DatabaseCorruptError: Expected block 512 to be level 2, not 0
3 Continuing check anyway
4 docdata:
5 blocksize=8K items=69147 firstunused=1388 revision=16615 levels=2 root=28
6 B-tree checked okay
7 docdata table structure checked OK
8
9 termlist:
10 blocksize=8K items=138456 firstunused=31862 revision=16615 levels=2 root=21246
11 xapian-check: DatabaseError: Block 2208: Used block also in freelist
Fix a database with xapian-check - didn't work out.
1 % xapian-check ~/.local/share/akonadi/search_db/email F
2 Database couldn't be opened for reading: DatabaseCorruptError: Expected block 512 to be level 2, not 0
3 Continuing check anyway
4 docdata:
5 B-tree checked okay
6 docdata table structure checked OK
7
8 termlist:
9 xapian-check: DatabaseError: Block 2208: Used block also in freelist
I found no way to recover the broken file. The only solution I found was
- stop akonadi,
1 akonadictl stop
- delete the entire directory,
1 rm -r ~/.local/share/akonadi/search_db/email
- start akonadi
1 akonadictl start
- fix the permissions
- re-index the email
- Email is generally indexed, when the item is retrieved, but touching everything is odd.
- Automatic indexing
- Open the folder-properties of your inbox
- Select the right most tab "Maintenance"
- There should be a button "Reindex Folder"
- If yes:
Open akonadiconsole
- Press the button
Monitor the progress in akonadiconsole
- Wait patiently (takes a while)
- If not:
Open akonadiconsole
- Enable local mailbox synchronization in:
Properties > Configure KMail …
Accounts > Receiving > $YOUR_ACCOUNT > General
- Check if the button is available now
- If yes:
Could not create collection trash, resourceid
Kmail/Kontact crashes
Open akonadiconsole
Tab DB-Browser: * Select 'resourcetable' and match the resourceid (9) -> akonadi_maildir_resource_0 * Select 'collectiontable ', sort by resourceid -> trash * "Local folders" are located in ~/.local/share/local-mail
FIX
There are probably ways to fix the maildir, but for trash it's probably okay to move it away (and later discard it).