Сreating a custom installer

There was a need to create a BSD installer, which will add its own kernel modules and certain packages, so as not to do this manually. How can I do that? Normal file conversion to one iso 9660 does not work. After the boot screen, an error about a mount problem appears.
 
Use the memstick image, that's much easier to modify. The ISO requires some special care to actually make it bootable. The memstick image is simply a disk image, just like any other install.
 
But it is not entirely clear how these files can be properly assembled into an iso installation image.
Have a look at

Add the configured ~/rootfs/etc/installerconfig file. To trigger installerconfig, copy an example of /etc/rc.local into the ROOTFSDIR,

Instead of building and installing base and kernel from source into ROOTFSDIR, one can simply extract distribution sets into it (i.e. https://download.freebsd.org/releases/amd64/13.1-RELEASE/ base.txz, kernel.txz).

Those distribution sets and MANIFEST (required) can be also added to the image (under ~/rootfs/usr/freebsd-dist), so they don't need to be downloaded.
 
When you enter some text in the inputbox that is not in English, the text leaves or is duplicated. The title goes to the left edge of the dialog box. How can this be fixed, or is it encoding problems?
 
if that's going to be re-used more than once, you may also consider something like PXE-booting and/or mfsBSD to kickstart a customized bsdinstall.

With bsdinstall you basically write a list of options for the installer and append it with a shellscript that runs everything else you'd normally have to do by hand to get the system to the state you want/need. A word of advice: keep the bsdinstall script relatively short and simple and (conditionally) run additional scripts e.g. for more complex network configuration or setting up users and their environments (NFS mounts etc). This modular approach makes it *much* easier to debug in the beginning and simplifies future changes or additions to your setup, e.g. if you have to setup some hosts for another network or user group or want to integrate some orchestration tools.
That being said, also have a look at proper automation/orchestration tools like e.g. sysutils/ansible to keep the actual installer and initial setup as basic as possible. This *immensely* helps with upgrades.

Depending on what you want to achieve or how complex your client-/network configuration is, you will most likely end up with a combination of both approaches. The nice thing about both: they are in essence all just simple scripts and can be easily modified and adapted.


I've built a fully automated client deployment a few years ago using PXE + bsdinstall + ansible (and a load of scripts and some ZFS-snapshot-cloning) and very early on had to learn the hard way to keep the most basic tools and steps that run first as simple and basic as possible and instead utilize the parts further up in the stack that are meant to be flexible and modular.
I.e.: prebuilt images are usually outdated the moment you've built them.
 
There was a need to create a BSD installer, which will add its own kernel modules and certain packages, so as not to do this manually. How can I do that? Normal file conversion to one iso 9660 does not work. After the boot screen, an error about a mount problem appears.

Do you refer to this "mount problem"?

mountpoint_iso.png
 
Yes, this happens when the iso image is built.

You can add the variables in your-iso/boot/defaults/loader.conf, for my case (ufs with cd9600 iso):
vfs.root.mountfrom="cd9660:/dev/cd0" # Specify root partition
vfs.root.mountfrom.options=ro

otherwise I have to type:
mountroot>cd9660:/dev/cd0 ro
During the boot.

You could just read the boot message to fix your case.
 
When you enter some text in the inputbox that is not in English, the text leaves or is duplicated. The title goes to the left edge of the dialog box. How can this be fixed, or is it encoding problems?
Could you provide a screenshot?
 
You can add the variables in your-iso/boot/defaults/loader.conf, for my case (ufs with cd9600 iso):
vfs.root.mountfrom="cd9660:/dev/cd0" # Specify root partition
vfs.root.mountfrom.options=ro

otherwise I have to type:
mountroot>cd9660:/dev/cd0 ro
During the boot.

You could just read the boot message to fix your case.
Trying this method, the computer went into reboot and showed this message again. The img image installation method worked.
 
Could you provide a screenshot?
If a character (not an English letter) appears in the text, an indent of 1-2 tabs is set after it. Because of this, the text either goes to new lines, duplicating part of the main text. The title also goes to the left when a character appears.
The full sentence is "Wybierz nazwe hosta dla tego komputera."
 

Attachments

  • proplem1.PNG
    proplem1.PNG
    15.6 KB · Views: 68
The screenshot shows dialog, anyway in CURRENT 14 both dialog and bsddialog seem ok (with auto sizing and fixed size).

Dialog
dialog-auto.png


dialog-fixed.png


BSDDialog

bsddialog-auto.png


bsddialog-fixed.png


Probably the problem is with an old version of dialog or the current locale, could you paste dialog --version and locale?

(I know a problem with portconfig/libbsddialog with an old version of ncurses in STABLE (issues/2), but the screenshot of Emniz shows dialog).
 
If a character (not an English letter) appears in the text, an indent of 1-2 tabs is set after it. Because of this, the text either goes to new lines, duplicating part of the main text. The title also goes to the left when a character appears.
The full sentence is "Wybierz nazwe hosta dla tego komputera."

Maybe for a fast fix you could add a newline: "Wybierz nazwę hosta dla tego\nkomputera.".
 
After bootstrap stage 2 or 3 completes, init(8) is invoked which eventually executes rc(8). I would recommend familiarizing yourself with the following manpages to learn to how hook your custom installer script(s) into the boot process correctly.

boot.config(5)
loader.conf(5)
init(8)
rc(8)

When you accomplish this, you'll likely be executing a custom shell script that formats and installs your desired system onto some collection of drive(s) (either automatically or interactively). However, be careful not to overwrite the wrong drive(s) or you will find yourself SOL. Remember to write a test to confirm the desired result(s) beforehand.
 
Maybe for a fast fix you could add a newline: "Wybierz nazwę hosta dla tego\nkomputera.".
I tried to solve the problem in this way on 13.1, but the resolutions are different and stretching the dialog box does not help in all cases.
problem2.PNG


For clarity, you can write the text in some other language, such as Hindi or Russian. The text takes on a life of its own.
 
You could enter multiple spaces into the text line to make the text appear symmetrically.

dialog-PL.png


Code:
msg_please_choose_a_hostname="         Wybierz nazwę\n   hosta dla tego komputera.      "
msg_set_hostname="  Ustawieanie nasmy hosta"
 
Regarding the ISO image, which stops at the mountroot prompt when booted, which method did you apply to build it?

I've tried the method from bsdinstall(8), section "BUILDING AUTOMATIC INSTALL MEDIA". Added a installerconfig file and executed the script to build a new iso image. Works fine for me, the iso installer boots in muti-user mode and executes installerconfig.
 
Back
Top