Installing FreeBSD over serial console

French Fries

Member

Thanks: 13
Messages: 53

#1
Dear all,

is there a simple way to install a standard FreeBSD installer using serial console only?
Serial console installation is covered by the documentation.
But I did not find any reference of an installation over serial console.

I am using small-factor servers (like PcEngines APU) to nice Supermicro servers with console redirection.
Today, I am preparing a migration, so I tested FreeBSD inside KVM, while learning, before I migrate in a few days.

If serial console is already a stock feature of the installer, please pardon my ignorance.

Kind regards,
French Fries
 
OP
OP
French Fries

French Fries

Member

Thanks: 13
Messages: 53

#2
https://www.freebsd.org/cgi/man.cgi?query=loader.conf&sektion=5&manpath=freebsd-release-ports
Code:
comconsole_speed
            (``9600'' or the value of the BOOT_COMCONSOLE_SPEED vari-
             able when loader(8) was compiled).     Sets the speed    of the
             serial console.  If the previous boot loader stage    speci-
             fied that a serial    console    is in use then the default
             speed is determined from the current serial port speed
             setting.

       console   (``vidconsole'') ``comconsole'' selects serial console,
             ``vidconsole'' selects the    video console, ``nullconsole''
             selects a mute console (useful for    systems    with neither a
             video console nor a serial    port), and ``spinconsole''
             selects the video console which prevents any input    and
             hides all output replacing    it with    ``spinning'' character
             (useful for embedded products and such).
How to swith to comconsole automatically when you are not in front of keyboard, only a serial console?​
 

Phishfry

Son of Beastie

Thanks: 950
Messages: 2,897

#3
You need to use #3 from the boot menu with the beastie logo. This drops you to a shell. You enter the commands here like this:
https://forums.freebsd.org/threads/59450/#post-341008

You can also mod your usb memstick installer and add /boot/loader.conf entries for comconsole. The installer will run in VT100 and others.
https://forums.freebsd.org/posts/340928/
You can modify you FreeBSD memstick installer without FreeBSD installed.
Simply boot up the memstick installer on any machine.
Instead of 'Install' pick 'LiveCD' and that will give you a chance to create /boot/loader.conf on the memstick installer and you add your comconsole settings. ee is easy editor and works good for text editing.
ee /boot/loader.conf
Code:
boot_multicons="YES"
boot_serial="YES"
comconsole_speed="115200"
console="comconsole,vidconsole"
Upon completing this you reboot your memstick installer and use it on the console box

After the FreeBSD installer runs it asks if you want to modify files for the new system.
This will drop you to a post-install shell that is the new install.
So you would then need to create /boot/loader.conf on the new system.
ee /boot/loader.conf
Add your comconsole settings

Many headless machines also need the vidconsole setting due to video cores on the cpu. Even without video output.
 

Phishfry

Son of Beastie

Thanks: 950
Messages: 2,897

#5
Yes i modified my post..No rebuild just make 1 file with the comconsole settings after writing the memstick installer disk image..
/boot/loader.conf
 

Rajesh

Member

Thanks: 3
Messages: 40

#7
Hi,
I am facing similar issue in connecting to the serial console for FreeBSD installation. I have set the following tunables from the loader prompt
Code:
set boot_multicons=YES
set boot_serial=YES
set comconsole_speed=115200 (I also made sure, the speed is same on the other side as well)
set console=comconsole
Then from a windows machine, using PUTTY opened a connection to the serial port with correct speed. But, I just get a blank screen. After this screen is opened, I run "boot -h" from the FreeBSD loader prompt. But nothing is seen in putty console.

Is there anything I am missing? I even tried with 9600 on both sides, but no help.

Note: I have connected a serial cable (D9) to my box where I am installing FreeBSD, and through a serial to usb converter I am connecting the other end to my windows usb port
 

SirDice

Administrator
Staff member
Administrator
Moderator

Thanks: 6,223
Messages: 27,193

#10
What type of null-modem cable? 3 wire, 5 wire or full? A 3 wire (RxD, TxD, GND) should be enough. Just make sure to turn off hardware handshaking in PuTTY. Also make sure to select the correct COM port for the USB->Serial converter in Windows, I have a few of those and they all get assigned a random COM port, so the first time it might be COM3, the next time you plug it in it's COM4, another time COM5, etc.
 

Rajesh

Member

Thanks: 3
Messages: 40

#11
Hi SirDice, I believe it's 3-wire only. After setting the above tunables in loader prompt, From putty serial settings, I set the following

1. Serial Line - COM1 (this name i got from device manager)
2. Speed - 115200
3. Databits - 8
4. Stop bits - 1
5. Parity - None
6. Flowcontrol - None

I verified the same settings in the windows device manager properties and also in the freebsd box. Also, I see the following in /etc/ttys

#Serial console
ttyu0 "/usr/libexec/getty 3wire" vt100 onifconsole secure
ttyu1 "/usr/libexec/getty 3wire" vt100 onifconsole secure
ttyu2 "/usr/libexec/getty 3wire" vt100 onifconsole secure
ttyu3 "/usr/libexec/getty 3wire" vt100 onifconsole secure
#Dumb console
dcons "/usr/libexec/getty std.9600" vt100 off secure

Since, I am connecting to my windows PC, dumb console settings wont apply here I assume. Is there any problem in the sequence I am following (First set tunables in loader prompt(in VGA console), then connect from putty)?
 

Phishfry

Son of Beastie

Thanks: 950
Messages: 2,897

#12
Also make sure to select the correct COM port for the USB->Serial converter in Windows,
Also double check the setting for the port speed in Windows. It has to be set there in the device manager and in putty.
Truthfully this is probably not the problem though, if there is a port speed problem you usually see gibberish on the screen.
Not a blank screen..
Is there any problem in the sequence I am following (First set tunables in loader prompt(in VGA console), then connect from putty
Nope those setting are straight out of the handbook.

Are you sure that the device you are connecting to uses COM1.
On some servers COM1 is used for iDRAC or other Lights-out BMC stuff.
Devices with an RJ45 comm port you see the same. RJ45-Console=COM1 and DB9=COM2
 

Phishfry

Son of Beastie

Thanks: 950
Messages: 2,897

#13
(First set tunables in loader prompt(in VGA console), then connect from putty)
Actually booting off VGA then setting the loader settings could be the problem. Have you tried hitting enter key repeatedly in putty?
Have you tried modifying a FreeBSD memstick installer with the /boot/loader.conf serial console settings already set?
That is the best way. It will run FreeBSD installer and ask you what mode. Pick vt100 and then you get a text mode install.

There is another Windows terminal program that I like too, TerraTerm.
https://osdn.net/projects/ttssh2/releases/
 

Phishfry

Son of Beastie

Thanks: 950
Messages: 2,897

#14
One more question. Does this computer you are attempting to connect to via serial console use Serial-Redirect in the BIOS?
Serial Console will work without "Serial Redirect" settings in the BIOS but you will not see anything on screen until you get to the loader section of boot up sequence.
 

Rajesh

Member

Thanks: 3
Messages: 40

#15
Hi Phishfry, Thanks for multiple inputs. To answer your questions one by one..

Also double check the setting for the port speed in Windows. It has to be set there in the device manager and in putty
I made sure the setting in device manager and the settings in putty serial connection are same and they are compatible with the peer setting (freebsd box, which i am trying to get serial console)

Are you sure that the device you are connecting to uses COM1.
On some servers COM1 is used for iDRAC or other Lights-out BMC stuff.
Devices with an RJ45 comm port you see the same. RJ45-Console=COM1 and DB9=COM2
Actually, by default device manager takes the serial console as COM6. Since, it doesn't work, I manually changed to COM1 and tried. But still no luck. Today I tried with COM1, COM2 and COM6 without VGA. No luck. Still blank screen only.

Actually booting off VGA then setting the loader settings could be the problem. Have you tried hitting enter key repeatedly in putty?
Have you tried modifying a FreeBSD memstick installer with the /boot/loader.conf serial console settings already set?
That is the best way. It will run FreeBSD installer and ask you what mode. Pick vt100 and then you get a text mode install.

There is another Windows terminal program that I like too, TerraTerm.
https://osdn.net/projects/ttssh2/releases/
I tried without VGA after changing the /boot/loader.conf. But still blank screen only seen. I couldn't install the TerraTerm program. Seems it's pretty old to run in windows 10. I made sure the /boot/loader.conf settings are proper by connecting to VGA and read the /boot/loader.conf file from loader prompt. It's all intact.

One more question. Does this computer you are attempting to connect to via serial console use Serial-Redirect in the BIOS?
Serial Console will work without "Serial Redirect" settings in the BIOS but you will not see anything on screen until you get to the loader section of boot up sequence.
Yes, this machine has a serial-redirect in BIOS. Those are enabled and here is the settings
Terminal Type - VT100
Bits per second - 115200
Data bits - 8
Parity - None
Stop Bits - 1
Flow control - None
Vt-UTF8 combo key sup - Enabled
Recorder Mode - Disabled
Resolution 100x31 - Disabled
Legacy OS redirection - 80x24
putty keypad - VT100
Redirection after BIOS - Always Enable

Note: I have two serial ports, with both of them having the same settings. One wierd thing I see here is, If I change the Bits per second to 9600 in port 0, I see the VGA console output getting slower (output drawn line by line).

Also, I tried changing the serial cable and the USB connector. But no luck.
 

Phishfry

Son of Beastie

Thanks: 950
Messages: 2,897

#16
One thing I noticed is you are only using part of the comconsole line:
set console=comconsole
The handbook says to use : set console=comconsole,vidconsole
And I think its best. Especially going back and forth trying VGA and console.
The Vidconsole setting at worst case has no effect at all. Even in a serial only box with no video on the CPU.
On boxes where you are using VGA to set loader commands, it seems to me it is essential.
Use it until you get this worked out, it has no ill effects.
 

Rajesh

Member

Thanks: 3
Messages: 40

#18
First, I tried setting both of them. But seems "vidconsole" is invalid in my setup

OK show console
comconsole
OK set console=comconsole,vidconsole
console vidconsole is invalid!
Available consoles:
efi
comconsole
nullconsole
OK

If I set "nullconsole" alone (or along with comconsole), even VGA console output goes away.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Thanks: 6,223
Messages: 27,193

#20
Try turning off any and all serial console port settings in the BIOS. I have a suspicion they're keeping the port locked preventing FreeBSD from using it.
 

Rajesh

Member

Thanks: 3
Messages: 40

#21
Hi SirDice, Sorry for the delayed response. In BIOS, I don't see much setting with respect to Serial port. There is one section for serial port settings. It lists two serial ports. Both are enabled. And for each enabled port, there is a subsection, which has the setting I listed in comment #15 above.

As I said in comment #15, If I change the Bits per second to 9600, I see the VGA console output getting slower (output drawn line by line). So, inline with your comment #20, I doubted VGA port doing something with respect to serial port. But I have already experimented unplugging the VGA port cable (headless) and tried just to get the serial console. But no luck.

One another test I did is to turn off all ttyvX from /etc/ttys and just have the ttydX(Serial terminals) and Dumb console on. But no luck. Wierdly, If i plug back the VGA cable, I see the beastie menu and boot logs in VGA output screen (which I believe shouldn't be the case). So, I am really confused.

At this point, I have two questions.
1) Why changing the Bits per second in serial port settings is slowing down the VGA output?
2) How even after turning off the ttyvX in /etc/ttys, I see the beastie menu and boot logs in VGA output?

Another thread (https://forums.freebsd.org/threads/serial-console-problem.15740/), suggests to disable acpi and test. But when I disabled acpi, I am running into panic with message "running without a device atpic requires a local APIC". So, I am compiling the src again with "device atpic" set in GENERIC, so that I can try running with ACPI disabled. I will post the results of it.

Meanwhile, Is there anything else I can try to get the serial console working? Or any other way to capture the boot logs from VGA output (No IPMI is there)?
 

Phishfry

Son of Beastie

Thanks: 950
Messages: 2,897

#22

Rajesh

Member

Thanks: 3
Messages: 40

#23
Hi Phishfry, I believe you said about the option (-h, -D, -Dh or -P) in /boot/config. If so, I have already tried that. But still facing the issue. If you mean something else, please correct me.

Today, I tried serial console for a Linux server with the same set of cables I used with Freebsd. I don't see the serial console working there as well. So, wondering cable has any issues. I tried 2 ways of cabling.

1. Null Modem cable from freebsd server connected to serial->usb converted and connected to windows through usb --> This used to be working with linux servers. Not sure what is different now.
2. Directly connected a serial to usb converter to freebsd server through a gender changer and the usb side to the windows.

I will do some more testing to make sure about the cabling part. Anyway, Thanks for the inputs.
 

Rajesh

Member

Thanks: 3
Messages: 40

#24
Sorry about the trouble here. Null modem cable I used is the problem here. Seems the connection went like direct line rather than cross-over.. Today I manually did a cross-over connection and I could see the boot menu in serial console (Even without any loader tunables set).

But I am facing another issue now. In the serial console, I see the logs only upto the following. After that I don't see anything in the serial console, but VGA output show the boot logs. Any idea why? I tried reducing the speed to 9600 and also set the previously said loader tunables. But I see the logs only upto the following.

/boot/kernel/kernel text=0x14972f8 data=0x1384c0+0x4c15e8 syms=[0x8+0x15e8b0+0x8+0x178422]
Booting...
Start @ 0xffffffff80302000 ...
 

Rajesh

Member

Thanks: 3
Messages: 40

#25
Following a similar issue reported below,

https://docs.freebsd.org/cgi/getmsg.../freebsd-questions/20090830.freebsd-questions

I tried setting hw.uart.console="io:0x3F8" (or) hw.uart.console="io:0x2F8" (set the flags of corresponding uart to 0x10) from loader.conf, but it didn't help in my case. For sure, I am missing some simple thing. But not sure what it is.

Note: For Testing, I manually connected Pin 5 to Pin 5, Pin 2 to Pin 3 and Pin 3 to Pin 2 directly. No other pins are connected (DTR, DSR and DCD) are not touched. I assume this is good for "None" Flow control case, as I am seeing the output on serial console upto FreeBSD loader. Only Kernel message are not seen. Please correct me if I am doing wrong.
 
Top