openandroidinstaller icon indicating copy to clipboard operation
openandroidinstaller copied to clipboard

Flatpak fails to launch on Artix Linux with dinit: No systemd user session available

Open Xpos587 opened this issue 6 months ago • 9 comments

Describe the bug OpenAndroidInstaller fails to launch via Flatpak on Artix Linux with dinit init system, throwing "Failed to run in transient scope: No systemd user session available, cgroups not available" error.

To Reproduce Steps to reproduce the behavior:

  1. Install OpenAndroidInstaller via Flatpak on Artix Linux with dinit init system
  2. Run flatpak run -v org.openandroidinstaller.OpenAndroidInstaller
  3. Application fails to start with systemd session error
  4. See error logs showing transient scope creation failure

Expected behavior OpenAndroidInstaller should launch normally and display the main interface, as it would on systemd-based distributions.

Log file

F: Failed to run in transient scope: No systemd user session available, cgroups not available
F: Running 'bwrap --args 40 -- xdg-dbus-proxy --args=37'
F: Running 'bwrap --args 37 -- openandroidinstaller'

Desktop (please complete the following information):

  • OS: Artix Linux (dinit init system, not systemd)
  • Version: Latest Flatpak version from official repositories
  • Init System: dinit with elogind for session management
  • Display Server: Wayland

Additional context This appears to be a fundamental incompatibility between Flatpak's systemd dependency and non-systemd distributions. Despite having elogind properly configured and running, Flatpak still attempts to create systemd transient scopes. The user session is properly initialized (XDG_RUNTIME_DIR and XDG_SESSION_ID are set), and cgroups are available, but Flatpak cannot proceed without systemd user session support.

Request: Please investigate Flatpak compatibility with elogind-based systems for better support of systemd-free distributions like Artix Linux.

Xpos587 avatar Jun 09 '25 21:06 Xpos587

Thanks for reporting this issue!

Unfortunately, I don't know enough about Linux and specifically Artix Linux and systemd-free systems to address this issue. Do you have an idea what could be the issue? I was under the impression flatpak should work on all linux systems.

The recommended solution is to boot ubuntu from an USB drive for now.

tsterbak avatar Jun 26 '25 12:06 tsterbak

Hi! I just discovered that the actual issue is different from what I initially reported. The "Failed to run in transient scope" message is just a warning - the container actually starts successfully via bubblewrap.

The real problem is that the application crashes with ModuleNotFoundError: No module named 'flet_web'. Starting from Flet version 0.25, the web components were separated into a dedicated package.

Here's the fix needed in the Flatpak manifest (org.openandroidinstaller.OpenAndroidInstaller.json):

   "modules": [
       {
           "name": "openandroidinstaller",
           "buildsystem": "simple",
           "build-commands": [
               "pip3 install --prefix=/app --no-deps --find-links=\"file://${PWD}\" --no-index poetry-core==1.0.7 .",
+              "pip3 install --prefix=/app --no-deps 'flet[web]==0.26.0'"
           ]
       }
   ]

Or add a separate module:

{
    "name": "flet-web",
    "buildsystem": "simple", 
    "build-commands": [
        "pip3 install --prefix=/app --no-deps flet-web==0.26.0"
    ]
}

This should resolve the missing dependency issue.

Xpos587 avatar Jun 26 '25 14:06 Xpos587

Stop! My first checks (where the ModuleNotFoundError is) were performed outside the Flatpak container! I do not know what is wrong, here are the strace logs:

❯ strace -f -e execve flatpak run -v org.openandroidinstaller.OpenAndroidInstaller
execve("/usr/bin/flatpak", ["flatpak", "run", "-v", "org.openandroidinstaller.OpenAnd"...], 0x7ffc75a42a40 /* 107 vars */) = 0
strace: Process 83275 attached
strace: Process 83276 attached
strace: Process 83277 attached
F: No installations directory in /etc/flatpak/installations.d. Skipping
F: Opening system flatpak installation at path /var/lib/flatpak
F: Opening user flatpak installation at path /home/michael/.local/share/flatpak
F: Opening user flatpak installation at path /home/michael/.local/share/flatpak
F: Opening system flatpak installation at path /var/lib/flatpak
F: Skipping parental controls check for app/org.openandroidinstaller.OpenAndroidInstaller/x86_64/stable since parental controls are disabled globally
F: Opening user flatpak installation at path /home/michael/.local/share/flatpak
F: Opening system flatpak installation at path /var/lib/flatpak
F: /var/lib/flatpak/runtime/org.freedesktop.Platform/x86_64/24.08/969d05c0de0757b0f679118154e3e67b3c19d15e13d9bc66b5297437de3886fe/files/lib32 does not exist
F: Cleaning up unused container id 3695053286
F: Cleaning up per-app-ID state for org.openandroidinstaller.OpenAndroidInstaller
F: Allocated instance id 1179042452
F: Add defaults in dir /org/openandroidinstaller/OpenAndroidInstaller/
F: Add locks in dir /org/openandroidinstaller/OpenAndroidInstaller/
F: Allowing wayland access
F: Failed to run in transient scope: No systemd user session available, cgroups not available
F: Running 'bwrap --args 42 -- xdg-dbus-proxy --args=39'
strace: Process 83281 attached
strace: Process 83282 attached
[pid 83282] execve("/home/michael/.nix-profile/bin/bwrap", ["bwrap", "--args", "42", "--", "xdg-dbus-proxy", "--args=39"], 0x55fab8800f40 /* 107 vars */) = -1 ENOENT (No such file or directory)
[pid 83282] execve("/nix/var/nix/profiles/default/bin/bwrap", ["bwrap", "--args", "42", "--", "xdg-dbus-proxy", "--args=39"], 0x55fab8800f40 /* 107 vars */) = -1 ENOENT (No such file or directory)
[pid 83282] execve("/usr/bin/bwrap", ["bwrap", "--args", "42", "--", "xdg-dbus-proxy", "--args=39"], 0x55fab8800f40 /* 107 vars */ <unfinished ...>
[pid 83281] +++ exited with 0 +++
[pid 83272] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=83281, si_uid=1000, si_status=0, si_utime=0, si_stime=0} ---
[pid 83282] <... execve resumed>)       = 0
strace: Process 83283 attached
[pid 83283] execve("/home/michael/.nix-profile/bin/xdg-dbus-proxy", ["xdg-dbus-proxy", "--args=39"], 0x7ffc24d28fa0 /* 107 vars */) = -1 ENOENT (No such file or directory)
[pid 83283] execve("/nix/var/nix/profiles/default/bin/xdg-dbus-proxy", ["xdg-dbus-proxy", "--args=39"], 0x7ffc24d28fa0 /* 107 vars */) = -1 ENOENT (No such file or directory)
[pid 83283] execve("/usr/bin/xdg-dbus-proxy", ["xdg-dbus-proxy", "--args=39"], 0x7ffc24d28fa0 /* 107 vars */) = 0
strace: Process 83284 attached
strace: Process 83285 attached
F: Running 'bwrap --args 39 -- openandroidinstaller'
[pid 83272] execve("/home/michael/.nix-profile/bin/bwrap", ["bwrap", "--args", "39", "--", "openandroidinstaller"], 0x55fab88154f0 /* 0 vars */) = -1 ENOENT (No such file or directory)
[pid 83272] execve("/nix/var/nix/profiles/default/bin/bwrap", ["bwrap", "--args", "39", "--", "openandroidinstaller"], 0x55fab88154f0 /* 0 vars */) = -1 ENOENT (No such file or directory)
[pid 83272] execve("/usr/bin/bwrap", ["bwrap", "--args", "39", "--", "openandroidinstaller"], 0x55fab88154f0 /* 0 vars */ <unfinished ...>
[pid 83277] +++ exited with 0 +++
[pid 83276] +++ exited with 0 +++
[pid 83275] +++ exited with 0 +++
[pid 83272] <... execve resumed>)       = 0
strace: Process 83286 attached
strace: Process 83292 attached
[pid 83292] execve("/app/bin/openandroidinstaller", ["openandroidinstaller"], 0x55fcfb1974e0 /* 122 vars */) = 0
strace: Process 83293 attached
[pid 83293] execve("/app/bin/python3", ["python3", "/app/lib/python3.11/site-package"..., "-l", "/home/michael/.var/app/org.opena"...], 0x5624f0ce6900 /* 122 vars */) = 0
strace: Process 83416 attached

I just noticed that bwrap is taken from nix. I need to study this point.

Xpos587 avatar Jun 26 '25 14:06 Xpos587

Everything is fine with bwrap. First, OAI tries to find bwrap in nix paths, and then it finds a working /usr/bin/bwrap file and continues working. Idk what wrong.

Xpos587 avatar Jun 26 '25 14:06 Xpos587

Thanks for investigating!

It seems also the flatpak in general is broken... so it might not be an issue of Artix Linux.

I seem to have introduced some dependecy issues that are hopefully resolved soon.

tsterbak avatar Jun 26 '25 15:06 tsterbak

Thanks for investigating!

It seems also the flatpak in general is broken... so it might not be an issue of Artix Linux.

I seem to have introduced some dependecy issues that are hopefully resolved soon.

Yes, I think this is a problem with flet-desktop.

Xpos587 avatar Jun 26 '25 15:06 Xpos587

Try installing flet[desktop,web] during the flatpak build. I think this should make a difference.

Xpos587 avatar Jun 26 '25 15:06 Xpos587

Hello!

❯ flatpak uninstall org.openandroidinstaller.OpenAndroidInstaller


        ID                                                       Branch            Op
 1. [-] org.openandroidinstaller.OpenAndroidInstaller            stable            r

Uninstall complete.
❯ rm -rf ~/.var/app/org.openandroidinstaller.OpenAndroidInstaller
❯ flatpak install --user org.openandroidinstaller.OpenAndroidInstaller
Looking for matches…

org.openandroidinstaller.OpenAndroidInstaller permissions:
    ipc    network    fallback-x11    wayland    x11    devices



        ID                                                        Branch             Op             Remote             Download
 1. [✓] org.openandroidinstaller.OpenAndroidInstaller             stable             i              flathub            102.2 MB / 140.8 MB

Installation complete.
flatpak install --user org.openandroidinstaller.OpenAndroidInstaller  2.77s user 2.96s system 8% cpu 1:08.17 total
❯ flatpak run -v org.openandroidinstaller.OpenAndroidInstaller
F: No installations directory in /etc/flatpak/installations.d. Skipping
F: Opening system flatpak installation at path /var/lib/flatpak
F: Opening user flatpak installation at path /home/michael/.local/share/flatpak
F: Opening user flatpak installation at path /home/michael/.local/share/flatpak
F: Skipping parental controls check for app/org.openandroidinstaller.OpenAndroidInstaller/x86_64/stable since parental controls are disabled globally
F: Opening user flatpak installation at path /home/michael/.local/share/flatpak
F: Regenerating ld.so.cache /home/michael/.var/app/org.openandroidinstaller.OpenAndroidInstaller/.ld.so/b173901c89c04198a8132c0de291added18425a4616f44321175dd3c5008b43b
F: /home/michael/.local/share/flatpak/runtime/org.freedesktop.Platform/x86_64/24.08/969d05c0de0757b0f679118154e3e67b3c19d15e13d9bc66b5297437de3886fe/files/lib32 does not exist
F: Running: 'bwrap --args 25 ldconfig -X -C /run/ld-so-cache-dir/b173901c89c04198a8132c0de291added18425a4616f44321175dd3c5008b43b.kadlYx'
F: /home/michael/.local/share/flatpak/runtime/org.freedesktop.Platform/x86_64/24.08/969d05c0de0757b0f679118154e3e67b3c19d15e13d9bc66b5297437de3886fe/files/lib32 does not exist
F: Cleaning up unused container id 1971955145
F: Cleaning up per-app-ID state for org.openandroidinstaller.OpenAndroidInstaller
F: Allocated instance id 1115538056
F: Add defaults in dir /org/openandroidinstaller/OpenAndroidInstaller/
F: Add locks in dir /org/openandroidinstaller/OpenAndroidInstaller/
F: Allowing wayland access
F: Failed to run in transient scope: No systemd user session available, cgroups not available
F: Running 'bwrap --args 42 -- xdg-dbus-proxy --args=39'
F: Running 'bwrap --args 39 -- openandroidinstaller'
  WARNING: The script uvicorn is installed in '/var/data/python/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script dotenv is installed in '/var/data/python/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script watchfiles is installed in '/var/data/python/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Installing flet-web 0.26.0 package...OK
Traceback (most recent call last):
  File "/app/lib/python3.11/site-packages/openandroidinstaller/openandroidinstaller.py", line 333, in <module>
    startup()
  File "/app/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/lib/python3.11/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/app/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/lib/python3.11/site-packages/openandroidinstaller/openandroidinstaller.py", line 326, in startup
    ft.app(
  File "/app/lib/python3.11/site-packages/flet/app.py", line 64, in app
    return asyncio.run(
           ^^^^^^^^^^^^
  File "/app/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/app/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/lib/python3.11/asyncio/base_events.py", line 650, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/app/lib/python3.11/site-packages/flet/app.py", line 156, in app_async
    else await __run_web_server(
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/lib/python3.11/site-packages/flet/app.py", line 285, in __run_web_server
    from flet_web.fastapi.serve_fastapi_web_app import serve_fastapi_web_app
ModuleNotFoundError: No module named 'flet_web'
~ ❯                                                                                                                                  10s 19:41:51

Xpos587 avatar Jul 07 '25 16:07 Xpos587

I was not able to make the flatpak work for now...

tsterbak avatar Aug 21 '25 09:08 tsterbak