# UUID length 64 or 32?

**URL:** <https://forums.balena.io/t/uuid-length-64-or-32/61190>\
**Category:** openBalena\
**Created:** [February 4, 2020, 8:16pm UTC](https://forums.balena.io/t/uuid-length-64-or-32/61190 "2020-02-04T20:16:43Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ciantic](https://avatars.discourse-cdn.com/v4/letter/c/8797f3/32.png) [@Ciantic](https://forums.balena.io/u/Ciantic)\
**Post date:** [February 4, 2020, 8:16pm UTC](https://forums.balena.io/t/uuid-length-64-or-32/61190/1 "2020-02-04T20:16:43Z")

</div>

I provisioned bunch of devices, interestingly one of them has 64 character length UUID whereas others has 32. All of the were provisioned with same image, in latest openBalena and balenaOS 2.46.1+rev3 rpi4 image.

Why does the UUID length differ between devices? This makes it difficult to write other applications when I can’t trust it being same length.

---

<div class="post-metadata">

**Author:** ![Ereski](https://avatars.discourse-cdn.com/v4/letter/e/958977/32.png) [@Ereski](https://forums.balena.io/u/Ereski)\
**Post date:** [February 4, 2020, 8:38pm UTC](https://forums.balena.io/t/uuid-length-64-or-32/61190/2 "2020-02-04T20:38:52Z")

</div>

Hi. UUIDs are always represented as 32 hexadecimal digits, so a 64-digit UUID is definitely not valid. Just to confirm, only one device has a 64-digit UUID, correct? Is the device working at all? Can you interact with it?

---

<div class="post-metadata">

**Author:** ![Ereski](https://avatars.discourse-cdn.com/v4/letter/e/958977/32.png) [@Ereski](https://forums.balena.io/u/Ereski)\
**Post date:** [February 4, 2020, 8:43pm UTC](https://forums.balena.io/t/uuid-length-64-or-32/61190/3 "2020-02-04T20:43:45Z")

</div>

Also, are either your build of openBalena or balenaOS customized?

---

<div class="post-metadata">

**Author:** ![Ciantic](https://avatars.discourse-cdn.com/v4/letter/c/8797f3/32.png) [@Ciantic](https://forums.balena.io/u/Ciantic)\
**Post date:** [February 4, 2020, 8:45pm UTC](https://forums.balena.io/t/uuid-length-64-or-32/61190/4 "2020-02-04T20:45:33Z")

</div>

@Ereski yeah, I tried it only briefly, it worked. Deleted it already, I didn’t like it, I want to use standard UUID so I can use them in my own database:

```
balena device 3d1d9ef
== NAMEHERE
ID: 12
DEVICE TYPE: raspberrypi4-64
STATUS: inactive
IS ONLINE: false
IP ADDRESS: 192.168.0.17
APPLICATION NAME: screens
UUID: 3d1d9ef49fbc4b6dac524c5e92d487b010464abd89839e4e7591d100f41a6a
COMMIT: 97e526e399fc29a7dfef0d26163a6e32
SUPERVISOR VERSION: 10.6.27
OS VERSION: balenaOS 2.46.1+rev3
DASHBOARD URL: https://dashboard..../devices/3d1d9ef49fbc4b6dac524c5e92d487b010464abd89839e4e7591d100f41a6a/summary

```

OpenBalena 2.0.1

Yes, only one of the devices had 64 char UUID, really weird. Others has 32. I’ve just followed the [https://www.balena.io/open/docs/getting-started](https://www.balena.io/open/docs/getting-started) no customization

---

<div class="post-metadata">

**Author:** ![Ereski](https://avatars.discourse-cdn.com/v4/letter/e/958977/32.png) [@Ereski](https://forums.balena.io/u/Ereski)\
**Post date:** [February 4, 2020, 8:53pm UTC](https://forums.balena.io/t/uuid-length-64-or-32/61190/5 "2020-02-04T20:53:45Z")

</div>

That is actually a 62-digit UUID, which is even weirder. We’d like to understand what might have caused this.

- Is any part of your stack customized?
- Upon deleting and getting a new UUID for that device, is the new UUID the correct length?
- If possible, could you use register the same device (same hardware) multiple times to try and reproduce this?

---

<div class="post-metadata">

**Author:** ![Ciantic](https://avatars.discourse-cdn.com/v4/letter/c/8797f3/32.png) [@Ciantic](https://forums.balena.io/u/Ciantic)\
**Post date:** [February 4, 2020, 9:07pm UTC](https://forums.balena.io/t/uuid-length-64-or-32/61190/6 "2020-02-04T21:07:09Z")

</div>

Nothing is customized, it’s plain openBalena, I just followed the getting started.

New UUID is correct, it’s easy to spot the ugly duckling in this list:

```
ID UUID DEVICE NAME DEVICE TYPE APPLICATION NAME STATUS IS ONLINE SUPERVISOR VERSION OS VERSION DASHBOARD URL
6 d046c00 xx raspberrypi4-64 screens Idle false 10.6.27 balenaOS 2.46.1+rev3 https://dashboard.xxx/devices/d046c00b139ab1db30791bbc0b4c796d/summary
7 8d12310 xx raspberrypi4-64 screens Idle false 10.6.27 balenaOS 2.46.1+rev3 https://dashboard.xxx/devices/8d123102d442c5ea088da41f8fb5ce11/summary
8 1909f99 xx raspberrypi4-64 screens Idle false 10.6.27 balenaOS 2.46.1+rev3 https://dashboard.xxx/devices/1909f9950bdf21fdf3b802c03808a860/summary
14 136b5ad xx raspberrypi4-64 screens Idle false 10.6.27 balenaOS 2.46.1+rev3 https://dashboard.xxx/devices/136b5ade5ce1ec9febac87ef54676a45/summary
12 3d1d9ef xx raspberrypi4-64 screens Idle false 10.6.27 balenaOS 2.46.1+rev3 https://dashboard.xxx/devices/3d1d9ef49fbc4b6dac524c5e92d487b010464abd89839e4e7591d100f41a6a/summary
13 d6560b4 xx raspberrypi4-64 screens Idle false 10.6.27 balenaOS 2.46.1+rev3 https://dashboard.xxx/devices/d6560b4da185d26bfe858b8ef8fe33b6/summary
9 4c03c67 xx raspberrypi4-64 screens Idle false 10.6.27 balenaOS 2.46.1+rev3 https://dashboard.xxx/devices/4c03c67d0bc22c1822a7477e28710952/summary
15 89360ff xx raspberrypi4-64 screens Idle false 10.6.27 balenaOS 2.46.1+rev3 https://dashboard.xxx/devices/89360ff66cef11b94262e7ef0e601d45/summary
10 334b928 xx raspberrypi4-64 screens false https://dashboard.xxx/devices/334b9288283f811ef2aa77c04b6acecd/summary
3 fec0fc3 xx raspberrypi4-64 screens Idle true 10.6.27 balenaOS 2.46.1+rev3 https://dashboard.xxx/devices/fec0fc3b85c69253a10f5ac79c935e1f/summary

```

Notice the last dashboard column. I have remoed some parts with “xx”.

New device came up correctly with 32 char UUID.

I will certainly post here if I see another weird UUID, it doesn’t make sense to me that it’s even possible to have differing length UUID.

---

<div class="post-metadata">

**Author:** ![Ciantic](https://avatars.discourse-cdn.com/v4/letter/c/8797f3/32.png) [@Ciantic](https://forums.balena.io/u/Ciantic)\
**Post date:** [February 4, 2020, 9:15pm UTC](https://forums.balena.io/t/uuid-length-64-or-32/61190/7 "2020-02-04T21:15:21Z")

</div>

It happened again!

New UUID:

519f787c2ae7610500a8cc62db1bbb5b51e174e3edd87e488a9a30300c7c89

C:\Users\jarip\>balena device 519f787  
== NAMEHERE  
ID: 18  
DEVICE TYPE: raspberrypi4-64  
STATUS: inactive  
IS ONLINE: true  
IP ADDRESS: 192.168.0.17  
APPLICATION NAME: screens  
UUID: 519f787c2ae7610500a8cc62db1bbb5b51e174e3edd87e488a9a30300c7c89  
COMMIT: 97e526e399fc29a7dfef0d26163a6e32  
SUPERVISOR VERSION: 10.6.27  
OS VERSION: balenaOS 2.46.1+rev3  
DASHBOARD URL: [https://dashboard.xxx/devices/519f787c2ae7610500a8cc62db1bbb5b51e174e3edd87e488a9a30300c7c89/summary](https://dashboard.xxx/devices/519f787c2ae7610500a8cc62db1bbb5b51e174e3edd87e488a9a30300c7c89/summary)

---

<div class="post-metadata">

**Author:** ![Ciantic](https://avatars.discourse-cdn.com/v4/letter/c/8797f3/32.png) [@Ciantic](https://forums.balena.io/u/Ciantic)\
**Post date:** [February 4, 2020, 9:24pm UTC](https://forums.balena.io/t/uuid-length-64-or-32/61190/8 "2020-02-04T21:24:00Z")

</div>

Okay here is what is happening, each time I provision a device, it creates another device that does not come online, but when another one comes online it creates second device with long UUID.

---

<div class="post-metadata">

**Author:** ![Ciantic](https://avatars.discourse-cdn.com/v4/letter/c/8797f3/32.png) [@Ciantic](https://forums.balena.io/u/Ciantic)\
**Post date:** [February 4, 2020, 9:27pm UTC](https://forums.balena.io/t/uuid-length-64-or-32/61190/9 "2020-02-04T21:27:32Z")

</div>

I provisioned one device, and it created two!

```
19 17b8226 hidden-feather raspberrypi4-64 screens false https://dashboard.xxx/17b8226b19bc5dd9c326feea5e9c3fbb/summary
21 9c69f14 white-snowflake raspberrypi4-64 screens Idle true 10.6.27 balenaOS 2.46.1+rev3 https://dashboard.xxx/9c69f148253ad53f9bdca8a83d880785cd5944c61d13351106dcc27d9dbe61/summary

```

argh.

---

<div class="post-metadata">

**Author:** ![jimsynz](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/jimsynz/32/4663_2.png) [@jimsynz](https://forums.balena.io/u/jimsynz)\
**Post date:** [February 4, 2020, 9:31pm UTC](https://forums.balena.io/t/uuid-length-64-or-32/61190/10 "2020-02-04T21:31:56Z")

</div>

Just to clarify, when you say “I provisioned one device” what is the exact process you followed? I’m assuming you simply mean that you burned the image to an SD card with Etcher and booted up the device?

Thanks,  
James.

---

<div class="post-metadata">

**Author:** ![Ciantic](https://avatars.discourse-cdn.com/v4/letter/c/8797f3/32.png) [@Ciantic](https://forums.balena.io/u/Ciantic)\
**Post date:** [February 4, 2020, 9:33pm UTC](https://forums.balena.io/t/uuid-length-64-or-32/61190/11 "2020-02-04T21:33:12Z")

</div>

@jimsynz yes sir. I boot it up, and then it creates one with short UUID, and then after a while it creates long UUID version that comes online.

Oddly enough, it worked normally for multiple devices, but now it’s failed three times in a row like this.

---

<div class="post-metadata">

**Author:** ![Ciantic](https://avatars.discourse-cdn.com/v4/letter/c/8797f3/32.png) [@Ciantic](https://forums.balena.io/u/Ciantic)\
**Post date:** [February 4, 2020, 9:34pm UTC](https://forums.balena.io/t/uuid-length-64-or-32/61190/12 "2020-02-04T21:34:25Z")

</div>

It happened three times in a row with one specific SD Card, now that we tried with a new card it worked fine. Very odd. Do you people seed the UUID with some hardware ID in the SD Card?

---

<div class="post-metadata">

**Author:** ![jimsynz](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/jimsynz/32/4663_2.png) [@jimsynz](https://forums.balena.io/u/jimsynz)\
**Post date:** [February 4, 2020, 9:40pm UTC](https://forums.balena.io/t/uuid-length-64-or-32/61190/13 "2020-02-04T21:40:01Z")

</div>

Nope, [it literally runs `openssl rand -hex 16`](https://github.com/balena-os/meta-balena/blob/master/meta-balena-common/recipes-support/balena-unique-key/balena-unique-key/balena-unique-key#L52) when it first boots and discovers there’s no device ID in the `config.json`. The only thing I can think of is that something else is also writing to the `config.json`.

Does it continue to happen if you reflash the problematic SD card?

---

<div class="post-metadata">

**Author:** ![Ciantic](https://avatars.discourse-cdn.com/v4/letter/c/8797f3/32.png) [@Ciantic](https://forums.balena.io/u/Ciantic)\
**Post date:** [February 4, 2020, 9:43pm UTC](https://forums.balena.io/t/uuid-length-64-or-32/61190/14 "2020-02-04T21:43:53Z")

</div>

We flashed the same SD card three times, each time it booted (provisioned) it came up with first short UUID, and long UUID in same device list.

I don’t have time to test further right now, but it worked just fine with a new SD card.

---

<div class="post-metadata">

**Author:** ![jimsynz](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/jimsynz/32/4663_2.png) [@jimsynz](https://forums.balena.io/u/jimsynz)\
**Post date:** [February 4, 2020, 9:47pm UTC](https://forums.balena.io/t/uuid-length-64-or-32/61190/15 "2020-02-04T21:47:06Z")

</div>

Are all the SD cards the same? Can you tell us exactly what cards you’re using?

---

<div class="post-metadata">

**Author:** ![jimsynz](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/jimsynz/32/4663_2.png) [@jimsynz](https://forums.balena.io/u/jimsynz)\
**Post date:** [February 4, 2020, 11:11pm UTC](https://forums.balena.io/t/uuid-length-64-or-32/61190/16 "2020-02-04T23:11:42Z")

</div>

Just to keep you up to date, it seems that there are two bugs here:

1. When we changed the generated key length in the host OS we didn’t update the corresponding library that the supervisor uses. [PR opened](https://github.com/balena-io-modules/balena-register-device/pull/38)
2. For some reason the supervisor is deciding that the device needs to be registered again, even though the host OS already registered it. [Issue opened](https://github.com/balena-io/balena-supervisor/issues/1193)

One of the supervisor team may be in touch with you to get more information about the circumstances. Additionally, any information you can give us about the SD card in question would be good.

Thanks,  
James.

---

<div class="post-metadata">

**Author:** ![Ciantic](https://avatars.discourse-cdn.com/v4/letter/c/8797f3/32.png) [@Ciantic](https://forums.balena.io/u/Ciantic)\
**Post date:** [February 4, 2020, 11:15pm UTC](https://forums.balena.io/t/uuid-length-64-or-32/61190/19 "2020-02-04T23:15:25Z")

</div>

These are really cheap Kingston 16GB.

If that is the only code that touches the key I’m baffled. ( **Edit** I see you added another comment as I was writing! Thanks)

1. Flash the SD with configured balena.img.
2. Insert to the Raspberry Pi 4
3. Wait… and first device appears in the `balena devices` it has a short UUID
4. Wait more… and second device with long UUID appears in the `balena devices` it comes online

The first short UUID never came online, it was just hanging there it can be identified in my above logs as the devices `334b928` and `17b8226` these are the devices that appeared but never came online. However the devices with long UUID did came online.

---

<div class="post-metadata">

**Author:** ![jimsynz](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/jimsynz/32/4663_2.png) [@jimsynz](https://forums.balena.io/u/jimsynz)\
**Post date:** [February 4, 2020, 11:23pm UTC](https://forums.balena.io/t/uuid-length-64-or-32/61190/20 "2020-02-04T23:23:36Z")

</div>

Thanks for the details. We’ll let you know what we find.  
James.

---

<div class="post-metadata">

**Author:** ![thgreasi](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/thgreasi/32/454_2.png) [@thgreasi](https://forums.balena.io/u/thgreasi)\
**Post date:** [February 7, 2020, 6:01pm UTC](https://forums.balena.io/t/uuid-length-64-or-32/61190/28 "2020-02-07T18:01:35Z")

</div>

Hi,  
We have identified what causes this issue and are working on getting a fix for this released in the next balenaOS release.  
Thanks for letting us know. We will give you a notice once this becomes available.

Kind regards,  
Thodoris
