How to upgrade FreeBSD 13.2 to 14.0

I just found out that FreeBSD 13.2-RELEASE will be end-of-life support within 1 month time from now. It’s time to upgrade FreeBSD on one of nas boxes to 14.0-RELEASE. The following is to capture the steps used to perform the upgrade. It’s similar to my old post. SSH into the server, and run tmux or screen. You really don’t want to lose SSH connection during the upgrade. $ ssh kenno@nas2 $ tmux Check the current running version of FreeBSD: root@nas2:~ # freebsd-version 13.2-RELEASE-p11 Make sure the system is up-to-date with all the patches: root@nas2:~ # freebsd-update fetch root@nas2:~ # freebsd-update install root@nas2:~ # pkg update root@nas2:~ # pkg upgrade Upgrade FreeBSD from 13.2 to 14.0 root@nas2:~ # freebsd-update -r 14.0-RELEASE upgrade src component not installed, skipped Looking up update.FreeBSD.org mirrors... 3 mirrors found. Fetching metadata signature for 13.2-RELEASE from update1.freebsd.org... done. Fetching metadata index... done. Inspecting system... done. The following components of FreeBSD seem to be installed: kernel/generic kernel/generic-dbg world/base world/lib32 The following components of FreeBSD do not seem to be installed: world/base-dbg world/lib32-dbg Does this look reasonable (y/n)? y Fetching metadata signature for 14.0-RELEASE from update1.freebsd.org... done. Fetching metadata index... done. Fetching 1 metadata patches. done. Applying metadata patches... done. Fetching 1 metadata files... done. Inspecting system... Wait for a long while… then when the update process detects changes in some important files, I’m asked to decide what to do by editing that file, pick the desired changes, and save them. For example: The following changes, which occurred between FreeBSD 13.2-RELEASE and [0/143] FreeBSD 14.0-RELEASE have been merged into /etc/ssh/sshd_config: --- current version +++ new version @@ -87,11 +87,11 @@ #UsePAM yes #AllowAgentForwarding yes #AllowTcpForwarding yes #GatewayPorts no -#X11Forwarding yes +#X11Forwarding no #X11DisplayOffset 10 #X11UseLocalhost yes #PermitTTY yes #PrintMotd yes #PrintLastLog yes @@ -104,11 +104,11 @@ #PidFile /var/run/sshd.pid #MaxStartups 10:30:100 #PermitTunnel no #ChrootDirectory none #UseBlacklist no -#VersionAddendum FreeBSD-20230719 +#VersionAddendum FreeBSD-20231004 # no default banner path #Banner none # override default of no subsystems Does this look reasonable (y/n)? y The following changes, which occurred between FreeBSD 13.2-RELEASE and FreeBSD 14.0-RELEASE have been merged into /etc/sysctl.conf: --- current version +++ new version @@ -1,6 +1,5 @@ -# $FreeBSD$ # # This file is read when going to multi-user and its contents piped thru # ``sysctl'' to adjust kernel values. ``man 5 sysctl.conf'' for details. # Does this look reasonable (y/n)? y To install the downloaded upgrades, run "/usr/sbin/freebsd-update install". Perform the update by running the above suggested command. root@nas2:~ # /usr/sbin/freebsd-update install src component not installed, skipped Creating snapshot of existing boot environment... done. Installing updates... Kernel updates have been installed. Please reboot and run "/usr/sbin/freebsd-update install" again to finish installing updates. I guess we know what to do next… root@nas2:~ # reboot Connection to nas2 closed by remote host. Connection to nas2 closed. Reconnect to the server with SSH. There is no need to run ’tmux’ session this time. root@nas2:~ # /usr/sbin/freebsd-update install src component not installed, skipped Creating snapshot of existing boot environment... done. Installing updates...rm: ///usr/include/c++/v1/__string: is a directory Restarting sshd after upgrade Performing sanity check on sshd configuration. Stopping sshd. Waiting for PIDS: 863. Performing sanity check on sshd configuration. Starting sshd. Scanning /usr/share/certs/untrusted for certificates... Scanning /usr/share/certs/trusted for certificates... Completing this upgrade requires removing old shared object files. Please rebuild all installed 3rd party software (e.g., programs installed from the ports tree) and then run "/usr/sbin/freebsd-update install" again to finish installing updates. How to rebuild all installed 3rd party software? I’m guessing I need to run pkg update && pkg upgrade. root@nas2:~ # pkg update pkg: Warning: Major OS version upgrade detected. Running "pkg bootstrap -f" recommended Updating FreeBSD repository catalogue... pkg: Repository FreeBSD has a wrong packagesite, need to re-create database Fetching meta.conf: 100% 178 B 0.2kB/s 00:01 Fetching data.pkg: 100% 7 MiB 3.6MB/s 00:02 Processing entries: 100% FreeBSD repository update completed. 34072 packages processed. All repositories are up to date. Love the suggestion about running pkg bootstrap -f. root@nas2:~ # pkg bootstrap -f The package management tool is not yet installed on your system. Do you want to fetch and install it now? [y/N]: y Bootstrapping pkg from pkg+http://pkg.FreeBSD.org/FreeBSD:14:amd64/quarterly, please wait... Verifying signature with trusted certificate pkg.freebsd.org.2013102301... done Installing pkg-1.21.3... package pkg is already installed, forced install Extracting pkg-1.21.3: 100% This time, I should be able to continue updating the 3rd party software. root@nas2:~ # pkg update Updating FreeBSD repository catalogue... FreeBSD repository is up to date. All repositories are up to date. root@nas2:~ # pkg upgrade Updating FreeBSD repository catalogue... FreeBSD repository is up to date. All repositories are up to date. Updating database digests format: 100% Checking for upgrades (44 candidates): 100% Processing candidates (44 candidates): 100% The following 43 package(s) will be affected (of 0 checked): Installed packages to be REINSTALLED: binutils-2.40_5,1 (ABI changed: 'freebsd:13:x86:64' -> 'freebsd:14:x86:64') bsdinfo-0.22_2 (ABI changed: 'freebsd:13:x86:64' -> 'freebsd:14:x86:64') btop-1.3.2 (ABI changed: 'freebsd:13:x86:64' -> 'freebsd:14:x86:64') dmidecode-3.5 (ABI changed: 'freebsd:13:x86:64' -> 'freebsd:14:x86:64') ...<SNIP>... tmux-3.3a_2 (ABI changed: 'freebsd:13:x86:64' -> 'freebsd:14:x86:64') tree-sitter-0.22.2 (ABI changed: 'freebsd:13:x86:64' -> 'freebsd:14:x86:64') unibilium-2.1.1_1 (ABI changed: 'freebsd:13:x86:64' -> 'freebsd:14:x86:64') zstd-1.5.6 (ABI changed: 'freebsd:13:x86:64' -> 'freebsd:14:x86:64') Number of packages to be reinstalled: 43 395 MiB to be downloaded. Proceed with this action? [y/N]: y That’s it! ...

May 29, 2024 · 5 min · 873 words · kenno

Rust cannot find derive macro `Serialize` in this scope

While trying out some Rust exercises, I came across the following error: $ cargo run --bin iter2 Compiling tutor-web-app-ssr v0.1.0 (/home/kenno/dev/rust/chapter7/ezytutors/tutor-web-app-ssr) error: cannot find derive macro `Serialize` in this scope --> tutor-web-app-ssr/src/bin/iter2.rs:17:10 | 17 | #[derive(Serialize, Deserialize)] | ^^^^^^^^^ | note: `Serialize` is imported here, but it is only a trait, without a derive macro --> tutor-web-app-ssr/src/bin/iter2.rs:5:26 | 5 | use serde::{Deserialize, Serialize}; | ^^^^^^^^^ error: cannot find derive macro `Deserialize` in this scope --> tutor-web-app-ssr/src/bin/iter2.rs:17:21 | 17 | #[derive(Serialize, Deserialize)] <SNIP> This happened because I didn’t specify the required dependency feature for serde crate. Here is what I had in Cargo.toml when the above error occurred: ...

May 22, 2024 · 1 min · 157 words · kenno

How to generate Let's Encrypt SSL cert for Bitnami Lightsail

So you just setup a new shiny WordPress website on a Lightsail (WordPress) instance. Now, you’ve been told to setup an SSL certificate for your website domain. What to do? The following steps show how to generate a free SSL certificate provided by Let’s Encrypt. bitnami@ip-172-26-12-25:~$ sudo /opt/bitnami/bncert-tool ---------------------------------------------------------------------------- Welcome to the Bitnami HTTPS Configuration tool. ---------------------------------------------------------------------------- Domains Please provide a valid space-separated list of domains for which you wish to configure your web server. Domain list []: lightsail.example.com The following domains were not included: www.lightsail.example.com. Do you want to add them? [Y/n]: n Warning: No www domains (e.g. www.example.com) or non-www domains (e.g. www.example.com) have been provided, so the following redirections will be disabled: non-www to www, www to non-www. Press [Enter] to continue: ---------------------------------------------------------------------------- Enable/disable redirections Please select the redirections you wish to enable or disable on your Bitnami installation. Enable HTTP to HTTPS redirection [Y/n]: Y ---------------------------------------------------------------------------- Changes to perform The following changes will be performed to your Bitnami installation: 1. Stop web server 2. Configure web server to use a free Let's Encrypt certificate for the domains: lightsail.example.com 3. Configure a cron job to automatically renew the certificate each month 4. Configure web server name to: lightsail.example.com 5. Enable HTTP to HTTPS redirection (example: redirect http://lightsail.example.com to https://lightsail.example.com) 6. Start web server once all changes have been performed Do you agree to these changes? [Y/n]: Y ---------------------------------------------------------------------------- Create a free HTTPS certificate with Let's Encrypt Please provide a valid e-mail address for which to associate your Let's Encrypt certificate. Domain list: lightsail.example.com Server name: lightsail.example.com E-mail address []: validemail@example.com The Let's Encrypt Subscriber Agreement can be found at: https://letsencrypt.org/documents/LE-SA-v1.3-September-21-2022.pdf Do you agree to the Let's Encrypt Subscriber Agreement? [Y/n]: ---------------------------------------------------------------------------- Performing changes to your installation The Bitnami HTTPS Configuration Tool will perform any necessary actions to your Bitnami installation. This may take some time, please be patient. ---------------------------------------------------------------------------- Success The Bitnami HTTPS Configuration Tool succeeded in modifying your installation. The configuration report is shown below. Backup files: * /opt/bitnami/apache/conf/httpd.conf.back.202405220509 * /opt/bitnami/apache/conf/bitnami/bitnami.conf.back.202405220509 * /opt/bitnami/apache/conf/bitnami/bitnami-ssl.conf.back.202405220509 * /opt/bitnami/apache/conf/vhosts/wordpress-https-vhost.conf.back.202405220509 * /opt/bitnami/apache/conf/vhosts/wordpress-vhost.conf.back.202405220509 Find more details in the log file: /tmp/bncert-202405220509.log If you find any issues, please check Bitnami Support forums at: https://github.com/bitnami/vms Press [Enter] to continue: That’s it. ...

May 22, 2024 · 2 min · 410 words · kenno

Nvim Treesitter reinstalls parser every time Neovim starts

I’m in the process of migrating existing Neovim plugins managed by Packer to a new plugin manager called ‘Lazy’. While setting the nvim-treesitter plugin, I came across this issue that nvim-treesitter keeps reinstalling all language parsers every time Neovim is started. [nvim-treesitter] [5/5] Treesitter parse for vim has been installed What happened? Well, it turns out this is is pretty much a common issue when you switching from Packer to Lazy plugin manager without cleaning up files and directories created by Packer according to this [1]. ...

May 18, 2024 · 1 min · 180 words · kenno

Adjusting Firefox DPI

On a few of my computers with 4K monitors running Linux, Firefox either display with tiny fonts or very large fonts, while most applications behave normally. After searching for a work around, I found the following solution works for me: setting the layout.css.devPixelsPerPx to a smaller number, e.g. 0.7. From this this page: You can set layout.css.devPixelsPerPx to 1.0 (default is -1) on the about:config page. Adjust its value in 0.1 or 0.05 steps (1.1 to enlarge or 0.9 to reduce) until icons or text looks right. You may need values above 2.0 if you have a high resolution display but make sure not to use values too large or too small. ...

May 4, 2024 · 1 min · 156 words · kenno