Linux serial console with VMWare server.

Linux has a complete remote serial console how to available. So why need another one?

  • I just need a really simple guide to finish my work. And later when my 256KB main brain memory overflow, I can pick it up quickly.
  • I also want to run Linux virtual machine within VMWare server using virtual serial console support from VMWare.

Let us call the Linux virtual machine as “target” and Linux host running VMWare as “host”:

Target side: [most c&p from previously mentioned howto]

  1. To enable kernel support. Select Y for -> Device Drivers-> Character devices-> Serial drivers-> 8250/16550 and compatible serial support (SERIAL_8250 [=y]). Recompile kernel.
  2. To add kernel run time parameter. Modify grub.conf and use parameter like “title 2.6.11.5 root (hd0,0) kernel /vmlinuz-2.6.11.5 ro root=/dev/sda3 console=ttyS0,9600n8 console=tty0″. These are recommended parameters. 9600 baud rate, no parity bit, 8 bit data bit, 1 stop bit, no flow control. Also leave the original tty0 usable. Of course, faster baud rate like 57600 will be better.
  3. Check and make sure mgetty is installed.
  4. To enable login prompt. Add one line in /etc/inittab “S0:23:respawn:/sbin/mgetty ttyS0″. Modify /etc/mgetty+sendfax/mgetty.config. Add “port ttyS0 speed 9600 direct yes data-only yes toggle-dtr yes need-dsr yes port-owner root port-group root port-mode 600 login-prompt @ \P login:40 login-time 60 term vt102″
  5. To enable root login. Add ttyS0 to /etc/securetty.

VMWare VM setting:

  1. [C&P from here]. Power down your virtual machine and click “Edit Virtual Machine Settings”. Add a serial port, select “Connect to named pipe”, and provide the pipe name “/tmp/com_1″. (note that this isn’t really a named pipe, but a Unix-domain socket) Click “advanced settings” and set “yield CPU on poll”. You can also get to this setting from the device list once you finish adding the port.
  2. You can start the Linux VM now.

Host side:

  1. Install socat from here.
  2. run “socat -d -d /tmp/com_1 PTY:”. socat should report something like “PTY is /dev/pts/x”.
  3. start minicom, configure it with right serial port setting, save the configuration and run it.
  4. now from minicom should get a full functional console. Sometime need to be patient to wait the login console appear.

Note: VMWare allows a serial port to be (1) physical port, (2) output to file, and (3) named pipe. So if we only need to capture console output like oops or boot message, we can use (2) to output to foo, and do “tail -f foo” in host.

About these ads

4 Comments »

  1. [...] Setup VMWare virtual serial port by following this. [...]

  2. Vivaldo Diniz said

    Por favor se alguem tem o serial do VMWARE Server, me mande por favor….agradeçoooooo.

  3. Dmitry said

    Great! Thank you very much!

  4. seema said

    To enable kernel support. Select Y for -> Device Drivers-> Character devices-> Serial drivers-> 8250/16550 and compatible serial support (SERIAL_8250 [=y]). Recompile kernel.

    I am not clear about this step. Is there no way I can view oops messages using serial console for a standard downloaded kernel image. I am using centos 5.3 on a vmware server. The kernel module I have written results in a crash, and I would like to view the oops messages. Your help will be highly appreciated.

    Thanks,
    Sima

RSS feed for comments on this post · TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: