Cloudflared Installation Not Properly Installing

Hello, I’m trying to install cloudflared and I messed up the original installation as my computer crashed. I’m trying to reinstall and it just pauses when using systemd.

curl -L --output cloudflared.deb https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb &&

sudo dpkg -i cloudflared.deb &&

sudo cloudflared service install [REDACTED]
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 16.8M  100 16.8M    0     0  5527k      0  0:00:03  0:00:03 --:--:-- 6871k
(Reading database ... 206160 files and directories currently installed.)
Preparing to unpack cloudflared.deb ...
Unpacking cloudflared (2023.10.0) over (2023.10.0) ...
Setting up cloudflared (2023.10.0) ...
Processing triggers for man-db (2.10.2-1) ...
2023-12-31T22:55:55Z INF Using Systemd

When I ctrl+c out of it and check status on cloudflared:

● cloudflared.service - cloudflared
     Loaded: loaded (/etc/systemd/system/cloudflared.service; enabled; vendor preset: enabled)
     Active: activating (start) since Sun 2023-12-31 16:55:55 CST; 2min 56s ago
   Main PID: 6114 (cloudflared)
      Tasks: 20 (limit: 38095)
     Memory: 18.4M
        CPU: 279ms
     CGroup: /system.slice/cloudflared.service
             └─6114 /usr/bin/cloudflared --no-autoupdate tunnel run --token REDACTED>

Dec 31 16:58:08 user-server cloudflared[6114]: 2023-12-31T22:58:08Z INF Retrying connection in up to 1m4s connIndex=>
Dec 31 16:58:09 user-server cloudflared[6114]: 2023-12-31T22:58:09Z ERR failed to serve incoming request error="Unau>
Dec 31 16:58:09 user-server cloudflared[6114]: 2023-12-31T22:58:09Z ERR Register tunnel error from server side error>
Dec 31 16:58:09 user-server cloudflared[6114]: 2023-12-31T22:58:09Z INF Retrying connection in up to 1m4s connIndex=>
Dec 31 16:58:25 user-server cloudflared[6114]: 2023-12-31T22:58:25Z ERR failed to serve incoming request error="Unau>
Dec 31 16:58:25 user-server cloudflared[6114]: 2023-12-31T22:58:25Z ERR Register tunnel error from server side error>
Dec 31 16:58:25 user-server cloudflared[6114]: 2023-12-31T22:58:25Z INF Retrying connection in up to 1m4s connIndex=>
Dec 31 16:58:50 user-server cloudflared[6114]: 2023-12-31T22:58:50Z ERR failed to serve incoming request error="Unau>
Dec 31 16:58:50 user-server cloudflared[6114]: 2023-12-31T22:58:50Z ERR Register tunnel error from server side error>
Dec 31 16:58:50 user-server cloudflared[6114]: 2023-12-31T22:58:50Z INF Retrying connection in up to 1m4s connIndex=>

Next I tried used the command sudo rm -rf /etc/apt/sources.list.d/cloudflared.list and rebooted my PC and then retried the following command:

curl -L --output cloudflared.deb https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb &&

sudo dpkg -i cloudflared.deb &&

sudo cloudflared service install REDACTED

resulting in the following

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 16.8M  100 16.8M    0     0  9210k      0  0:00:01  0:00:01 --:--:-- 13.5M
[sudo] password for user:
Selecting previously unselected package cloudflared.
(Reading database ... 206156 files and directories currently installed.)
Preparing to unpack cloudflared.deb ...
Unpacking cloudflared (2023.10.0) ...
Setting up cloudflared (2023.10.0) ...
Processing triggers for man-db (2.10.2-1) ...
2023-12-31T23:11:57Z INF Using Systemd
2023-12-31T23:11:57Z ERR error generating service template error="cloudflared service is already installed at /etc/systemd/system/cloudflared.service; if you are running a cloudflared tunnel, you can point it to multiple origins, avoiding the need to run more than one cloudflared service in the same machine; otherwise if you are really sure, you can do `cloudflared service uninstall` to clean up the existing service and then try again this command"
cloudflared service is already installed at /etc/systemd/system/cloudflared.service; if you are running a cloudflared tunnel, you can point it to multiple origins, avoiding the need to run more than one cloudflared service in the same machine; otherwise if you are really sure, you can do `cloudflared service uninstall` to clean up the existing service and then try again this command

My installation is screwed up and I’m not sure how to fix it. What can I do?

Try doing sudo rm /etc/systemd/system/cloudflared.service then reinstalling.

I tried that and then the same errors keep popping up.

Here’s what happens when I try starting cloudflare.service with systemctl start cloudflared.service.

Jan 01 12:55:38 user-server cloudflared[19994]: 2024-01-01T18:55:38Z DBG edge discovery: returning same edge address back to pool connIndex=0 event=0 ip=<IP>
Jan 01 12:55:38 user-server cloudflared[19994]: 2024-01-01T18:55:38Z DBG Connecting via http2 connIndex=0 event=0 ip=<IP>
Jan 01 12:55:38 user-server cloudflared[19994]: 2024-01-01T18:55:38Z DBG rpc rx error: context canceled
Jan 01 12:55:38 user-server cloudflared[19994]: 2024-01-01T18:55:38Z ERR failed to serve incoming request error="Unauthorized: Failed to get tunnel"
Jan 01 12:55:38 user-server cloudflared[19994]: 2024-01-01T18:55:38Z ERR Register tunnel error from server side error="Unauthorized: Failed to get tunnel" connIndex=0 event=0 ip=<IP>

Haven’t found anything online for these errors either.

In the meantime, may I ask if you’re going to manage and use config.yml file at the origin itsel to run the cloudflared tunnel, or you’d like to manage it via the ZT Dashboard? :thinking:

Did you configured and managed the cloudflared tunnel at the origin using config.yml file, or?

By the stated, are you using Debian?

Did you used purge just in case?

Did you disabled and stopped the service, then tried removing and purging?

This makes it seem like the token you are using isn’t valid. What happens if you roll the token and use the new one?

1 Like

How do I do this? @Cyb3r-Jak3

Hey fritex. I’d like to manage it with the ZT dashboard. I have configured the tunnel using the config.yml file and the tunnel starts when I created and ran the locally-managed tunnel through CLI but the background service. I am currently using Ubuntu 22.04 and I did use purge. I tried stopping the service, removing and purging and then reinstalling but the errors above came up. Then I followed the steps with the link under and I was able to create a local tunnel that worked but the background service still wasn’t being started without errors: