Failed to connect Cumulocity cloud

I ran this command:

“sudo tedge connect c8y”

after installing “thin-edge” and uploading the required certificate but I got this error message:

What should I do ?

The error means that thin-edge.io can’t resolve the c8y.url address that you have configured. This could be for different reasons, but mostly the most common causes are just some operating system level misconfiguration.

Try the following commands to at least gather more information

Can curl reach the c8y.url?

curl https://thin-edge-io.eu-latest.cumulocity.com

# If the above fails, try google
curl google.com

Can you ping the c8y.url?

ping thin-edge-io.eu-latest.cumulocity.com

# If the above fails, try google
ping google.com

If the google.com addresses don’t work, then you definitely have a network issue (connectivity or configuration).

it works

Though you have to use the urls that you configured :wink: Those urls were for my tenant.

This can be easily done using some bash commands which will read your c8y.url settings using convenient tedge cli commands.

C8Y_URL="$(tedge config get c8y.url)"
curl "https://$C8Y_URL"
ping "$C8Y_URL"

The above is doing the following:

  1. Get the c8y.url settings from the tedge config and storing the value in a variable
  2. Curl against the url (using the c8y.url from step 1, and adding https:// prefix)
  3. Ping against the url (from step 1 as well)

I dont understand this variable “$(tedge config get c8y.url)”
can you give me an example

You just need to run the code as is. Did you try running it?

Using $(tedge config get c8y.url) just uses the tedge cli command to lookup what you have configured as the c8y.url property with thin-edge.io and assigns the value to a bash variable (C8Y_URL). The bash variable is then referenced in the follow up curl and ping commands.

I did and this what I get:

You seem to have misspelled your url, it is cumulocity (not cumolocity)

So try correcting the setting via:

sudo tedge config set c8y.url wi-hwg-lu.cumulocity.com

You’ve got ‘cumolocity’ - should be ‘cumulocity’ configured.

1 Like

I got this

I suspect your misspelled url is still in the mosquitto bridge configuration, so you will need to disconnect then connect again using the following commands:

sudo tedge disconnect c8y
sudo tedge connect c8y

I did but still failed to connect

Can you please print out what your settings are (using code blocks please, not screenshots, see 💻 </> How to format code in posts and articles):

1. Check the mosquitto bridge settings

sudo cat /etc/tedge/mosquitto-conf/c8y-bridge.conf

2. Check the tedge settings

sudo tedge config list

For the first command I’ve got this

file or directory not found

but for the second one I’ve got this list

device.id=iwilr2-5.hwg-lu.de
device.key_path=/etc/tedge/device-certs/tedge-private-key.pem
device.cert_path=/etc/tedge/device-certs/tedge-certificate.pem
device.type=thin-edge.io
c8y.url=wi-hwg-lu.cumulocity.com
c8y.root_cert_path=/etc/ssl/certs
c8y.smartrest.templates=
c8y.http:443=wi-hwg-lu.cumolocity.com
c8y.mqtt:8883=wi-hwg-lu.cumolocity.com
c8y.topics=[“tedge/measurements”, “tedge/measurements/+”, “tedge/alarms/+/+”, “tedge/alarms/+/+/+”, “tedge/events/+”, “tedge/events/+/+”, “tedge/health/+”, “tedge/health/+/+”]
az.root_cert_path=/etc/ssl/certs
az.mapper.timestamp=true
az.topics=[“tedge/measurements”, “tedge/measurements/+”, “tedge/health/+”, “tedge/health/+/+”]
aws.root_cert_path=/etc/ssl/certs
aws.mapper.timestamp=true
aws.topics=[“tedge/measurements”, “tedge/measurements/+”, “tedge/alarms/+/+”, “tedge/alarms/+/+/+”, “tedge/events/+”, “tedge/events/+/+”, “tedge/health/+”, “tedge/health/+/+”]
mqtt.bind.address=127.0.0.1
mqtt.bind.port=1883
mqtt.client.host=localhost
mqtt.client.port=1883
http.bind.port=8000
http.bind.address=127.0.0.1
software.plugin.max_packages=1000
run.path=/run
run.lock_files=true
logs.path=/var/log
tmp.path=/tmp
data.path=/var/tedge
firmware.child.update.timeout=3600
service.type=service

Though can you check the following additional steps:

fyi, you can create a code block using the following (triple backticks), as you previous post contained quoted blocks.

```
example code
```

1. Check if openssl is able to reach the url

Though could you just check if openssl is able to reach the Cumulocity IoT url (because if openssl has a problem then tedge will most likely also have a problem), or do you have the VPN still connected, maybe the traffic is being route

yes | openssl s_client -connect wi-hwg-lu.cumulocity.com:8883

2. Did you upload the cert using the tedge cli?

Did you upload the certificate using the following command (note: the user will have to be your user). Because I’m kind of surprised that uploading the cert worked, but the connection to c8y doesn’t…or did you manually upload the certificate…if so they why? As this would point to a general connectivity problem with your device.

tedge cert upload c8y --user myuser@example.com

If everything else fails

If this still fails then it possible that the device has some custom networking (e.g. using a proxy, or a VPN which is interfering), you might have some success talking with your network admin if this is the case.

Wait one sec…I just saw that you have some incorrect settings (it was a bit hard to spot because you used a quoted block instead of a code block)…

The tedge config list output shows that you have two “weird” entries, which I’m not sure where they came from…

c8y.http:443=wi-hwg-lu.cumolocity.com
c8y.mqtt:8883=wi-hwg-lu.cumolocity.com

It looks like you have accidentally set some invalid settings…can post the contents of the following commands?

env | grep "TEDGE"
cat /etc/tedge/tedge.toml

Another user uploaded the certificate

you have right there are wrong entries

pi@IWILR2-5:~ $ env | grep "TEDGE"
pi@IWILR2-5:~ $ cat /etc/tedge/tedge.toml
[config]
version = "2"

[c8y]
url = "wi-hwg-lu.cumulocity.com"
http = "wi-hwg-lu.cumolocity.com:443"
mqtt = "wi-hwg-lu.cumolocity.com:8883"

the other user have the admin rights so he uploaded the certificate, can I do it as well or what

It is always worth while reading the output before posting it, as the output shows that your configuration still has the typo in the urls.

Since you are just using the default Cumulocity IoT endpoints, you can actually just delete the http and mqtt keys under the c8y section, so afterwards your /etc/tedge/tedge.toml should look like this:

[config]
version = "2"

[c8y]
url = "wi-hwg-lu.cumulocity.com"