Skip to content

How to mount/extract a flatpak bundle? #126

Closed

Description

@pcx862

Hi,
Is there a way to manually mount or extract a .flatpack file?
Something like: flatpak --extract LibreOffice.flatpak
Is there any utility to do this?

Thanks in advance.

Activity

  1. matthiasclasen commented on Jun 18, 2016

    @matthiasclasen
    Collaborator

    Use flatpak install --bundle to install a bundle file.

  2. pcx862 commented on Jun 18, 2016

    @pcx862
    Author

    Thanks, but I was looking specifically for an extraction tool... or some way to just unpack/extract/mount a .flatpak file

    I guess we can just install the .flatpak on a chroot and check the contents... but a dedicated extraction tool would be useful... (Malware analysis, unpacking to convert into Portable Apps, etc.)

    On a related note, is there any documentation about the file format? A technical specification or something?

    Thanks

  3. alexlarsson commented on Jun 18, 2016

    @alexlarsson
    Member

    The format is an ostree static delta file, so you should be able to apply it to a new ostree repo with something like:

    ostree init --repo=repo
    ostree static-delta apply-offline LibreOffice.flatpak
    

    You can then check out the file with ostree checkout.

    Alternatively you can install the app and then look in /var/lib/flatpak/app/org.app.name/x86_64/$version/active to see the files. This will not run any code from the app.

  4. pcx862 commented on Jun 18, 2016

    @pcx862
    Author

    Great! Thats what I was looking for.

    Just one more thing... ostree checkout requires a commit/SHA256
    Any way to tell ostree to "just extract the latest commit"?

  5. alexlarsson commented on Jun 19, 2016

    @alexlarsson
    Member

    The "latest commit" is stored by branch (just like in git), and the branch name is the app+arch+version. You can use ostree refs to list them.

  6. pcx862 commented on Jun 19, 2016

    @pcx862
    Author

    Strange... I had tried that, but I can't get it to work with the extracted repo:

    ostree init --repo=repo
    sudo ostree static-delta apply-offline --repo=repo LibreOffice.flatpak
    ostree refs --repo=repo
    (the command is executed but no output is produced)

    However, if I do:
    sudo flatpak install --bundle LibreOffice.flatpak
    ostree refs --repo=/var/lib/flatpak/repo
    I get:

    org.libreoffice.LibreOffice-origin:app/org.libreoffice.LibreOffice/x86_64/fresh

    Further investigation reveals the repos have some differences:
    cat $HOME/repo/config

    [core]
    repo_version=1
    mode=bare

    cat /var/lib/flatpak/repo/config

    [core]
    repo_version=1
    mode=bare-user

    [remote "org.libreoffice.LibreOffice-origin"]
    url=http://download.documentfoundation.org/libreoffice/flatpak/repository
    xa.title=LibreOffice.flatpak
    xa.noenumerate=true
    xa.prio=0

    What am I missing?
    (ostree version 2016.5 / Fedora 23 / 64bits)

  7. alexlarsson commented on Jun 20, 2016

    @alexlarsson
    Member

    Just had a look at this, and yeah, there is in issue here. ostree apply-offline doesn't actually create a ref, so you can't easily reference the newly created commit object from apply-offiline. @cgwalters: Maybe ostree should accept an optional branchname here?

    Anyway, for now you can do something like:

    ostree init --repo=repo --mode=bare-user
    ostree static-delta apply-offline --repo=repo LibreOffice.flatpak
    ostree checkout --repo=repo -U $(basename $(echo repo/objects/*/*.commit | cut -d/ -f3- --output-delimiter= ) .commit) outdir
    
  8. pcx862 commented on Jun 21, 2016

    @pcx862
    Author

    Excellent! I confirm this works.

    This will be very useful. Thank you.

  9. alexlarsson commented on Jun 21, 2016

    @alexlarsson
    Member

    May I ask what you're using it for?

  10. pcx862 commented on Jun 21, 2016

    @pcx862
    Author

    Sure: I'm the lead developer of ORB (Open Runnable Bundle), which is a project to create "next-gen Linux executables"

    ORB executables (.orb files) work out-of-the-box on most modern linux distros: they behave exactly like ELF binaries (just mark the file as executable and run)
    They also have a "next-gen mode" (enabled after installing ORB Launcher) where the .orb executables become clickable, with icons and with several security features, like automatic cryptographic signature checking.

    Now to answer your question: We are very excited about Flatpak and are planning to add support for it in our ORB Creator. In short, it will take a .flatpak as input, download the runtimes, and output a cross-distro .orb executable (a Portable App)

    In addition, it might also be interesting to take the flatpak+runtimes and create a
    cross-distro/offline-friendly/clickable installer (using flatpak at the "back-end").

    Feel free to let me know if you have any questions or suggestions (either regarding Flatpak integration or anything else)

  11. matthiasclasen commented on Jun 30, 2016

    @matthiasclasen
    Collaborator

    I think the question here was answered.

  12. probonopd commented on Jul 4, 2016

    @probonopd

    Doesn't work on Ubuntu Live ISOs because Unable to set xattr: Operation not supported.

  13. skierpage commented on Jan 2, 2017

    @skierpage

    @probonopd alexlarsson's command line above also fails with the same error if you unpack in a tmpfs like /tmp. I retried on a regular ext file system and it worked.

    FWIW my scenario is trying to figure if the latest LibreOffice flatpak bundle for download matched the version that flatpak --user update installed. So I unpacked then ran diff ~/.local/share/flatpak/app/org.libreoffice.LibreOffice/x86_64/fresh/783b14e2f564bbc37f3beb0c7ec26f71755674968917afdd01c7e683d4e4d1cf/files/libreoffice/program ~/temp/ostree_LibreOffice/outdir/files/libreoffice/program.

  14. probonopd commented on Jan 1, 2018

    @probonopd

    There still seems no exist no way to extract the contents of a flatpak file using a system running on a Xubuntu 16.04 Live ISO:

    me@host:~$ sudo add-apt-repository ppa:alexlarsson/flatpak -y
    me@host:~$ sudo apt update
    me@host:~$ sudo apt install flatpak ostree -y
    
    me@host:~$ ostree init --repo=repo --mode=bare-user
    error: fsetxattr(user.ostreemeta): Operation not supported
    

    #986 seems to have made no difference?

  15. added a commit that references this issue on Oct 12, 2018
  16. ryanabx commented on Apr 28, 2024

    @ryanabx
    Contributor

    I went ahead and automated the process of running a .flatpak file: https://github.com/ryanabx/portapak

  17. faveoled commented on May 3, 2025

    @faveoled
  18. locked as resolved and limited conversation to collaborators on May 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions