WildBill's Blogdom

Mongo only pawn, in game of life.

Howto: Build Your Own Console and Remote Power Server for Fun and Profit

| Comments

If you’re anything like me (and man, I hope you’re not!) you probably have several systems kicking around the house. I’ve recently moved most of my systems to the garage… and having to go out to the garage to do anything really sucks. We use Cyclades terminal servers and RPC power managers @ work for remote console and remote power (on our legacy servers - new boxes are HP with iLO) , and I got to thinking that the same capability would be really cool at home.

Fortunately, I had just cleaned my desk area and found the following pieces:

  • Dell Inspiron 3000 (PIII/600 with 256MB RAM)
  • 2x Laplink cables (the dual-headed DB9/DB25 type)
  • 2x USB-Serial adapters
  • Cheesy little USB hub
  • X10 Firecracker home automation module with 2 Appliance modules

I got to thinking, and I realized I had the makings of a serial console. And since I had three servers that actually support a serial console (2 1U x86 boxes and a Sun Netra X1 - NO COMMENTS JORGE!) I decided to set them up in the garage and get an for-real serial console going.

The tentative plan was to hook up one x86 box to the built in serial port on the laptop, and the other two boxes to the USB-Serial adapters through the USB hub. I’d then use the Firecracker module and the Appliance modules to remotely manage the power on the x86 boxes - the Sun has built in serial-based LOM for console and power management, so no X10 mojo would be needed. I knew I could use minicom to manage the boxes over a serial link, and while that’d be pretty nifty, I figured there was probably a better way to do it. There is. Conserver is the answer. Conserver will let you attach to a serial console from the command line, without using minicom or anything. It’ll also log EVERYTHING on the console, so it’s good for auditing/troubleshooting, and it supports more than one person attaching to the console, so it’s good for collaboration or training. Best of all, it’s apt-gettable in Ubuntu. Just “apt-get install conserver-server conserver-client” (yep, it’s got a server and a client), configure the thing, and you’re good to go. Configuring conserver is easy, all I did was add definitions to /etc/conserver/conserver.cf for my three machines. I’ll put my config snippet below - “ftknox” is my main server @ the house, “zod” is the server I’m building to replace the SPARC that powers this blog, and “enzo” is my Netra X1.

/etc/conserver/conserver.cf console ftknox { master localhost; type device; device /dev/ttyS0; baud 9600; parity none; } console zod { master localhost; type device; device /dev/ttyUSB0; baud 9600; parity none; } console enzo { master localhost; type device; device /dev/ttyUSB1; baud 9600; parity none; }

That about covers conserver’s installation and configuration. On to the remote power piece… the X10 Firecracker module mentioned above is a little serial passthru dongle thing. All I had to do is hook that to the serial port on the laptop and then run the console cable to my 1st server. I found a little app called bottlerocket that runs under Linux, so I popped that on (also apt-gettable in universe) and plugged the two x86 boxes into the appliance modules.

NOTE: IF you have X10 gear and want to try this, you must use appliance modules. If you use lamp modules you’ll have no end of trouble - they can’t pass the current required for a computer.

Since bottlerocket’s syntax is kind of weird, I created a couple of bash aliases to make life easy. Again, I don’t have an X10 module on the Sun Netra cause it’s built in LOM provides that functionality way better than this hack. Here are the bash aliaes I’m using…

alias ftknoxpower=’br -x /dev/ttyS0 B1 $1’ alias zodpower=’br -x /dev/ttyS0 B9 $1’

So here’s how this whole mess works… I ssh to my console server (called ‘console’, duh…) and get a shell. Then, if I want to power on a box, let’s say “zod”, I just do this:

bill@console:~$ zodpower on

Zod will power on and start booting. Now, to get a console on it, I just do:

bill@console:~$ console zod

And now I’m on zod’s console. ROCK! I can watch zod boot, or get into the BIOS and change the boot order or other settings, and all kinds of other nifty stuff. When I’m done, I can do a “zodpower off” and zod will shut off. NOTE: My server has a “serial console redirection” option in the BIOS. Most server-class boards have this. Desktop PCs don’t. Your mileage may vary. Also, to get into the BIOS I have to hit “DEL” - but the console doesn’t properly pass this. I need to use the break sequence (Conserver’s default is ’Ec’) and then use the key sequence “177” to pass the octal keycode for DEL. That’s a pain, but it does work, and I can probably configure conserver to pass that code somehow.

Once I got this going, I had to edit GRUB to allow serial “dumb” terminal support for linux to display boot messages. This is actually really easy under Ubuntu, all I had to do was edit the kopt= line in /boot/grub/menu.lst and append “console=ttyS0,9600n81” to that, and run “sudo update-grub” and that fixed that.

So now I can not only manage my servers at the house from anywhere, I can also power them on and off from anywhere. That includes my couch, which makes my life much better. The servers are out of the house so they’re not an eyesore, and everyone wins.