# How to Configure and Connect to Cumulocity IoT in Rasbery Pi?

**URL:** <https://community.cumulocity.com/t/how-to-configure-and-connect-to-cumulocity-iot-in-rasbery-pi/1528>\
**Category:** Forum\
**Tags:** cumulocity\
**Created:** [July 4, 2023, 4:52am UTC](https://community.cumulocity.com/t/how-to-configure-and-connect-to-cumulocity-iot-in-rasbery-pi/1528 "2023-07-04T04:52:33Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![aatif.jariwala](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@aatif.jariwala](https://community.cumulocity.com/u/aatif.jariwala)\
**Post date:** [July 5, 2023, 4:01am UTC](https://community.cumulocity.com/t/how-to-configure-and-connect-to-cumulocity-iot-in-rasbery-pi/1528/21 "2023-07-05T04:01:24Z")

</div>

So I need to follow this command, right?

sudo tedge config set c8y.url “[aatif312.eu-latest.cumulocity.com](http://aatif312.eu-latest.cumulocity.com)”

sudo tedge cert upload c8y --user “aatif\_jariwala”

---

<div class="post-metadata">

**Author:** ![aatif.jariwala](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@aatif.jariwala](https://community.cumulocity.com/u/aatif.jariwala)\
**Post date:** [July 5, 2023, 4:23am UTC](https://community.cumulocity.com/t/how-to-configure-and-connect-to-cumulocity-iot-in-rasbery-pi/1528/22 "2023-07-05T04:23:47Z")

</div>

I followed this command shown in the figure, but it gives the same error ☹

 ![image](https://europe1.discourse-cdn.com/flex005/uploads/cumulocity/original/3X/b/9/b97d8cde30494f4a3ed5f1b46e17c20ed950da3c.png)

---

<div class="post-metadata">

**Author:** ![Reuben\_Miller2](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/reuben_miller2/32/317_2.png) [@Reuben\_Miller2](https://community.cumulocity.com/u/Reuben_Miller2)\
**Post date:** [July 5, 2023, 8:18am UTC](https://community.cumulocity.com/t/how-to-configure-and-connect-to-cumulocity-iot-in-rasbery-pi/1528/23 "2023-07-05T08:18:08Z")

</div>

From what I can tell it looks like you’re now using the correct url and username (though I can’t verify that myself, so I will have to trust you on that).

So I can still think of a few scenarios which might be causing you to get a 401 (not authorized) response:

1. You are using the wrong password (or something unexpected is happening when you are pasting/typing the password when you are prompted by the `tedge` command).
2. You are using a SSO (Single Sign On user). SSO users can’t access the API (used by `tedge cert upload`) via a username/password, as it requires the generation of a token instead. An alternative solution would be to create a new user in your tenant by following the [Cumulocity documentation](https://cumulocity.com/guides/users-guide/administration/#to-add-a-user), though don’t enable TFA (Two Factor Authentication) for this user as that is also not supported for the uploading of certs.

---

<div class="post-metadata">

**Author:** ![Robert\_Neale](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/robert_neale/32/31965_2.png) [@Robert\_Neale](https://community.cumulocity.com/u/Robert_Neale)\
**Post date:** [July 5, 2023, 8:35am UTC](https://community.cumulocity.com/t/how-to-configure-and-connect-to-cumulocity-iot-in-rasbery-pi/1528/24 "2023-07-05T08:35:37Z")

</div>

It is an ‘external’ user being used.

 ![image](https://europe1.discourse-cdn.com/flex005/uploads/cumulocity/original/3X/f/d/fd958b93fb3558d6873e531d763ee61ca7932b8a.png)

Can you use a different account or allow me to create you one for the certificate upload?

---

<div class="post-metadata">

**Author:** ![aatif.jariwala](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@aatif.jariwala](https://community.cumulocity.com/u/aatif.jariwala)\
**Post date:** [July 5, 2023, 8:46am UTC](https://community.cumulocity.com/t/how-to-configure-and-connect-to-cumulocity-iot-in-rasbery-pi/1528/25 "2023-07-05T08:46:03Z")

</div>

The same problem occurs when I use another different account.

How do I give you access to create a new account?

---

<div class="post-metadata">

**Author:** ![Robert\_Neale](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/robert_neale/32/31965_2.png) [@Robert\_Neale](https://community.cumulocity.com/u/Robert_Neale)\
**Post date:** [July 5, 2023, 2:21pm UTC](https://community.cumulocity.com/t/how-to-configure-and-connect-to-cumulocity-iot-in-rasbery-pi/1528/26 "2023-07-05T14:21:04Z")

</div>

I’ve created a user ‘certuser’. I’ll email you the password.

---

<div class="post-metadata">

**Author:** ![aatif.jariwala](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@aatif.jariwala](https://community.cumulocity.com/u/aatif.jariwala)\
**Post date:** [July 6, 2023, 4:00am UTC](https://community.cumulocity.com/t/how-to-configure-and-connect-to-cumulocity-iot-in-rasbery-pi/1528/28 "2023-07-06T04:00:39Z")

</div>

ok, please share the password to my email

---

<div class="post-metadata">

**Author:** ![Robert\_Neale](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/robert_neale/32/31965_2.png) [@Robert\_Neale](https://community.cumulocity.com/u/Robert_Neale)\
**Post date:** [July 6, 2023, 7:59am UTC](https://community.cumulocity.com/t/how-to-configure-and-connect-to-cumulocity-iot-in-rasbery-pi/1528/29 "2023-07-06T07:59:56Z")

</div>

Sent to aatif.jariwala@dnkmail.in

---

<div class="post-metadata">

**Author:** ![aatif.jariwala](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@aatif.jariwala](https://community.cumulocity.com/u/aatif.jariwala)\
**Post date:** [July 6, 2023, 9:25am UTC](https://community.cumulocity.com/t/how-to-configure-and-connect-to-cumulocity-iot-in-rasbery-pi/1528/30 "2023-07-06T09:25:30Z")

</div>

Hi Robert, I have not received the mail yet

---

<div class="post-metadata">

**Author:** ![Robert\_Neale](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/robert_neale/32/31965_2.png) [@Robert\_Neale](https://community.cumulocity.com/u/Robert_Neale)\
**Post date:** [July 6, 2023, 10:22am UTC](https://community.cumulocity.com/t/how-to-configure-and-connect-to-cumulocity-iot-in-rasbery-pi/1528/31 "2023-07-06T10:22:14Z")

</div>

Is there an alternative email address I can use?

---

<div class="post-metadata">

**Author:** ![aatif.jariwala](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@aatif.jariwala](https://community.cumulocity.com/u/aatif.jariwala)\
**Post date:** [July 6, 2023, 10:24am UTC](https://community.cumulocity.com/t/how-to-configure-and-connect-to-cumulocity-iot-in-rasbery-pi/1528/32 "2023-07-06T10:24:42Z")

</div>

[mdaatif2000.dnk@gmail.com](mailto:mdaatif2000.dnk@gmail.com)

You can send me credentials to this email.

---

<div class="post-metadata">

**Author:** ![aatif.jariwala](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@aatif.jariwala](https://community.cumulocity.com/u/aatif.jariwala)\
**Post date:** [July 6, 2023, 12:02pm UTC](https://community.cumulocity.com/t/how-to-configure-and-connect-to-cumulocity-iot-in-rasbery-pi/1528/33 "2023-07-06T12:02:59Z")

</div>

Ok I have got it password from my email address

my tenant id:- certuser

So I can log in with these credentials, and what is my environment name for login purposes?

---

<div class="post-metadata">

**Author:** ![Robert\_Neale](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/robert_neale/32/31965_2.png) [@Robert\_Neale](https://community.cumulocity.com/u/Robert_Neale)\
**Post date:** [July 6, 2023, 12:48pm UTC](https://community.cumulocity.com/t/how-to-configure-and-connect-to-cumulocity-iot-in-rasbery-pi/1528/34 "2023-07-06T12:48:49Z")

</div>

certuser is your user id. You have the password via emal.

the tenant is [http://aatif312.eu-latest.cumulocity.com](http://aatif312.eu-latest.cumulocity.com)

Type this in a browser address bar and use the credentials to check you can log on to the tenant.

---

<div class="post-metadata">

**Author:** ![aatif.jariwala](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@aatif.jariwala](https://community.cumulocity.com/u/aatif.jariwala)\
**Post date:** [July 7, 2023, 5:04am UTC](https://community.cumulocity.com/t/how-to-configure-and-connect-to-cumulocity-iot-in-rasbery-pi/1528/35 "2023-07-07T05:04:03Z")

</div>

Hi Robert,  
I have successfully connected to the Cumulocity account using (certuser) user id in the raspberry pi device.  
But I can not send data using Mosquito broker  
I have faced such kinds of errors:-

 ![ipmsgclip_r_1688705022_0](https://europe1.discourse-cdn.com/flex005/uploads/cumulocity/original/3X/1/e/1e5592fd25e159b037b35d68054051c7c94ca25f.png)

 ![image](https://europe1.discourse-cdn.com/flex005/uploads/cumulocity/original/3X/c/7/c7ff632485e24553a2aaeffad05e0617e73d737e.png)

 ![image](https://europe1.discourse-cdn.com/flex005/uploads/cumulocity/original/3X/5/c/5c44c12f968fa28b89dff12827b5a6d096fe902f.png)

---

<div class="post-metadata">

**Author:** ![Reuben\_Miller2](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/reuben_miller2/32/317_2.png) [@Reuben\_Miller2](https://community.cumulocity.com/u/Reuben_Miller2)\
**Post date:** [July 7, 2023, 7:55am UTC](https://community.cumulocity.com/t/how-to-configure-and-connect-to-cumulocity-iot-in-rasbery-pi/1528/36 "2023-07-07T07:55:35Z")

</div>

From the screenshot that you posted, it shows that you are running the mosquitto MQTT broker from a non-standard location (e.g. just from a folder under `~/Downloads/...`).

I would highly recommend following the [thin-edge.io](http://thin-edge.io) getting started guide, and installing it as per the instructions.

- [Getting Started | Thin-edge](https://thin-edge.github.io/thin-edge.io/start/)

Yes you can use a custom installed mosquitto broker, however you need to then managed the bridge configuration yourself…I would avoid this if possible, as the more non-standard your setup is, the more likely you will run into unexpected pitfalls, and unless you know how to handle them, it just unnecessarily complications things. It also makes it hard to offer support 😉

---

<div class="post-metadata">

**Author:** ![aatif.jariwala](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@aatif.jariwala](https://community.cumulocity.com/u/aatif.jariwala)\
**Post date:** [July 7, 2023, 10:06am UTC](https://community.cumulocity.com/t/how-to-configure-and-connect-to-cumulocity-iot-in-rasbery-pi/1528/37 "2023-07-07T10:06:17Z")

</div>

Yes Reuben we have followed the [thin-edge.io](http://thin-edge.io) steps but it gives an error

 ![ipmsgclip_r_1688705022_0](https://europe1.discourse-cdn.com/flex005/uploads/cumulocity/original/3X/1/e/1e5592fd25e159b037b35d68054051c7c94ca25f.png)

We are using the default setup of Paho mosquito broker, Are there any steps for installation for Mosquitto broker? Because we are currently using by default MQTT broker by Eclipse Paho.

---

<div class="post-metadata">

**Author:** ![Stefan\_Witschel](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/stefan_witschel/32/31955_2.png) [@Stefan\_Witschel](https://community.cumulocity.com/u/Stefan_Witschel)\
**Post date:** [July 7, 2023, 10:49am UTC](https://community.cumulocity.com/t/how-to-configure-and-connect-to-cumulocity-iot-in-rasbery-pi/1528/38 "2023-07-07T10:49:25Z")

</div>

What Reuben is mentioning is that you should use the MQTT Broker that comes with [thin-edge.io](http://thin-edge.io) because the configuration is much more easier than using your own installed MQTT Broker.

Btw. paho is the mqtt client, mosquitto is the mqtt broker.

The manual steps to configure a mqtt broker can be found here [https://thin-edge.github.io/thin-edge.io/operate/configuration/config\_local\_mqtt\_bind\_address\_and\_port](https://thin-edge.github.io/thin-edge.io/operate/configuration/config_local_mqtt_bind_address_and_port). This excludes the bridge configuration, so this is why Reuben mentioned to avoid this and use the pre-configured broker which comes with these steps:

> **[A tour of thin-edge.io | Thin-edge](https://thin-edge.github.io/thin-edge.io/start/getting-started/)**
>
> User Context

---

<div class="post-metadata">

**Author:** ![Reuben\_Miller2](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/reuben_miller2/32/317_2.png) [@Reuben\_Miller2](https://community.cumulocity.com/u/Reuben_Miller2)\
**Post date:** [July 7, 2023, 11:13am UTC](https://community.cumulocity.com/t/how-to-configure-and-connect-to-cumulocity-iot-in-rasbery-pi/1528/39 "2023-07-07T11:13:13Z")

</div>

If you installed [thin-edge.io](http://thin-edge.io) using the install script (as detailed in the getting started instructions), then it would have installed the `mosquitto` Debian package which runs the mosquitto broker as a service under the service manager (systemd, part of the operating systemd).

From your previous screenshot showing the mosquitto log output, it showed that you were starting `mosquitto` manually and not using the system service, because the screenshot showed you were calling `mosquitto` from the command line…this is not correct.

Also, you can’t have two mosquitto brokers running either as this can cause problem.

So I would try the following:

1. Stop your manually started mosquitto broker

2. Start the mosquitto service using:

3. Installing additional mosquitto clients (this installs the `mosquitto_sub` and `mosquitto_pub` cli commands)

4. Try publishing to the broker (just to check that the broker is running)…the message could be anything, but you shouldn’t see any errors when running the command.

5. Then try to reconnect the [thin-edge.io](http://thin-edge.io) mapper.

If this still does not work, then you need to provide some more information about your setup, as all systems are not the same, so without knowing more specifics then it is a bit difficult to assist.

- What hardware are you using (Raspberry Pi 3/4 ?)
- What operating system version are you using: `cat /etc/os*`
- What system architecture are you using: `uname -a`
- What version of [thin-edge.io](http://thin-edge.io) are you using: `tedge --version`

Though I suspect if you still feel out of depth, then maybe a more hands on meeting would be appropriate, however this would depend on support contracts etc.

---

<div class="post-metadata">

**Author:** ![aatif.jariwala](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@aatif.jariwala](https://community.cumulocity.com/u/aatif.jariwala)\
**Post date:** [July 8, 2023, 4:30am UTC](https://community.cumulocity.com/t/how-to-configure-and-connect-to-cumulocity-iot-in-rasbery-pi/1528/40 "2023-07-08T04:30:13Z")

</div>

> [@Reuben\_Miller2](#):
>
> assist

I am using this Ubuntu 18.04.5 version, not raspberry pi. Is there any issue with the Ubuntu version ??

 ![image](https://europe1.discourse-cdn.com/flex005/uploads/cumulocity/original/3X/1/8/189afafd06dde68403d8bdec16efb37473a02255.png)

I have followed your process, but it gives some error, What am I doing wrong?

![image](https://europe1.discourse-cdn.com/flex005/uploads/cumulocity/optimized/2X/5/51e5f71b48aeb2b729e61248aa13e357c2ac9bee_2_690x35.png)

---

<div class="post-metadata">

**Author:** ![Reuben\_Miller2](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/reuben_miller2/32/317_2.png) [@Reuben\_Miller2](https://community.cumulocity.com/u/Reuben_Miller2)\
**Post date:** [July 8, 2023, 6:42am UTC](https://community.cumulocity.com/t/how-to-configure-and-connect-to-cumulocity-iot-in-rasbery-pi/1528/41 "2023-07-08T06:42:55Z")

</div>

I think we need to talk about some general guidelines first when posting responses, before continuing.

## Guide to being a good forum citizen

### 1. Please don’t post misleading/false information

The title of the ticket mentions that you are using a Raspberry Pi, but now you’re saying you’re on Ubuntu.  
Having misleading information makes it very difficult (and frustrating) for people to help.

### 2. Provide more context when something does not work as expected

Generally don’t just post “What am I doing wrong?” without providing more context. A screenshot of one line form the console is not enough context to help. Most of the time the lead up to the error is more useful than the error itself.

### 3. Use code-blocks over images if you can

Images are not very helpful to transmit information on forum style websites. Images are less searchable, and generally it is a pain for anyone helping to copy information from the image when debugging unexpected behaviour.

Instead use a markdown [code block](https://www.markdownguide.org/basic-syntax/#code-blocks) (see the link for the syntax). A code block makes it much easier for everyone to read/copy from (especially when we’re talking about console output which is 100% text based).

Here is an example how a markdown code block is visualized…it is just plain text but rendered in a nice fenced block.

```sh
# sudo systemctl status mosquitto
● mosquitto.service - Mosquitto MQTT Broker
     Loaded: loaded (/lib/systemd/system/mosquitto.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2023-06-28 07:37:35 UTC; 1 weeks 2 days ago
       Docs: man:mosquitto.conf(5)
             man:mosquitto(8)
    Process: 35 ExecStartPre=/bin/mkdir -m 740 -p /var/log/mosquitto (code=exited, status=0/SUCCESS)
    Process: 38 ExecStartPre=/bin/chown mosquitto /var/log/mosquitto (code=exited, status=0/SUCCESS)
    Process: 44 ExecStartPre=/bin/mkdir -m 740 -p /run/mosquitto (code=exited, status=0/SUCCESS)
    Process: 46 ExecStartPre=/bin/chown mosquitto /run/mosquitto (code=exited, status=0/SUCCESS)
   Main PID: 60 (mosquitto)
      Tasks: 1 (limit: 9515)
     Memory: 52.9M
     CGroup: /docker/c2d0a8898f9600d80a088d1bf3c0bfec9b43ea084b9dcc6d854ae70bb3255dd9/system.slice/mosquitto.service
             └─60 /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf

Jul 08 06:17:52 c2d0a8898f96 mosquitto[60]: 1688797072: Sending PUBLISH to auto-B4BB0523-8946-3F87-FB13-33E6D4DE58A4 (d0, q0, r0, m0, 'tedge/measurements/tedge_c2d0a8898f96_child01', ... (65 bytes))
Jul 08 06:17:52 c2d0a8898f96 mosquitto[60]: 1688797072: Received PINGREQ from tedge_c2d0a8898f96_child01

```

* * *

Ok now back to the topic.

## Point 1: You are using a operating system which is now End-of-Line and no longer supported by Ubuntu!

You are using an older Ubuntu 18.04 version which is now in [End-of-Line and no longer supported](https://ubuntu.com/blog/18-04-end-of-standard-support) since official 2023-05-31, however generally you should be upgrading the operating system before the end-of-line date.

I would strongly insist upgrading your (server/virtual machine?..hard to say because you didn’t post your the hardware information I requested). Never use unsupported/outdated operating systemd as they do not receive security patches for both the operating system and any software package!

## Point 2: Did you follow my instructions?

If you followed all of the [instructions](https://community.cumulocity.com/t/how-to-configure-and-connect-to-cumulocity-iot-in-rasbery-pi/1528/39) from my last post, can you please include the entire output in a markdown code block (mentioned in the guideline above). And if you didn’t follow my instructions, can you please run them again.

It is very difficult to say “what went wrong” without showing me proof that you did in fact run the commands. As previously you’ve posted confusing information, where I believe your description is misleading to what you are actually doing. For example, you posted that the [thin-edge.io](http://thin-edge.io) install script worked just fine, but then you post console output showing that you manually started mosquitto by calling the binary directly from a custom downloaded folder!

You could also be experiencing problems because you are using an unsupported operating system, that the mosquitto version available there is too old…but this is pure speculation, as I don’t have any information from you to go by.

[Previous page](https://community.cumulocity.com/t/how-to-configure-and-connect-to-cumulocity-iot-in-rasbery-pi/1528.md?page=1)

[Next page](https://community.cumulocity.com/t/how-to-configure-and-connect-to-cumulocity-iot-in-rasbery-pi/1528.md?page=3)
