wizardsardine / liana

The missing safety net for your coins
https://wizardsardine.com/liana
BSD 3-Clause "New" or "Revised" License
322 stars 58 forks source link

liana-gui : Panic when creating new wallet at step 5/5 'finalize installation' #272

Closed cc1cc1cc1 closed 1 year ago

cc1cc1cc1 commented 1 year ago

Running under Ubuntu 22.10 with Mate 1.26.0, linux kernel 5.19.0-26 bitcoincore installed using snap

bitcoin.conf: rpcallowip=127.0.0.1 server=1

cookie path is ok

I got this output instantly after pressing "finalize installaton" buton at step 5/5:

cc1@cc1:~/Downloads/liana-0.1-x86_64-linux-gnu$ ./liana-gui
[1672061942][winit::platform_impl::platform::x11::window][INFO] Guessed window scale factor: 1.0625
[1672061971][liana][INFO] Created a new data directory at '/home/cc1/.liana/bitcoin'
[1672061971][liana::database::sqlite][INFO] Created a fresh database at /home/cc1/.liana/bitcoin/lianad.sqlite3.
[1672061971][liana][INFO] Database initialized and checked.
[1672061971][liana][ERROR] panic occurred at line 376 of file /vendor/liana/src/bitcoin/d/mod.rs: Some("We must not fail to make a request for more than a minute: Server(Rpc(RpcError { code: -4, message: \"Wallet file verification failed. filesystem error: cannot create directories: Permission denied [/home/cc1/.liana/bitcoin/lianad_watchonly_wallet]\", data: None }))")
   0: liana::setup_panic_hook::{{closure}}
   1: std::panicking::rust_panic_with_hook
   2: <unknown>
   3: std::sys_common::backtrace::__rust_end_short_backtrace
   4: rust_begin_unwind
   5: core::panicking::panic_fmt
   6: core::result::unwrap_failed
   7: liana::bitcoin::d::BitcoinD::create_watchonly_wallet
   8: liana::setup_bitcoind
   9: liana::DaemonHandle::start_default
  10: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
  11: <futures_util::future::future::map::Map<Fut,F> as core::future::future::Future>::poll
  12: <futures_util::future::future::Map<Fut,F> as core::future::future::Future>::poll
  13: <futures_util::future::future::Map<Fut,F> as core::future::future::Future>::poll
  14: <futures_util::future::future::Map<Fut,F> as core::future::future::Future>::poll
  15: <futures_util::future::future::flatten::Flatten<Fut,<Fut as core::future::future::Future>::Output> as core::future::future::Future>::poll
  16: tokio::runtime::task::core::CoreStage<T>::poll
  17: tokio::runtime::task::harness::Harness<T,S>::poll
  18: std::thread::local::LocalKey<T>::with
  19: tokio::runtime::scheduler::multi_thread::worker::Context::run_task
  20: tokio::runtime::scheduler::multi_thread::worker::Context::run
  21: tokio::macros::scoped_tls::ScopedKey<T>::set
  22: tokio::runtime::scheduler::multi_thread::worker::run
  23: <tokio::runtime::blocking::task::BlockingTask<T> as core::future::future::Future>::poll
  24: tokio::runtime::task::harness::Harness<T,S>::poll
  25: tokio::runtime::blocking::pool::Inner::run
  26: std::sys_common::backtrace::__rust_begin_short_backtrace
  27: core::ops::function::FnOnce::call_once{{vtable.shim}}
  28: <unknown>
  29: start_thread
             at ./nptl/./nptl/pthread_create.c:442:8
  30: __GI___clone3
             at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

here details about folders:

cc1@cc1:~/.liana$ ls -al
total 12
drwx------  3 cc1 cc1 4096 déc.  26 14:52 .
drwxr-x--- 46 cc1 cc1 4096 déc.  26 14:52 ..
drwx------  2 cc1 cc1 4096 déc.  26 14:52 bitcoin
cc1@cc1:~/.liana/bitcoin$ ls -al
total 120
drwx------ 2 cc1 cc1   4096 déc.  26 14:52 .
drwx------ 3 cc1 cc1   4096 déc.  26 14:52 ..
-rw------- 1 cc1 cc1 114688 déc.  26 14:52 lianad.sqlite3
darosior commented 1 year ago

Thank you for your report. We could document this better but it is an issue on your end: the bitcoind process isn't able to create a wallet within the Liana data directory (~/.liana/bitcoin as your example for mainnet). It is most probably not writable by the user your run bitcoind as, as suggested by the output of ls -al you pasted.

cc1cc1cc1 commented 1 year ago

i got that, but the .liana folder is made by liana, so the soft itself define access right, is'nt it?

darosior commented 1 year ago

Yes, the data directory is created with no permissions for the group and others: https://github.com/wizardsardine/liana/blob/80fb0ecb01f65c15782f215fdda9bc99ad6c78d2/src/lib.rs#L136-L148

Are you running bitcoind as another user? If so there are two ways we could support this:

I think the second one makes more sense as i can imagine it to be useful in other situations as well. What do you think?

cc @edouardparis if you have any suggestion too.

kloaec commented 1 year ago

I don't use Snap, but a quick search seems like it would install Core as root. Liana would be installed as the user. Might be that, but i'm absolutely not knowledgeable with Snap.

cc1cc1cc1 commented 1 year ago
cc1@cc1:~$ ps -aux | grep bitcoin
cc1        12570 51.3  4.9 5658348 790240 ?      SLl  21:28   3:21 bitcoin-qt

so i'm running bitcoin-qt (not bitcoind) by same user than liana so i think problem not from there

but when i check for bitcoind and bitcoin-cli:

cc1@cc1:~$ bitcoind --version
bitcoind: command not found
cc1@cc1:~$ bitcoin-cli --version
bitcoin-cli: command not found

then i found them here:

cc1@cc1:~$ locate bitcoind | grep snap
/snap/bitcoin-core/120/bin/bitcoind
cc1@cc1:~$ locate bitcoin-cli | grep snap
/snap/bitcoin-core/120/bin/bitcoin-cli
cc1cc1cc1 commented 1 year ago

just try that:

sudo ln -s /snap/bitcoin-core/120/bin/bitcoin-cli /usr/bin/bitcoin-cli
sudo ln -s /snap/bitcoin-core/120/bin/bitcoind /usr/bin/bitcoind

but still have the same issue

cc1cc1cc1 commented 1 year ago

running bitcoind instead of bitcoin-qt seems solve issue but....

new issue following: image

liana log:

cc1@cc1:~/Downloads/liana-0.1-x86_64-linux-gnu$ ./liana-gui
[1673474479][winit::platform_impl::platform::x11::window][INFO] Guessed window scale factor: 1.0625
[1673474549][liana][INFO] Created a new data directory at '/home/cc1/.liana/bitcoin'
[1673474549][liana::database::sqlite][INFO] Created a fresh database at /home/cc1/.liana/bitcoin/lianad.sqlite3.
[1673474549][liana][INFO] Database initialized and checked.

relevant log from bitcoind:

2023-01-11T22:02:29Z Using SQLite Version 3.32.1
2023-01-11T22:02:29Z Using wallet /home/cc1/.liana/bitcoin/lianad_watchonly_wallet
2023-01-11T22:02:29Z init message: Loading wallet…
2023-01-11T22:02:29Z [/home/cc1/.liana/bitcoin/lianad_watchonly_wallet] Wallet File Version = 10500
2023-01-11T22:02:29Z [/home/cc1/.liana/bitcoin/lianad_watchonly_wallet] Keys: 0 plaintext, 0 encrypted, 0 w/ metadata, 0 total. Unknown wallet records: 0
2023-01-11T22:02:29Z [/home/cc1/.liana/bitcoin/lianad_watchonly_wallet] Wallet completed loading in              22ms
2023-01-11T22:02:29Z [/home/cc1/.liana/bitcoin/lianad_watchonly_wallet] setKeyPool.size() = 0
2023-01-11T22:02:29Z [/home/cc1/.liana/bitcoin/lianad_watchonly_wallet] mapWallet.size() = 0
2023-01-11T22:02:29Z [/home/cc1/.liana/bitcoin/lianad_watchonly_wallet] m_address_book.size() = 0
2023-01-11T22:03:28Z [/home/cc1/.liana/bitcoin/lianad_watchonly_wallet] Releasing wallet
2023-01-11T22:03:28Z SQLite Error. Code: 28. Message: file unlinked while open: /home/cc1/.liana/bitcoin/lianad_watchonly_wallet/wallet.dat

should i open new issue for this one or they are linked?

darosior commented 1 year ago

It's very surprising that running bitcoind in place of bitcoin-qt solved the issue. If the lack of RPC server (by default when running bitcoin-qt) was the issue we'd fail earlier in the process.

should i open new issue for this one or they are linked?

I've opened #284 to track this.

cc1cc1cc1 commented 1 year ago

yes very surprising because i can connect to rpc using python bitcoinrpc package with this setup... i'll double check with a fresh install of bitcoin-core from sources

cc1cc1cc1 commented 1 year ago

just try with bitcoin-qt build from source, works fine then reinstall from snap, seems they update version, now it is fine, working with bitcoin-qt from snap also

darosior commented 1 year ago

Cool. Thank you for letting us know. ------- Original Message ------- Le vendredi 3 février 2023 à 4:26 PM, cc1 @.***> a écrit :

just try with bitcoin-qt build from source, works fine then reinstall from snap, seems they update version, now it is fine, working with bitcoin-qt from snap also

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

cc1cc1cc1 commented 1 year ago

waiting 0.2 release to dig more and more into liana ;) thank you guys for your amazing work