• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Editing FreeBSD installer img files

GregTheHun

Member


Messages: 25

#1
Hi all,

I was just curious about whether or not there is a way to edit files on the installer USB img file that way I can install FreeBSD from a serial connection.

It appears that after installing a basic freebsd system and then going into da0p3 partition and editing the files manually doesn't actually keep my settings.

Help?

Thank all
 

GregTheHun

Member


Messages: 25

#3
Question though, it seems that the thread you point to appears to be getting at setting the parameters at boot once you get to the main install screen. I have the ability to be able to get a monitor and keyboard at first, but ultimately my goal would be:

1) Change the configs on the install disk (USB img) to be able to have the parameters set to:
a) console="comconsole,vidconsole"
b) comconsole_speed="115200"
c) boot_multicons="YES"
d) boot_serial="YES"​
2) Not have the settings change after each reboot (this happened after installing a base system and manually editing the files in the partitions after mounting)

Help? :)
 

Phishfry

Daemon

Thanks: 581
Messages: 2,056

#4
Well right after you write the image to USB mount the USB memstick and do your serial console settings.
Somehow you are not mounting the drive rw the way it sounds to me.

For #2 at the end of a FreeBSD install it gives you a chance to modify the install so do that and fire up an editor and edit.
ee /boot/loader.conf
Add the same setting to this as the memstick.
 

GregTheHun

Member


Messages: 25

#6
Phishfry,

To answer both things, my steps:
1) Install a base FreeBSD system just to give me access to root.
2) After loading freshly installed system, login as root, plug in USB, mount da0p3 (the only one that mounts in my case with the base system)
3) edit /boot/loader.conf as you say
4) Rebooted into installed system and remounted to verify, didn’t change​
 

Phishfry

Daemon

Thanks: 581
Messages: 2,056

#9
I have the ability to be able to get a monitor and keyboard at first, but ultimately my goal would be:
So from this I gather this is not a headless computer but you want to run it headless with a serial connection?
If so just add those settings to the /boot/loader.conf and reboot without video connected.

What your doing with the memstick is correct I am not sure where the problem is.
 

GregTheHun

Member


Messages: 25

#10
I'm not aware either, but I don't know if there's some sort of write block when I'm editing things on the install USB drive that I'm not aware of.

(As an aside, I want to do an install headless as well, unless that isn't possible, but shouldn't be the case given certain APUs that are mentioned in other posts)

It would seem that as long as I'm root and editing the file on the disk it should stick, but no dice.
 

Phishfry

Daemon

Thanks: 581
Messages: 2,056

#11
I went home last night and did this on a fresh memstick and it worked as I thought.
Here is the blow by blow:

dd if=/dev/zero of=/dev/da0 bs=1M
dd if=/root/Downloads/FreeBSD-11.1-RELEASE-amd64-memstick.img of=/dev/da0 bs=1M conv=sync
mount /dev/da0p3 /mnt
ee /mnt/boot/loader.conf
Add these settings:
boot_multicons="YES"
boot_serial="YES"
comconsole_speed="115200"
console="comconsole,vidconsole"

umount /mnt
 

GregTheHun

Member


Messages: 25

#12
That is exactly what I did, and I believe your not wrong, but let me tell you my setup.

I have a Windows machine that I use Putty from all the time and it has the ability to use Serial from. I have two USB to Serial devices and a Null Modem adapter. I can verify the null modem works from Putty by plugging in one side to a USB port on Windows and shorting pins 2 and 3 together. When starting the terminal session. I can type gibberish, I can see text. Great! :-D

However after setting up the USB drive as you stated, and plugging in both USB ends with the null modem adapter in the middle it doesn’t appear to display anything like the installer screen and such. I get nothing.

So, it should be:

PC to install FreeBSD <- USB end | - null modem - | USB end -> Windows machine.

If it helps, here is the USB to Serial cable I’m using: https://www.amazon.com/UGREEN-Converter-Adapter-Chipset-Windows/dp/B00QUZY4JC

Also, the null modem adapter: https://www.amazon.com/Bargain-Cable-Female-Modem-Adapter/dp/7507825604

Thanks Phishfry, I think you’re almost at the right answer, I have never done this before and it appears something is missing on my end. :)
 

Phishfry

Daemon

Thanks: 581
Messages: 2,056

#13
it doesn’t appear to display anything like the installer screen and such
Another bit of info, when you install via the serial console it comes up with a screen asking what terminal to use.
I use VT100 on the APU.

I really don't know about your usb-serial adapters. Wouldn't the system see them as USB devices with a virtual COM port.
I never tried with a usb adapter. Only db9 to db9.

On boards without "Serial Redirect" in the BIOS you will not see any of the bootup sequence.
FreeBSD won't show up on screen until you reach the loader section of bootup (on boards without serial redirection).
 

sko

Well-Known Member

Thanks: 131
Messages: 296

#14
Not all USB/Serial adapers are working for console redirection. Price unfortunately is not an indicator, but I had the most luck with adapters which are also listed as suitable for serial flashing/programming - which are also available very cheap.
Also beware of the multitude of non-standard and not fully wired serial cables out there. Scrambled output might be caused by a faulty/wrong cable (or wrong console type). Nullmodem cables usually have some lines crossed and don't work with most serial consoles. A lot of cables also might have some proprietary pinout even if they have db9 connectors on both ends - Dell and HP are notorious for this, so are the various serial or rollover cables from APC, Cisco or Allied Telesis. Plug a standard serial cable in your APC UPS and it shuts down (been there, done that, got anything but a t-shirt for the downtime...)

My collection of serial- and rollover cables has grown to ~20 different kinds by now - labeling every cable after verifying with what equipment it works is essential. If in doubt, grab a multimeter and verify the alleged "serial console cable" is wired 1:1 between the connectors.

I'd say 90% of all problems with serial consoles I had were caused by the serial cable. I started marking the cables and connectors at the equipment in matching colors to keep my sanity...


That being said; the settings posted by Phishfry are identical to those I use on 2 systems that are accessible via serial console, so the Problem is somewhere up the stack - most likely the USB/Serial adapters. Try accessing a known-working serial console with a known-working cable (e.g. on your switch) using one of these USB adapters, just to verify this works.
I mostly use screen(1) to access serial consoles, never used putty/windows though, but if it works with another console (again, e.g. your switch) you should be fine. If you see only scrambled output, try another terminal type or check your cable (again: a "serial console cable" is not always a serial console cable...)
 

sko

Well-Known Member

Thanks: 131
Messages: 296

#16
Sorry sko, this is not for a switch, this is for accessing a PC over serial.
I am aware of that. I was only suggesting using a switch to verify the USB/Serial adapters (and/or cables) are working for console access.
 

GregTheHun

Member


Messages: 25

#17
Ah, k, the only problem is I don't have a switch to verify. So, that plan won't work.

At least the main way I verified that I can even get a serial connection is that I shorted pins 2 and 3 to allow me to setup a terminal session and can type text. Won't get a response, but I was reading somewhere that would at least let you know it's not the cable erroring.
 

GregTheHun

Member


Messages: 25

#18
OK, so, slight update. It appears that the configuration is holding for some reason on the USB partition now.

However, when trying to get any output from Putty, I get nothing on the screen even starting it before I boot the machine.
 

GregTheHun

Member


Messages: 25

#19
Well, other than these settings in loader.conf:

Code:
boot_multicons="YES"
boot_serial="YES"
comconsole_speed="115200"
console="comconsole,vidconsole"
Is there anything else I could be missing?

I feel like it's either:
  1. COM port I'm trying to access via Windows (Which I've tried the COM port the USB cable is using and 1-3)
  2. A setting I might be missing in PuTTY
  3. Another setting I might be missing on the install drive
  4. It may also be the USB cables and null modem adapter I might be using
Thoughts?