Dawkins12
Posts: 6
Joined: Tue Jul 26, 2016 12:53 pm

Unique Serial Number

Tue Jul 26, 2016 1:48 pm

Hi,

I just wanted to know if each raspberry pi has their own unique serial number. For instance will a Pi 3 and Pi 2 (or any other version of Pi) have the same serial number?

Thanks in advance for any help.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 27433
Joined: Sat Jul 30, 2011 7:41 pm

Re: Unique Serial Number

Tue Jul 26, 2016 1:50 pm

Yes,

viewtopic.php?f=66&t=59864

(Google would have found this more quickly)
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.

Dawkins12
Posts: 6
Joined: Tue Jul 26, 2016 12:53 pm

Re: Unique Serial Number

Tue Jul 26, 2016 1:57 pm

Are you answering the main question if they are unique or the example?

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 27433
Joined: Sat Jul 30, 2011 7:41 pm

Re: Unique Serial Number

Tue Jul 26, 2016 2:05 pm

Dawkins12 wrote:Are you answering the main question if they are unique or the example?
Unique over the entire range of RPF product. They have to be otherwise the codecs keys would work on more than one device, since they are slaved to the serial number.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.

Dawkins12
Posts: 6
Joined: Tue Jul 26, 2016 12:53 pm

Re: Unique Serial Number

Tue Jul 26, 2016 2:11 pm

thank you

User avatar
jojopi
Posts: 3354
Joined: Tue Oct 11, 2011 8:38 pm

Re: Unique Serial Number

Tue Jul 26, 2016 6:49 pm

Given the number of Pi sold, and that the serial numbers appear to be random, it is practically certain that there are several thousand duplicates in the wild by now. (Birthday paradox.)

That does not affect the security of codec licensing, however. The overwhelming majority of serials will be unique, and there is no practical method to locate two matching ones.

Heater
Posts: 16846
Joined: Tue Jul 17, 2012 3:02 pm

Re: Unique Serial Number

Tue Jul 26, 2016 7:39 pm

jojopi,
Given the number of Pi sold, and that the serial numbers appear to be random, it is practically certain that there are several thousand duplicates in the wild by now. (Birthday paradox.)
Interesting. The serial number is 16 hex digits or 64 bits. That means there are 2 to the power 64 possible serial numbers. Or 18446744073709552000 or about 1e20.

There have been about 10 million Pi sold. Or 1e7

So, if serial numbers were selected at random the chance of a collision, two Pi with the same serial number, is about 1e20/1e7 = 1e13 or one in 10,000,000,000,000.

So I would turn it around and say it is practically impossible that there are duplicates in the wild.

Now, who knows how the serial numbers are generated?

If every Pi was numbered, starting from 0, 1, 2, 3 etc then the serial number could just be a hash of that counter and it would appear to be random even if it is not. Or perhaps the serial number is a hash of the location and time of manufacture. These would of course be unique.
Memory in C++ is a leaky abstraction .

User avatar
rpdom
Posts: 17723
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Unique Serial Number

Tue Jul 26, 2016 7:42 pm

jojopi wrote:Given the number of Pi sold, and that the serial numbers appear to be random, it is practically certain that there are several thousand duplicates in the wild by now. (Birthday paradox.)
So people in the know who say they are unique are lying?

The serial appears to be a 32 bit value (the top 32 bits of the value displayed are all 0). That gives a possibility of 4,294,967,295 values. Now, assuming there is some CRC error checking on there and not all values are used, (assume an 8 bit checksum), that still leaves 268,435,455 possible values. I think there is a good chance that they are really unique.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 27433
Joined: Sat Jul 30, 2011 7:41 pm

Re: Unique Serial Number

Wed Jul 27, 2016 10:42 am

Uh Oh.

Turns out I was wrong in what I said above(*)

They are in fact random (generated using the HW RNG on the Pi itself during production testing), but as Heater states above, the chances of collision are vanishingly small, so there are no issues with COdec licensing etc.

Apologies for the misinformation.



* It had to happen sooner or later.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.

texy
Forum Moderator
Forum Moderator
Posts: 5160
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: Unique Serial Number

Wed Jul 27, 2016 11:15 am

I guess the foundation could of used unique sequential serial numbers and worry about duplicates once the 18446744073709552001st pi was produced :D
Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

User avatar
Burngate
Posts: 6373
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore
Contact: Website

Re: Unique Serial Number

Thu Jul 28, 2016 8:33 am

Not sure about this , but ...
... wouldn't using unique sequential serial numbers incur a logistical problem, given more than one manufacturer? (this occured to me right at the beginning, so it's been festering in my brain for four years or so!)
Ok, so RS could have used even numbers and E14 odd ones, but if at some stage a third company joined in, then a fourth, I can imagine the board-level discussions.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 27433
Joined: Sat Jul 30, 2011 7:41 pm

Re: Unique Serial Number

Thu Jul 28, 2016 8:57 am

Burngate wrote:Not sure about this , but ...
... wouldn't using unique sequential serial numbers incur a logistical problem, given more than one manufacturer? (this occured to me right at the beginning, so it's been festering in my brain for four years or so!)
Ok, so RS could have used even numbers and E14 odd ones, but if at some stage a third company joined in, then a fourth, I can imagine the board-level discussions.
Probably why they are now random.

Usually, serial serial numbers would be assigned in batches to allow multiple manufacturing sites.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.

User avatar
davidcoton
Posts: 5503
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK
Contact: Website

Re: Unique Serial Number

Thu Jul 28, 2016 9:38 am

Two thoughts:
1) If it's random, it's not a "serial" number. UID, maybe. Actually, since it's not guaranteed unique, UID ain't right. RID?
2) As jojopi says, the birthday paradox comes into play. If there are 2^32 possible RIDs, then a duplicate becomes statistically likely in a randomly selected group of more than 2^16 Pis. That is much less than the number of Pis produced, but much greater than the number likely to be in a potentially conflicting group. (Mathematicians please correct if I'm wrong.)
Location: 345th cell on the right of the 210th row of L2 cache

User avatar
jahboater
Posts: 6290
Joined: Wed Feb 04, 2015 6:38 pm
Location: Wonderful West Dorset

Re: Unique Serial Number

Thu Jul 28, 2016 9:58 am

The serial number forms part of the MAC address, so I hope they are unique.

jdb
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2466
Joined: Thu Jul 11, 2013 2:37 pm

Re: Unique Serial Number

Thu Jul 28, 2016 10:46 am

Serial numbers are indeed generated from the internal HWRNG, programmed during factory test.

The serial number is 32bit, which as previous posters have pointed out means that it does suffer from the birthday problem. However you need to have a set of over 9000 Pis to have a 1% chance of serial number collision. Thus MAC collision is extremely unlikely and it's near-impossible to have a chance of circumventing the licence key requirement.
Rockets are loud.
https://astro-pi.org

User avatar
DougieLawson
Posts: 40211
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Unique Serial Number

Thu Jul 28, 2016 12:39 pm

jahboater wrote:The serial number forms part of the MAC address, so I hope they are unique.
That's only going to be a problem if you have 16 million on the same /8 subnet (and you'll run out of NAT port numbers with less than 64K stations). With NAT'd networks your only need to worry about your NAT router having a unique MAC for the upstream network.
Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All fake doctors are on my foes list.

Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

mutley
Posts: 61
Joined: Sat Jan 02, 2016 8:06 pm

Re: Unique Serial Number

Thu Jul 28, 2016 6:47 pm

DougieLawson wrote:
jahboater wrote:The serial number forms part of the MAC address, so I hope they are unique.
That's only going to be a problem if you have 16 million on the same /8 subnet (and you'll run out of NAT port numbers with less than 64K stations). With NAT'd networks your only need to worry about your NAT router having a unique MAC for the upstream network.
I'm not sure that's accurate. You can't have the same MAC on the same LAN, so it only needs to match any machine in the same LAN to cause you an issue. The NAT you mention is an issue for your internet connection, it doesn't hide / mask anything behind that / on the LAN. And you don't need 16 million to run out, you only need one conflict, so 2 machines that have been given the same MAC.
Now the chances of that conflict is a different story, that's probably close to zero, plus you can usually manually change the MAC on most machines these days anyway.

mutley
Posts: 61
Joined: Sat Jan 02, 2016 8:06 pm

Re: Unique Serial Number

Thu Jul 28, 2016 6:56 pm

jahboater wrote:The serial number forms part of the MAC address, so I hope they are unique.
A manufacturer can't (well they shouldn't) just arbitrarily make up MAC address. MAC Address are assigned in blocks to manufactures by IEEE. It's very common for manufactures to use the same MAC on multiple devices/machines, so a MAC address is not unique world wide, it only needs to be unique within a local subnet segment as to not cause the switch packed routing issues.

SonOfAMotherlessGoat
Posts: 690
Joined: Tue Jun 16, 2015 6:01 am

Re: Unique Serial Number

Thu Jul 28, 2016 7:27 pm

The RPF has an OUI assigned to them, it's the other half of the MAC that is tied to the serial number.
Account Inactive

User avatar
DougieLawson
Posts: 40211
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Unique Serial Number

Thu Jul 28, 2016 9:47 pm

mutley wrote: And you don't need 16 million to run out, you only need one conflict, so 2 machines that have been given the same MAC.
You have more chance of winning a 6 from 49 lottery.
Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All fake doctors are on my foes list.

Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

texy
Forum Moderator
Forum Moderator
Posts: 5160
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: Unique Serial Number

Fri Jul 29, 2016 9:05 am

DougieLawson wrote:
mutley wrote: And you don't need 16 million to run out, you only need one conflict, so 2 machines that have been given the same MAC.
You have more chance of winning a 6 from 49 lottery.
I should hope there is a greater chance than 1 in 49 of duplication !!
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

User avatar
jojopi
Posts: 3354
Joined: Tue Oct 11, 2011 8:38 pm

Re: Unique Serial Number

Fri Jul 29, 2016 9:35 am

DougieLawson wrote:You have more chance of winning a 6 from 49 lottery.
The analogy is whether any two players in a group will pick the same numbers, not whether they will pick the winning numbers. The MAC uses just 24 bits of the serial number, so you "only" need to buy 4823 Pi for it to be more likely than not that you will have a MAC collision. It is still not a problem, but for completely different reasons than you gave. There are limits to the number of hosts you should cluster using layer 2 switches alone.

Going back to the original topic: truly random allocation is great because, even when it does produce collisions, you can be confident that they are rare and isolated and distributed among the entire population; impractical to find. By contrast, any kind of systematic allocation requires impeccable record keeping. The likely consequence of a mistake is that you release a full batch that duplicates some previous batch—a much more serious problem.

Return to “General discussion”