deltachat-core-rust icon indicating copy to clipboard operation
deltachat-core-rust copied to clipboard

SQLite error 3850 when exporting backup

Open link2xt opened this issue 1 year ago • 11 comments

User reports that Delta Chat desktop 1.46.5 installed from flathub fails to export backups into home directory. The error is displayed in a toast: "IMEX failed to complete: could not export database: failed to attach backup database: disk I/O error: Error code 3850: I/O error in the advisory file locking layer". The whole home directory has eCryptfs mounted from ~/.Private into ~. Underlying filesystem is ext4.

I have tried the same version of Delta Chat desktop from flathub and it successfully exports backups. I don't use ecryptfs though.

I have tried to reproduce the error by installing ecryptfs-utils, running modprobe ecryptfs, creating a new ~/.Private with ecryptfs-setup-private --nopwcheck --noautomount and mounting with ecryptfs-mount-private. Delta Chat desktop then successfully exports backup into ~/Private even if I run desktop with XDG_CONFIG_HOME=$HOME/Private/config to place account folder into ecryptfs as well.

I have not tried to run Delta Chat desktop inside flatpak and exporting into ecryptfs. Maybe there is some bad interaction between flatpak and ecryptfs. If this does not fails as well then I don't know how to reproduce the problem.

link2xt avatar Aug 30 '24 20:08 link2xt

This ecryptfs bugreport suggests ecryptfs implements advisory posix locks without forwarding to the underlying filesystem: https://bugs.launchpad.net/ecryptfs/+bug/2012301

link2xt avatar Aug 30 '24 21:08 link2xt

I use ecryptfs over btrfs with options rw,nosuid,nodev,relatime,ecryptfs_sig=[...],ecryptfs_fnek_sig=[...],ecryptfs_cipher=aes,ecryptfs_key_bytes=16,ecryptfs_unlink_sigs,user, just made a successful backup export from DC Desktop 1.46.6. Both the account folder and backup target folder are on ecryptfs.

iequidoo avatar Aug 30 '24 21:08 iequidoo

Looking at eCryptfs source code at https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/ecryptfs, does not look like it cares about file locks at all. POSIX locks are probably handled independent of the FS and there is nothing special about eCryptfs.

Maybe probem is something else depending on the OS distribution used. Could be AppArmor or something like this, don't know.

link2xt avatar Aug 30 '24 21:08 link2xt

I even tried installing from flatpak and exporting into mounted Private/ folder with eCryptfs, it works.

link2xt avatar Sep 04 '24 18:09 link2xt

Heyyy, first of all this is the first time I'm writing an bug report and I'm not super much into tech stuff, but a friend recommended me to write here. So I basically have the same problem. Everytime I try to export a backup it says: "IMEX failed to complete: could not export database: failed to attach backup database: disk I/O error: Error code 3850: I/O error in the advisory file locking layer"

I'm using Linux Mint 23.1 Cinnamon on my Laptop and Delta Chat Desktop 1.46.8 (git: flathub).

If you have any questions to me that might help to solve the problem, just ask.

Matschepampe1312 avatar Sep 14 '24 17:09 Matschepampe1312

@Matschepampe1312, so you don't use eCryptfs? Could you run smth like flock -x local-lock-file echo 'a b c'? Better from the directory where you are trying to export a backup to. And maybe from the directory where you have the Delta Chat db as well.

iequidoo avatar Sep 14 '24 23:09 iequidoo

Original problem was also reported for Linux Mint btw, so maybe there is something special about Linux Mint in contrast to e.g. Ubuntu.

link2xt avatar Sep 15 '24 03:09 link2xt

@iequidoo Tbh I don't even know what eCrypfs is. But I do have a .ecryptfs directory. But I don't know what its for or what its doing. Like I said I'm not super much into tech stuff. I tried the comand anyways but still cant export the backup, still shows the same thing as before when I tried.

Matschepampe1312 avatar Sep 15 '24 07:09 Matschepampe1312

Ok, it seems that Linux Mint uses eCryptfs for /home encryption if the user chooses this kind of encryption during the installation. Or used it in the past and now just supports it. @Matschepampe1312, but what was the command output, did it print a b c or smth else? Also, could you try to export a backup to another location, e.g. to your root directly (it shouldn't be eCryptfs-encrypted)?

iequidoo avatar Sep 15 '24 19:09 iequidoo

You can try exporting backup to /tmp

link2xt avatar Sep 15 '24 21:09 link2xt

@iequidoo Yes it prints a b c . I also tried to export it to another location but it still doesnt work. @link2xt Also doesnt work exporting it to /tmp

Matschepampe1312 avatar Oct 11 '24 06:10 Matschepampe1312

actionable item is to install most recent Linux Mint (in a virtual machine) with eCryptfs enabled on installation (probably sth as "Encrypt Home Dir", install Delta and check if backup is working or not.

otherwise use defaults and also do not do/install anything special, @Matschepampe1312 reported to not even know about eCryptfs.

some time has passed since original report, maybe it is already working, otherwise, we are actionable to get a log or so and can see if further investigation are worth the effort

r10s avatar Oct 13 '25 21:10 r10s