# Error while exporting backup in order to add a secondary device \[3850 I/O error in advisory file locking - setlk on xdg-document-portal of Debian 12\]

**URL:** <https://forum.delta.chat/t/error-while-exporting-backup-in-order-to-add-a-secondary-device-3850-i-o-error-in-advisory-file-locking-setlk-on-xdg-document-portal-of-debian-12/5761>\
**Category:** Mutual Help\
**Tags:** solved, core, desktop\
**Created:** [September 8, 2026, 5:49pm UTC](https://forum.delta.chat/t/error-while-exporting-backup-in-order-to-add-a-secondary-device-3850-i-o-error-in-advisory-file-locking-setlk-on-xdg-document-portal-of-debian-12/5761 "2026-09-08T17:49:25Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![bleb](https://forum.delta.chat/letter_avatar_proxy/v4/letter/b/c77e96/32.png) [@bleb](https://forum.delta.chat/u/bleb)\
**Post date:** [September 8, 2026, 5:49pm UTC](https://forum.delta.chat/t/error-while-exporting-backup-in-order-to-add-a-secondary-device-3850-i-o-error-in-advisory-file-locking-setlk-on-xdg-document-portal-of-debian-12/5761/1 "2026-09-08T17:49:26Z")

</div>

I have Delta Chat on my desktop and I am trying to add it to my laptop. The QR code workflow does not work for me as neither device has a camera. I started following the “manual transfer” process [here](https://delta.chat/en/help#backup) and a progress meter flashes very briefly before closing, then I see a red overlay with this error message: **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 am running Debian with a window manager started via `exec dbus-run-session cwm` in my `.xinitrc`. Delta Chat is installed through flatpak and run with `flatpak run chat.delta.desktop`. When I get the error nothing is printed in the terminal from which the command is run.

Any help is appreciated! I’m about to go on a week-long trip and I was really hoping to be able to access Delta Chat while I’m away.

---

<div class="post-metadata">

**Author:** ![ian](https://forum.delta.chat/user_avatar/forum.delta.chat/ian/32/3164_2.png) [@ian](https://forum.delta.chat/u/ian)\
**Post date:** [September 8, 2026, 6:48pm UTC](https://forum.delta.chat/t/error-while-exporting-backup-in-order-to-add-a-secondary-device-3850-i-o-error-in-advisory-file-locking-setlk-on-xdg-document-portal-of-debian-12/5761/2 "2026-09-08T18:48:44Z")

</div>

Thank you for reporting the issue and I’m sure others here can help debug your issue further.

As a stopgap, you can create a backup file yourself manually (sorry about the hack). First, enable `Multi-Device Mode` in the settings on both devices under Advanced. Then exit Delta Chat and wait for it to stop.

First find your data folder with `find ~ -name dc.db`

Copy `dc.db` and `dc.db-blobs` to a new folder. Rename `dc.db` there to `dc_database_backup.sqlite` and the folder to `$BLOBDIR` under a new folder `blobs_backup`. Then compress these two with `tar -cvf delta-chat-backup-2026-09-07-00-something@somewhere.tar dc.db blobs_backup` (i.e., it should not contain an extra containing folder) You can then transfer the file over USB MTP or another private way.

---

<div class="post-metadata">

**Author:** ![ian](https://forum.delta.chat/user_avatar/forum.delta.chat/ian/32/3164_2.png) [@ian](https://forum.delta.chat/u/ian)\
**Post date:** [September 8, 2026, 6:52pm UTC](https://forum.delta.chat/t/error-while-exporting-backup-in-order-to-add-a-secondary-device-3850-i-o-error-in-advisory-file-locking-setlk-on-xdg-document-portal-of-debian-12/5761/3 "2026-09-08T18:52:09Z")

</div>

Maybe related:

> <https://github.com/chatmail/core/issues/5933>
>
> User reports that Delta Chat desktop 1.46.5 installed from flathub fails to expo…rt 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.

---

<div class="post-metadata">

**Author:** ![WofWca](https://forum.delta.chat/user_avatar/forum.delta.chat/wofwca/32/1702_2.png) [@WofWca](https://forum.delta.chat/u/WofWca)\
**Post date:** [September 8, 2026, 6:58pm UTC](https://forum.delta.chat/t/error-while-exporting-backup-in-order-to-add-a-secondary-device-3850-i-o-error-in-advisory-file-locking-setlk-on-xdg-document-portal-of-debian-12/5761/4 "2026-09-08T18:58:38Z")

</div>

> [@bleb](#):
>
> When I get the error nothing is printed in the terminal from which the command is run.

You may find the log at Settings → About Delta Chat → View Log.

The error happens here

> <https://github.com/chatmail/core/blob/49496756e415e5cd296700ce59507ef5dbea5d0b/src/imex.rs#L761-L762>

---

<div class="post-metadata">

**Author:** ![ian](https://forum.delta.chat/user_avatar/forum.delta.chat/ian/32/3164_2.png) [@ian](https://forum.delta.chat/u/ian)\
**Post date:** [September 8, 2026, 7:09pm UTC](https://forum.delta.chat/t/error-while-exporting-backup-in-order-to-add-a-secondary-device-3850-i-o-error-in-advisory-file-locking-setlk-on-xdg-document-portal-of-debian-12/5761/5 "2026-09-08T19:09:41Z")

</div>

See the attached GitHub issue. It won’t help much as it seems to be an SQlite vs. file system or security subsystem issue possibly.

- [Result and Error Codes](https://sqlite.org/rescode.html#ioerr_lock)

> (3850) SQLITE\_IOERR\_LOCK  
> The SQLITE\_IOERR\_LOCK error code is an [extended error code](https://sqlite.org/rescode.html#pve) for [SQLITE\_IOERR](https://sqlite.org/rescode.html#ioerr) indicating an I/O error in the advisory file locking logic. Usually an SQLITE\_IOERR\_LOCK error indicates a problem obtaining a [PENDING lock](https://sqlite.org/lockingv3.html#pending_lock). However it can also indicate miscellaneous locking errors on some of the specialized [VFSes](https://sqlite.org/vfs.html) used on Macs.

By the way, Delta Chat backup exporting does work with eCryptfs on Ubuntu, so it might be something else Mint-specific.

---

<div class="post-metadata">

**Author:** ![link2xt](https://forum.delta.chat/user_avatar/forum.delta.chat/link2xt/32/1971_2.png) [@link2xt](https://forum.delta.chat/u/link2xt)\
**Post date:** [September 8, 2026, 8:01pm UTC](https://forum.delta.chat/t/error-while-exporting-backup-in-order-to-add-a-secondary-device-3850-i-o-error-in-advisory-file-locking-setlk-on-xdg-document-portal-of-debian-12/5761/6 "2026-09-08T20:01:46Z")

</div>

Could you post the output of `mount` on your system? I would like to reproduce the issue so we can fix it properly.

---

<div class="post-metadata">

**Author:** ![bleb](https://forum.delta.chat/letter_avatar_proxy/v4/letter/b/c77e96/32.png) [@bleb](https://forum.delta.chat/u/bleb)\
**Post date:** [September 9, 2026, 1:21pm UTC](https://forum.delta.chat/t/error-while-exporting-backup-in-order-to-add-a-secondary-device-3850-i-o-error-in-advisory-file-locking-setlk-on-xdg-document-portal-of-debian-12/5761/7 "2026-09-09T13:21:50Z")

</div>

thank you all for the information, I will follow up next week with the system info.

---

<div class="post-metadata">

**Author:** ![bleb](https://forum.delta.chat/letter_avatar_proxy/v4/letter/b/c77e96/32.png) [@bleb](https://forum.delta.chat/u/bleb)\
**Post date:** [September 15, 2026, 2:53am UTC](https://forum.delta.chat/t/error-while-exporting-backup-in-order-to-add-a-secondary-device-3850-i-o-error-in-advisory-file-locking-setlk-on-xdg-document-portal-of-debian-12/5761/8 "2026-09-15T02:53:56Z")

</div>

It looks like I am actually having problems at both ends, i.e. in generating the backup in on my primary device and in restoring from backup on my secondary device. Both are PCs running Debian as I describe in my original post.

> [@ian](#):
>
> As a stopgap, you can create a backup file yourself manually (sorry about the hack). First, enable `Multi-Device Mode` in the settings on both devices under Advanced. Then exit Delta Chat and wait for it to stop.
> 
> First find your data folder with `find ~ -name dc.db`
> 
> Copy `dc.db` and `dc.db-blobs` to a new folder. Rename `dc.db` there to `dc_database_backup.sqlite` and the folder to `$BLOBDIR` under a new folder `blobs_backup`. Then compress these two with `tar -cvf delta-chat-backup-2026-09-07-00-something@somewhere.tar dc.db blobs_backup` (i.e., it should not contain an extra containing folder) You can then transfer the file over USB MTP or another private way.

I couldn’t figure out what to put for `$BLOBDIR` so I just used that string literally. Here is what I have in my backup file:

```plaintext
$ tar -tf delta-chat-backup-2026-09-14-00-something\@somewhere.tar 
dc_database_backup.sqlite
blobs_backup/
blobs_backup/$BLOBDIR/
blobs_backup/$BLOBDIR/e26cb65b856086891eadd12d349b067.pdf
blobs_backup/$BLOBDIR/313e387bcc2e141ef752e819bceaf8d.html
blobs_backup/$BLOBDIR/969142cb84015bc135767bc2370934a.png
blobs_backup/$BLOBDIR/91f9bc261758b09b57844798ebb61f1.jpg
blobs_backup/$BLOBDIR/c2ab10c1dba5170d19c9f3998f095b0.png
blobs_backup/$BLOBDIR/4140213a8aacaa46c4526cf228477d6.txt
blobs_backup/$BLOBDIR/f09b17e4970c805b8e1af9af419ff84.pdf

```

I then installed and ran Delta Chat using Flatpak on my second device. Here’s what it prints:

```plaintext
$ flatpak run chat.delta.desktop

Note that the directories 

'/var/lib/flatpak/exports/share'
'/home/cm/.local/share/flatpak/exports/share'

are not in the search path set by the XDG_DATA_DIRS environment variable, so
applications installed by Flatpak may not appear on your desktop until the
session is restarted.

F: Can't get document portal: GDBus.Error:org.freedesktop.DBus.Error.NoReply: Message recipient disconnected from message bus without replying
Logfile: /home/cm/.var/app/chat.delta.desktop/config/DeltaChat/logs/2026-09-14-22-45-45.log
init: 713.237ms

```

A Delta Chat window pops up, I click “I Already Have a Profile,” then “Restore from Backup,” then select `delta-chat-backup-2026-09-14-00-something@somewhere.tar`. The file selection menu then disappears, leaving the “I Already Have a Profile” modal with no indication of success or failure. Nothing shows up in the log file `~/.var/app/chat.delta.desktop/config/DeltaChat/logs/2026-09-14-22-45-45.log`. This could be a problem with the format of the manually generated backup file, or a problem with the way I am running Delta Chat.

> [@link2xt](#):
>
> Could you post the output of `mount` on your system? I would like to reproduce the issue so we can fix it properly.

Here is the output of `mount` on the primary device which shows the “could not export database” error when I try to export a backup:

```auto
$ mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,nosuid,relatime,size=8114892k,nr_inodes=2028723,mode=755,inode64)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,noexec,relatime,size=1631668k,mode=755,inode64)
/dev/sda3 on / type ext4 (rw,relatime,errors=remount-ro)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,inode64)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k,inode64)
cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
bpf on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime,mode=700)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=29,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=1000)
mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,pagesize=2M)
debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime)
tracefs on /sys/kernel/tracing type tracefs (rw,nosuid,nodev,noexec,relatime)
configfs on /sys/kernel/config type configfs (rw,nosuid,nodev,noexec,relatime)
ramfs on /run/credentials/systemd-sysctl.service type ramfs (ro,nosuid,nodev,noexec,relatime,mode=700)
fusectl on /sys/fs/fuse/connections type fusectl (rw,nosuid,nodev,noexec,relatime)
ramfs on /run/credentials/systemd-sysusers.service type ramfs (ro,nosuid,nodev,noexec,relatime,mode=700)
ramfs on /run/credentials/systemd-tmpfiles-setup-dev.service type ramfs (ro,nosuid,nodev,noexec,relatime,mode=700)
ramfs on /run/credentials/systemd-tmpfiles-setup.service type ramfs (ro,nosuid,nodev,noexec,relatime,mode=700)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,nosuid,nodev,noexec,relatime)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=1631664k,nr_inodes=407916,mode=700,uid=1000,gid=1000,inode64)
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
portal on /run/user/1000/doc type fuse.portal (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)

```

As far as I know this is what Debian 12 gives you by default. If there’s anything unusual about my setup it’s the lack of a desktop environment with integrated D-Bus support, so that to run Delta Chat I had to start my window manager with `dbus-run-session`.

---

<div class="post-metadata">

**Author:** ![link2xt](https://forum.delta.chat/user_avatar/forum.delta.chat/link2xt/32/1971_2.png) [@link2xt](https://forum.delta.chat/u/link2xt)\
**Post date:** [September 15, 2026, 5:48am UTC](https://forum.delta.chat/t/error-while-exporting-backup-in-order-to-add-a-secondary-device-3850-i-o-error-in-advisory-file-locking-setlk-on-xdg-document-portal-of-debian-12/5761/9 "2026-09-15T05:48:47Z")

</div>

This is how backup generated by DC (development version, so there is a fingerprint instead of an email address now in the filename, but otherwise it is the same) looks like:

```auto
$ tar tf delta-chat-backup-2026-09-15-00-AC6891014021C9F08A3BD3E218DF90190DCB9143.tar
dc_database_backup.sqlite
blobs_backup/$BLOBDIR/40c5793b03b631a57020323f0f10bfa
blobs_backup/$BLOBDIR/c2ab10c1dba5170d19c9f3998f095b0.png
blobs_backup/$BLOBDIR/91f9bc261758b09b57844798ebb61f1.jpg
blobs_backup/$BLOBDIR/969142cb84015bc135767bc2370934a.png

```

`$BLOBDIR` is a literal `$BLOBDIR` filename, so your backup file looks correct, with the exception that DC does not add `$BLOBDIR` as a separate entry.

This might be the real reason:

> [@bleb](#):
>
> `F: Can't get document portal: GDBus.Error:org.freedesktop.DBus.Error.NoReply: Message recipient disconnected from message bus without replying`

“Desktop portal” is needed for flatpak apps to access files outside of the flatpak I think. Maybe you need to install `xdg-desktop-portal` package and make sure `xdg-document-portal.service` is started? EDIT: `portal on /run/user/1000/doc` in `mount` output probably means it is.

The one that is actually required for accessing the files I think is the [“desktop portal”](https://packages.debian.org/bookworm/xdg-desktop-portal-gtk) rather than “document portal”, but if you get a file selection dialog then it is likely already working.

I tried stopping document portal locally, but got a different error: “file:///app/delta/resources/app/src/components/Settings/Backup.tsx:93:13” “backup-export failed:” {“code”:-1,“message”:“Transport endpoint is not connected (os error 107)”}

---

<div class="post-metadata">

**Author:** ![link2xt](https://forum.delta.chat/user_avatar/forum.delta.chat/link2xt/32/1971_2.png) [@link2xt](https://forum.delta.chat/u/link2xt)\
**Post date:** [September 15, 2026, 6:09am UTC](https://forum.delta.chat/t/error-while-exporting-backup-in-order-to-add-a-secondary-device-3850-i-o-error-in-advisory-file-locking-setlk-on-xdg-document-portal-of-debian-12/5761/10 "2026-09-15T06:09:55Z")

</div>

It might be this issue: [flock fails · Issue #1951 · flatpak/xdg-desktop-portal · GitHub](https://github.com/flatpak/xdg-desktop-portal/issues/1951)  
But somehow for me exporting backups from flatpak works.

Here is what I see in the log when successfully exporting a backup:

```auto
2026-09-15T06:22:33.217Z core/event INFO "" 1 "src/imex.rs:158: Export path: /run/user/1000/doc/debf6TFuweaJrMbz3RV_nw/foobar"
2026-09-15T06:22:33.217Z core/event INFO "" 1 "src/sql.rs:990: Start housekeeping..."
2026-09-15T06:22:33.217Z core/event INFO "" 1 "src/sql.rs:1051: 4 files in use."
2026-09-15T06:22:33.218Z core/event INFO "" 1 "src/sql.rs:775: Incremental vacuum freed 0 pages."
2026-09-15T06:22:33.218Z core/event INFO "" 1 "src/sql.rs:682: wal_checkpoint: Total time: 3.118902ms. Writers blocked for: 230.755µs. Readers blocked for: 145.13µs."
2026-09-15T06:22:33.220Z core/event INFO "" 1 "src/sql.rs:921: Housekeeping done."
2026-09-15T06:22:33.527Z core/event INFO "" 1 "src/imex.rs:460: Backup '/home/user/.var/app/chat.delta.desktop/config/DeltaChat/accounts/b0127be9-bf09-4ae8-b252-791256dc6132/dc.db' to '/run/user/1000/doc/debf6TFuweaJrMbz3RV_nw/foobar/delta-chat-backup-2026-09-15-00-bn14kdyur@nine.testrun.org.tar'."

```

`/run/user/1000/doc` is the FUSE filesystem, but apparently where backup is exported **to** does not need locking, we just write a .tar archive there.

In my case backup is exported from `/home/user/.var/app/chat.delta.desktop/config/DeltaChat/accounts/b0127be9-bf09-4ae8-b252-791256dc6132/dc.db` and this path is on a real ext4.

@bleb Could you check the log file for the path from which the backup is exported? Maybe in your case backup is somehow exported via fuse.portal filesystem and the whole app is running from a FUSE mount? In may case it looks like Delta Chat exports directly from ext4.

I am using xdg-destktop-portal-gtk, maybe the problem is with a different portal implementation.

---

<div class="post-metadata">

**Author:** ![bleb](https://forum.delta.chat/letter_avatar_proxy/v4/letter/b/c77e96/32.png) [@bleb](https://forum.delta.chat/u/bleb)\
**Post date:** [September 18, 2026, 5:52pm UTC](https://forum.delta.chat/t/error-while-exporting-backup-in-order-to-add-a-secondary-device-3850-i-o-error-in-advisory-file-locking-setlk-on-xdg-document-portal-of-debian-12/5761/11 "2026-09-18T17:52:02Z")

</div>

I’ve tried a few things:

- Moving my `.xinitrc` to `.xsession` which should cause startx to run the default `/etc/X11/xinit/xinitrc` which by extension sources the files under `/etc/X11/Xsession.d/`, including `20dbus_xdg-runtime` and `20flatpak` which seemed relevant.

- Purging `xdg-desktop-portal-gtk` which was previously running, based on [this reddit post](https://www.reddit.com/r/debian/comments/1d0u5e4/cant_get_xdg_portals_to_work_properly/lsd22ph/).

- Updating and rebooting.

I tried exporting a backup from Delta Chat multiple times while I was making these changes, with no success. Sometimes the 3850 error would be shown on the screen and sometimes it wouldn’t. When I tried just now, I did not get the 3850 error and nothing about any “portal” service or the `dc.db` path shows up in `journalctl` or in the log file under `~/.var/app/chat.delta.desktop/config/DeltaChat/logs`. Running `systemctl --user status xdg-desktop-portal` shows `Active: inactive (dead)` and I’m not sure if that’s expected or where I would look for an error if it’s not expected. The one error message I see is printed by the flatpak command when Delta Chat starts up:

```plaintext
[2:0918/130845.027904:ERROR:dbus/object_proxy.cc:572] Failed to call method: org.freedesktop.DBus.Properties.Get: object_path= /org/freedesktop/portal/desktop: org.freedesktop.DBus.Error.InvalidArgs: No such interface “org.freedesktop.portal.FileChooser”

```

I am happy to try more things if anyone has suggestions.

Thankfully, I was able to add my laptop as a secondary device with the following steps:

- On my primary device, select “Add Second Device”, then when the QR code is displayed click the three dots and “Copy”.

- Paste the string into a file on my NAS.

- Open the file on my second device and copy it.

- In Delta Chat on my second device, select “I Already Have a Profile” and “Add as Second Device”, then click the gear icon and “Paste from Clipboard”.

It would be good to solve the original error, but it would also have saved me a lot of time if this procedure was described under [https://delta.chat/en/help#multiclient](https://delta.chat/en/help#multiclient).

I also think it would improve the UI to have text fields for viewing and entering the QR code string, rather than just clipboard operations. Anyone doing this workaround will want to see what they are copying anyway, and if someone decides to copy the string manually it avoids the dance of typing it into a file and then copying it to the clipboard.

---

<div class="post-metadata">

**Author:** ![ian](https://forum.delta.chat/user_avatar/forum.delta.chat/ian/32/3164_2.png) [@ian](https://forum.delta.chat/u/ian)\
**Post date:** [September 18, 2026, 6:46pm UTC](https://forum.delta.chat/t/error-while-exporting-backup-in-order-to-add-a-secondary-device-3850-i-o-error-in-advisory-file-locking-setlk-on-xdg-document-portal-of-debian-12/5761/12 "2026-09-18T18:46:44Z")

</div>

Some possible hints:

> <https://github.com/hyprwm/xdg-desktop-portal-hyprland/issues/47>
>
> Hi !
> 
> I'm trying to use the ImHex editor https://github.com/WerWolv/ImHex in h…yprland.
> As I need the screen sharing feature in discord, I also installed XDPH and it works really nicely, thanks !
> 
> But now I'm having a problem when trying to open a file in ImHex, I get this message :
> \`\`\`
> There was an error while opening the file browser:
> No such interface "org.freedesktop.portal.FileChooser" on object at path /org/freedesktop/portal/desktop.
> This might be caused by your system not having a xdg-desktop-portal backend installed correctly.
> \`\`\`
> 
> I understand that this project is primarily aimed to implement advanced screen sharing on hyperland so the file picker might be out of it's scope, is there a way to configure an external file picker like Nautilus ?
> 
> Idrk if this is the right place to ask or if I should go ask an alternative on the ImHex repository ?

> **[\[SOLVED\]xdg-desktop-portal-gnome update causes FileChooser to not work /...](https://bbs.archlinux.org/viewtopic.php?id=299593)**

---

<div class="post-metadata">

**Author:** ![link2xt](https://forum.delta.chat/user_avatar/forum.delta.chat/link2xt/32/1971_2.png) [@link2xt](https://forum.delta.chat/u/link2xt)\
**Post date:** [September 19, 2026, 1:11pm UTC](https://forum.delta.chat/t/error-while-exporting-backup-in-order-to-add-a-secondary-device-3850-i-o-error-in-advisory-file-locking-setlk-on-xdg-document-portal-of-debian-12/5761/13 "2026-09-19T13:11:50Z")

</div>

I have debugged the problem by installing Debian 12 in a virtual machine.  
tl;dr is that **you need to upgrade xdg-desktop-portal to at least [version 1.19.0](https://github.com/flatpak/xdg-desktop-portal/releases/tag/1.19.0)**. It is only available in Debian 13, so you need to upgrade to Debian 13.

* * *

I downloaded Debian 12 ISO from [https://get.debian.org/images/archive/12.15.0-live/amd64/iso-hybrid/debian-live-12.15.0-amd64-standard.iso](https://get.debian.org/images/archive/12.15.0-live/amd64/iso-hybrid/debian-live-12.15.0-amd64-standard.iso)

Created a VM with QEMU:

```auto
qemu-img create -f qcow2 disk.qcow2 40G
qemu-system-x86_64 -accel kvm -display sdl -hda disk.qcow2 -cdrom debian-live-12.15.0-amd64-standard.iso -m 2G

```

I had to add “-display sdl” and install `qemu-ui-sdl` Arch package, otherwise QEMU tried to open VNC port instead of the UI. `-m 2G` is needed because with default settings Linux fails to boot with “initramfs unpacking failed” error.

I selected “Start installer” in the boot menu (rather than live image). When installing selected default options for everything. When partitioning the disk selected “All files in one paritition” option because I did not see separate `/home` in the `mount` output.

Then installed cwm 7.1-1, [X.org](http://X.org), xterm and Flatpak with “apt install cwm xorg xterm flatpak”. I have then put `exec dbus-run-session cwm` into `.xinitrc` and started [X.org](http://X.org) with `startx`. In cwm used Alt+Shift+Enter to start `xterm`.

Following [https://flathub.org/en/setup/Debian](https://flathub.org/en/setup/Debian) I have added flathub repository:  
`flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo`  
I ran the command as the non-root user, it asked for the root password and I entered it. Then I ran `flathub install flathub chat.delta.desktop`, again entered the root password when it asked.

Then started Delta Chat with `flathub run chat.delta.desktop`.  
Created a new profile, tried to export a backup, and it failed with “Error code 3850” in the log.  
In the log I noticed the line: “src/imex.rs:158: Export path: /run/user/1000/doc/613104b2/user”

On my system where exporting works, I have this in the log:

```auto
src/imex.rs:158: Export path: /run/user/1000/doc/EEenso35vM1FB3c2qETrFg/user
src/imex.rs:460: Backup '/home/user/.var/app/chat.delta.desktop/config/DeltaChat/accounts/b0127be9-bf09-4ae8-b252-791256dc6132/dc.db' to '/run/user/1000/doc/EEenso35vM1FB3c2qETrFg/user/delta-chat-backup-2026-09-19-00-bn14kdyur@nine.testrun.org.tar'.

```

I tried to attach the database manually on my system, it worked:

```auto
$ sqlite3 /home/user/.var/app/chat.delta.desktop/config/DeltaChat/accounts/b0127be9-bf09-4ae8-b252-791256dc6132/dc.db
SQLite version 3.53.4 2026-07-24 19:02:57
Enter ".help" for usage hints.
sqlite> ATTACH '/run/user/1000/doc/EEenso35vM1FB3c2qETrFg/user/foo.db' AS backup;

```

`mount` showed this:

```auto
portal on /run/user/1000/doc type fuse.portal (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)

```

On Debian 12 I installed sqlite3 with `apt install sqlite3` and tried the same thing: went to  
`~/.var/app/chat.delta.desktop/config/DeltaChat/accounts/30e86195-f23a-45e6-b1fa-1ecc7c2170f5` and ran `sqlite3 dc.db`.

Trying to attach failed:

```auto
$ sqlite3 dc.db
SQLite version 3.40.1 2022-12-28 14:03:47
Enter ".help" for usage hints.
sqlite> ATTACH DATABASE '/run/user/1000/doc/613104b2/user/backup.db' AS backp;
Runtime error: disk I/O error (10)
sqlite>

```

I ran SQLite under `strace` (`strace sqlite3 ~/.var/app/...`, pressed “up” arrow to select previous command) and it failed with

```auto
fcntl(6, F_SETLK, {l_type=F_UNLCK, l_whence=SEEK_SET, l_start=124, l_len=1}) = 0
fcntl(4, F_SETLK, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=1073741824, l_len=1}) = -1 ENOSYS (Function not implemented)
...
close(4) = 0
write(2, "Runtime error: disk I/O error (...)

```

I have then searched xdg-desktop-portal source code on GitHub for `F_SETLK` and found this commit:

> <https://github.com/flatpak/xdg-desktop-portal/commit/5be1ceda95088e4979f82595ac85f3b0233221bf>
>
> This is needed for things like sqlite3
> 
> See https://github.com/flatpak/xdg-deskt…op-portal/issues/1117
> Signed-off-by: Hubert Figuière \<hub@figuiere.net\>

The commit message explicitly says “This is needed for things like sqlite3”. There is a [corresponding issue](https://github.com/flatpak/xdg-desktop-portal/issues/1117) linked.

This change went into [release 1.19.0](https://github.com/flatpak/xdg-desktop-portal/releases/tag/1.19.0):

> Implement getlk and setlk, and honour O\_NOFOLLOW, in the Document portal’s FUSE filesystem.

On my system where exporting backup works, `xdg-desktop-portal` is version 1.22.1. On Debian 12 xdg-desktop-portal is version 1.16.0-2 according to `apt show xdg-desktop-portal`.  
Debian 13 (trixie, stable) has [xdg-desktop-portal 1.20.3+ds-1](https://packages.debian.org/trixie/xdg-desktop-portal).

To try the new version, I edited `/etc/apt/sources.list` to replace “bookworm” with “trixie” everywhere (`%s/bookworm/trixie/g` in `vi`). Ran `apt update` and then `apt install xdg-desktop-portal` to upgrade. **This is not a proper way to upgrade bookworm to trixie**. Should have upgraded properly, it anyway pulled new version of libc etc., basically upgraded almost everything. Anyway, after upgrading I stopped everything with `killall cwm`, ran `startx` again, started Delta Chat and backup export succeeded, I got a .tar file.

---

<div class="post-metadata">

**Author:** ![bleb](https://forum.delta.chat/letter_avatar_proxy/v4/letter/b/c77e96/32.png) [@bleb](https://forum.delta.chat/u/bleb)\
**Post date:** [September 21, 2026, 12:39am UTC](https://forum.delta.chat/t/error-while-exporting-backup-in-order-to-add-a-secondary-device-3850-i-o-error-in-advisory-file-locking-setlk-on-xdg-document-portal-of-debian-12/5761/14 "2026-09-21T00:39:55Z")

</div>

Thank you for the investigation! Would you be able to provide some intuition for why this error shows up when exporting the database and not when using the sqlite database during normal use?

I am also curious about the benefits of this sqlite-specific operation compared to the generic operations used e.g. to export attachments to the Downloads folder. After all the procedure ian suggested to manually create a backup file used generic file operations and no sqlite3 commands.

---

<div class="post-metadata">

**Author:** ![link2xt](https://forum.delta.chat/user_avatar/forum.delta.chat/link2xt/32/1971_2.png) [@link2xt](https://forum.delta.chat/u/link2xt)\
**Post date:** [September 21, 2026, 9:29am UTC](https://forum.delta.chat/t/error-while-exporting-backup-in-order-to-add-a-secondary-device-3850-i-o-error-in-advisory-file-locking-setlk-on-xdg-document-portal-of-debian-12/5761/15 "2026-09-21T09:29:49Z")

</div>

> [@bleb](#):
>
> Would you be able to provide some intuition for why this error shows up when exporting the database and not when using the sqlite database during normal use?

Normal SQLite database is in `~/.var/app/...`, it is likely also locked, but locking works there because it is a normal ext4 filesystem. When exporting a database for backup, we create a new database in `/run/user/1000/doc` which is a FUSE filesystem implemented by `xdg-desktop-portal`.

> [@bleb](#):
>
> I am also curious about the benefits of this sqlite-specific operation compared to the generic operations used e.g. to export attachments to the Downloads folder. After all the procedure ian suggested to manually create a backup file used generic file operations and no sqlite3 commands.

Exporting a backup with SQLite commands makes sure that WAL (write-ahead log) is also included in the database. If you copy the database manually, but don’t keep the WAL, you may lose some changes, e.g. some message may be missing or even restored (if deletion was written in the WAL, but not snapshotted yet. Also if you copy the database while it is changed e.g. by copying the database file byte-by-byte while Delta Chat writes into it, I don’t know what can happen, maybe you can end up with a corrupted database.

Locking of the target database might be unnecessary if you are absolutely sure that nobody will try to open it at the same time, but SQLite always locks databases when writing into them and I think it’s correct that it expects that locking works.

---

<div class="post-metadata">

**Author:** ![bleb](https://forum.delta.chat/letter_avatar_proxy/v4/letter/b/c77e96/32.png) [@bleb](https://forum.delta.chat/u/bleb)\
**Post date:** [September 21, 2026, 8:27pm UTC](https://forum.delta.chat/t/error-while-exporting-backup-in-order-to-add-a-secondary-device-3850-i-o-error-in-advisory-file-locking-setlk-on-xdg-document-portal-of-debian-12/5761/16 "2026-09-21T20:27:46Z")

</div>

thanks, that makes sense. it’s just too bad that it breaks without warning on platforms that will still be supported for years to come – Debian 12, Ubuntu 24.04, AlmaLinux 9, etc. flatpaks are often billed as a way to get more up-to-date software without the need to upgrade a stable system, so it’s unfortunate if the only recourse in this case is to upgrade.

I guess people can use the workaround I found, but the ability to export a backup is also useful on its own rather than just to add a second device. can you see any reasonable way to avoid this dependency? maybe write a copy of the database to a temporary file under ~/var, then copy it to the FUSE filesystem?

when I get the chance I will take another crack at ian’s suggested workaround, since I was having problems on both the sender side and the recipient side.

---

<div class="post-metadata">

**Author:** ![link2xt](https://forum.delta.chat/user_avatar/forum.delta.chat/link2xt/32/1971_2.png) [@link2xt](https://forum.delta.chat/u/link2xt)\
**Post date:** [September 21, 2026, 9:14pm UTC](https://forum.delta.chat/t/error-while-exporting-backup-in-order-to-add-a-secondary-device-3850-i-o-error-in-advisory-file-locking-setlk-on-xdg-document-portal-of-debian-12/5761/17 "2026-09-21T21:14:45Z")

</div>

> [@bleb](#):
>
> maybe write a copy of the database to a temporary file under ~/var, then copy it to the FUSE filesystem?

I have looked into creating temporary files in the OS [`temp_dir`](https://doc.rust-lang.org/std/env/fn.temp_dir.html), but then the problem is that on Android this is a cache directory that will not be cleaned up, so if backup fails, you might end up with the database copy stored there. Creating temporary files next to the exported backup has the advantage that user can clean up anything that ends up there on failure, while on mobile OSes there may be no temp dir and “temporary” files end up in inaccessible directories.

Maybe we can create a “temporary” directory in the data folder, and just clean up whatever is there on every app start.

---

<div class="post-metadata">

**Author:** ![ian](https://forum.delta.chat/user_avatar/forum.delta.chat/ian/32/3164_2.png) [@ian](https://forum.delta.chat/u/ian)\
**Post date:** [September 22, 2026, 2:13am UTC](https://forum.delta.chat/t/error-while-exporting-backup-in-order-to-add-a-secondary-device-3850-i-o-error-in-advisory-file-locking-setlk-on-xdg-document-portal-of-debian-12/5761/18 "2026-09-22T02:13:51Z")

</div>

I found it the hard way that SQlite also tries to lock and write to the database even if you open it `readonly` and in `safe` mode, so it can fail on a read-only file system or with restrictive permissions.

One problem with creating temporaries in the data folder is if your profile already takes up many gigabytes, the partition might not have sufficient space to store it twice or three times.
