Solved 11.2-RELEASE unable to find ZFS bootcode

Fogelholk

New Member

Reaction score: 1
Messages: 4

Hi,

After a successful upgrade from latest 11.1 patchlevel to 11.2, my zfs-pool required a pool upgrade to activate new features (device_removal, obsolete_counts and zpool_checkpoint).
After running the zpool upgrade command ( zpool upgrade zroot) I was asked to also upgrade the bootcode, which I did:

Code:
# gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 /dev/ada0
partcode written to ada0p1
bootcode written to ada0
# gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 /dev/ada1
partcode written to ada1p1
bootcode written to ada1
Now my system does not start.

When trying to start my system it just loops around at:

Code:
Booting from Embedded SATA Port Disk A: EFI Fixed Disk Boot Device 1
Boot Failed: Embedded SATA Port Disk A: EFI Fixed Disk Boot Device 1

Booting from Embedded SATA Port Disk B: EFI Fixed Disk Boot Device 2
Boot Failed: Embedded SATA Port Disk B: EFI Fixed Disk Boot Device 2
This system is running on a Dell FC430 with two disks in a ZFS mirror. I have a system similarly installed which I also ran the above commands on, but have not rebooted yet if anyone helping require more information.

How can I make my system boot up normally again?
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 8,050
Messages: 31,634

Is the other system exactly the same? I mean, same disk layout and all? I'm guessing your system normally uses an EFI boot, in which case you've written the wrong boot code.

On the still working system can you do a gpart show and post the output?
 
OP
OP
F

Fogelholk

New Member

Reaction score: 1
Messages: 4

Both systems were installed at the same time, same hardware and disk layout and so on, just different hostnames but having the same packages installed otherwise (active/passive servers) :)

Here's the gpart show of the working system:
Code:
# gpart show
=>       40  781422688  ada0  GPT  (373G)
         40       1600     1  efi  (800K)
       1640       1024     2  freebsd-boot  (512K)
       2664       1432        - free -  (716K)
       4096   31457280     3  freebsd-swap  (15G)
   31461376  749961216     4  freebsd-zfs  (358G)
  781422592        136        - free -  (68K)

=>       40  781422688  ada1  GPT  (373G)
         40       1600     1  efi  (800K)
       1640       1024     2  freebsd-boot  (512K)
       2664       1432        - free -  (716K)
       4096   31457280     3  freebsd-swap  (15G)
   31461376  749961216     4  freebsd-zfs  (358G)
  781422592        136        - free -  (68K)
 

ShelLuser

Son of Beastie

Reaction score: 1,751
Messages: 3,568

Seems SirDice hit the nail on the head. You installed the boot code to -i 1, and /dev/ada0p1 is your UEFI boot partition. You should have used -i 2 in order to target the FreeBSD boot partition.

So the solution to this problem is to fix your UEFI setup. I have very little experience with UEFI but my assumption is that you'll need to overwrite the partition using /boot/boot1.efifat but make sure to verify this statement for yourself before just applying it.
 
OP
OP
F

Fogelholk

New Member

Reaction score: 1
Messages: 4

THANK YOU!

I had been looking how to rewrite the efi and freebsd-boot partition before starting this thread but seems like I didn't look hard enough, and which data goes where!

After booting the server into the LiveCD I was able to solve this problem by issuing the following commands:

Code:
# dd if=/boot/boot1.efifat of=/dev/ada0p1
# gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 2 /dev/ada0
# dd if=/boot/boot1.efifat of=/dev/ada1p1
# gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 2 /dev/ada1
 
Top