Re: How to get Serial number in Linux w/o using dmidecode (11209 Views)
Reply
Valued Contributor
Sreer
Posts: 222
Registered: ‎07-02-2008
Message 1 of 6 (11,267 Views)

How to get Serial number in Linux w/o using dmidecode

Hello Gurus,

 

My dmidecode is not helpfull to get the Serial number of my server.

 

Server details:

[root@server1 ~]# uname -a
Linux server1 2.6.18-348.1.1.el5 #1 SMP Fri Dec 14 05:26:02 EST 2012 i686 i686 i386 GNU/Linux
[root@server1 ~]#
[root@server1 ~]# cat /etc/redhat-rel*
Red Hat Enterprise Linux Server release 5.9 (Tikanga)
[root@server1 ~]#
[root@server1 ~]# rpm -qa | grep -i release
redhat-release-notes-5Server-46
redhat-release-5Server-5.9.0.2
[root@server1 ~]#

 

If I use dmidecode I gets the below o/p.

 


[root@server1 ~]# dmidecode -s system-serial-number
%..#&.....{a.y
[root@server1 ~]#

 

is there any other ways to get the serila number info?

 

Regards,

Sree

Honored Contributor
Jimmy Vance
Posts: 1,576
Registered: ‎11-27-2006
Message 2 of 6 (11,251 Views)

Re: How to get Serial number in Linux w/o using dmidecode

If you run dmidecode without any options can you see the serial number and other text output OK?

 

I just ran

 

dmidecode -s system-serial-number 

and

dmidecode | grep "Serial Number:"

 

They both show the serial number of the system

 

 

Occasional Visitor
panchalchetan
Posts: 2
Registered: ‎02-14-2014
Message 3 of 6 (11,241 Views)

Re: How to get Serial number in Linux w/o using dmidecode

Dear..

 

Install "lshw OR hardinfo" pkgs in your system.

 

This  two utilies find serial number.

Honored Contributor
VK2COT
Posts: 921
Registered: ‎01-17-2006
Message 4 of 6 (11,209 Views)

Re: How to get Serial number in Linux w/o using dmidecode

Hello,

 

Let me add another, not well-known tool - facter.

 

Here is an example from my own CentOS 6.5 server.

dmidecode you already said you do not want to use...

 

# dmidecode -s system-serial-number
4CE25207LN

 

# lshw |grep -m1 'serial:'
    serial: 4CE25207LN

 

# facter | grep serialnumber
serialnumber => 4CE25207LN

Cheers,

 

VK2COT - Dusan Baljevic
Occasional Visitor
mdella256
Posts: 1
Registered: ‎03-22-2014
Message 5 of 6 (11,176 Views)

Re: How to get Serial number in Linux w/o using dmidecode

[ Edited ]

Something that just came up yesterday... If you are using a newer version of the HP BIOS (in this case a DL360p with BIOS P71) you might get the following problem:

 

[root@USE406RK54 ~]# dmidecode -s system-serial-number
# SMBIOS implementations newer than version 2.7 are not
# fully supported by this version of dmidecode.
USE406RK54      
[root@USE406RK54 ~]#

 

The interesting part of this is that you DO get the serial number, however you also get a bunch of text that basically screws up any string scripts that you might be using.   Another way to get this information as the serial number only is the following:

 

/usr/sbin/dmidecode -t 1 | egrep 'Serial' | awk '{print $3}'

 

[root@USE406RK54 init.d]# /usr/sbin/dmidecode -t 1 | egrep 'Serial' | awk '{print $3}'
USE406RK54
[root@USE406RK54 init.d]#

 

This bad behaviour only started with BIOS P71 (just released recently, supporting the new SMBIOS 2.8.0 standard).  The full output of the dmidecode -t 1 is:

 

[root@USE406RK54 init.d]# /usr/sbin/dmidecode -t 1
# dmidecode 2.11
SMBIOS 2.8 present.
# SMBIOS implementations newer than version 2.7 are not
# fully supported by this version of dmidecode.

Handle 0x0100, DMI type 1, 27 bytes
System Information
        Manufacturer: HP
        Product Name: ProLiant DL360p Gen8
        Version: Not Specified
        Serial Number: USE406RK54      
        UUID: 35363636-3233-5355-4534-3036524B3534
        Wake-up Type: Power Switch
        SKU Number: 666532-B21      
        Family: ProLiant

[root@USE406RK54 init.d]#

 

--

 

Side notes:

 

dmidecode released with CentOS (or RHEL) 6.4 and earlier is version 2.11 which does not support the 2.8 version of SMBIOS.  So you'll not *quite* get the answer you want when using the "dmidecode -s system-serial-number" version of this string. You need dmidecode version 2.12 or later to get the latest ROM BIOS reads from HP Gen8 Gear.

 

Personally I'm trying to see if there is a newer version of dmidecode out there for either centos 6.4 or 6.5 or on the updates that handles the newer SMBIOS 2.8.0 standard (its been published since April 2013, but only recently implemented by HP).

Occasional Visitor
GreyGnome
Posts: 1
Registered: 3 weeks ago
Message 6 of 6 (1,171 Views)

Re: How to get Serial number in Linux w/o using dmidecode

If dmidecode is replying with junk, then your system serial number is junk. I believe you need to go into the BIOS/UEFI and change it. Look on the case of your machine and get its true serial number, then reboot, go into your BIOS, and modify it.

 

We had a number of serial numbers change mysteriously at a job I worked at. We never figured out how that happened.

 

In the meantime, you can also find the system serial number at /sys/devices/virtual/dmi/id/product_serial. ...Requires root to read, but many of the files in /sys/devices/virtual/dmi/id/ are readable by any user.

 

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.