Page 1 of 1

Internal serial number or MAC from Raspbian?

Posted: Wed May 11, 2016 9:01 pm
by MrGreg
I need to find the internal serial number or MAC from Raspbian.
I do not have the physical RPi to do a cat /proc/cpuinfo.
I do still have the SD card with the raspbian install that was the operating system for the RPi in question.
So...
Is the Serial number or MAC, or any other unique identifier for the RPI stored in Raspbian?
If so where and how would I find it?

Any information on this folks...

Re: Internal serial number or MAC from Raspbian?

Posted: Wed May 11, 2016 9:15 pm
by rpdom
No. The serial number is internal to the Pi and not stored on the SD card.

Well, perhaps the MAC address may be stored in a DHCP lease file, wherever dhcpcd stores those. It used to be /var/lib/dhcp/dhclient.eth0.leases.

Hmm, thinking about it, the serial number may well get logged into /var/log/dmesg. Yes, "grep serial /var/lib/dmesg" on one of my Pis gives the Kernel command line, which is /boot/cmdline.txt and some extra bits, including "bcm2708.serial=0x12345678 smsc95xx.macaddr=B8:27:EB:34:56:78"

Re: Internal serial number or MAC from Raspbian?

Posted: Wed May 11, 2016 9:29 pm
by MrGreg
Cheers !
I'll have a rummage around in there

Thanks

Re: Internal serial number or MAC from Raspbian?

Posted: Thu May 12, 2016 5:27 pm
by rayjoh
You can find the serial number in /proc/cpuinfo. The six last digits is reused in MAC address.

Code: Select all

grep Serial /proc/cpuinfo

Re: Internal serial number or MAC from Raspbian?

Posted: Thu May 12, 2016 6:06 pm
by B.Goode
rayjoh wrote:You can find the serial number in /proc/cpuinfo. The six last digits is reused in MAC address.

Code: Select all

grep Serial /proc/cpuinfo
But @MrGreg is ahead of you: he wrote in his original post -
I do not have the physical RPi to do a cat /proc/cpuinfo.

Re: Internal serial number or MAC from Raspbian?

Posted: Fri May 13, 2016 8:25 pm
by DougieLawson
rpdom wrote: Hmm, thinking about it, the serial number may well get logged into /var/log/dmesg. Yes, "grep serial /var/lib/dmesg" on one of my Pis gives the Kernel command line, which is /boot/cmdline.txt and some extra bits, including "bcm2708.serial=0x12345678 smsc95xx.macaddr=B8:27:EB:34:56:78"
That worked on an SDCard I had booted on a RPi on 5th May.

I did it with
mount /dev/sda2 /mnt
cd /mnt/var/log
grep -i 'smsc95' syslog
you'd have to use mount /dev/sda6 /mnt if it was a NOOBS card.

Code: Select all

May  5 10:07:53 raspberrypi kernel: [    0.000000] Kernel command line: dma.dmachans=0x7f35 bcm2708_fb.fbwidth=720 bcm2708_fb.fbheight=480 bcm2708.boardrev=0xe bcm2708.serial=0x62144670 smsc95xx.macaddr=B8:27:EB:14:46:70 bcm2708_fb.fbswap=1 bcm2708.uart_clock=3000000 vc_mem.mem_base=0x1ec00000 vc_mem.mem_size=0x20000000  dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
May  5 10:07:53 raspberrypi kernel: [    1.384563] usbcore: registered new interface driver smsc95xx
May  5 10:07:53 raspberrypi kernel: [    2.822200] smsc95xx v1.0.4
May  5 10:07:53 raspberrypi kernel: [    2.892826] smsc95xx 1-1.1:1.0 eth0: register 'smsc95xx' at usb-20980000.usb-1.1, smsc95xx USB 2.0 Ethernet, b8:27:eb:14:46:70
May  5 10:07:55 raspberrypi kernel: [   17.125562] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup
May  5 10:07:56 raspberrypi kernel: [   18.618498] smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0x45E1

Re: Internal serial number or MAC from Raspbian?

Posted: Mon May 16, 2016 9:12 pm
by MrGreg
Got it, thanks

( Gosh! There is a whole lot of stuff in that log)

Much appreciated

MrGreg