CloudflareD Tunnel keeps finding old tunnel.json file despite of creating new tunnel

Hi all,

I deleted my existing tunnel and created a new one. I have updated the tunnel ID in config.yaml file.
If I hit 'cloudflared tunnel run ', it is working as expected.

I created a script and gave it permissions to executes. Then, I created a service file point to script saying it has to execute everytime on startup.

But, whenever the service starts, it does not work. I get the following output from service status.

Nov 28 16:35:56 cypher systemd[1]: Started cloudflared.service.
Nov 28 16:35:56 cypher[5051]: Sleeping for 5 seconds
Nov 28 16:36:01 cypher[5051]: Starting Cloudflared Tunnel
Nov 28 16:36:03 cypher[5067]: 2021-11-28T16:36:03Z INF Starting tunnel tunnelID=d74c51a9-7f72-4f58-9365-e86a45428ed1
Nov 28 16:36:03 cypher[5067]: Tunnel credentials file '/home/ajitesh/.cloudflared/a89a84c8-0240-4edb-bd97-fba86990ee0d.json' doesn't >
Nov 28 16:36:03 cypher systemd[1]: cloudflared.service: Main process exited, code=exited, status=1/FAILURE
Nov 28 16:36:03 cypher systemd[1]: cloudflared.service: Failed with result 'exit-code'.

According to output, it knows the new tunnel id, but still it looks for oldtunnelid.json file. I don’t know why.

I have tried replacing tunnels, re-installing cloudflared tunnel etc.
If it is working fine with manual execution, its not working in systemd.
Moreover, I feel like this is a ubuntu or linux issue.

Kindly assist me.

I find that I end up with the relevant files not only in the directory where I start the process, but in /etc/cloudflared as well. I always have to tidy up to make sure they all match my new configuration.

It’s also possible it’s a permissions issue with that file. I see mine in .cloudflared is 600. You might try changing them to 644.


Do the same in /etc/cloudflared then restart it should work

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.