Serial console shenanigans

I'm reading Chapter 4 of Michael Lucas's great book, Absolute FreeBSD on startup and he's talking about connecting to the serial console of the FreeBSD machine... so, of course, I have to go digging for null modem cables, usb-db9 cables, and hook it up to try out what he's talking about. At first, no luck, then a couple of hours later and swapping this cable for that one, I got it working and it's glorious. Watching the machine boot is so much more fun on the serial console - lots of additional info, but it's in a terminal window where I can easily scroll. I definitely should have done this sooner - oh, wait, I did, about 10 years ago when my laptop had a serial port... I remember it being a week or two of experimentation, apparently I've picked up a lot of know-how since then. Anyway, here's what I did. I have some questions and would appreciate any tips on doing it the "right" way y'all might have.

1. Get a USB to DB9 (male) cuz my T430 doesn't have a serial port :(. I tried two different prolific chipset cables and they both worked fine. I don't have an FTDI version, but one of these days...

2. Get a Null Modem Female DB9 to Female DB9 (my m92p has a Male DB9 serial port)

3. Connect them to each other and connect them to the host and client

# on the client (USB side)
4. See what the kernel picks up (dmesg):
Code:
ugen0.2: <Prolific Technology Inc. USB-Serial Controller> at usbus0

uplcom0 on uhub1

uplcom0: <Prolific Technology Inc. USB-Serial Controller, class 0/0, rev 2.00/3.00, addr 6> on usbus0

5. start a session (this is voodoo, but it works, 9600 was slow, but 115200 is quick)

# cu session

Code:
sudo cu -l /dev/cuaU0 -s 115200
or
sudo cu -l /dev/ttyU0 -s 115200
dunno how to exit, but disconnecting the cable works

# screen (pretty and kinda like tmux... makes me wonder if tmux would work)
Code:
sudo screen /dev/ttyU0 115200
or
sudo screen /dev/cuaU0 115200
CTL-a CTL-\ to exit

Note: I did a google search to figure out what device it would be on, these work:

Code:
crw-rw----  1 uucp dialer 0x202 Feb 11 19:23 /dev/cuaU0
crw-------  1 root wheel  0x1ff Feb 11 19:23 /dev/ttyU0

# on the host (Null Modem DB9 side)
6. configure loader.conf (another bit of voodoo, took several tries to find an incantation that worked

Code:
vi /boot/loader.conf
boot_multicons="YES"
boot_serial="YES"
comconsole_speed=""115200
console="comconsole,efi"

7. configure ttys (more voodoo and googlefu)

Code:
vi /etc/ttys
ttyu0  "/usr/libexec/getty 3wire"      vt100   onifconsole secure

8. Reboot host and watch the magic

Code:
\  ______               ____   _____ _____
  |  ____|             |  _ \ / ____|  __ \
  | |___ _ __ ___  ___ | |_) | (___ | |  | |
  |  ___| '__/ _ \/ _ \|  _ < \___ \| |  | |
  | |   | | |  __/  __/| |_) |____) | |__| |
  | |   | | |    |    ||     |      |      |
  |_|   |_|  \___|\___||____/|_____/|_____/      ```                        `
                                                s` `.....---.......--.```   -/
 +---------- Welcome to FreeBSD -----------+    +o   .--`         /y:`      +.
 |                                         |     yo`:.            :o      `+-
 |  1. Boot Multi user [Enter]             |      y/               -/`   -o/
 |  2. Boot Single user                    |     .-                  ::/sy+:.
 |  3. Escape to loader prompt             |     /                     `--  /
 |  4. Reboot                              |    `:                          :`
 |  5. Cons: Dual (Serial primary)         |    `:                          :`
 |                                         |     /                          /
 |  Options:                               |     .-                        -.
 |  6. Kernel: default/kernel (1 of 2)     |      --                      -.
 |  7. Boot Options                        |       `:`                  `:`
 |  8. Boot Environments                   |         .--             `--.
 |                                         |            .---.....----.
 +-----------------------------------------+
   Autoboot in 1 seconds. [Space] to pause
   Autoboot in 0 seconds. [Space] to pause
Loading kernel...

My questions are:

1. what's the difference between /dev/cuaXXX and /dev/ttyXXX?
2. is the ttys stuff necessary/correct? in that file it's listed as /dev/ttyu0, but the dev is /dev/ttyU0 (or /dev/cuaU0)
3. how do you exit cu? I just pulled the usb cable... seems drastic.
4. the book and online sources talk about using tip, how does that work (I tried a bunch of stuff to no avail)?
5. how do I know that uplcom0 is attached to /dev/ttyU0? or how do I figure it out other than trial and error.

Thanks!
 
3. how do you exit cu? I just pulled the usb cable... seems drastic.


~.
 

~.
It's finicky, but the <enter>~. thing works, but if you type ~ twice it escapes the tilde and then you need to press enter again. Weird, but workable!
 
4. the book and online sources talk about using tip, how does that work (I tried a bunch of stuff to no avail)?
Figured this one out after rereading the chapter some more and thinking things through..

Code:
vi /etc/remote
#modify the line pertaining to /dev/cuaU0
ucom1:dv=/dev/cuaU0:br#115200:pa=none:

Then, just use the shortcut ucom1 for tip:

Code:
tip ucom1

And
Code:
~.
to exit tip.
 
Back
Top