2

I'm looking for a way to pass in the Raspberry Pi serial number to Chromium when running from the command line.

chromium-browser --incognito --noerrdialogs http://url.com?sn={serial}

Is this possible?

2 Answers 2

3

2020-02-07 answer:
You can get the serial number with:

rpi ~$ cat /sys/firmware/devicetree/base/serial-number
10000000cd0297b1

So the command to call chromium on the command line with serial number resulted in:

rpi ~$ chromium-browser --incognito --noerrdialogs http://url.com?sn=$(cat /sys/firmware/devicetree/base/serial-number)
3
  • 4 years later and I haven't thought about this in a while but this post has reinvigorated me. I will see how this works, thank you!
    – hunter
    Commented Mar 26, 2020 at 14:08
  • another question is if the serial number would be different on different rpi's that were clones of one another...
    – hunter
    Commented Mar 26, 2020 at 14:09
  • 1
    @hunter For my understanding the serial number is on the hardware, burned into a read only chip. You may have a clone of the operating system but not of the Raspberry Pi.
    – Ingo
    Commented Mar 26, 2020 at 14:26
2

here is a related question.

Briefly, you could read the file /proc/cpuinfo which would produce a listing like so

#cat /proc/cpuinfo

processor       : 0
model name      : ARMv7 Processor rev 4 (v7l)
BogoMIPS        : 38.40
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt                                                                                                                      vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

processor       : 1
model name      : ARMv7 Processor rev 4 (v7l)
BogoMIPS        : 38.40
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt                                                                                                                      vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

processor       : 2
model name      : ARMv7 Processor rev 4 (v7l)
BogoMIPS        : 38.40
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt                                                                                                                      vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

processor       : 3
model name      : ARMv7 Processor rev 4 (v7l)
BogoMIPS        : 38.40
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt                                                                                                                      vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

Hardware        : BCM2709
Revision        : a02082
Serial          : 000000003d1d1c36

The last line should give you what you need.

you could use a

  • python script to read the serial number (as described in the link) and launch the chromium browser with the right argument using subprocess module (the linked question's answers have such examples)

  • if you commandline savvy awk would give you a one liner

2
  • Does chromium offer any way to pull that variable and use it?
    – hunter
    Commented Nov 21, 2016 at 19:53
  • I doubt chromium would have such specialized functionality OOB. Moreover I'd think it would be a security problem the browser was able read arbitrary (system) files when requested by a page (via javascript). Commented Nov 21, 2016 at 20:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.