immense / Remotely

A remote control and remote scripting solution, built with .NET 8, Blazor, and SignalR.
GNU General Public License v3.0
4.42k stars 1.61k forks source link

Service on Ubuntu 20.04.3 not working #395

Open MatthK opened 2 years ago

MatthK commented 2 years ago

I came across another issue. I tried to install the agent on an Ubuntu server and downloaded the file and installed it with sudo /bin/bash Install_Ubuntu_x64.sh. That worked and didn't seem to come up with any errors. However, in the Home screen, the server does not show up. After a reboot, I checked the agent service to find that there is a Loaded problem (not found) and it also says it failed to connect to the server.

matth@vs02:~/Downloads$ sudo service remotely-agent status
● remotely-agent.service
     Loaded: not-found (Reason: Unit remotely-agent.service not found.)
     Active: active (running) since Wed 2021-11-17 11:53:01 HKT; 2h 35min ago
   Main PID: 3540 (Remotely_Agent)
     CGroup: /system.slice/remotely-agent.service
             └─3540 /usr/local/bin/Remotely/Remotely_Agent

Nov 17 14:27:36 vs02 Remotely_Agent[3540]: Skipping update check due to previous failure.  Restart the service to try again, or manually install the update.
Nov 17 14:27:37 vs02 Remotely_Agent[3540]: Websocket closed.  Reconnecting in 9 seconds...
Nov 17 14:27:47 vs02 Remotely_Agent[3540]: Failed to connect to server.  Internet connection may be unavailable.
Nov 17 14:27:47 vs02 Remotely_Agent[3540]: Response status code does not indicate success: 405 (Method Not Allowed).
Nov 17 14:27:47 vs02 Remotely_Agent[3540]: Skipping update check due to previous failure.  Restart the service to try again, or manually install the update.
Nov 17 14:27:48 vs02 Remotely_Agent[3540]: Websocket closed.  Reconnecting in 9 seconds...
Nov 17 14:27:58 vs02 Remotely_Agent[3540]: Failed to connect to server.  Internet connection may be unavailable.
Nov 17 14:27:58 vs02 Remotely_Agent[3540]: Response status code does not indicate success: 405 (Method Not Allowed).
Nov 17 14:27:58 vs02 Remotely_Agent[3540]: Skipping update check due to previous failure.  Restart the service to try again, or manually install the update.
Nov 17 14:27:59 vs02 Remotely_Agent[3540]: Websocket closed.  Reconnecting in 25 seconds...

Remotely Version Server (can be found on about page): Version: 2021.08.17.1435 Agent (can be found in device card): n/a

Desktop (please complete the following information):

MatthK commented 2 years ago

I did a complete reinstall of Ubuntu and just tried to install the remotely-agent again. It does install, and immediately after the install, I can see a lot of files in the directory /usr/local/bin/Remotely/, including the Remotely_agent. However, the service keeps failing with

matth@vs02:~/Downloads$ sudo service remotely-agent status
● remotely-agent.service - The Remotely agent used for remote access.
     Loaded: loaded (/etc/systemd/system/remotely-agent.service; enabled; vendor preset: enabled)
     Active: activating (auto-restart) (Result: exit-code) since Sat 2021-11-20 19:03:02 HKT; 1s ago
    Process: 24567 ExecStart=/usr/local/bin/Remotely/Remotely_Agent (code=exited, status=203/EXEC)
   Main PID: 24567 (code=exited, status=203/EXEC)

When I then check the directory again after a short while, there are only two files left in the directory. They somehow all got deleted.

matth@vs02:~/Downloads$ ls /usr/local/bin/Remotely/ -lia
total 12
 1573611 drwxr-xr-x 2 root root 4096 Nov 20 19:02 .
10354774 drwxr-xr-x 3 root root 4096 Nov 20 19:02 ..
 1573613 -rw-r--r-- 1 root root  192 Nov 20 19:02 ConnectionInfo.json
 1573614 -rw-r--r-- 1 root root    0 Nov 20 19:02 etag.txt

I tried to run the install a few times, but it keeps happening that the files get deleted.

saiinformatica commented 2 years ago

I've observed on a clean installation of Ubuntu 20.04.3:

Remotely Version Server (can be found on about page): Version: 2021.11.02.0914 Agent (can be found in device card): n/a

Desktop (please complete the following information): OS: [e.g. iOS] Ubuntu 20.04.3 LTS, fully updated

gt2416 commented 2 years ago

Same thing happens on CentOS 8. Complete clean install. However I could get it to start with the command dotnet /var/www/remotely/Remotely_Server.dll

The problem on CentOS anyway is that the systemctl file /etc/systemd/system/remotely.service calls /usr/bin/dotnet but the actual location of dotnet bin is /usr/local/bin. Changing the remotely.service file fixes it and I was able to make it work. You could try this on ubuntu.

lukastrkan commented 2 years ago

@saiinformatica I had exactly the same issue. I fixed it by changing http to https in the install script :)

saiinformatica commented 2 years ago

Thank you @lukastrkan for the tip, that worked for me. Checking Redirect to HTTPS on Server Config produces the correct hostname on the script, and probably avoids future client update problems.

toutti commented 2 years ago

Please, this script works on Centos text mode?

saschabrockel commented 10 months ago

@MatthK did you fix it? I have the same problem now with Ubuntu 22.04LTS which should be supported.

● remotely-agent.service - The Remotely agent used for remote access.
     Loaded: loaded (/etc/systemd/system/remotely-agent.service; enabled; vendor preset: enabled)
     Active: activating (auto-restart) (Result: exit-code) since Sun 2023-10-15 05:00:41 CEST; 2s ago
    Process: 51669 ExecStart=/usr/local/bin/Remotely/Remotely_Agent (code=exited, status=203/EXEC)
   Main PID: 51669 (code=exited, status=203/EXEC)
        CPU: 2ms

Ah, it is probably because this device has ARM64 architecture and the Linux package was x86 / x64. Because if I try this:

odroid@server:/usr/local/bin/Remotely$ ./Remotely_Agent
-bash: ./Remotely_Agent: cannot execute binary file: Exec format error

You can see the error.

MatthK commented 10 months ago

No, I never fixed it. As I couldn't find a solution, I gave up and use an RDP connection instead.