Serial Consoles FTW like its 1978!

A little history

If you’re older than me I need not explain what a serial console is, but if you are younger than me then let me give you a little background information. Back in the day, they needed a way to make computers more user-friendly. switches and punch cards were all the rage, but there had to be a better way… enter the “Video Terminal”, which was connected via RS-232 cable to the computer. (think precursor to VGA and AT Keyboard).

Wikipedia is your friend if you want to get up to speed on your history https://en.wikipedia.org/wiki/System_console

Serial consoles do still live on for many of the network engineers among us, as the preferred way to configure a switch or a router. Outside of that, serial consoles have all but disappeared.

Or have they?

Fast Forward to 2018

AWS users have been begging for serial consoles for years… literally since 2006, and from what I can tell it’s still unresolved. Here is the forum on the topic.

Microsoft Azure, however, already has a Serial Console feature (in preview as of this writing) in the Azure Resource Manager console, and after this post, I bet you will take full advantage of it!

Why though?

Log into your public cloud web UI and open up a console session to your VMs. I’ll wait while you look at how to do that.

—- an hour passes —-

OK, so as you found out, there is NO INTERACTIVE VGA CONSOLE on any public cloud.

SOOOO if you have a VM that gets a little squirrely and RDP or SSH stops working, guess what? Your S.O.L.

I bet you understand the answer to “why serial consoles” now, don’t ya?

So how do I get a serial console?

Linux

The process is pretty simple for Linux and has been used for years by Linux admins for all sorts of stuff. I won’t get super deep into the details because from what I have seen most distros are all the same.

At a high level, what you need to do is tell the Linux kernel that you want a console on ttyS0. So do some googling on your distro + serial console.

As for the parameters specific to Azure, you will want to use the following

Serial port = COM1 (or ttyS0)

Baud Rate = 115200

Data bits = 8

Parity = NO

Stop Bit = 1

(or 115200 8n1 depending on what you are used to)

For Grub2 based systems you will probably just need to modify /etc/grub.conf, then run the grub2-mkconfig command, for CentOS and RHEL I have the “how to” build into my Tips and Tricks page. CentOS and RHEL 6 HERE.

Once you enable the console on ttyS0 you are all set to use Azure Serial Console.

Windows

Windows is a little more tricky. I would be lying if I told you that I already knew Windows had a serial console. But surprisingly enough it does!

I would walk you through all the how to’s but Microsoft has a perfect article on how to do it here.

I will summarize though.

On your virtual machine run the following commands from an administrator cmd prompt:

[powershell]bcdedit /ems {current} on
bcdedit /emssettings EMSPORT:1 EMSBAUDRATE:115200[/powershell]

Now reboot the VM. After the reboot, the Windows “Special Administrative Console” is active on COM1.

If your VM is still running on VMware or HyperV, this output will just get dumped to /dev/null but once you migrate the VM to Azure with Zerto or some other method… the serial information will go to the Azure Serial Console and you will be able to troubleshoot your VMs that get broken or don’t fully boot.

What If you forgot to enable this before you moved or failed over your VM to Azure?

Well, there are procedures to get you out of a jam.

For Linux simply attach the broken root disk to another Linux machine and make the grub changes. Then attach the disk back to the machine it belongs to and boot it up. You should be able to access the serial console now.

For Windows, you can do the same thing, but registry modifications are needed as well. The Microsoft article that I linked to before has instructions on how to make those changes.

Has the serial console in Azure saved your VM?

If so leave a comment, would love to hear the story!

Loading

Share This Post

Post Comment