Linux Serial Console
Portishead - All Mine
Ok this is just a neat toy and something I never needed to care about, and probably will never use.
I have a 16 port Avocent serial console that lets me log into all my network hardware and watch it boot if there are any issues and you can't connect to them over the network. This is all pretty standard Network Guy nerd nonsense. It's what you do in a datacenter. Being a network guy, and one who de-commissions lots of stuff, I basically run my house like a datacenter now as well. This is especially useful since I've been working from home the last five years. I have very little downtime.
My main workstation has a physical 9-pin serial port so I figured it'd be neat have it start getty at boot so I can use a serial console and bounce to it through the Avocent. And so I set off about trying to figure out the pinout for a serial to RJ-45 Avocent cable . But what didn't really click until I read thread while I was on my search is that you can have Grub start that getty and get full access beginning at the bootloader. This makes this actually useful. If there is some problem, and I'm either not here, or the problem includes "there's no video from my machine", I can view the serial console, log in if the machine is up, reboot it and watch the startup sequence to see where it's failing. The Grub boot menu actually shows up on the serial console /before/ my monitor displays it.
On all my production server hardware we have iLO anyway, so like, what did I care about watching those servers over serial anyway? Actually from what I understand my servers will output over serial right from the BIOS so you can watch the machines post and such before they even reach the bootloader. I doubt my Asus motherboard will do that, but I'll definitely dig around in there for a while.
Anyway, while I did find enough information to make the cable, I re-documented it so the next person might find the guide I wish I had. Since some people are more "visual" I've included both a basic text "RJ45 pin 1 -> DE-9 Pin 8" and a color coded diagram. I started by testing continuity inside the connector and noting which colors aligned to which RJ45 pins, then made before and after diagrams. The 9 pin connector is "as seen from the back (inside) of the connector" where the solder points are. Most of these have labels on the pins both on the inside and outside, they're just hard to see:
Here's a PDF of that if you want to zoom in, apparently the original draw.io file is embedded in there too.
Most pins are pretty straight forward swapping a wire from one pin to another, but pin 4 on the serial connector has two wires going to it, so I just twisted them together and soldered them both in. Pins 1 and 6 on the Serial connector also need to connect to the same RJ-45 wire. So I soldered the main wire to Pin 1 and used some very fine bodge wire to connect Pin1 to Pin 6. So far so good.
I took some photos, but they're pretty blurry and I'm not ripping this thing back apart since I don't want to break anything. Honestly the diagrams above do a better job of conveying it.
To get Grub to launch getty and start listening, the relevant part of the SuperUser.com thread, and the even more dense Arch documentation they linked to was:
vi /etc/default/grub
GRUB_TERMINAL="console serial"
GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"grub-mkconfig -o /boot/grub/grub.cfg
Here it is all working in a video recorded on my bench machine:
The Avocent is the top thing in (not on, in) the rack here, the yellow network cable is going to my workstation:
- xrayspx's blog
- Log in to post comments
- 68 reads