Bug 358516

Summary: KActivities: Database can not be opened in WAL mode. Check the SQLite version (required >3.7.0).
Product: [Unmaintained] kactivitymanagerd Reporter: vst <slava18+bugs>
Component: generalAssignee: Ivan Čukić <ivan.cukic>
Status: RESOLVED FIXED    
Severity: crash CC: ephemient, plasma-bugs-null
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description vst 2016-01-25 03:25:18 UTC
From .xsession-errors, keeps crashing several times a day:

KActivities: Database can not be opened in WAL mode. Check the SQLite version (required >3.7.0). And whether your filesystem supports shared memory
Application::crashHandler() called with signal 6; recent crashes: 1
KCrash: Application 'plasmashell' crashing...
KCrash: Attempting to start /usr/lib/drkonqi from kdeinit
Service started, version: 
KActivities: FATAL ERROR: Failed to contact the activity manager daemon

Plasma 5 behaves very strangely (i.e. I cannot open a right-click menu on Kicker items, crashes plasma). I suspect it's because of the above errors.

Removing .local/share/kactivitymanagerd/ does not help.

Reference in Archlinux Bugs: https://bugs.archlinux.org/task/47473

Reproducible: Sometimes
Comment 1 Ivan Čukić 2016-01-25 17:13:48 UTC
Which version of sqlite do you have?
What filesystem do you use for $HOME?
Comment 2 vst 2016-01-26 06:30:51 UTC
sqlite 3.10.2-1

/dev/mapper/slvg-home on /home type ext4 (rw,relatime,data=ordered)
(ext4 on LVM on LUKS)
Comment 3 Ivan Čukić 2016-01-26 06:40:10 UTC
Maybe luks kills the fs shared memory.

Can you do the following:

cd ~/.local/share/kactivitymanagerd/resources
sqlite3 dbtest
pragma journal_mode;
pragma journal_mode=wal;

and post the output?
Comment 4 vst 2016-01-26 06:54:05 UTC
[vst@host ~]$ cd ~/.local/share/kactivitymanagerd/resources
[vst@host resources]$ sqlite3 dbtest
SQLite version 3.10.2 2016-01-20 15:27:19
Enter ".help" for usage hints.
sqlite> pragma journal_mode;
delete
sqlite> pragma journal_mode=wal;
wal
sqlite>
Comment 5 Ivan Čukić 2016-01-26 06:57:31 UTC
Fun :)

Next test - the same, but with the already existing database:

cd ~/.local/share/kactivitymanagerd/resources
sqlite3 database
pragma journal_mode;
pragma journal_mode=wal;
Comment 6 vst 2016-01-26 07:01:10 UTC
[vst@host ~]$ cd ~/.local/share/kactivitymanagerd/resources
[vst@host resources]$ sqlite3 database
SQLite version 3.10.2 2016-01-20 15:27:19
Enter ".help" for usage hints.
sqlite> pragma journal_mode;
Error: database disk image is malformed
sqlite> pragma journal_mode=wal;
Error: database disk image is malformed
sqlite>
Comment 7 Ivan Čukić 2016-01-26 07:11:09 UTC
> Error: database disk image is malformed

Ok. Something is corrupting the database - and since you have previously deleted the .local/share/kactivitymanagerd, it is happening always.

Can you stop kactivitymanagerd, plasma and friends, and create kamd_share directory on a non-luks filesystem, and create a symbolic link to ~/.local/share/kactivitymanagerd and start kactivitymanagerd again?
Comment 8 vst 2016-01-30 18:23:15 UTC
Checked, the same. I created your suggested directory on /boot which is plain ext4 on disk.
I rebooted the pc, did the symlink from a vt, then launched kde. So it was as clean as it could be.

[vst@host ~]$ ls -l .local/share/kactivitymanagerd
lrwxrwxrwx 1 root root 16 Jan 30 .local/share/kactivitymanagerd -> /boot/kamd_share
[vst@host ~]$ ls -ld /boot/kamd_share/
drwxr-xr-x 3 vst users 4096 Jan 30 /boot/kamd_share/
[vst@host ~]$ tree /boot/kamd_share/
/boot/kamd_share/
└── resources
    └── database

1 directory, 1 file
[vst@host ~]$ sqlite3 /boot/kamd_share/resources/database
SQLite version 3.10.2 2016-01-20 15:27:19
Enter ".help" for usage hints.
sqlite> .tables
Error: database disk image is malformed
sqlite>
Comment 9 vst 2016-03-28 21:16:28 UTC
Upgraded to KDE 5.6.0, issue persists.
Comment 10 vst 2016-04-29 08:04:39 UTC
Hi Ivan, I've fixed the issue by recreating my home directory and starting with a fresh KDE configuration. Currently on KDE 5.6.3 and the issue is resolved. Thanks for your help.
Comment 11 Ivan Čukić 2016-05-02 20:27:04 UTC
Cool, glad it got fixed, though it would be nicer if we knew the reason why sqlite refused to create a wal database.