Tips & Tricks

Adrian Perez edited this page Oct 18, 2016 · 4 revisions


To debug a flatpak application, these steps might be helpful:

  1. install the SDK, for example with flatpak --user install gnome-nightly org.gnome.Sdk. This is needed to have debug symbols. Omit the --user flag and change the repo if necessary.
  2. open a flatpak debug shell, for example with sh: flatpak run -d --command=sh org.gnome.Gitg. You might want to choose a different shell or start a different application.
  3. in this shell, run gdb gitg or replace gitg with the application you chose in step 2.

Debugging a failing build

If you're using flatpak-builder and some module mysteriously fails to build, you can get a shell in the build tree by using:

host $ flatpak-builder --run appdir sh
sh-4.3$ cd /run/build/failed-modulename

Now you're in a shell with the build directory and can start debugging the failure.

Note: Only the failed module build directory will be there to look at. If you specify --keep-build-dirs to flatpak-builder you can also see the other build dirs.

Running/Testing an uninstalled application

If you've just built an application and want to test it, you don't have to export the appdir to a repo and then install it. Instead you can use flatpak build appdir bash to get a shell in the application, so you can test it.

Note: This will be a typical "build" environment, so the app may not have access to all the permissions it requests. If you need these you have to manually specify them again. If you're using flatpak-builder to build the app you can use the flatpak-builder --run helper which will automatically call flatpak build with all the finish-args that your manifest specified.

Testing an app with a different runtime

You can (for testing) run an application with a different runtime than it typically uses. For instance, to run stable gedit with the latest unstable gnome runtime you can do:

flatpak run --runtime-version=master org.gnome.gedit

You can also use a completely different runtime (but same version number):

flatpak run --runtime=org.gnome.Sdk org.gnome.gedit

Note: If you just want to use the sdk instead of the platform like the above, a better approach is to use -d.