Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

luci-app-wireguard: RPCError RPC call to luci.wireguard/getWgInstances failed with error -32000 #5393

Closed
teqlee opened this issue Sep 26, 2021 · 52 comments · Fixed by #5399 or #5403
Closed

Comments

@teqlee
Copy link

teqlee commented Sep 26, 2021

RPCError RPC call to luci.wireguard/getWgInstances failed with error -32000: Object not found at ClassConstructor.handleCallReply (https://192.168.16.1/luci-static/resources/rpc.js?v=git-21.267.65414-1d9067b:11:3)

Openwrt SNAPSHOT r17584

@lvoegl

@feckert
Copy link
Member

feckert commented Sep 27, 2021

Should be fixed with 9d560c4

@feckert feckert closed this as completed Sep 27, 2021
@mydogteddy
Copy link

mydogteddy commented Sep 28, 2021

Not fixed,
Hostname OpenWrt
Model Linksys E8450 (UBI)
Architecture ARMv8 Processor rev 4
Target Platform mediatek/mt7622
Firmware Version OpenWrt SNAPSHOT r17630-6cd54254e4 / LuCI Master git-21.226.86205-376af36
Kernel Version 5.10.64

Still seeing
RPC call to luci.wireguard/getWgInstances failed with error -32000: Object not found

I have cleared my cache and checked
luci-proto-wireguard
file "/usr/libexec/rpcd/luci.wireguard
are installed

@teqlee
Copy link
Author

teqlee commented Sep 28, 2021

Still not fixed. Minor difference error showing:
RPC call to luci.wireguard/getWgInstances failed with error -32000: Object not found at handleCallReply (https://192.168.16.1/luci-static/resources/rpc.js?v=git-21.267.65414-1d9067b:11:3)
@feckert

@feckert
Copy link
Member

feckert commented Sep 28, 2021

Have you update luci-app-wireguard and luci-proto-wireguard.
Also you have to restart rpcd with the command /etc/init.d/rpcd ?

@mydogteddy
Copy link

                        Prior to recompiling the code I did,

./scripts/feeds update -a; ./scripts/feeds install -a

and

git pull --ff-only

then after compiling I flashed the new code, unfortunately the error was still showing

@mydogteddy
Copy link

I have also tried deleting the build_dir and then recompiling it made no difference the error was still there

@teqlee
Copy link
Author

teqlee commented Sep 28, 2021

Just to be sure, I rebuilt from scratch by following:

  • git pull && ./scripts/feeds update -a
  • make package/clean
  • make
    And i'm sysupgrade fw without keep config.
    my fw infos:
  • LuCI Master (git-21.267.65414-1d9067b)
  • OpenWrt SNAPSHOT r17631-9c3b1d5563
  • luci-app-wireguard - git-21.269.42646-9d560c4
  • luci-proto-wireguard - git-21.269.42646-9d560c4`

@dhcpme
Copy link

dhcpme commented Sep 29, 2021

I can also confirm this is not fixed with 9d560c4 on a Belkin RT3200 (Linksys E8450 (UBI))
image
image

@feckert
Copy link
Member

feckert commented Sep 29, 2021

What is your output of ubus -v list luci.wireguard

@feckert feckert reopened this Sep 29, 2021
@dhcpme
Copy link

dhcpme commented Sep 29, 2021

Empty :(

root@OpenWrt:~# ubus -v list luci.wireguard
Command failed: Not found

@mydogteddy
Copy link

root@OpenWrt:# ubus -v list luci.wireguard
Command failed: Not found
root@OpenWrt:
#

@feckert
Copy link
Member

feckert commented Sep 29, 2021

It's very strange that it's included in the repository.
Does this file exist on your target? /usr/libexec/rpcd/luci.wireguard

@mydogteddy
Copy link

yes

@feckert
Copy link
Member

feckert commented Sep 29, 2021

@mydogteddy ok could you please restart ubus with following command /etc/init.d/rpcd restart and show me the output
of the rpcd with ubus call luci.wireguard getWgInstances

@dhcpme
Copy link

dhcpme commented Sep 29, 2021

root@OpenWrt:~# /etc/init.d/rpcd restart
root@OpenWrt:~# ubus call luci.wireguard getWgInstances
Command failed: Not found

@feckert
Copy link
Member

feckert commented Sep 29, 2021

@dhcpme See my comment #5393 (comment)

@dhcpme
Copy link

dhcpme commented Sep 29, 2021

root@OpenWrt:~# ls -ltra /usr/libexec/rpcd/luci.wireguard
-rwxr-xr-x    1 root     root          4432 Sep 28 08:27 /usr/libexec/rpcd/luci.wireguard
root@OpenWrt:~# md5sum /usr/libexec/rpcd/luci.wireguard
ae2f10cdcfffe03283680a53728111c6  /usr/libexec/rpcd/luci.wireguard

@feckert
Copy link
Member

feckert commented Sep 29, 2021

Sorry I can't reproduce this.
It works for me?
Screenshot_2021-09-29 dev - WireGuard - LuCI

root@st-dev-07 /usr/libexec/rpcd # md5sum luci.wireguard
ae2f10cdcfffe03283680a53728111c6  luci.wireguard

@mydogteddy
Copy link

I am glad it works for you

@dhcpme
Copy link

dhcpme commented Sep 29, 2021

Related?
#4555 (comment)

@mydogteddy
Copy link

root@OpenWrt:/usr/libexec/rpcd# md5sum luci.wireguard
ae2f10cdcfffe03283680a53728111c6 luci.wireguard
root@OpenWrt:/usr/libexec/rpcd#

@feckert
Copy link
Member

feckert commented Sep 29, 2021

@mydogteddy @dhcpme and @teqlee
Could you please check if all files from von luci-app-wireguard and luci-proto-wireguard are installed on your system an does have the content as in the luci repository (md5sum check)?

We're talking about the latest master branch here?

@teqlee
Copy link
Author

teqlee commented Sep 29, 2021

Here md5sum on my system, I dont know how compare to master repos.

md5deep -r ~/opentrunk/feeds/luci/applications/luci-app-wireguard

9a1e9c01566472b087e0d0192c9df267  /home/teq/opentrunk/feeds/luci/applications/luci-app-wireguard/root/usr/share/luci/menu.d/luci-app-wireguard.json
718474b39bfb6e597e3d5a12dfb5a7a5  /home/teq/opentrunk/feeds/luci/applications/luci-app-wireguard/root/usr/share/rpcd/acl.d/luci-app-wireguard.json
ecc5deaeed18e5602d6e8f0993632753  /home/teq/opentrunk/feeds/luci/applications/luci-app-wireguard/htdocs/luci-static/resources/view/wireguard/status.js
c71ec3e475714afa21e1bbe4c66732e0  /home/teq/opentrunk/feeds/luci/applications/luci-app-wireguard/Makefile

md5deep -r ~/opentrunk/feeds/luci/protocols/luci-proto-wireguard
ae2f10cdcfffe03283680a53728111c6  /home/teq/opentrunk/feeds/luci/protocols/luci-proto-wireguard/root/usr/libexec/rpcd/luci.wireguard
c86175d91113469d1ad66c4c63950bdb  /home/teq/opentrunk/feeds/luci/protocols/luci-proto-wireguard/Makefile
43fcd70d409ec70c149d6809d00ebef9  /home/teq/opentrunk/feeds/luci/protocols/luci-proto-wireguard/root/usr/share/rpcd/acl.d/luci-wireguard.json
78788cb08a2ee4da898699ef1563bdeb  /home/teq/opentrunk/feeds/luci/protocols/luci-proto-wireguard/htdocs/luci-static/resources/protocol/wireguard.js

@teqlee
Copy link
Author

teqlee commented Sep 29, 2021

I'm trying git clone https://git.openwrt.org/project/luci.git
check md5sum and it's the same:

teq@TeqDesk:~/downloads$ md5deep -r luci/applications/luci-app-wireguard
9a1e9c01566472b087e0d0192c9df267  /home/teq/downloads/luci/applications/luci-app-wireguard/root/usr/share/luci/menu.d/luci-app-wireguard.json
718474b39bfb6e597e3d5a12dfb5a7a5  /home/teq/downloads/luci/applications/luci-app-wireguard/root/usr/share/rpcd/acl.d/luci-app-wireguard.json
ecc5deaeed18e5602d6e8f0993632753  /home/teq/downloads/luci/applications/luci-app-wireguard/htdocs/luci-static/resources/view/wireguard/status.js
c71ec3e475714afa21e1bbe4c66732e0  /home/teq/downloads/luci/applications/luci-app-wireguard/Makefile

teq@TeqDesk:~/downloads$ md5deep -r luci/protocols/luci-proto-wireguard
ae2f10cdcfffe03283680a53728111c6  /home/teq/downloads/luci/protocols/luci-proto-wireguard/root/usr/libexec/rpcd/luci.wireguard
43fcd70d409ec70c149d6809d00ebef9  /home/teq/downloads/luci/protocols/luci-proto-wireguard/root/usr/share/rpcd/acl.d/luci-wireguard.json
78788cb08a2ee4da898699ef1563bdeb  /home/teq/downloads/luci/protocols/luci-proto-wireguard/htdocs/luci-static/resources/protocol/wireguard.js
c86175d91113469d1ad66c4c63950bdb  /home/teq/downloads/luci/protocols/luci-proto-wireguard/Makefile

@feckert
Copy link
Member

feckert commented Sep 29, 2021

Yes, I can confirm that I have the same hashes.
Have you cleared your browser cache?
But this would not explain this error result #5393 (comment)

@teqlee
Copy link
Author

teqlee commented Sep 29, 2021

Yep, tried cleared all cache, disabled all add-on/extensions, also trying Firefox Chrome Edge, the same.

@castillofrancodamian
Copy link
Contributor

The button to generate a private key does not work either.

@jow-
Copy link
Contributor

jow- commented Sep 30, 2021

Please execute /usr/libexec/rpcd/luci.wireguard list as command on the cli and see if it crashes. I suspect it requires one or more LuCI libraries which are not listed as dependencies.

In particular I think that a not installed libuci-lua is the culprit. It was previously pulled in by luci-compat which is not a dependency anymore since the conversion to JS. LuCI itself does not require libuci-lua so it is usually not installed by default.

@mydogteddy
Copy link

root@OpenWrt:# /usr/libexec/rpcd/luci.wirguard list
-ash: /usr/libexec/rpcd/luci.wirguard: not found
root@OpenWrt:
#

@mydogteddy
Copy link

there is a typo in jows command
root@OpenWrt:# /usr/libexec/rpcd/luci.wirguard list
-ash: /usr/libexec/rpcd/luci.wirguard: not found
root@OpenWrt:
# git checkout
-ash: git: not found
root@OpenWrt:# /usr/libexec/rpcd/luci.wirguard list
-ash: /usr/libexec/rpcd/luci.wirguard: not found
root@OpenWrt:
# /usr/libexec/rpcd/luci.wireguard list
lua: /usr/libexec/rpcd/luci.wireguard:6: module 'uci' not found:
no field package.preload['uci']
no file './uci.lua'
no file '/usr/share/lua/uci.lua'
no file '/usr/share/lua/uci/init.lua'
no file '/usr/lib/lua/uci.lua'
no file '/usr/lib/lua/uci/init.lua'
no file './uci.so'
no file '/usr/lib/lua/uci.so'
no file '/usr/lib/lua/loadall.so'
stack traceback:
[C]: in function 'require'
/usr/libexec/rpcd/luci.wireguard:6: in main chunk
[C]: ?
root@OpenWrt:~#

@feckert
Copy link
Member

feckert commented Sep 30, 2021

As already mentioned by @jow- (thanks for this) there is a dependency issue with luci.wireguard that I have not seen on merge

All of you have to install libuci-lua with the command opkg update && opkg install libuci-lua
I will prepare a fix for this of this is the solution

@mydogteddy
Copy link

I compiled again including libuci-lua but it did not correct the issue.

root@OpenWrt:# opkg list_installed | grep libuci
libuci20130104 - 2021-04-14-4b3db117-6
root@OpenWrt:
#

                              -*- libuci........... C library for the Unified Configuration Interface (UCI)                            │ │  

│ │ <*> libuci-lua............................................ Lua plugin for UCI │

root@OpenWrt:# /usr/libexec/rpcd/luci.wireguard list
lua: /usr/libexec/rpcd/luci.wireguard:6: module 'uci' not found:
no field package.preload['uci']
no file './uci.lua'
no file '/usr/share/lua/uci.lua'
no file '/usr/share/lua/uci/init.lua'
no file '/usr/lib/lua/uci.lua'
no file '/usr/lib/lua/uci/init.lua'
no file './uci.so'
no file '/usr/lib/lua/uci.so'
no file '/usr/lib/lua/loadall.so'
stack traceback:
[C]: in function 'require'
/usr/libexec/rpcd/luci.wireguard:6: in main chunk
[C]: ?
root@OpenWrt:
#

@mydogteddy
Copy link

I compiled and flashed again just to be sure and now I see this

root@OpenWrt:# /usr/libexec/rpcd/luci.wireguard list
{"generateQrCode":{"allowed_ips":["allowed_ips"],"privkey":"privkey","psk":"psk"},"generateKeyPair":{},"getWgInstances":{}}
root@OpenWrt:
#

@feckert
Copy link
Member

feckert commented Sep 30, 2021

That looks good, then try the LuCI to see if it fixes the problem now.

@mydogteddy
Copy link

In luci I see this,
https://imgur.com/mwnjNLZ.png

I have a WG running from my phone to the router at the same time

@mydogteddy
Copy link

wg show has all the correct info

@jow-
Copy link
Contributor

jow- commented Sep 30, 2021

In luci I see this,

Possibly a theme (XHTML) specific issue, please retest with the default bootstrap theme.

@mydogteddy
Copy link

@mydogteddy
Copy link

I can confirm OpenWrt | OpenWrt SNAPSHOT r17531-f413e4835e | Load: 0.54 0.18 0.06 works OK if this is of any use

@mydogteddy
Copy link

This version works OK

Hostname OpenWrt
Model Linksys E8450 (UBI)
Architecture ARMv8 Processor rev 4
Target Platform mediatek/mt7622
Firmware Version OpenWrt SNAPSHOT r17531-f413e4835e / LuCI Master git-21.226.86205-376af36
Kernel Version 5.10.64
Local Time 2021-09-30 10:35:17
Uptime 0h 3m 12s
Load Average 0.05, 0.11, 0.05

@mydogteddy
Copy link

this version does not work OK

Hostname OpenWrt
Model Linksys E8450 (UBI)
Architecture ARMv8 Processor rev 4
Target Platform mediatek/mt7622
Firmware Version OpenWrt SNAPSHOT r17630-6cd54254e4 / LuCI Master git-21.226.86205-376af36
Kernel Version 5.10.64
Local Time 2021-09-30 10:39:31
Uptime 0h 2m 17s
Load Average 0.28, 0.16, 0.06

@mydogteddy
Copy link

for clarity I have 2 x these Belkins one with the code I have recently compiled (which does not show in luci the WG status) and the other one which has some code compiled a short while ago and does show the WG status in luci

@teqlee
Copy link
Author

teqlee commented Sep 30, 2021

Installed libuci-lua & rebooted:

wg_issue

Also, generate priv-key button comeback to work after install libuci-lua.

@castillofrancodamian
Copy link
Contributor

Installed libuci-lua & rebooted:

wg_issue

Also, generate priv-key button comeback to work after install libuci-lua.

The same here. Even with this dependency installed, the WireGuard status does not appear.

@mydogteddy
Copy link

I have just done a new git clone however WG status is still not working

@dhcpme
Copy link

dhcpme commented Sep 30, 2021

I installed the libuci-lua dependency before using attended-sysupgrade to install a new image with it included and the status page appeared to work for a while but resembled the screenshots above by the time I connected a peer. I lost the ability to login to Luci after a reboot so I reverted to an image made yesterday via the CLI although it may have been my browser. I may try again later or sit back for a week and let you guys ride this out. :o)

@lvoegl
Copy link
Contributor

lvoegl commented Oct 1, 2021

Installed libuci-lua & rebooted:
wg_issue
Also, generate priv-key button comeback to work after install libuci-lua.

The same here. Even with this dependency installed, the WireGuard status does not appear.

Do you have any servers configured? This is the old vs. new Status with and without a WireGuard configuration.

new

new without config
new with config

old

old without config
old with config

@mydogteddy
Copy link

There was less than 100 commits between WG status working and it not working
Firmware Version OpenWrt SNAPSHOT r17531-f413e4835e / LuCI Master git-21.226.86205-376af36
Firmware Version OpenWrt SNAPSHOT r17630-6cd54254e4 / LuCI Master git-21.226.86205-376af36

@teqlee
Copy link
Author

teqlee commented Oct 1, 2021

Do you have any servers configured? This is the old vs. new Status with and without a Wireguard configuration.

Yes, i have server & client wg configured.
image

config interface 'wg1'
        option proto 'wireguard'
        option private_key 'xxx'
        option metric '9'
        option delegate '0'
        option peerdns '0'
        option mtu '1280'
        list addresses 'xxxx'

config wireguard_wg1
        option public_key 'xxxx'
        option endpoint_port '2408'
        option persistent_keepalive '25'
        option route_allowed_ips '1'
        option description 'Cloudflare'
        option endpoint_host 'xxxx'
        list allowed_ips '0.0.0.0/0'

config interface 'wg0'
        option proto 'wireguard'
        option delegate '0'
        option private_key 'xxxx'
        list addresses '10.111.111.1/24'
        option force_link '1'
        option listen_port '55820'
        option peerdns '0'

config wireguard_wg0
        option route_allowed_ips '1'
        option persistent_keepalive '25'
        list allowed_ips '10.111.111.5/32'
        option description 'x'
        option public_key 'xxxx'

@lvoegl
Copy link
Contributor

lvoegl commented Oct 1, 2021

should be fixed with #5403

@teqlee
Copy link
Author

teqlee commented Oct 1, 2021

should be fixed with

Well, confirm fixed. Tks for hard work.
image

@feckert
Copy link
Member

feckert commented Oct 1, 2021

Thanks all for testing
@lvoegl thanks for fixing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
7 participants