I prefer to use the -STABLE branch which means there are many more updates compared to RELEASE. I try to do an update once a week or at least a couple times a month. This is not a particularly difficult task but I still refer to a printout of a tutorial page from an old BSD Now podcast. I have a number of customizations which I have used in the past along with a custom kernel, but I have not used them lately, or at least not the customized KERNCONF. This entire process will need to be done as root due to standard default permissions.
If you have not done so already, you will need to obtain the source for the build you intend to use.
and then to prepare now for future updates do:
Since I use the stable branch of version 12, below is how I obtain a specific branch:
Assuming you hadn't just completed the above, or sometime next week you choose to rebuild, one of the first steps is to update /usr/src. This can be as easy as changing to the directory
Now that the preparations have been made, we can begin. You can take advantage of multiple cores in your system by setting one job per core or cpu. If you are uncertain you can check by
Now that that is complete, I can do the next step. This one I discovered can be combined with the step after it, as below. This explicitly defines the kernel configuration file, which must reside in
Although I have had a custom kernel in the past, and I still have the modified kernconf file, I am using GENERIC because shockingly, I had some difficulties. My troubles with booting and with kernel builds have been primarily related to graphics. I think I have a decent handle on them now, but rather than use the monolithic configuration I made, I want to take a closer look at how it compares to GENERIC and also discover which items can be built as kernel objects. Once I know that, I would limit kernel object builds to those I need or might use, and reduce rather than increase the kernel by removing things I never use.
The next step is to go to single user. This I do with a reboot which also verifies that the kernel I just installed functions as intended to that point.
Watch for the FreeBSD startup menu, press space as needed to pause it -- it may be set to be a very short countdown here, then choose 'singleuser' by hitting '2'. It is NOT recommended to use another shell for handling the buildworld or buildkernel processes, so when it finishes and shows the prompt below, tap the return or enter key.
Enter full pathname of shell or RETURN for /bin/sh
As I mentioned in another blog post, now I can't boot the way to access
and then if your system is ZFS rather than UFS, this mounts all datasets:
Once in /usr/src there are a few more things to do and then we can reboot into the new system. First, what the manpage calls a pre-buildworld mode mergemaster which compares the installed /etc/group and /etc/master.passwd with the new defaults so that you can choose what to adjust as needed, and then the install command.
Function of etcupdate is essentially the same, pre-buildworld option remains -p for this step.
Should you see a message like below, which can appear,
At installworld Make: "/usr/src/Makefile" line 360: Check your date/time
it is a simple fix, type the following command to continue:
Now that the error is corrected, finish the command that was interrupted:
The next steps will help update configuration files, allow you to merge your customized lines with the new file as needed, while automatically handling those files which are essentially identical or have not been user-modified.
-n Enable “dry-run” mode. Do not merge any changes to the
destination directory. Instead, report what actions would
be taken during a merge. Note that the existing “current”
and “previous” trees will not be changed. If the -r
option is not specified, then a temporary “current” tree
will be extracted to perform the comparison.
-N Perform a NO_ROOT build when building a “current” tree.
The resulting tree will include a corresponding METALOG
file at its root.
-p Enable “pre-world” mode. Only merge changes to files that
are necessary to successfully run ‘make installworld’ or
‘make installkernel’. When this flag is enabled, the
existing “current” and “previous” trees are left alone.
Instead, a temporary tree is populated with the necessary
files. This temporary tree is compared against the
“current” tree. This allows a normal update to be run
after ‘make installworld’ has completed. Any conflicts
generated during a “pre-world” update should be resolved
by a “pre-world” resolve.
It is good practice to be certain old libraries and other assorted files are not left around to cause problems, especially true between updates of major versions, so the next two commands will help remove all of them automatically. The command below, yes repeats 'y' to fulfill prompts, thus agreeing to each deletion which automates the script. Yes as described by its manpage can be used to repeat any text.
Now that everything is finished, you can reboot one last time to load up and use your newly updated system. If for any reason there is a failure with booting, refer to now I can't boot for some steps to help solve it.
