[flatpak] - I cannot choose or change datadir when running from flatpak #24612

issue orsenthil opened this issue on March 18, 2022
  1. orsenthil commented at 2:35 PM on March 18, 2022: none

    <!-- This issue tracker is only for technical issues related to Bitcoin Core. General bitcoin questions and/or support requests are best directed to the Bitcoin StackExchange at https://bitcoin.stackexchange.com. For reporting security issues, please read instructions at https://bitcoincore.org/en/contact/. If the node is "stuck" during sync or giving "block checksum mismatch" errors, please ensure your hardware is stable by running memtest and observe CPU temperature with a load-test tool such as linpack before creating an issue! -->

    <!-- Describe the issue -->

    flatpak run org.bitcoincore.bitcoin-qt -choosedatadir

    <!--- What behavior did you expect? -->

    The -choosedatadir Should allow me to choose the datadir. But it is not. It immediately starts downloading headers from the peers. The chooses a predefined datadir in

    ~/.var/app/org.bitcoincore.bitcoin-qt$ ls
    cache  config  data
    
    • I am unable to modify the datadir location when I run the client using flatpak (on PopOS).

    To reproduce

    1. Install flatpak client
    2. try the command

    flatpak run org.bitcoincore.bitcoin-qt -choosedatadir

    <!--- How reliably can you reproduce the issue, what are the steps to do so? -->

    Everytime.

    System information

    <!-- What version of Bitcoin Core are you using, where did you get it (website, self-compiled, etc)? -->

    1. PopOS, Flatpak version. Client information
    $ flatpak run org.bitcoincore.bitcoin-qt -version
    Bitcoin Core version v22.0.0
    Copyright (C) 2009-2021 The Bitcoin Core developers
    
    Please contribute if you find Bitcoin Core useful. Visit
    <https://bitcoincore.org/> for further information about the software.
    The source code is available from <https://github.com/bitcoin/bitcoin>.
    
    This is experimental software.
    Distributed under the MIT software license, see the accompanying file COPYING
    or <https://opensource.org/licenses/MIT>
    
    

    <!-- What type of machine are you observing the error on (OS/CPU and disk type)? -->

    <!-- GUI-related issue? What is your operating system and its version? If Linux, what is your desktop environment and graphical shell? -->

    <!-- Any extra information that might be useful in the debugging process. -->

    <!--- This is normally the contents of a `debug.log` or `config.log` file. Raw text or a link to a pastebin type site are preferred. -->

  2. orsenthil added the label Bug on Mar 18, 2022
  3. ryanofsky commented at 3:12 PM on March 18, 2022: contributor

    I don't know much about the flatpak, but I'm guessing the "flatpak run" command is invoking bitcoin-qt with a hardcoded -datadir= argument that preempts the -choosedatadir argument:

    https://github.com/bitcoin/bitcoin/blob/66e2d21ef203e422eea8f0a3c7029ac59b210668/src/qt/intro.cpp#L210-L213

    Probably easiest way to fix this is for flatpack to stop passing a hardcoded datadir to bitcoin-qt and instead create an initial $HOME/.config/Bitcoin/Bitcoin-Qt.conf file with something like:

    [General]
    strDataDir=/path/to/datadir
    

    Or, to help with this and make it easier, bitcoin-qt could provide a new softer way of setting a datadir directory that has lower precedence than existing command line and config options like a -defaultdatdir argument or a BITCOIN_DATADIR environment variable.

    Assuming flatpak is passing a -datadir argument, it might not be possible to fix this solely in bitcoin-qt without changing the flatpak, because the -datadir argument does take precedence over everything else by design.

  4. ryanofsky commented at 3:39 PM on March 18, 2022: contributor

    https://github.com/flathub/org.bitcoincore.bitcoin-qt/blob/2d5b49c3ee87bc86f93e75b87512163afd54e284/install_wrappers.sh#L6

    Thanks. Since that wraps both bitcoind and bitcoin-qt, it looks like a similar problem would also happen with bitcoind and the -conf option. For example if user tried to use the flatpak with -conf argument and a configuration file containing datadir=/some/path, the configured datadir would be ignored because of the flatpak command line argument.

    Maybe a decent way to fix these issues across all the binaries could be to make GetDefaultDataDir check for a BITCOIN_DATADIR environment variable, and change the flatpak to set BITCOIN_DATADIR instead of passing -datadir=

    Having the wrapper create an initial Bitcoin-Qt.conf as suggested previously could also work to fix the GUI problem, but seems more awkward.

  5. orsenthil commented at 6:48 PM on March 18, 2022: none

    @MarcoFalke - Interesting. the change /setup was in the flathub/org.bitcoincore.bitcoin-qt repo, while the issues page led me here.

    That said, yes. I found it impossible to configure anything or provide datadir during startup while running from flatpak.

  6. ryanofsky commented at 7:26 PM on March 18, 2022: contributor

    That said, yes. I found it impossible to configure anything or provide datadir during startup while running from flatpak.

    You should still be able to override the datadir from the command line by appending your own -datadir argument.

  7. orsenthil commented at 7:30 PM on March 18, 2022: none

    I had tried that. I gave an option a different datadir, which I had moved, and run didn't recognize. I will try again and share the output.

    I ended up using a non flatpak version - compiled from the master of this repo.

  8. ryanofsky commented at 7:37 PM on March 18, 2022: contributor

    Sounds good. I think we have enough information to fix this in any case.

    Another possible option if flatpak supports this could be to put a symlink in the flatpak datadir location that points to the desired location

  9. orsenthil commented at 7:47 PM on March 18, 2022: none

    I tried the symlink option too. I moved the datadir from ~/.var/app/org.bitcoincore.bitcoin-qt and ln -s that data dir; but the flatpak run complained (something like datadir doesn't exist).

  10. nolajohn commented at 4:22 PM on May 11, 2024: none

    This worked for me - Pop!_OS (Ubuntu 22.04 LTS) running bitcoincore installed via flatpak:

    Get the flatpak ID:

    > flatpak list | grep -i bitcoin
    > Bitcoin Core	org.bitcoincore.bitcoin-qt	26.1	stable	user
    

    Allow flatpak to use the new data folder:

    > flatpak override --user --filesystem=/my/new/folder/for-btc-data org.bitcoincore.bitcoin-qt
    

    Launch from the command line:

    > flatpak run org.bitcoincore.bitcoin-qt --datadir=/my/new/folder/for-btc-data &
    

    I have to launch from the command line. Editing the flatpak .desktop file does not work.

  11. willcl-ark assigned laanwj on Oct 21, 2025
  12. laanwj commented at 11:50 AM on October 22, 2025: member

    Allow flatpak to use the new data folder:

    > flatpak override --user --filesystem=/my/new/folder/for-btc-data org.bitcoincore.bitcoin-qt
    

    This is the correct solution. Flatpak applications are sandboxed, and there's nothing bitcoin-qt can do to reach outside that, unless given explicit permission.

    After giving it permission, as above, you should be able to use the qt chooser dialog to pick the datadir, so that it gets picked automatically in the future:

    > flatpak run org.bitcoincore.bitcoin-qt -choosedatadir &
    

    If that never shows the datadir picker with flatpak, that's a bug. It is.

  13. laanwj added the label GUI on Oct 22, 2025
  14. laanwj commented at 12:04 PM on October 22, 2025: member

    I don't know much about the flatpak, but I'm guessing the "flatpak run" command is invoking bitcoin-qt with a hardcoded -datadir= argument that preempts the -choosedatadir argument:

    Looks like you're right. Flatpak creates a wrapper script that simply passes -datadir unconditionally. https://github.com/flathub/org.bitcoincore.bitcoin-qt/blob/master/install_wrappers.sh

    There would be multiple ways to solve this. One way to fix it without changes to this repository would be to adapt the script so that when -choosedatadir is passed, or an explicit -datadir,, it doesn't pass the argument.

  15. bialy39439 commented at 5:20 PM on December 1, 2025: none

    I'm facing same issue.

    Solution for me was to add --datadir argument afer org.bitcoincore.bitcoin-qt in .desktop file , eg:

    /usr/bin/flatpak run --branch=stable --arch=x86_64 --command=bitcoin-qt --file-forwarding org.bitcoincore.bitcoin-qt --datadir=/path/to/somewhere

    Flatpak override is necessary anyway.

  16. holocronweaver commented at 11:35 PM on February 10, 2026: none

    I tend to think the flatpak wrapper script should use -choosedatadir only on first run, then after that not hardcode any paths. Leave it up to the user if they want to use bitcoin.conf, a command flag, or whatnot to specify datadir.

    At the very least some documentation of this and other quirks on flathub would save people time finding this issue or digging around in the source repo.

    It is odd to me that the GUI doesn't allow changing the datadir in its settings, that would make this problem much simpler.

  17. fanquake commented at 12:31 PM on February 18, 2026: member

    I've moved this over to the packaging repo: https://github.com/bitcoin-core/packaging/issues/332.

  18. fanquake closed this on Feb 18, 2026


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-21 18:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me