Error when creating new Monero wallet
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
- Go to New wallet
- Click on Monero
- Put name and password
- Select Polyseed and English (but other options are same)
Expected behavior The wallet could be created
Screenshots
Platform:
- OS: ArchLinux
- Device: desktop
- Cake Wallet Version: 1.13.2
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?
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?
https://github.com/MrCyjaneK/monero_c/pull/125
upstream arch AUR updated to v4.24.0, I'll consider this as solved
Sorry but with the 4.26.0 version, the issue is still opened. Same error during Monero wallet creation...
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.
Maybe, I am doing something wrong. Can someone else check https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=cake-wallet-bin?
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.
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?
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
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
Same issue with Cake Wallet 5.4.2.
However, from my research:
The
execstackcommand 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.
I think there could be reasons why execstack is omitted from the Core and Extra repo...
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.