webos-tools / cli

command-line interface (CLI) for webOS
Apache License 2.0
24 stars 5 forks source link

error message when unable to connect to a device is cryptic/useless #2

Closed ericblade closed 7 months ago

ericblade commented 7 months ago

device wsl-localhost-22 was not up and running at the time of the first attempt to ares-install

G:\grocy-micro-ui\public>ares-install webos\com.randomstreasures.grocy-micro-ui_1.0.0_all.ipk
[Info] Set target device : wsl-localhost-22
ares-install ERR! AggregateError 

when device is running, install does not produce cryptic errors

G:\grocy-micro-ui\public>ares-install webos\com.randomstreasures.grocy-micro-ui_1.0.0_all.ipk
[Info] Set target device : wsl-localhost-22
Installing package webos\com.randomstreasures.grocy-micro-ui_1.0.0_all.ipk
SeongCheolHeo commented 7 months ago

Thanks for your bug report. Could you share the result of "ares-setup-device -F"? Could you share how to reproduce this issue?

ericblade commented 7 months ago

Sure, just try to install a package to a device that isn't online or powered on. There's no error handling, it just drops multiple failed promises in an AggregateErr.

G:\grocy-micro-ui\public>ares-setup-device -F
[
    {
        "profile": "ose",
        "name": "wsl-device",
        "default": false,
        "deviceinfo": {
            "ip": "127.0.0.1",
            "port": "5522",
            "user": "root"
        },
        "connection": [
            "ssh"
        ],
        "details": {
            "password": "",
            "description": "wsl-device"
        }
    },
    {
        "profile": "ose",
        "name": "wsl-localhost-22",
        "default": true,
        "deviceinfo": {
            "ip": "127.0.0.1",
            "port": "22",
            "user": "root"
        },
        "connection": [
            "ssh"
        ],
        "details": {
            "password": "",
            "description": "new device description"
        }
    },
    {
        "profile": "ose",
        "name": "emulator",
        "default": false,
        "deviceinfo": {
            "ip": "127.0.0.1",
            "port": "6622",
            "user": "developer"
        },
        "connection": [
            "ssh"
        ],
        "details": {
            "privatekey": "webos_emul",
            "description": "LG webOS Emulator"
        }
    },
    {
        "profile": "ose",
        "name": "RaspberryPi3B",
        "default": false,
        "deviceinfo": {
            "ip": "192.168.0.96",
            "port": "22",
            "user": "root"
        },
        "connection": [
            "ssh"
        ],
        "details": {
            "privatekey": "webos_emul",
            "description": "RaspberryPi3B"
        }
    }
]
nhamkthd commented 7 months ago

@ericblade thank for your sharing. It seems your device information is nothing special, you can try "ares-install" again by adding -v option and share me the log results (ares-install PACKAGE -v)

SeongCheolHeo commented 7 months ago

@ericblade I want to reproduce your case. But I don't know what is wsl device. So I just try to below. I installed WSL2 in my windows pc, and I installed ubuntu 22.04 in WSL2 and installed openssh on ubuntu. When I run ares-shell from host pc into ubuntu on WSL, it's working fine. And when I turned off ubuntu on WSL. When I try to run ares-shell from host pc into ubuntu on WSL, error is correctly shown below.

ares-shell ERR! [syscall failure]: connect ECONNREFUSED 127.0.0.1:22 ares-shell ERR! [Tips]: Connection refused. Please check the device IP address or the port number

Could you explain what is wsl device? And could you share how to make wsl device to reproduce your case?

ericblade commented 7 months ago

hmm. OK, I'll retract this. I do get a proper error when trying to ares-install to my RaspberryPi while it's offline (Connection timed out), so I'll go debug what's happening when I try to connect to wsl.

The wsl-device is a thing I'm working on to run webOS as a WSL distribution. Got it working pretty well, though it needs a little more work before I show it off, though. :)

I'll go and debug whatever is happening when I try to connect to it while webOS isn't running, since it's not the usual timeout or connrefused...

Thanks for checking, though. I don't have a fully supported OSE device, just a Pi3, which works fine with some modifications.

I'll probably end up submitting a patch for whatever the error condition is when I find out. Thanks!