2

I have been experimenting with an RS-232 null modem cable and am curious to know how one would allow FreeBSD to use a serial port as a terminal, like in the days of the PDP-11 where all users had dumb terminals connected to the computer via serial connections. I wish to do the same with a headless FreeBSD machine with a serial cable running to my main PC which is using PuTTY to communicate over the serial port. Before you ask why I don't use SSH for the same purpose, I prefer this type of connection because if the network were to go down I would still be able to log into the server and see what exactly is happening, whereas if the same situation occurred with SSH I would be mostly out of luck, if that makes any sense at all. I have seen other similar questions with answers pointing to screen and minicom but these seem to be for fulfilling the role of PuTTY on the BSD side, which is not what I want here. What I want is a serial port configured at a specific baud rate with getty running on it, etc. as if it were an actual terminal.

To answer the question of what version of init I am running, I am using FreeBSD 10.3, and I haven't changed anything at the system level so it's running the default BSD-style init that uses rc scripts.

14
  • 1
    Launching the getty processes is the responsibility of init. So to start with, tell us what version of init you're using.
    – user41515
    Jun 8, 2017 at 17:05
  • 1
  • 1
    This freebsd guide looks relevant: freebsd.org/doc/handbook/term.html - you may need to edit /etc/ttys. Have you got any confirmation that the serial driver is working?
    – user41515
    Jun 8, 2017 at 17:19
  • 1
    @nkeck72, It would really be much easier to answer your question if you were clear about what system you're using: FreeBSD or Linux, and if latter, which distribution.
    – ilkkachu
    Jun 8, 2017 at 18:32
  • 2
    The instructions for editing /etc/ttys looked pretty clear to me. Have you tried it?
    – user41515
    Jun 8, 2017 at 19:14

1 Answer 1

3

Take a look at the /etc/ttys file. It's kind of like gettytab in Linux. There's one line for each... terminal line. The "ttyuX" are for serial ports (different drivers have different device names, consult man pages, eg man uart for physical serial ports .

What you need to do to enable them is to change the "off" (or "onifconsole") to "on", and notify init by running "init q" as root.

Remember that differently from protocols like SSH or TELNET, serial ports don't have a protocol to negotiate terminal type and size. So, at minimum, run resizewin(1) (http://man.freebsd.org/resizewin) from your shell initialization script. Otherwise the default terminal size (as visible in "stty -a") will be zero, and this will result in things like shell line editing, less(1) or vi(1) output to be badly messed up.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .