It is only recently that I’ve started using tmux and I am finding it very useful.
For all those wanting to give it a try, here you can download my tmux cheatsheet
When you work as a systems administrator being able to access your systems is important.
There are times when this is not as easy as it seems. Might be due to a network problem, a misconfiguration or some other problem.
A good resource is to configure serial over lan on your physical boxes, so that you are not bound to a network connectivity and/or a healthy OS. This saves you from visiting the datacenter and that is good.
This type access through a serial port is also available when you virtualize your servers, admittedly is usually not so important, but still useful nonetheless.
To properly configure this on your virtual machines when using KVM here is what you have to do:
Make sure your VM definition includes a console port mapped to a serial port. This is true by default and you can verify it with
bash-4.3$ virsh dumpxml server1.example.com | grep \<console -A 4
<console type='pty' tty='/dev/pts/1'>
<target type='serial' port='0'/>
Once that is done you need to boot your linux guest and add the following to
bash-4.3$ sudo cat >> /etc/default/grub << EOF
## Serial console
For bonus verbosity during boots we are going to remove the quiet mode and the GUI boot window with
$ sudo sed -i 's/ rhgb quiet//' /etc/default/grub
Then rebuild the kernel parameters for the grub entries with:
bash-4.3$ sudo grub2-mkconfig -o /boot/grub2/grub.cfg
Found linux image: /boot/vmlinuz-3.10.0-229.14.1.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-229.14.1.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-229.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-229.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-93ec805c5e364aff9c1c49035a337436
Found initrd image: /boot/initramfs-0-rescue-93ec805c5e364aff9c1c49035a337436.img
And we’re done!
Ideally you should resize your terminal to 25 rows by 80 columns before connecting.
Now you can launch the console against your VM and you should get to see the whole boot process since the Grub menu. Eg.
1 2 3 4 5 6 7 8
To close the console session press
] on OS X.
Here two screenshots of the end result.
Now you can do funky things like messing TCP wrappers and stuff :P