Wednesday, 13 June 2012

How to get hardware information in Linux

We often need to get the hardware information, In Redhat Linux, this can be easily done by using the dmidecode.
To get the bios information:
# dmidecode -t 0
In dmidecode, 0 is the type code for BIOS.

By using dmidecode, we can get many information about the system, for details, please refer to the man page
# man dmidecode
All the Linux systems I have been managed are Redhat running on Dell servers, so I am also using Dell OpenManage to get the system hardware information.
To get the bios information
$ omreport chassis bios
There are also many other options we can use in Dell OpenManage, for details, please refer to:

Please note that we can only run dmidecode as super user, whereas we can run omreport as normal user.

Thursday, 7 June 2012

Linux: how to recover root password

In Linux, if you forget the root password, you can recover it in this way:

  1. Reboot the machine, at grub menu, edit the boot entry for Linux
  2. press 'e' to to edit the entry,
    append " single" at the end of the kernel line
    alternatively, you can also append " init=/bin/sh" at the end of the kernel line
  3. press 'b' to boot Linux into single user mode
  4. now you will be able to log in the system without entering password 
  5. type 'passwd' to reset root password