Category Archives: IT Tips

Update FreeBSD to 14.0, Update zpool, and can’t boot…how to fix?

As FreeBSD 13.2 is EOF and FreeBSD 14.0 is released, so I think it’s time to update my server to FreeBSD 14.

So I updated the server as what I did before.

freebsd-update -r 14.0-RELEASE upgrade
freebsd-update install
shutdown -r now
freebsd-update install

And when I also noticed that FreeBSD 14 updated zpool verson and introduce some new features, so I also updated zpool as well.

zpool upgrade zroot

And also updated bootcode on all disks, this is very important.

gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 da0
...
gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 da7

And the final step is to reboot the server to finish upgrade.

Then, server can’t boot. I got below error.

And gpart can find all disks and partition.

What’s happening? I updated bootcode why I still get this error?

And then I did some research, and found that in FreeBSD 14 release note, it’s mentioned

There have been a number of improvements in the boot loaders, and upgrading the boot loader on the boot partition is recommended in most cases, in particular if the system boots via EFI. If the root is on a ZFS file system, updating the boot loader is mandatory if the pool is to be upgraded, and the boot loader update must be done first. Note that ZFS pool upgrades are not recommended for root file systems in most cases, but updating the boot loader can avoid making the system unbootable if the pool is upgraded in the future. The bootstrap update procedure depends on the boot method (EFI or BIOS), and also on the disk partitioning scheme. The next several sections address each in turn.

Well, this is something new in FreeBSD 14, and I didn’t update EFI boot file and that’s why I’m facing this issue.

So, spend some time to fix the boot issue.

First, I tried to change bios from BIOS to UEFI, to see if I can boot the server via BIOS. But unfortunately, it’s not working, and got below error.

So, the only choice is to boot the server with liveCD and fix it.

Select 1, boot installer here. Do not select 2 single mode as single mode is readonly.

Select liveCD

Type root to login, no password is needed.

And then you can mount your zpool via below command (Actually this is not needed if you only need to fix the boot issue)

zpool import -f -R /tmp/zroot zroot

Keep in mind here the only writable folder is /tmp, so you must mount your zpool here.

Determined the location of the boot loader via below command:

efibootmgr -v.

The one with + is the one in use, in below screen shot as I boot from virtual CD so it’s marked as USB.

The one on local disk is mfisyspd0p1

Mount the ESP partition via below command:

mount_msdosfs /dev/mfisyspd0p1 /boot/efi

And then run below files to copy the EFI boot loaders from CD to local disk.


cp /boot/loader.efi /mnt/efi/freebsd/loader.efi
cp /boot/loader.efi /mnt/efi/boot/bootx86.efi

Then reboot,

Then I got an error complaint UEFI is broken.

Then tried to boot into livecd and copy the files again, then reboot.

This time no error, just complaint not able to boot.

So what’s happening?

I remember when I copied the EFI loader, there are some errors from the HBA card.

Then I checked the sha256 of the loader.efi on CD and on local disk, looks like the loader on local disk is corrupted.

This is a known issue for several years. The default drive in FreeBSD is not working properly with mfi driver (I’m using dell h330). So the fix is

Option 1, when you use livecd to boot, select 3 and enter below command to load the right mrsas driver:

set hw.mfi.mrsas_enable="1"

boot

 

Option 2, keeps copy the file to hard disk, and then use command sync to force OS to write data to disk.  And then check the sha256 of the file. Due to the default driver is not stable, I tried about 10 times, finally got the loader.efi copied to the right position.

Then reboot. This time server can boot successfully, but it booted into single mode.

That’s because we replace the file via livecd, so just run fsck to fix it

fsck /dev/da0p1

Then reboot, all good now.

 

Fix IOS App outlook can’t show preview issue – “Open outlook to read your message”

Looks like it’s a bug. The fix is

  • Go into Outlook App settings and turn on Face ID at the bottom. Restart App
  • Go back into Outlook App settings and turn Face ID off at the bottom. Restart App
  • Go into iPhone settings, scroll down to Outlook, find Face ID setting. Turn it OFF
  • Open Outlook App.

Install certificate for Unifi Controller

1. Request certificate. I saved my certificate as unifi2020.crt and unifi2020.key
2. Replace certificate on unifi controller

openssl pkcs12 -export -inkey unifi2020.key -in unifi2020.crt -out unifi.p12 -name unifi  -password pass:temppass
keytool -importkeystore -deststorepass aircontrolenterprise -destkeypass aircontrolenterprise -destkeystore /var/lib/unifi/keystore -srckeystore unifi.p12 -srcstoretype PKCS12 -srcstorepass temppass -alias unifi -noprompt

3. Restart unifi

/etc/init.d/unifi restart

expand AWS EC2 FreeBSD ZFS disk

For testing purpose, I setup a Freebsd instance on AWS, which is using zfs on root.
And then I add 10G disk space to the root volume. Even though I enabled auto-expand for zroot, it seems the 10G space is not added to system. Here are the steps to expand the disk for zroot:

1. Reboot the server.  Even though it’s said that reboot is not necessary, I suggest to reboot the server to make sure server can recognize the new size.

2. As the disk size change, we need to fix the GPT partition table first.

gpart recovery ada0

3. Some documents said can use “zpool online -e” to expand the disk. As shown in above picture, the command can’t auto update GPT and assign the space to zfs partition.

4. We need to use gpart to update GPT first, then expand the zfs partition.

#gpart resize -i 2 ada0
#zpool online -e zrrot /dev/adap2

Customize Office 365 Home installation

I just switched from Office2019 retail to Office 365 Home edition.
And we also can’t choose which office program to install, which means by default access/outlook will be installed on my computer and OneNote will not be installed.

And I checked MS document (https://support.office.com/en-us/article/product-ids-that-are-supported-by-the-office-deployment-tool-for-click-to-run-77654e77-aaeb-4ed6-84eb-1d8b0e086590), it seems we can also use Office Deployment Tool to customize Office 365 Home/Personal installation.

1, go to https://config.office.com to generate a configuration file for installation. For Office Suites, you can choose Office365 Proplus, and we’ll change it after the configuration file is generated.
2, select the Apps you want to install.
3. For the update channel, select “Monthly”
4. Answer the rest questions
5. Click export to download the XML file.
6. Open the XML file, change prodouctID from O365ProPlusRetail to O365HomePremRetail or O365PersonalRetail.
7. Download office deployment tool from https://www.microsoft.com/en-us/download/details.aspx?id=49117
8, open command line, run

setup.exe /configure Configuration_home.xml

Done!

And below are my configuration files, you can use it if you want.

<Configuration>
  <Add OfficeClientEdition="64" Channel="Monthly" ForceUpgrade="TRUE">
    <Product ID="O365HomePremRetail">
      <Language ID="en-us" />
      <ExcludeApp ID="Access" />
      <ExcludeApp ID="Groove" />
      <ExcludeApp ID="Lync" />
      <ExcludeApp ID="OneDrive" />
      <ExcludeApp ID="Outlook" />
      <ExcludeApp ID="Publisher" />
    </Product>
  </Add>
  <Property Name="SharedComputerLicensing" Value="0" />
  <Property Name="PinIconsToTaskbar" Value="TRUE" />
  <Property Name="SCLCacheOverride" Value="0" />
  <Updates Enabled="TRUE" />
  <RemoveMSI />
</Configuration>