Wednesday, November 16, 2011

Setting up Serial Logging for Linux/UNIX virtual machines

To enable Serial Logging:
Right-click the virtual machine or virtual appliance and click Edit Settings.
Click the Hardware tab and then click Add.
Select Serial Port and click Next.
Select Output to file and click Next.
Click Browse and navigate to the virtual machine for which you want to add a serial port.
In File Name, type SerialOutput and click OK.
Under Device Status, select Connect at power on and click Next > Finish.
Click the Options tab.
Click Boot Options and enter 10,000 in Power On Boot Delay.
Click OK to commit the changes.
Power on the virtual machine. The virtual machine waits for 10 seconds before it begins to load the operating system.
After the operating system loads (a blue background loads), you see this line on top of the screen:
Press any key to enter the Boot menu
Press the Space Bar to enter into the GNU GRUB.
Select the operating system, such as CentOS (2.6.18-164.9.1.el5), and press e to modify the grub options.
Use the down arrow key to select the line:
kernel /vmlinuz-2.6.78-164.9.1.el5 ro root=LABEL=10 console
Press e to append this line:
console=ttys0,115200 console=tty0
Press Enter to commit the changes.
Press b to boot into the grub.
After a boot failure, power on the virtual machine, log in to the host that manages the virtual machine, and navigate to the home directory. You should see a file named SerialOutput, which is the new Serial Logging log. 
For more info read the following article from VMware