Repository: flatpak/flatpak (C)

Issue:
[Bug]: Fails to install any application: Could not unmount revokefs-fuse filesystem
### Checklist

- [X] I agree to follow the [Code of Conduct](https://github.com/flatpak/flatpak/blob/main/CODE_OF_CONDUCT.md) that this project adheres to.
- [X] I have searched the [issue tracker](https://www.github.com/flatpak/flatpak/issues) for a bug that matches the one I want to file, without success.
- [X] If this is an issue with a particular app, I have tried filing it in the appropriate issue tracker for the app (e.g. under https://github.com/flathub/) and determined that it is an issue with Flatpak itself.
- [X] This issue is not a report of a security vulnerability (see [here](https://github.com/flatpak/flatpak/blob/main/SECURITY.md) if you need to report a security issue).

### Flatpak version

1.12.2

### What Linux distribution are you using?

Gentoo Linux

### Linux distribution version

5.18.1-gentoo-r2 #3

### What architecture are you using?

x86_64

### How to reproduce

1. run `flatpak install flathub com.usebottles.bottles`
2. alternatively, run `flatpak install flathub org.gnome.Platform/x86_64/42`

### Expected Behavior

Installs [bottles](https://flathub.org/apps/details/com.usebottles.bottles) or the desired application

### Actual Behavior

Starts to download dependencies but after each dependency is downloaded this warning is put in the terminal.
```
Warning: Could not unmount revokefs-fuse filesystem at /var/tmp/flatpak-cache-JLUYS1/org.freedesktop.Platform.GL.default-G58MS1: Child
process exited with code 1
```
After all dependencies are installed this error occurs and it fails.
```
error: Failed to install org.gnome.Platform: Could not unmount revokefs-fuse filesystem at /var/tmp/flatpak-cache-JLUYS1/org.gnome.Platform-3IALS1: Child process exited with code 1
```

This is the case for every package I attempt to install.

![image](https://user-images.githubusercontent.com/61510083/190833753-b41559f3-84a5-40e6-a912-718f12a12b09.png)


![image](https://user-images.githubusercontent.com/61510083/190833729-588d972a-f213-4cae-b7cb-c5213dddb6eb.png)


### Additional Information

output of `stat /usr/bin/fusermount`
```
  File: /usr/bin/fusermount
  Size: 35424           Blocks: 72         IO Block: 4096   regular file
Device: 10303h/66307d   Inode: 8785934     Links: 1
Access: (4711/-rws--x--x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2022-09-16 20:03:03.132608560 -0400
Modify: 2022-09-16 20:03:03.942608618 -0400
Change: 2022-09-16 20:03:05.075608700 -0400
 Birth: 2022-09-16 20:03:03.132608560 -0400
```

I am curious if having both of these installed causes the issue
`fusermount --version`
```
fusermount version: 2.9.9
```
`fusermount3 --version`
```
fusermount3 version: 3.11.0
```

`uname -a`
```
Linux gentoo 5.18.1-gentoo-r2 #3 SMP PREEMPT_DYNAMIC Sat Jun 18 19:33:04 EDT 2022 x86_64 AMD Ryzen 7 1700 Eight-Core Processor AuthenticAMD GNU/Linux
```

I looked through previous issues but could not find anyone with a similar problem.
[Bug]: fusermount used unconditionally of fuse3 or fuse2 used
### Checklist

- [X] I agree to follow the [Code of Conduct](https://github.com/flatpak/flatpak/blob/main/CODE_OF_CONDUCT.md) that this project adheres to.
- [X] I have searched the [issue tracker](https://www.github.com/flatpak/flatpak/issues) for a bug that matches the one I want to file, without success.
- [X] If this is an issue with a particular app, I have tried filing it in the appropriate issue tracker for the app (e.g. under https://github.com/flathub/) and determined that it is an issue with Flatpak itself.
- [X] This issue is not a report of a security vulnerability (see [here](https://github.com/flatpak/flatpak/blob/main/SECURITY.md) if you need to report a security issue).

### Flatpak version

main branch

### What Linux distribution are you using?

Alpine Linux

### Linux distribution version

inux alpine-edge 6.6.15-0-lts #1-Alpine SMP PREEMPT_DYNAMIC Thu, 01 Feb 2024 17:07:32 +0000 x86_64 GNU/Linux

### What architecture are you using?

x86_64

### How to reproduce

1. Build flatpak with fuse3 dependency
2. See lots of tests fail with missing fusermount

### Expected Behavior

When compiling against fuse3, flatpak checks for fusermount3 instead of fusermount. According to libfuse 3.0.0 [release notes](https://github.com/libfuse/libfuse/releases/tag/fuse-3.0.0): "The fusermount and mount.fuse binaries have been renamed to fusermount3 and mount.fuse3 to allow co-installation of libfuse 2.x and 3.x". I guess other distros probably install a default symlink, but I guess it cannot really be expected?





### Actual Behavior

Lots of tests fail with missing fusermount

### Additional Information

I'm mostly wondering if a patch to fix this would be accepted. I had to write it to test locally anyway.


Discussion: ## UPDATE

Note that THIS IS NOT NECESSARILY the cause or the solution to the OP's issue, it just so happens that our similar issue (on surface), was solved on my end. Scouring through the issues list, this problem could have varying causes from something wrong with `flatpak` (presumably fixed since `1.14.0-2`), or with your `fusermount`/`fusermount3`. In my case it's the latter.

As stated in my issue below, my flatpak version is `1.15.4`, fusermount version `2.9.9` and fusermount3 version `3.14.0`. I also have a secondary PC that is also based on `EndeavourOS Linux x86_64`, and was set up similarly to my main machine but solely for entertainment. In my attempt to fully the update that system, including its flatpaks, everything went smoothly as it used to on my main one.

I then checked the versions of the earlier 3 packages i mentioned, and found that the `fusermount3` version was slightly newer (`3.14.1`) on my entertainment PC. I then checked the source of `fusermount3` on each machine, and found that my main machine uses `$HOME/.local/podman/bin/fusermount3`, while my entertainment PC uses `/usr/bin/fusermount3`.

Checking the `/usr/bin/fusermount3` version shows that my main machine too has `3.14.1` and was probably the binary it has been using before. What changed that was, some time ago I had installed [`podman`](https://github.com/89luca89/distrobox/blob/main/docs/compatibility.md#install-podman-in-a-static-manner) for `distrobox`, and I had `$HOME/.local/podman/bin` in my shell path which took priority over `/usr/bin`.

To fix this issue on my end, I simply had to ensure `/usr/bin` is higher up in my `$PATH` list, which then now uses the correct `fusermount3` version `3.14.1` (`/usr/bin/fusermount3`). Performing `flatpak update` now works perfectly, as intended.

## Old Issue

I am only now just having this error when running `flatpak update`, or by attempting to update flatpak packages using `plasma-discover`, the Discover app would just crash. Never had this issue previously, and nothing in mind was done to have caused this.

I saw that this issue may also be present in one of the unstable version of SteamOS 3 on Steam Decks, as detailed in this Steam Community Bug Report on April 27 2023: [Flatpak applications unable to be installed or updated on Main](https://steamcommunity.com/app/1675200/discussions/1/3824162050993740938).

This issue seems to also be related and has been closed, but the solution seems to have been to upgrade to a particular Flatpak `1.14.0` version, which isn't really helpful in my case: #5073.

### Flatpak version

```
1.15.4
```

### What Linux distribution are you using?

```
EndeavourOS Linux x86_64
```

### Linux distribution version

```
6.2.13-arch1-1
```

### What architecture are you using?

```
x86_64
```

### Additional Information

`fusermount` version

```
2.9.9
```

`fusermount3` version

```
3.14.0
```

### Result of updating all pending apps using `flatpak update`

```fish
❯ flatpak update
Looking for updates…

New com.discordapp.Discord permissions:
    dbus access [1]

    [1] org.freedesktop.ScreenSaver

New org.kde.audiotube permissions:
    bus ownership [1]

    [1] org.mpris.MediaPlayer2.AudioTube


        ID                                                         Branch             Op             Remote             Download
        ID                                                         Branch             Op             Remote             Download
        ID                                                         Branch             Op             Remote             Download
 1. [—] io.mpv.Mpv.Locale                                          stable             u              flathub                1.0 kB / 46.8 kB
        ID                                                         Branch             Op             Remote             Download
        ID                                                         Branch             Op             Remote             Download
        ID                                                         Branch             Op             Remote             Download
 1. [✗] io.mpv.Mpv.Locale                                          stable             u              flathub                1.0 kB / 46.8 kB
        ID                                                         Branch             Op             Remote             Download
        ID                                                         Branch             Op             Remote             Download
        ID                                                         Branch             Op             Remote             Download
 1. [✗] io.mpv.Mpv.Locale                                          stable             u              flathub                1.0 kB / 46.8 kB
        ID                                                         Branch             Op             Remote             Download
        ID                                                         Branch             Op             Remote             Download
        ID                                                         Branch             Op             Remote             Download
 1. [✗] io.mpv.Mpv.Locale                                          stable             u              flathub                1.0 kB / 46.8 kB
        ID                                                         Branch             Op             Remote             Download
        ID                                                         Branch             Op             Remote             Download
        ID                                                         Branch             Op             Remote             Download
 1. [✗] io.mpv.Mpv.Locale                                          stable             u              flathub                1.0 kB / 46.8 kB
        ID                                                         Branch             Op             Remote             Download
        ID                                                         Branch             Op             Remote             Download
        ID                                                         Branch             Op             Remote             Download
 1. [✗] io.mpv.Mpv.Locale                                          stable             u              flathub                1.0 kB / 46.8 kB
        ID                                                         Branch             Op             Remote             Download
        ID                                                         Branch             Op             Remote             Download
        ID                                                         Branch             Op             Remote             Download
 1. [✗] io.mpv.Mpv.Locale                                          stable             u              flathub                1.0 kB / 46.8 kB
        ID                                                         Branch             Op             Remote             Download
        ID                                                         Branch             Op             Remote             Download
        ID                                                         Branch             Op             Remote             Download
 1. [✗] io.mpv.Mpv.Locale                                          stable             u              flathub                1.0 kB / 46.8 kB
 2. [✗] org.freedesktop.Platform.GL.nvidia-530-41-03               1.4                u              flathub              344.3 MB / 345.2 MB
 3. [✗] org.freedesktop.Platform.GL32.nvidia-525-89-02             1.4                u              flathub              414.1 MB / 415.0 MB
 4. [✗] org.freedesktop.Platform.GL32.nvidia-530-41-03             1.4                u              flathub              344.3 MB / 345.2 MB
 5. [✗] org.gnome.Platform.Compat.i386                             43                 u              flathub                1.1 kB / 198.9 MB
 6. [✗] org.gnome.Platform.Locale                                  43                 u              flathub                1.0 kB / 340.6 MB
 7. [✗] org.gnome.Platform.Locale                                  44                 u              flathub                1.0 kB / 340.5 MB
 8. [\] org.gnome.Platform                                         44                 u              flathub                1.0 kB / 326.4 MB
 9. [ ] com.github.tchx84.Flatseal                                 stable             u              flathub            < 151.7 kB
10. [ ] org.gnome.Platform                                         43                 u              flathub            < 329.3 MB
11. [ ] org.gimp.GIMP                                              stable             u              flathub            < 127.4 MB
12. [ ] com.visualstudio.code                                      stable             u              flathub             < 92.4 MB
13. [ ] org.signal.Signal                                          stable             u              flathub            < 150.0 MB
14. [ ] io.mpv.Mpv                                                 stable             u              flathub             < 38.4 MB
15. [ ] com.microsoft.Edge                                         stable             u              flathub            < 148.6 MB
16. [ ] com.discordapp.Discord                                     stable             u              flathub             < 96.1 MB
17. [ ] org.kde.audiotube                                          stable             u              flathub             < 11.4 MB
18. [ ] com.borgbase.Vorta                                         stable             u              flathub             < 15.0 MB
19. [ ] org.kde.kdenlive.Locale                                    stable             u              flathub              < 2.7 MB (partial)
20. [ ] org.kde.kdenlive                                           stable             u              flathub             < 81.7 MB
21. [ ] org.mozilla.Thunderbird.Locale                             stable             u              flathub             < 41.7 MB (partial)
22. [ ] org.mozilla.Thunderbird                                    stable             u              flathub             < 81.0 MB
23. [ ] org.mozilla.firefox.Locale                                 stable             u              flathub             < 49.5 MB (partial)
24. [ ] org.mozilla.firefox                                        stable             u              flathub             < 90.7 MB
25. [ ] org.telegram.desktop.Locale                                stable             u              flathub              < 2.8 MB (partial)
26. [ ] org.telegram.desktop                                       stable             u              flathub             < 78.8 MB

Warning: Could not unmount revokefs-fuse filesystem at /var/tmp/flatpak-cache-E6FG41/io.mpv.Mpv.Locale-WRBS41: Child process exited with code 1
Warning: Could not unmount revokefs-fuse filesystem at /var/tmp/flatpak-cache-E6FG41/io.mpv.Mpv.Locale-WRBS41: Child process exited with code 1
(internal error, please report)
Warning: Could not unmount revokefs-fuse filesystem at /var/tmp/flatpak-cache-E6FG41/org.freedesktop.Platform.GL.nvidia-530-41-03-X2WD41: Child process exited with code 1
Warning: Could not unmount revokefs-fuse filesystem at /var/tmp/flatpak-cache-E6FG41/org.freedesktop.Platform.GL.nvidia-530-41-03-X2WD41: Child process exited with code 1
(internal error, please report)
Warning: Could not unmount revokefs-fuse filesystem at /var/tmp/flatpak-cache-E6FG41/org.freedesktop.Platform.GL32.nvidia-525-89-02-Q2SR41: Child process exited with code 1
Warning: Could not unmount revokefs-fuse filesystem at /var/tmp/flatpak-cache-E6FG41/org.freedesktop.Platform.GL32.nvidia-525-89-02-Q2SR41: Child process exited with code 1
(internal error, please report)
Warning: Could not unmount revokefs-fuse filesystem at /var/tmp/flatpak-cache-E6FG41/org.freedesktop.Platform.GL32.nvidia-530-41-03-XUGT41: Child process exited with code 1
Warning: Could not unmount revokefs-fuse filesystem at /var/tmp/flatpak-cache-E6FG41/org.freedesktop.Platform.GL32.nvidia-530-41-03-XUGT41: Child process exited with code 1
(internal error, please report)
Warning: Could not unmount revokefs-fuse filesystem at /var/tmp/flatpak-cache-E6FG41/org.gnome.Platform.Compat.i386-DKTJ41: Child process exited with code 1
Warning: Could not unmount revokefs-fuse filesystem at /var/tmp/flatpak-cache-E6FG41/org.gnome.Platform.Compat.i386-DKTJ41: Child process exited with code 1
(internal error, please report)
Warning: Could not unmount revokefs-fuse filesystem at /var/tmp/flatpak-cache-E6FG41/org.gnome.Platform.Locale-HGSC41: Child process exited with code 1
Warning: Could not unmount revokefs-fuse filesystem at /var/tmp/flatpak-cache-E6FG41/org.gnome.Platform.Locale-HGSC41: Child process exited with code 1
(internal error, please report)
Warning: Could not unmount revokefs-fuse filesystem at /var/tmp/flatpak-cache-E6FG41/org.gnome.Platform.Locale-GLTH41: Child process exited with code 1
Warning: Could not unmount revokefs-fuse filesystem at /var/tmp/flatpak-cache-E6FG41/org.gnome.Platform.Locale-GLTH41: Child process exited with code 1
(internal error, please report)
Warning: Could not unmount revokefs-fuse filesystem at /var/tmp/flatpak-cache-E6FG41/org.gnome.Platform-OGRJ41: Child process exited with code 1
Warning: Could not unmount revokefs-fuse filesystem at /var/tmp/flatpak-cache-E6FG41/org.gnome.Platform-OGRJ41: Child process exited with code 1

(flatpak update:145467): GLib-CRITICAL **: 14:09:03.979: g_propagate_error: assertion 'src != NULL' failed

(flatpak update:145467): GLib-CRITICAL **: 14:09:03.979: g_error_copy: assertion 'error != NULL' failed

(flatpak update:145467): GLib-CRITICAL **: 14:09:03.979: g_propagate_error: assertion 'src != NULL' failed
**
GLib:ERROR:../glib/glib/gerror.c:1156:g_propagate_prefixed_error: assertion failed: (*dest != NULL)
Bail out! GLib:ERROR:../glib/glib/gerror.c:1156:g_propagate_prefixed_error: assertion failed: (*dest != NULL)
fish: Job 1, 'flatpak update' terminated by signal SIGABRT (Abort)
```

### Result of updating a single flatpak app (`org.kde.audiotube`) using `plasma-discover`

```fish
❯ plasma-discover
fetch ratings! false
adding empty sources model QStandardItemModel(0x5632c2c782d0)
no component found for "com'.endeavouros.endeavouros"
file:///usr/lib/qt/qml/org/kde/kirigami.2/ScrollablePage.qml:200:9: QML MouseArea: Binding loop detected for property "implicitHeight"
file:///usr/lib/qt/qml/org/kde/kirigami.2/ScrollablePage.qml:200:9: QML MouseArea: Binding loop detected for property "implicitHeight"
file:///usr/lib/qt/qml/org/kde/kirigami.2/ScrollablePage.qml:200:9: QML MouseArea: Binding loop detected for property "implicitHeight"
file:///usr/lib/qt/qml/org/kde/kirigami.2/ScrollablePage.qml:200:9: QML MouseArea: Binding loop detected for property "implicitHeight"
file:///usr/lib/qt/qml/org/kde/kirigami.2/ScrollablePage.qml:200:9: QML MouseArea: Binding loop detected for property "implicitHeight"
file:///usr/lib/qt/qml/org/kde/kirigami.2/private/globaltoolbar/ToolBarPageHeader.qml:80:13: QML Binding: Binding loop detected for property "value"
file:///usr/lib/qt/qml/org/kde/kirigami.2/private/globaltoolbar/ToolBarPageHeader.qml:86:13: QML Binding: Binding loop detected for property "value"
fusermount3: failed to unmount /var/tmp/flatpak-cache-E6FG41/org.freedesktop.Platform.GL.nvidia-530-41-03-AG4T41: Operation not permitted

(process:180088): flatpak-WARNING **: 17:44:05.525: Could not unmount revokefs-fuse filesystem at /var/tmp/flatpak-cache-E6FG41/org.freedesktop.Platform.GL.nvidia-530-41-03-AG4T41: Child process exited with code 1
fusermount3: failed to unmount /var/tmp/flatpak-cache-E6FG41/org.freedesktop.Platform.GL.nvidia-530-41-03-AG4T41: Operation not permitted

(process:180088): flatpak-WARNING **: 17:44:05.532: Could not unmount revokefs-fuse filesystem at /var/tmp/flatpak-cache-E6FG41/org.freedesktop.Platform.GL.nvidia-530-41-03-AG4T41: Child process exited with code 1

(process:180088): GLib-CRITICAL **: 17:44:05.536: g_propagate_error: assertion 'src != NULL' failed
fish: Job 1, 'plasma-discover' terminated by signal SIGSEGV (Address boundary error)
```
Also experienced the same issue, SteamOS 3 main channel.
Same error for `audiotube` 
endevourOS gnome

```
❯ flatpak list
Name                                               Application ID                                                   Version                  Branch                   Installation
Brave Browser                                      com.brave.Browser                                                1.52.117                 stable                   system
teams-for-linux                                    com.github.IsmaelMartinez.teams_for_linux                        1.1.1                    stable                   system
Flatseal                                           com.github.tchx84.Flatseal                                       2.0.1                    stable                   system
tidal-hifi                                         com.mastermindzh.tidal-hifi                                      5.1.0                    stable                   system
Slack                                              com.slack.Slack                                                  4.31.155                 stable                   system
Freedesktop Platform                               org.freedesktop.Platform                                         21.08.18                 21.08                    system
Freedesktop Platform                               org.freedesktop.Platform                                         22.08.11                 22.08                    system
Mesa                                               org.freedesktop.Platform.GL.default                              21.3.9                   21.08                    system
Mesa                                               org.freedesktop.Platform.GL.default                              23.0.2                   22.08                    system
Mesa (Extra)                                       org.freedesktop.Platform.GL.default                              23.0.2                   22.08-extra              system
Intel                                              org.freedesktop.Platform.VAAPI.Intel                                                      21.08                    system
Intel                                              org.freedesktop.Platform.VAAPI.Intel                                                      22.08                    system
openh264                                           org.freedesktop.Platform.openh264                                2.1.0                    2.0                      system
openh264                                           org.freedesktop.Platform.openh264                                2.1.0                    2.2.0                    system
GNOME Application Platform version 44              org.gnome.Platform                                                                        44                       system
Adwaita dark GTK theme                             org.gtk.Gtk3theme.Adwaita-dark                                                            3.22                     system
KDE Application Platform                           org.kde.Platform                                                                          5.15-22.08               system
QGnomePlatform                                     org.kde.PlatformTheme.QGnomePlatform                                                      5.15-22.08               system
QGnomePlatform-decoration                          org.kde.WaylandDecoration.QGnomePlatform-decoration                                       5.15-22.08               system
AudioTube                                          org.kde.audiotube                                                23.04.1                  stable                   system
Zoom                                               us.zoom.Zoom                                                     5.14.7.2928              stable                   system
```

**Error log**

```
❯ flatpak run org.kde.audiotube
Gtk-Message: 18:13:13.678: Failed to load module "xapp-gtk3-module"
Gtk-Message: 18:13:13.725: Failed to load module "canberra-gtk-module"
Gtk-Message: 18:13:13.726: Failed to load module "canberra-gtk-module"
qt.qpa.qgnomeplatform: Could not find color scheme  ""
Qt: Session management error: None of the authentication protocols specified are supported
asyncdatabase: Checking whether migration "2022-05-20-194850_init" is already applied
asyncdatabase: … yes
asyncdatabase: Checking whether migration "2022-05-25-212054_playlists" is already applied
asyncdatabase: … yes
asyncdatabase: Migrations finished
asyncdatabase: Running "select distinct (search_query) from searches order by search_id desc"
asyncdatabase: Running "select * from favourites natural join songs order by favourites.rowid desc"
asyncdatabase: Running "select * from played_songs natural join songs"
asyncdatabase: Running "select * from played_songs natural join songs order by plays desc limit 10"
Cannot initialize model with data QJsonObject(). missing: QJsonValue(string, "urls")
Cannot initialize model with data QJsonObject(). missing: QJsonValue(string, "urls")
asyncdatabase: Running "select * from playlists"
Cannot initialize model with data QJsonObject(). missing: QJsonValue(string, "urls")
Cannot initialize model with data QJsonObject(). missing: QJsonValue(string, "urls")
asyncdatabase: Running "select * from playlists"
asyncdatabase: Running "select * from playlists"
qrc:/main.qml:97:17: Unable to assign null to double
qrc:/MinimizedPlayerControls.qml:245:13: Unable to assign bool to int
qrc:/LibraryPage.qml:28:13: Unable to assign [undefined] to double
qrc:/LibraryPage.qml:322:13: Unable to assign [undefined] to double
qrc:/LibraryPage.qml:609:13: Unable to assign [undefined] to double
qrc:/dialogs/RenamePlaylistDialog.qml:25: TypeError: Cannot read property 'title' of undefined
qrc:/dialogs/RenamePlaylistDialog.qml:31: TypeError: Cannot read property 'description' of undefined
qrc:/dialogs/AddPlaylistDialog.qml:19:15: QML FormLayout: Binding loop detected for property "implicitHeight"
qrc:/dialogs/RenamePlaylistDialog.qml:20:15: QML FormLayout: Binding loop detected for property "implicitHeight"
qrc:/dialogs/AddPlaylistDialog.qml:19:15: QML FormLayout: Binding loop detected for property "implicitHeight"
qrc:/dialogs/PlaylistDialog.qml:38:9: QML AddPlaylistDialog: Binding loop detected for property "implicitHeight"
qrc:/LibraryPage.qml:661:9: QML RenamePlaylistDialog: Binding loop detected for property "implicitHeight"
qrc:/dialogs/PlaylistDialog.qml:38:9: QML AddPlaylistDialog: Binding loop detected for property "implicitHeight"
```
> Same error for audiotube

No, what you quoted there is not the same error at all. It looks like an unrelated bug in the app itself.
@irfanhakim-as:

> I then checked the source of fusermount3 on each machine, and found that my main machine uses $HOME/.local/podman/bin/fusermount3, while my entertainment PC uses /usr/bin/fusermount3.

flatpak will have been running the first `fusermount3` or `fusermount` that is found in the `PATH`, and expecting that to be correct. It seems unlikely that a copy of `fusermount` that is installed per-user can work reliably, because `fusermount` needs to be setuid root to do its job (at least on older distributions, perhaps not true any more on very new distribution versions) and something that you have installed into your home directory will not be setuid root.

If this is a common failure mode, then the way to resolve it would be for flatpak to detect the path to a known-good `fusermount` or `fusermount3` at build-time, and run that.
@notseanray:

> I am curious if having both [`fusermount` and `fusermount3`] installed causes the issue

Perhaps. FUSE 3's version of `fusermount` (usually installed as `fusermount3`) can unmount filesystems that were mounted using either FUSE 3 or FUSE 2, so on the Linux distributions I'm familiar with (such as Debian), `/usr/bin/fusermount` is just a symbolic link to `/usr/bin/fusermount3`. Does Gentoo not do that?

If this is a common failure mode, then the way to resolve it would be for flatpak to either use `fusermount3` when it was compiled using the FUSE 3 library, or have a build-time option to set and hard-code the appropriate FUSE unmount executable for this particular distribution (which Gentoo would presumably set to `fusermount3` or even `/usr/bin/fusermount3`).
@rstanuwijaya: There is not enough information in your comment to diagnose whether your situation is the same as @notseanray, or the same as @irfanhakim-as, or something different. What is the output of `command -v fusermount` , `command -v fusermount3`, `fusermount --version` and `fusermount3 --version` on your system?
Hi
it looks like Flatpak and distrbox cannot get along between each other
![image](https://github.com/flatpak/flatpak/assets/29157187/409b3021-62f7-408c-b34f-05fb550550aa)

@irfanhakim-as I saw this problem happens on SteamOS 3.5.5 stable version and I need to delete the .local/podman folder and i want to reinstall it from scratch (curl -s https://raw.githubusercontent.com/89luca89/distrobox/main/uninstall | sh -s -- --prefix ~/.local) But, when I tried to create new container I got this:
distrobox create --image archlinux:latest archlinux


Image archlinux:latest not found.
Do you want to pull the image now? [Y/n]: y
ERRO[0000] validating network configs invalid cni_plugin_dirs: /home/deck/.local/podman/lib/cni
What do you think?


I  had the same issue and have podman/distrobox installed, moving `/usr/bin` up in the `$PATH` fixed the problem and distrobox still works.
For me this was caused by a different version of libfuse I installed via homebrew. Running `brew unlink libfuse` fixed it.

> I'm mostly wondering if a patch to fix this would be accepted

I'd certainly consider it!

We have had other issues where a copy of fusermount or fusermount3 in the PATH from non-distro-provided sources like Linuxbrew has overridden and broken the system copy, so probably the best way would be to add a build-time option `fusermount` which can be set with `meson setup -Dfusermount=/usr/bin/fusermount3` or `meson setup -Dfusermount=fusermount` or similar. To solve your issue, it could default to the empty string, which could be special-cased to select either `fusermount` or `fusermount3` depending on FUSE version?
> other issues where a copy of fusermount or fusermount3 in the PATH from non-distro-provided sources like Linuxbrew has overridden and broken the system copy

#5104
> select either fusermount or fusermount3 depending on FUSE version?

That's what I had in my mind, yes :)

> the best way would be to add a build-time option 

This wouldn't be hard to implement, but are you really sure you want *another* build-time option? I was transitioning alpine's build to meson and I was quite overwhelmed by the sheer amount of options already available.


> are you really sure you want _another_ build-time option?

I think so. Or at least, I don't see any other way to accommodate both "search the PATH for the correct `fusermount`" (our historical behaviour, which is robust against distributions randomly moving things around without needing to recompile Flatpak) and "I know that in this distro, the correct `fusermount` is `/usr/bin/fusermount` and I'm willing to hard-code that" (which is the only way I can see to avoid accidentally picking up an incompatible `~/.local/bin/fusermount` or similar, causing #5104).



Fix (patch):
diff --git a/common/flatpak-dir.c b/common/flatpak-dir.c
index 9ecf23c3e1..d030399d9e 100644
--- a/common/flatpak-dir.c
+++ b/common/flatpak-dir.c
@@ -2110,8 +2110,7 @@ flatpak_dir_revokefs_fuse_unmount (OstreeRepo **repo,
 
   fusermount = g_subprocess_new (G_SUBPROCESS_FLAGS_NONE,
                                  error,
-                                 "fusermount", "-u", "-z", mnt_dir,
-                                 NULL);
+                                 FUSERMOUNT, "-u", "-z", mnt_dir, NULL);
   if (g_subprocess_wait_check (fusermount, NULL, error))
     {
       g_autoptr(GFile) mnt_dir_file = g_file_new_for_path (mnt_dir);
diff --git a/meson.build b/meson.build
index 7794e5b725..fbbe154016 100644
--- a/meson.build
+++ b/meson.build
@@ -188,7 +188,6 @@ polkit_agent_dep = dependency('polkit-agent-1', version : '>=0.98', required : g
 build_system_helper = polkit_agent_dep.found()
 
 fuse_dep = dependency('fuse3', version : '>=3.1.1', required : false)
-
 if fuse_dep.found()
   fuse_api = 31
 else
@@ -196,6 +195,20 @@ else
   fuse_api = 26
 endif
 
+fusermount = get_option('system_fusermount')
+if fusermount == ''
+  if fuse_api >= 30
+    fusermount_program = find_program('fusermount3', required: true)
+  else
+    fusermount_program = find_program('fusermount', required: true)
+  endif
+  if meson.version().version_compare('>=0.55')
+    fusermount = fusermount_program.full_path()
+  else
+    fusermount = fusermount_program.path()
+  endif
+endif
+
 xau_dep = dependency('xau', required : get_option('xauth'))
 libostree_dep = dependency('ostree-1', version : '>=' + required_libostree)
 json_glib_dep = dependency('json-glib-1.0')
@@ -347,6 +360,7 @@ cdata.set_quoted(
 cdata.set_quoted('G_LOG_DOMAIN', 'flatpak')
 cdata.set_quoted('GETTEXT_PACKAGE', 'flatpak')
 cdata.set('FUSE_USE_VERSION', fuse_api)
+cdata.set_quoted('FUSERMOUNT', fusermount)
 
 if get_option('system_bubblewrap') == ''
   cdata.set_quoted('HELPER', get_option('prefix') / get_option('libexecdir') / 'flatpak-bwrap')
@@ -433,6 +447,7 @@ summary(
     'Build selinux module' : build_selinux_module,
     'Build bubblewrap' : (get_option('system_bubblewrap') == ''),
     'Build dbus-proxy' : (get_option('system_dbus_proxy') == ''),
+    'fusermount executable' : fusermount,
     'Use sandboxed triggers' : get_option('sandboxed_triggers'),
     'Use seccomp' : libseccomp_dep.found(),
     'Privileged group' : get_option('privileged_group'),
diff --git a/meson_options.txt b/meson_options.txt
index fed5931f66..c4f34c2df5 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -140,6 +140,12 @@ option(
   description : 'system xdg-dbus-proxy executable, or empty string to build subproject',
   value : '',
 )
+option(
+  'system_fusermount',
+  type : 'string',
+  description : 'system fusermount executable, or empty string to auto-select based on fuse version',
+  value : '',
+)
 option(
   'system_font_cache_dirs',
   type : 'array',