>> Azure VM serial console enables you to use
an interactive shell in situations
where you may be unable to connect to your VM.
This makes it super easy to troubleshoot
issues and diagnose your VM.
Alfred Sin is here to show us how it
works today on Azure Friday.
Hey, everyone. Donovan Brown here with
another episode of Azure Friday.
So Alfred, talk to me about this serial console.
>> Sure thing. So, the reason why we created this
all serial console was
actually for the VM supportability.
So, that's the whole story here,
is supportability on your VM.
>> Okay.
>> We noticed that
the most popular support tickets
that we would receive over
an Azure relating to VMs relates to
can't RDP or can't SSH to my VM.
In a lot of those situations,
the solution is actually relatively simple.
It's just a matter of getting that level
of interactivity with the VM to fix
something that might be a little bit
messed up like IP tables,
your firewall rules, and
fstab configuration, something like that.
So, that's where serial console comes in.
How it works, is we take the serial input and output.
So, a lot of operating systems send input and output
to the serial port and we just take
that and bring that out to
our customers who can then access
the VM through a separate channel that's not
dependent on network configuration.
>> Awesome. So, just recently,
this happened to me to where I had to lock down all of
my VMs and we put on
such strict firewall rules
that we literally had stopped 22,
so I couldn't SSH.
So, I could have used this to still
get to that machine even though
my firewall was blocking my access.
>> Exactly.
>> Got it. Okay, cool.
>> If you accidentally block off port 22 and you get
rejected when you SSH, this will still work.
Serial host is still going to work.
>> All right. Very cool. So, besides
me making a mistake with my firewall,
there are other scenarios to where you can't reach
your machine even when all your firewall's set up.
So, what are some other scenarios where
you might not be able to access your machine anymore?
>> Absolutely. So one such scenario
would be let's say your a system admin or
something similar and you're running a bunch
of scripts on one of your VMs,
and unknown to you,
there's something in the script
that accidentally changes your fstab.
So, you run the script,
it finishes and then you reboot your VM.
All of a sudden, you notice that you can't SSH to it.
So, that's the situation that we set up
here is you'll notice for this VM,
in the Azure portal,
you can still see that it started.
It's okay, it's running, status is running.
So, let's try to SSH to it.
This IP address and we're getting connection refused.
>> Got it.
>> So at this point, what you might be tempted to do
is delete your instance
and restart it again and recreate it,
which is a lot of work.
But Azure has a serial console
now which is what we're here to talk about today.
So, let's drop into it.
So, I've got it opened up in a new tab
because it takes a couple of seconds to load up,
so we'll will save that little bit of time here.
We notice in the serial console
that you are now in emergency mode here,
which means that when this machine was booting up,
it noticed something wrong and tried to fix it.
It didn't really work out and it dropped
you into this emergency mode.
>> I see. Yeah. So, this right
now without this technology,
there is simply no way to fix this?
>> Exactly.
>> Okay. Got it.
>> It's impossible to run up to your little data center
somewhere and just plug in a cable.
You can't do that in the Cloud.
So, this is the next best thing which is the best thing.
>> Got it.
>> So, let's have a look.
Let's check out our fstab.
>> All right. So, you just typed a lot
of words I never understood there.
So, VM is the scariest editor I've ever
used because I know I can't figure out how to exit,
but what is this fstab stuff?
Because I'm a Windows guy
and I have no idea what that is.
>> Sure thing.
So, this is the file system table and all it is
is a file describing
how things are mounted, where things are mounted.
Then, what usually happens is
a lot of customers come along and
they accidentally change something
here unknowingly. This is quite common.
People do this all the time.
If we look at this fstab in particular,
you'll see that there is a strange entry
done here with a UID of
one and it's suppose to have a mount point of
foo, which doesn't exist.
>> All right. Got it.
>> So, let's just delete this line and
then exit out of our editor here.
Then, we'll just go reboot it and we'll see what happens.
>> So, what we believe we've done is we've
been able to diagnose what the problem was.
I can even see the bootloader here coming up.
>> Yeah.
>> Now, I'm able to go ahead and
reboot the machine and hopefully with my table fixed,
I can now SSH like I did before.
>> Yes. Exactly.
>> Okay.
>> So, side note, this is GRUB,
Grand Unified Bootloader,
and you would not see this in SSH.
When you got SSH to a machine,
it's already past this.
>> Exactly.
>> Got you.
>> So, this is another thing that
serial console allows you to do.
>> Wow.
>> If you really want to, you can edit your boot config,
you can go in here, change the fa.
If you really want to get that low level, in our case,
I think we're reasonably confident that editing
that fstab has fixed our problem.
So, let's just drop into Ubuntu.
>> So, that level of granular that you just got to
like actually connecting to
the machine before it's even booted,
does that work also on the Windows side?
>> It does.
>> So, I look at the diagnostics,
even on my BIOS, all that kind of crazy stuff?
>> You can do the same on the Windows.
We've got serial console enabled for
Windows and I'll show that right
after we're done with the Linux.
>> Awesome.
>> But you might also be wondering,
hey this is an Ubuntu VM,
does this work on other Linux stations?
The answer is yes.
We've got serial console enabled
on all other Linux stations is running in Azure.
So, if you want this on your RHEL VM.
If you want this on your Debian, CentOS, it'll work.
`>> Awesome. Well, yeah,
it's funny because the other day,
I didn't know it was a firewall
issue until I did a lot of
diagnostics and what would
have been nice is to have been able
to drop in to here and at least confirm that no Donovan,
the VM is ready, it's rock and roll.
It's not an issue with the VM,
it's an issue with accessing the VM.
That would have helped me troubleshoot really quickly
which I was literally just in the dark panicking,
called some friends and we finally realized that oh yeah
you've clearly blocked 22 that's why you can't get in.
>> Exactly. This is
the cause of a lot of our support tickets too.
So, this will help alleviate a lot of grief.
>> Awesome.
>> So now, our VM is booted up.
So, let's try connecting to it
again and you'll notice that, boom, we're in.
So, it was that fstab problem that
prevented the whole connection from happening.
This is working now. We're good.
One last thing on this Linux VM,
we've also added extra troubleshooting capabilities.
So, if your VM is stuck to the point where
you can't even interact with it in
a serial console like it's hung,
something's totally wrong with it,
you can still send NMI,
a Non-Maskable Interrupt or
a system request also known as the SysRq.
So, I'll use a SysRq for this Linux VM.
>> So, this is like a three finger salute?
>> Exactly. Just like what you have
on the keyboards, you can just control.
Like the Linux version of that.
>> Got you.
>> We've got extensive coverage
in our docs about all the key commands,
key combos that you can send.
I will just send this one.
Good old REISUB. What this does is a graceful reboot.
So, it'll kill all the tasks
and then it'll reboot your VM and then here we go.
>> There we are in.
>> We're back in there.
>> Interesting.
>> So, that's all in Linux VM.
So, let's move on to the Windows VM.
>> Yes. Where I feel like a man again.
Because I had no idea what you were talking about.
>> No worries. So, we've got Windows Server 2016.
I've actually got it RDP'd as well.
So, I've got this all open.
I've got our network interface showing.
Another issue in addition to misconfigured file system,
we've got a super common network misconfiguration.
So, sometimes people will accidentally
disconnect their network configure,
network interface cards, something that,
again similar to your port 22 issue.
>> Sure.
>> That's exactly what might happen here.
So, to simulate that, let's do this.
If I can type. So, what
I'm doing is I'm disabling Ethernet two.
Let's click "Enter". Now, all of a sudden,
because I've disabled that,
I'm typing and nothing's happening.
>> Nothing is happening.
>> Yeah. Exactly. Let's try to move it around.
Nothing's happening. So, this session is dead.
Again, if you're just
using this without serial console you would say,
whoops, time to contact support and enter those whoops.
>> Got you.
>> Instead, we have serial console.
So, let's drop into a command channel here.
This initially shows up as
the special administration console and
this is the gateway to the command channel.
So, even over the serial,
you're still required to authenticate
before you jump into that particular machine.
>> Yes. Exactly.
>> But I don't really remember you
doing that on the Linux side.
>> On the Linux side, that has already started.
>> But you did the same thing there.
So you do have the auth against the machine
so you have permissions to be on that machine.
>> So the level of access that you must
have is contributor level access.
You must have that on the VM and you must have that on
the boot diagnostics which are
required to run serial console.
>> Perfect.
>> All those details, they're all in
our docs if you want to look at them
>> So, we're going to
run the same command in reverse to re-enable that.
>> So, let's have a look. We've got
Ethernet 2 here disconnected,
disabled, however, you want to call it.
It is not working.
So, Ethernet 2 and
let's enable that. Now, we can-
>> Wait for their reconnect.
Yeah, just going to try again
here in just a second and see what's going to happen.
So, I've done this graphically like you go,
you right click on your network icon,
you go and accidentally disable something.
You would be in that situation.
>> Exactly. Yes.
>> Then now, I can go back and enable it
because now we're back and looks like you can-
>> Yeah. Cool. It's actually
working because you're able to type
so it's clearly working here as well.
All right. Cool.
>> There we go.
>> This is really good to know.
>> Yeah. So, let's go back to the serial console here.
Some people if they don't prefer to use CMD,
they're probably asking, where is my PowerShell?
>> I love PowerShell.
>> Exactly. So, we've actually got PowerShell enabled.
You can drop yourself into a PowerShell and let's just
do a quick little reboot
because there's something else I want to show you.
>> Okay. Cool.
>> One more thing. So, this will kick us out of
PowerShell then this will kick us out of CMD.
>> Because it's actually rebooting the machine
and it's closing down everything.
>> Exactly.
>> Got you, and we're back at SAC, at the beginning.
So now, we have to wait for it to actually,
we don't necessarily have to wait for it to reboot
because I'm going to be able to see.
>> Here we go.
Yeah. So, this is the Windows Boot Manager.
So, you remember I just showed you
GRUB on the Linux side.
Exact same thing on the Windows side.
So you've got Boot Manager enabled and look at this.
To specify an advanced option for
this choice, press "F8".
If for whatever reason your keyboard
doesn't have F8 or your keys aren't working,
something like that, we've even got F8 here.
You can be lazy, you can just click
F8 and you can view these advanced options.
>> Safe mode and everything.
This is awesome.
>> Safe mode. Safe mode networking blah, blah, blah.
This is something that a lot of customers have asked
for is the last known good configuration.
The abilities you just have this here.
So, the fact that we can drop into
this boot menu and get to that point,
that should please a lot of people.
>> Sure.
>> But let's just start Windows normally.
>> So, this serial console
that you're showing right now is
this just an Azure feature
or can any cloud provider do this?
>> So, AWS actually does not have serial console.
>> Interesting.
>> So, this is something that we have in
Azure that we can allow people to
troubleshoot their VMs whereas someone using
an EC2 Instance might just have
to delete it and recreate it.
>> Ouch. Painful.
>> So, it saves a lot of time.
>> Awesome.
>> So, final thing is I
skipped over the Non-Maskable
Interrupt for Linux because I
saved it for Windows and all this is is
a command that is designed to crash your virtual machine.
How this is useful is,
you're like why would you ever
want to crash your virtual machine?
>> I have no problems crashing my machines, by the way.
So, I don't know why I
need this but sure, show me how this works.
>> So, you can configure this to
actually create a crash dump
containing memory contents or
whatnot when you crash this.
So, this is super useful again if you get
stuck in a situation where you're doing
some kernel level debugging
and your VM is just not responsive.
You can send this NMI and crash the whole thing.
>> Wow.
>> So, I send it a dump
of everything that I need to so I can go back
and diagnose the state of the machine
when I issue the crash.
>> If you look closely, you might recognize this message.
It's a good old blue screen.
>> Exactly.
>> This is the blue screen within
the serial console that we have just triggered.
>> Wow. We are learning all about
the serial console here on Azure Friday.