cake_wallet icon indicating copy to clipboard operation
cake_wallet copied to clipboard

Error when creating new Monero wallet

Open Spheerys opened this issue 10 months ago • 13 comments

Describe the bug When I try to create a new Monero wallet, I get this error : Invalid argument(s): Failed to load dynamic library 'monero_libwallet2_api_c.so'

To Reproduce I'm runing Cake Wallet under Arch Linux

  1. Go to New wallet
  2. Click on Monero
  3. Put name and password
  4. Select Polyseed and English (but other options are same)

Expected behavior The wallet could be created

Screenshots Image

Platform:

  • OS: ArchLinux
  • Device: desktop
  • Cake Wallet Version: 1.13.2

Spheerys avatar Mar 11 '25 23:03 Spheerys

The issue was also reported on Arch Linux with a possible solution, https://aur.archlinux.org/packages/cake-wallet-bin#comment-1016815.

Lately on Artix I've been having an issue where opening {Mo,Wow}nero wallets errors out with the following:

flutter: cw_monero/api/wallet_manager.dart#null:null wmPtr: Invalid argument(s): Failed to load dynamic library 'monero_libwallet2_api_c.so': monero_libwallet2_api_c.so: cannot enable executable stack as shared object requires: Invalid argument

I have found that running sudo execstack -c /opt/cake-wallet-bin/lib/monero_libwallet2_api_c.so and sudo execstack -c /opt/cake-wallet-bin/lib/wownero_libwallet2_api_c.so fixes this. Could this workaround be added to the PKGBUILD?

Spixmaster avatar Mar 25 '25 15:03 Spixmaster

https://aur.archlinux.org/packages/cake-wallet-bin#comment-1017067

Hey! The issue got resolved in latest release, could you check if https://github.com/cake-tech/cake_wallet/releases/tag/v4.24.0 fixes that for you?

MrCyjaneK avatar Mar 26 '25 11:03 MrCyjaneK

https://github.com/MrCyjaneK/monero_c/pull/125

MrCyjaneK avatar Mar 26 '25 11:03 MrCyjaneK

upstream arch AUR updated to v4.24.0, I'll consider this as solved

MrCyjaneK avatar Mar 27 '25 14:03 MrCyjaneK

Sorry but with the 4.26.0 version, the issue is still opened. Same error during Monero wallet creation...

Spheerys avatar Apr 15 '25 17:04 Spheerys

Sorry but with the 4.26.0 version, the issue is still opened. Same error during Monero wallet creation...

Yep same here. I just installed the 4.26.0-1 version from the aur.

I get the same error as OP when creating a new monero wallet:

flutter: cw_monero/api/wallet_manager.dart#null:null wmPtr: Invalid argument(s): Failed to load dynamic library 'monero_libwallet2_api_c.so': monero_libwallet2_api_c.so: cannot enable executable stack as shared object requires: Invalid argument
flutter: cake_wallet/view_model/wallet_creation_vm.dart#null:null WalletCreationVMBase: error: Invalid argument(s): Failed to load dynamic library 'monero_libwallet2_api_c.so': monero_libwallet2_api_c.so: cannot enable executable stack as shared object requires: Invalid argument
flutter: cake_wallet/view_model/wallet_creation_vm.dart#null:null WalletCreationVMBase: stack: #0      _open (dart:ffi-patch/ffi_dynamic_library_patch.dart:11)
#1      new DynamicLibrary.open (dart:ffi-patch/ffi_dynamic_library_patch.dart:22)
#2      WalletManagerFactory_getWalletManager (package:monero/monero.dart:3791)
#3      wmPtr.<anonymous closure> (package:cw_monero/api/wallet_manager.dart:57)
#4      wmPtr (package:cw_monero/api/wallet_manager.dart:67)
#5      restoreWalletFromSpendKeySync (package:cw_monero/api/wallet_manager.dart)
#6      _restoreFromSpendKey (package:cw_monero/api/wallet_manager.dart:479)
#7      restoreFromSpendKey (package:cw_monero/api/wallet_manager.dart:560)
#8      MoneroWalletService._restoreFromPolyseed (package:cw_monero/monero_wallet_service.dart:475)
#9      MoneroWalletService.create (package:cw_monero/monero_wallet_service.dart:137)
<asynchronous suspension>
#10     WalletCreationService.create (package:cake_wallet/core/wallet_creation_service.dart:66)
<asynchronous suspension>
#11     WalletCreationVMBase.create (package:cake_wallet/view_model/wallet_creation_vm.dart:107)
<asynchronous suspension>
#12     _WalletNameFormState._confirmForm (package:cake_wallet/src/screens/new_wallet/new_wallet_page.dart:407)
<asynchronous suspension>

i ran the fix:

> sudo execstack -c /opt/cake-wallet-bin/lib/monero_libwallet2_api_c.so 
>
> sudo execstack -c /opt/cake-wallet-bin/lib/wownero_libwallet2_api_c.so 

This worked for me. Installed execstack from the aur.

dimyself avatar Apr 28 '25 02:04 dimyself

Maybe, I am doing something wrong. Can someone else check https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=cake-wallet-bin?

Spixmaster avatar Apr 28 '25 05:04 Spixmaster

I am having the same issues. I am using cake-wallet-bin 4.27.0 from the AUR. None of the solutions worked for me.

nowhereandgoodbye avatar Apr 29 '25 13:04 nowhereandgoodbye

same issue, i'be tried also the targs package from the releases: the stack trace is:

~/Downloads/Cake_Wallet_v4.27.0_Linux ❯ ./cake_wallet 
flutter: cw_monero/api/wallet_manager.dart#null:null wmPtr: Invalid argument(s): Failed to load dynamic library 'monero_libwallet2_api_c.so': monero_libwallet2_api_c.so: cannot enable executable stack as shared object requires: Invalid argument
flutter: cake_wallet/view_model/wallet_creation_vm.dart#null:null WalletCreationVMBase: error: Invalid argument(s): Failed to load dynamic library 'monero_libwallet2_api_c.so': monero_libwallet2_api_c.so: cannot enable executable stack as shared object requires: Invalid argument
flutter: cake_wallet/view_model/wallet_creation_vm.dart#null:null WalletCreationVMBase: stack: #0      _open (dart:ffi-patch/ffi_dynamic_library_patch.dart:11)
#1      new DynamicLibrary.open (dart:ffi-patch/ffi_dynamic_library_patch.dart:22)
#2      WalletManagerFactory_getWalletManager (package:monero/monero.dart:3791)
#3      wmPtr.<anonymous closure> (package:cw_monero/api/wallet_manager.dart:57)
#4      wmPtr (package:cw_monero/api/wallet_manager.dart:67)
#5      restoreWalletFromSpendKeySync (package:cw_monero/api/wallet_manager.dart)
#6      _restoreFromSpendKey (package:cw_monero/api/wallet_manager.dart:479)
#7      restoreFromSpendKey (package:cw_monero/api/wallet_manager.dart:560)
#8      MoneroWalletService._restoreFromPolyseed (package:cw_monero/monero_wallet_service.dart:475)
#9      MoneroWalletService.create (package:cw_monero/monero_wallet_service.dart:137)
<asynchronous suspension>
#10     WalletCreationService.create (package:cake_wallet/core/wallet_creation_service.dart:66)
<asynchronous suspension>
#11     WalletCreationVMBase.create (package:cake_wallet/view_model/wallet_creation_vm.dart:107)
<asynchronous suspension>
#12     _WalletNameFormState._confirmForm (package:cake_wallet/src/screens/new_wallet/new_wallet_page.dart:405)
<asynchronous suspension>

running on arch linux, a fresh install, I'm missing some libraries?

kanopo avatar May 03 '25 15:05 kanopo

same issue, i'be tried also the targs package from the releases: the stack trace is:

~/Downloads/Cake_Wallet_v4.27.0_Linux ❯ ./cake_wallet flutter: cw_monero/api/wallet_manager.dart#null:null wmPtr: Invalid argument(s): Failed to load dynamic library 'monero_libwallet2_api_c.so': monero_libwallet2_api_c.so: cannot enable executable stack as shared object requires: Invalid argument flutter: cake_wallet/view_model/wallet_creation_vm.dart#null:null WalletCreationVMBase: error: Invalid argument(s): Failed to load dynamic library 'monero_libwallet2_api_c.so': monero_libwallet2_api_c.so: cannot enable executable stack as shared object requires: Invalid argument flutter: cake_wallet/view_model/wallet_creation_vm.dart#null:null WalletCreationVMBase: stack: #0 _open (dart:ffi-patch/ffi_dynamic_library_patch.dart:11) #1 new DynamicLibrary.open (dart:ffi-patch/ffi_dynamic_library_patch.dart:22) #2 WalletManagerFactory_getWalletManager (package:monero/monero.dart:3791) #3 wmPtr. (package:cw_monero/api/wallet_manager.dart:57) #4 wmPtr (package:cw_monero/api/wallet_manager.dart:67) #5 restoreWalletFromSpendKeySync (package:cw_monero/api/wallet_manager.dart) #6 _restoreFromSpendKey (package:cw_monero/api/wallet_manager.dart:479) #7 restoreFromSpendKey (package:cw_monero/api/wallet_manager.dart:560) #8 MoneroWalletService._restoreFromPolyseed (package:cw_monero/monero_wallet_service.dart:475) #9 MoneroWalletService.create (package:cw_monero/monero_wallet_service.dart:137) #10 WalletCreationService.create (package:cake_wallet/core/wallet_creation_service.dart:66) #11 WalletCreationVMBase.create (package:cake_wallet/view_model/wallet_creation_vm.dart:107) #12 _WalletNameFormState._confirmForm (package:cake_wallet/src/screens/new_wallet/new_wallet_page.dart:405) running on arch linux, a fresh install, I'm missing some libraries?

what worked for me was installing execstack from aur and running:

> sudo execstack -c /opt/cake-wallet-bin/lib/monero_libwallet2_api_c.so 
>
> sudo execstack -c /opt/cake-wallet-bin/lib/wownero_libwallet2_api_c.so 

then it ran fine

dimyself avatar May 03 '25 18:05 dimyself

Same issue with Cake Wallet 5.4.2.

And the fix still works.

yay execstack
sudo execstack -c /opt/cake-wallet-bin/lib/monero_libwallet2_api_c.so
sudo execstack -c /opt/cake-wallet-bin/lib/wownero_libwallet2_api_c.so 

ThomasDalla avatar Oct 03 '25 22:10 ThomasDalla

Same issue with Cake Wallet 5.4.2.

However, from my research:

The execstack command is a tool used in Linux to manage the executable stack flag of ELF binaries and shared libraries. This flag determines whether the stack can execute code, which is a critical security consideration. By default, modern systems typically block code execution on the stack to prevent certain types of security exploits.

Source

I think there could be reasons why execstack is omitted from the Core and Extra repo...

archerallstars avatar Oct 05 '25 19:10 archerallstars

I was able to reproduce the issue, despite looking at the fix that was applied earlier to fix it https://github.com/MrCyjaneK/monero_c/pull/125, I'll check what causes this flag to not be applied properly.

MrCyjaneK avatar Oct 08 '25 20:10 MrCyjaneK