#Failed cloudflared.service startup

36 messages · Page 1 of 1 (latest)

celest socket
#

Hello, I recently tried installing cloudflared.service though my PC crashed during the installation. Now whenever I try reinstalling, it pauses infinitely after I run sudo systemctl start cloudflared. Here is the logs for when I try starting up the service. I haven't had much luck online either.

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>
low sleet
#

error="Unauthorized: Failed to get tunnel"

Try to regenerate the tunnel token and replace the one inside cloudflared.service with the new one

celest socket
#

@low sleet how do you do this?

#

how do you regenerate the tunnel token i mean

low sleet
#

Zero trust dash -> Tunnels -> tunnel in question -> at the bottom of the pge, refresh token.
then copy the new token from the box above and remove sudo cloudflared service install then copy the remaining in to the cloudflared.service file in /etc/systemd/system/cloudflared.service

celest socket
#

i'll have to migrate over then right

low sleet
#

you can either migrate it over, or use the same steps that you used to create the tunnel to re-gen a cert for it

celest socket
#

alright i'll give it a shot

low sleet
#

or just a cloudflared tunnel login should work

#

then copy the cert.pem to wherever the current one is stored.

celest socket
#

the command?

low sleet
#

yeah

celest socket
#

the cloudflared tunnel login is different from the cloudflared.service

low sleet
celest socket
#

i was able to auth with cloudflared tunnel login but the cloudflared.service still won't start

#

ya this is the guide i went through

low sleet
#

ah, i see

celest socket
#

i can create the tunnel locally but the background service doesn't work at all

low sleet
#

In your config file you need to reference the path for the cert.pem

#

it does not just magically know where it is

celest socket
#

let me double check

low sleet
#

the default location would be ~/.cloudflared/cert.pem in whatever user you use to login

celest socket
#

in the guide they didn’t include how to reference it so this is all I have

low sleet
low sleet
#

try regen it

celest socket
#

how do you find the token?

#

when the cloudflare.service executes token run <token>

low sleet
celest socket
#

I migrated it and ran the command and here's the error

sudo cloudflared service install TOKEN
2024-01-01T21:10:57Z INF Using Systemd
2024-01-01T21:10: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
#

im not sure what i did but it started working now