Friday, November 8, 2013

How To Redirect a ESX Linux VM's Console Output to a File

This How To will redirect the Linux console output to a file.  Especially useful when you want to collect the full boot log, or full stack trace of a Linux Kernel Panic.

Add VM Serial Port

1. Edit VM Settings and select "Add.." to add new hardware:









2. Select "Serial Port" from the Device Type:








3.Select "Output to file" for Serial Port Type:










4. Specify the file name to output as, on the desired Datastore: (I recommend an NFS share for easy access)










5. Finish saving your changes. Now ready to configure the VM.  Example of a finished Serial Port configuration:















Redirect Linux Console to Serial

1. Test serial out with: (should appear in serial output file specified above)
echo "hello" > /dev/ttyS0 
2. Modify Grub to have Linux Kernel also send console output to Serial: (/boot/grub/grub.conf)
  • Comment out splash screen (optional)
  • Add serial and terminal settings below "hidden menu" (optional)
  • Add kernel options (this is the important part)
# splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
serial --unit=1 --speed=19200
terminal --timeout=8 console serial
title CentOS
  ...
  kernel ... console=tty0 console=ttyS0,19200n8
3. (Optional) Create serial virtual console, append to /etc/inittab: (useful for login through serial)
S0:23:respawn:/sbin/agetty -h -L ttyS0 19200 vt100
  • Note: This would be useful if you change the output type from file to something bidirectional (physical serial, pipe, network) that you could login from (if needed)
4. Reboot.  Console output should now appear in the serial output file.

Test a Kernel Panic

To quickly test a kernel panic:
echo c > /proc/sysrq-trigger

Auto Answer Append/Replace Question

To auto answer the append/replace question that occurs when you now power on this VM: (http://kb.vmware.com/kb/1027096http://kb.vmware.com/kb/1027096)
1. Power off the virtual machine.
2. In the vSphere Client, right-click the virtual machine and choose Edit Settings.
3. Click the Options tab.
4. Under Advanced, select General and then click Configuration Parameters.







5. Click Add Row.
6. In the new row, enter "answer.msg.serial.file.open" for the Name and enter a Value of either "Append" or "Replace".
answer.msg.serial.file.open = Append

7 .Click OK in the Configuration Parameters window, then click OK in the Virtual Machine Properties window.

References:

  • Add a Serial Port to a Virtual Machine in the vSphere Client - http://pubs.vmware.com/vsphere-50/index.jsp?topic=%2Fcom.vmware.vsphere.vm_admin.doc_50%2FGUID-A779C84D-4324-4D32-AF43-BBD962ABC9E3.html
  • VMware vSphere 4 - ESX and vCenter Server - Add an Output Serial Port - http://pubs.vmware.com/vsphere-4-esx-vcenter/index.jsp?topic=/com.vmware.vsphere.webaccess.doc_40/adding_hardware_to_a_virtual_machine/t_add_an_output_serial_port.html
  • Linux: Configure / Enable Serial Console By Editing GRUB Boot Loader - http://www.cyberciti.biz/faq/linux-serial-console-howto/
  • VMware KB: Powering on a virtual machine pauses at 95% while waiting for a question to be answered - http://kb.vmware.com/kb/1027096

23 comments:

  1. I admire the valuable information you offer in your articles. I will bookmark your blog and have my friends check up here often. I am quite sure they will learn lots of new stuff here than anybody else! Regards, vmware jobs in hyderabad

    ReplyDelete
    Replies
    1. Big data is a term that describes the large volume of data – both structured and unstructured – that inundates a business on a day-to-day basis. big data projects for students But it’s not the amount of data that’s important.Project Center in Chennai

      Spring Framework has already made serious inroads as an integrated technology stack for building user-facing applications. Corporate TRaining Spring Framework the authors explore the idea of using Java in Big Data platforms.

      Spring Training in Chennai

      The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training

      Delete
  2. Trucking Cube provides all type of shifting like moving and packing shifting, goods shifting, transportation services, etc.

    Truck Hire
    Freight Forwarder

    ReplyDelete
  3. Looks easy enough. Thanks for the guide. Hope it's applicable to vSphere replication .

    ReplyDelete
  4. The information given in this article is very good and I like it. I have also written this kind of blog you can also read for more knowledge.
    why cloud computing is needed
    benefits of machine learning
    benefits of devops
    php vs .net
    js interview questions
    javascript interview questions for experienced


    ReplyDelete
  5. Terrific post thoroughly enjoyed reading the blog and more over found to be the tremendous one. In fact, educating the participants with it's amazing content. Hope you share the similar content consecutively. Primavera Course in Chennai | Primavera online course

    ReplyDelete
  6. Thank you for sharing such beautiful information with us. I hope you will share some more information about packing and moving. Please keep sharing. Packers and movers.
    Cheapest packers and movers in Kolkata
    packers movers in parnasree Kolkata
    House shifting services in Kolkata
    Office shifting services
    Packers movers services, professional packers

    ReplyDelete
  7. Ucuz, kaliteli ve organik sosyal medya hizmetleri satın almak için Ravje Medyayı tercih edebilir ve sosyal medya hesaplarını hızla büyütebilirsin. Ravje Medya ile sosyal medya hesaplarını organik ve gerçek kişiler ile geliştirebilir, kişisel ya da ticari hesapların için Ravje Medyayı tercih edebilirsin. Ravje Medya internet sitesine giriş yapmak için hemen tıkla: ravje.com

    İnstagram takipçi satın almak için Ravje Medya hizmetlerini tercih edebilir, güvenilir ve gerçek takipçilere Ravje Medya ile ulaşabilirsin. İnstagram takipçi satın almak artık Ravje Medya ile oldukça güvenilir. Hemen instagram takipçi satın almak için Ravje Medyanın ilgili sayfasını ziyaret et: instagram takipçi satın al

    Tiktok takipçi satın al istiyorsan tercihini Ravje Medya yap! Ravje Medya uzman kadrosu ve profesyonel ekibi ile sizlere Tiktok takipçi satın alma hizmetide sunmaktadır. Tiktok takipçi satın almak için hemen tıkla: tiktok takipçi satın al

    İnstagram beğeni satın almak için Ravje medya instagram beğeni satın al sayfasına giriş yap, hızlı ve kaliteli instagram beğeni satın al: instagram beğeni satın al

    Youtube izlenme satın al sayfası ile hemen youtube izlenme satın al! Ravje medya kalitesi ile hemen youtube izlenme satın almak için tıklayın: youtube izlenme satın al

    Twitter takipçi satın almak istiyorsan Ravje medya twitter takipçi satın al sayfasına tıkla, Ravje medya güvencesi ile organik twitter takipçi satın al: twitter takipçi satın al

    ReplyDelete
  8. I wanted to thank you for this excellent read!! I definitely loved every little bit of it. I have you bookmarked your site to check out the new stuff you post. 먹튀검증 I am writing on this topic, so I think it will help a lot. I leave my blog address below. Please visit once.!

    ReplyDelete
  9. What a nice post! I'm so happy to read this. 토토사이트추천 What you wrote was very helpful to me. Thank you. Actually, I run a site similar to you. If you have time, could you visit my site? Please leave your comments after reading what I wrote. If you do so, I will actively reflect your opinion. I think it will be a great help to run my site. Have a good day.

    ReplyDelete