It's sometimes useful to add debugging prints to servers or drivers and have the output not show up on your screen, but redirected to serial. This way, you can log the prints to a text file or terminal on another box.
As stated, all kernel, drivers and servers (-lsys processes) output goes to serial when enabled with
cttyline=0. This makes it convenient to log, search, analyze etc. such output.
IS is the information server that interrogates others / makes them print output. In serial mode, the result goes to serial instead of the screen. Press shift+F5 to see an overview of the various available debug dumps. Each is an F-key. Press the F-key to see the output on serial.
The Minix kernel also listens to input from serial in this mode. Keys that do things:
First you have to tell Minix to redirect
printf's from system processes to serial out. You do this by providing the
cttybaud parameters to the kernel upon boot up. To modify the boot menu, add the following to /etc/boot.cfg.local (create the file if it doesn't exist; it is only a single line, do not insert newlines in between):
menu=Start latest serial MINIX 3:load_mods /boot/minix_latest/mod*;multiboot /boot/minix_latest/kernel rootdevname=c0d0p0s0 cttyline=0 cttybaud=115200
After you've created that, run
to update the boot configuration. If you also want the boot menu to be sent over serial instead of showing up on the screen, add
to /etc/boot.cfg.local as well. Note that if add this line but you don't attach a null modem or terminal to your serial port, you won't see and be able to pick an option from the boot menu. Finally, make sure to use a recent boot loader which enables a baud rate of 115200 instead of 9600:
# cd /usr/src/sys # make clean install # updateboot
We can use serial out on real hardware and on VMs.
To log the serial output to a file add the following option
If you want to be able to pick an option from the boot menu over serial, use
If you want both, use
tee to multiplex the output and
sed to sanitize the output:
-serial stdio | sed -u 's/^M//g' | tee /path/to/file
Before you run a VM, edit the VM settings and add a Serial Port device. There you have a number of options such as redirecting to a physical device or a file.
It takes a little setting up, but the most pleasant resulting usage is to redirect it to a pipe and then connect to the pipe using e.g. a telnet client.
To do that under windows, redirect the serial output to a named pipe, and call it “\\.\pipe\com_1”. Then download, install and run “Named Pipe TCP proxy.” Make a new connection and set Pipe name to “\\.\pipe\com_1”, description “vmware.” Start it. Set TCP port to e.g. 1001. Then configure a telnet client (e.g. putty works well) to connect to localhost port 1001. If your vmware is running, you should see it connected and you have access to your serial console.
Connect your Minix box to a receiving box using a null modem . Then start a terminal client on the receiving box such as kermit:
$ kermit -l /dev/ttyS0
However, this way kermit will stop working upon every reboot. You can use following script to prevent that (save as a file and make it executable):
#!/usr/bin/kermit + kermit -E -l /dev/ttyS0 set speed 115200 set reliable fast set carrier-watch off set flow-control none set prefixing all connect
In the FreeBSD base system you can use tip. Edit /etc/remote to set the right parameters, e.g.:
# tip uart0
and you're in.