PR

FreeBSD OS Maintenance 13.0 -> 13.1

FreeBSD
記事内に広告が含まれています。

The original Japanese version is available here.

While we were maintaining our FreeBSD applications, the OS version 13.1 itself was released as well. So we will update the OS from 13.0 to 13.1. We have not done any customization on our FreeBSD OS. So this will be a boring update task. But let’s give it a try anyway.

I think the main reason is that the OS major version is the same, there is basically no need to touch the application. We will be able to try this area next time when 14.0-RELEASE comes out.

Well, the current version is 13.0-RELEASE-p11. All applications seem to be up-to-date.

The current status.

The first step is to check if it is up-to-date within 13.0. If there is an update, the patch level should be up-to-date. but it seems to be already up-to-date.

We can use freebsd^update for OS maintenance.

Update to 13.1-RELEASE since both OS and applications are up-to-date.

We need to run freebsd-update command with target OS version specified. For more detail. try man freebsd-update.

Do you remember the components you selected when installing the OS? If they match the components to be installed, you are OK and can proceed.

If you don’t see generic kernel option here, then you need to restore the kernel from your custom kernel to generic kernel first. Then you update the OS and you need to rebuild your own custom kernel again.

The necessary files are copied locally and the update is prepared based on that information.

It takes time …

It will take quite a while to get to this point. No changes will be made until you select installation option, so take your time with a cup of coffee. Since this is a minor update, the number of the update files are expected to be small, but if this is a major update or minor versions are far apart, there will be many update files. Be careful to have enough free disk space. After the update files are ready, if the installer founds unintended or complex updates to a configuration file or other file, it will ask if it is OK to make this change. If the changes are complex, you will be asked to edit the file with an editor. In either case, if you know how to read the diff command output, you should have no problem.

yes or no ?

If all checks are done, you are ready to go. Install the update file as instructed.

Nothing is changed until this point.

The “freebsd-update install” command needs to be executed twice. First, only the kernel is updated, then reboot to run the new kernel, and then run again to install the OS files running under the new kernel.

The kernel files are updated.

Now that the kernel files have been installed, reboot and continue.

Execute the rest on the new kernel.

This is unstable 🙂 Let’s make it stable!

The best combination is the same versions.

The everything except the kernel will be installed with the 2nd execution.

The files are being updated…

Restart the entire system, as it may be running an old file module as daemons.

The final step.

Since 13.1 has just been released, 13.1-RELEASE-p0 seems to be the latest patch level. But just to be sure, we will check if it is up-to-date with freebsd-update fetch command.

That’s all done. This is probably the easiest update I have ever done. It is rare case that the OS update procedure is as simple as it is written in the text book. Since binary compatibility of applications is basically guaranteed when the OS major version is the same, so there is no need to touch the ports or packages, and the configuration file that needs to be changed is to the /etc/group file only. If this is the case, for example, updating from 12.3 to 13.1, you will have to run “freebsd-update install” three times. What you do between the second and the third time is to reinstall the ports and packages on the new kernel and new libraries. The share library files related to 12.3 were moved to special directory to keep compatibility. And we need to rebuild the applications with new library files for 13.1 in the proper system directories.
The third “freebsd-update install” will then remove the old shared libraries. You can find more information about this here, and you will be able to enjoy it yourself when 14.0-RELEASE is released 🙂

Finally, you will probably need to test your applications to see if they work as expected after the OS update, but if there are features that no longer work after updating to 13.1, there are two options you can take. If it looks easy, leave it as is and fix the problem. If it is not so easy to figure out what is wrong, revert to the original version 13.0, then reproduce the problem in an experimental environment, and then update to 13.1 again, or update and apply the fix the next time when 13.2 is released. If you choose the latter option, you can easily revert to the original state. Files updated by the update tasks are stored in the /var/db/freebsd-update directory.

Undo everything and get the system back to the point before you start updating.

Reboot and the update tasks are done.

rebooting the system is required.

The system was reverted. As you may have noticed, when updating or rolling back across major versions, it takes time to handle ports and packages. Basically, in a rollback, the shared libraries of the newer OS simply disappear with rollback operation, so the applications you have rebuilt on 13.1 may not work with very high possibilities. In the case of an update operation, both the old and new libraries are available in the system, so the downtime is the time it takes to restart the application only, but in the case of a rollback operation, it is likely that the application will not work until they are recreated, so the downtime will be significant. Planning and experimentation are important.

Is everything OK? Once you have confirmed that everything is OK, delete the files that are no longer needed. Delete entire /var/db/freebsd-update directory and create a directory with the same name. The mode of the directory should be 700.

Advertisement below


コメント