What Happened?
I have this LUKS-encrypted removable disk that I usually mount like this:
sudo cryptsetup open /dev/sdb mybackup
sudo mount /dev/mapper/mybackup /mnt/backup
Then I use elementary Files to browse it.
To eject it, first I close Files and any other app running in the foreground that could be using it, and then:
sudo umount /mnt/backup
sudo cryptsetup close mybackup
Unfortunately, the cryptsetup close command fails with "Device is still in use".
Workarounds
The easiest way around it is to log out of my user, supposedly because it kills whatever user processes are accessing the disk.
To find out what exactly is using it, I used fuser -m /dev/mapper/mybackup, which gave me one PID. The process is /usr/libexec/xdg-desktop-portal, owned by my user; and apparently it is managed by the xdg-desktop-portal.service (in --user scope).
Restarting the systemd service allows me to close the LUKS device:
systemctl restart --user xdg-desktop-portal.service
sudo cryptsetup close mybackup
I don't know how this service works, but I can see in systemctl status --user that elementary Files is somehow connected to it:
● helium
State: running
Units: 575 loaded (incl. loaded aliases)
Jobs: 0 queued
Failed: 0 units
Since: Thu 2026-02-12 09:21:34 -03; 8h ago
systemd: 255.4-1ubuntu8.12
CGroup: /user.slice/user-1000.slice/user@1000.service
├─app.slice
│ ├─_io.elementary.files.xdg-desktop-portal.service
│ │ └─3684 /usr/lib/x86_64-linux-gnu/io.elementary.files.xdg-desktop-portal
│ ├─_io.elementary.settings-daemon.xdg-desktop-portal.service
│ │ └─3582 /usr/libexec/io.elementary.settings-daemon.xdg-desktop-portal
Steps to Reproduce
Follow my steps described above.
Observations:
- The device I'm using is a flash stick containing a single partition that is encrypted with LUKS (without LVM). The unlocked device contains an ext4 filesystem.
- The problem doesn't happen all the time. I have yet to figure out how to reliably reproduce it.
- Other apps that I use to access files from that disk: GNOME Loupe (image viewer), mpv (video player) and elementary Code for text files. I always close them all when I'm done.
Expected Behavior
Device should not be kept busy when no apps in the foreground are using it.
OS Version
8.x (Circe)
OS Architecture
amd64 (on most hardwares)
Session Type
Secure Session (Wayland, This is the default)
Software Version
Latest release (I have run all updates)
Log Output
Hardware Info
No response
What Happened?
I have this LUKS-encrypted removable disk that I usually mount like this:
Then I use elementary Files to browse it.
To eject it, first I close Files and any other app running in the foreground that could be using it, and then:
Unfortunately, the
cryptsetup closecommand fails with "Device is still in use".Workarounds
The easiest way around it is to log out of my user, supposedly because it kills whatever user processes are accessing the disk.
To find out what exactly is using it, I used
fuser -m /dev/mapper/mybackup, which gave me one PID. The process is/usr/libexec/xdg-desktop-portal, owned by my user; and apparently it is managed by thexdg-desktop-portal.service(in--userscope).Restarting the systemd service allows me to close the LUKS device:
I don't know how this service works, but I can see in
systemctl status --userthat elementary Files is somehow connected to it:Steps to Reproduce
Follow my steps described above.
Observations:
Expected Behavior
Device should not be kept busy when no apps in the foreground are using it.
OS Version
8.x (Circe)
OS Architecture
amd64 (on most hardwares)
Session Type
Secure Session (Wayland, This is the default)
Software Version
Latest release (I have run all updates)
Log Output
Hardware Info
No response