# Error Message: "Missing boot loader" after zpool upgrade



## beastie3 (May 1, 2018)

Hi folks,
I have upgrade my ZFS pools and I get the message "Missing boot loader" after rebooting.
My installation consists of two SSDs as a mirror. The layout of one disk is:


```
% gpart show ada0
=>       40  976773088  ada0  GPT  (466G)
         40     409600     1  efi  (200M)
     409640  2008            - free - (1.0M)
     411648  4194304     2  freebsd-zfs  (2.0G)
  4605952   4194394     3  freebsd-swap  (2.0G)
  8800256   967972864 4   freebsd-zfs (462G)
976773120            8         - free - (4.0K)
```

On the mirror I have two pools, a geli-encrypted pool zroot and a pool called bootpool. After
`zpool upgrade zroot` and `zpool upgrade bootpool`
I ran
`gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada0`
and the same for ada1.

But now I get "Missing boat loader" after rebooting.
Can anybody tell me what i did wrong?


----------



## SirDice (May 1, 2018)

You installed the bootloader for CSM boot (traditional BIOS boot) while your system is installed for UEFI boot.

Boot from the install disk, drop to a shell and dd(1) the /boot/boot1.efifat image to the efi partition.


----------



## beastie3 (May 1, 2018)

Thank you, it boots again!


----------



## beowuff (Jul 9, 2018)

I have the same issue, but the above commands have not helped... :/

gpart show:

=>                   40    1953525088    ada0    GPT    (932G)
                       40             409600           1    efi       (200M)
              409640                 2008                  - free -    (1.0M)
              411648          8388608           2    freebsd-swap    (4.0G)
            8800256   1944723456           3    freebsd-zfs    (927G)
     1953523712                 1416                 - free -    (708K)

=>                   40    1953525088    ada1    GPT    (932G)
                       40             409600           1    efi       (200M)
              409640                 2008                  - free -    (1.0M)
              411648          8388608           2    freebsd-swap    (4.0G)
            8800256   1944723456           3    freebsd-zfs    (927G)
     1953523712                 1416                 - free -    (708K)

=>                   40    1953525088    ada2    GPT    (932G)
                       40             409600           1    efi       (200M)
              409640                 2008                  - free -    (1.0M)
              411648          8388608           2    freebsd-swap    (4.0G)
            8800256   1944723456           3    freebsd-zfs    (927G)
     1953523712                 1416                 - free -    (708K)

=>                   40    1953525088    ada3    GPT    (932G)
                       40             409600           1    efi       (200M)
              409640                 2008                  - free -    (1.0M)
              411648          8388608           2    freebsd-swap    (4.0G)
            8800256   1944723456           3    freebsd-zfs    (927G)
     1953523712                 1416                 - free -    (708K)

I've dd'd the /boot/boot1.efifat to all of the p1 partitions and run "gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 3" on ada0-3. I still get missing boot device, no matter what drive I try to boot from. I'm assuming since I don't have any "freebsd-boot" partitions, that the freebsd-zfs partitions would be the correct ones.

Note these are zraid 10 (two mirrored stripes).


----------



## ShelLuser (Jul 9, 2018)

beowuff said:


> I've dd'd the /boot/boot1.efifat to all of the p1 partitions and run "gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 3" on ada0-3.


Then chances are high that you effectively destroyed your entire ZFS pool(s). Never blindly use commands which you obviously don't understand.

What you did was install the contents of /boot/gptzfsboot (the ZFS bootloader) onto the ZFS data partition itself (such as /dev/ada0p3). It is meant to be installed on a boot partition, something of type freebsd-boot, NOT on your actual data partition.

I think now would be a good time to verify your backups.


----------



## beowuff (Jul 9, 2018)

But there has never been a "freebsd-boot" partition, so where is that code supposed to go? This was a working 11.1 that I upgraded to 11.2. freebsd-boot partition is obviously not required.

Also, the data is still there. I can boot from a disk, change the zfs mountpoint for zroot/ROOT/default to /tmp/zroot, mount it, and see data. So, it's not destroyed.


----------



## ShelLuser (Jul 9, 2018)

I don't have hands on experience with UEFI myself, but as far as I know you don't need /boot/gptzfsboot at all, that is all handled by the UEFI booting image, which according to the wiki page also has support for root on ZFS.

So that should be all you need.


----------



## beowuff (Jul 9, 2018)

Hm, okay. That makes sense, thank you. Still not sure why doing the dd of efifat didn't work. :/

Fortunatly this is a testing box, so I don't have to worry about the backups. Just trying to understand what went wrong in case it happens on a more important box.


----------



## SirDice (Jul 10, 2018)

beowuff said:


> Still not sure why doing the dd of efifat didn't work.


It did work but you broke things even further by (partially) overwriting your ZFS partition with the gpart(8) bootcode. If you _only_ used dd(1) to restore the EFI partition things would have been fixed.


----------



## mickey (Jul 11, 2018)

Partitions of type _freebsd-boot_ are only required for booting a system in BIOS mode as is writing anything to those partitions using `gpart bootcode`.
On UEFI systems the code required to boot the system is contained solely within the EFI partition and it can handle ZFS also.


----------

