On Sat, 23 Feb 2019 at 16:23:20 +0100, Ronny Standtke wrote: > Unfortunately, calling flatpak in a live-build hook fails with > some dbus and polkit error messages and then flatpak segfaults > ... > (flatpak remote-add:9603): GLib-GIO-CRITICAL **: > g_dbus_connection_register_object: assertion 'G_IS_DBUS_CONNECTION > (connection)' failed > > ** (flatpak remote-add:9603): CRITICAL **: > polkit_authority_register_authentication_agent_with_options_sync: > assertion 'POLKIT_IS_AUTHORITY (authority)' failed > > Segmentation fault
These live-build hooks appear to be running in an environment where you don't have a D-Bus system bus (dbus-daemon --system, provided by the systemd system unit dbus.service or the LSB init script /etc/init.d/dbus). I don't know whether live-build can provide a system bus or other system services while the live system is being built. Installing Flatpak apps and runtimes system-wide normally requires the system bus and won't work without it. It shouldn't crash, and it's a bug that it crashes, but you can't assume that it will *work* either - when the crash has been fixed, the most likely result is that it will still fail, but with a better error message. It might be possible to install system-wide without D-Bus by running flatpak(1) as root (uid 0), which would give the flatpak process the necessary privileges to write to /var/lib/flatpak directly, without needing to communicate with the system helper /usr/libexec/flatpak-system-helper over D-Bus. Alternatively, if the live image has an ordinary user, you should be able to run `flatpak install --user` as that user, which will install apps into the user's ~/.local/share/flatpak instead of into /var/lib/flatpak. This might require a D-Bus session bus (dbus-run-session) but shouldn't require a system bus. > I tried prefixing the call to flatpak with dbus-run-session, but it > still fails. dbus-run-session provides a D-Bus session bus for the current user, which is not the same as the D-Bus system bus (even if the current user is root or messagebus). If something needs the system bus, then dbus-run-session won't help, and that isn't a bug. smcv