[Bug 259631] pkgbase upgrade from 12 13 with root on zfs leaves system unbootable

From: <bugzilla-noreply_at_freebsd.org>
Date: Wed, 03 Nov 2021 17:15:13 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=259631

            Bug ID: 259631
           Summary: pkgbase upgrade from 12 13 with root on zfs leaves
                    system unbootable
           Product: Base System
           Version: 13.0-RELEASE
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: misc
          Assignee: bugs@FreeBSD.org
          Reporter: theraven@FreeBSD.org

I have a FreeBSD 12.x VM that is using old-style BIOS booting (Type 1 Hyper-V
VM) and a GPT partition table.  After running `pkg upgrade` to move it to 13, I
am left with an unbootable system, with this error:

```
-
Can't find /boot/zfsloader

FreeBSD/x86 boot
Default: zroot/ROOT/12.2:/boot/kernel/kernel
boot:
```

If I boot from the 13.0-RELEASE ISO, I can

```
set currdev=zroot/ROOT/12.2
boot /boot/kernel/kernel
```

The kernel then fails at the mountroot> prompt, claiming that the FS is an
unknown type.

Fortunately, I created a ZFS boot environment before the upgrade, so I am able
to restore to the previous state.  This is my zpool configuration:

```
NAME         SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP  HEALTH
 ALTROOT
zroot     632G   365G   267G        -         -    35%    57%  1.00x  ONLINE  -
  da0p4   124G   115G  8.55G        -         -    73%  93.1%
  da1p1   508G   249G   259G        -         -    26%  49.0%
```

This is my partition table:

```
# gpart list
Geom name: da0
modified: false
state: OK
fwheads: 255
fwsectors: 63
last: 266338263
first: 40
entries: 128
scheme: GPT
Providers:
1. Name: da0p1
   Mediasize: 209715200 (200M)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r0w0e0
   efimedia: HD(1,GPT,0a4b5b02-5f2f-11e8-b4ae-00155d684600,0x28,0x64000)
   rawuuid: 0a4b5b02-5f2f-11e8-b4ae-00155d684600
   rawtype: c12a7328-f81f-11d2-ba4b-00a0c93ec93b
   label: efiboot0
   length: 209715200
   offset: 20480
   type: efi
   index: 1
   end: 409639
   start: 40
2. Name: da0p2
   Mediasize: 524288 (512K)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r0w0e0
   efimedia: HD(2,GPT,0a5936c3-5f2f-11e8-b4ae-00155d684600,0x64028,0x400)
   rawuuid: 0a5936c3-5f2f-11e8-b4ae-00155d684600
   rawtype: 83bd6b9d-7f41-11dc-be0b-001560b84f0f
   label: gptboot0
   length: 524288
   offset: 209735680
   type: freebsd-boot
   index: 2
   end: 410663
   start: 409640
3. Name: da0p3
   Mediasize: 2147483648 (2.0G)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r1w1e0
   efimedia: HD(3,GPT,0a685cba-5f2f-11e8-b4ae-00155d684600,0x64800,0x400000)
   rawuuid: 0a685cba-5f2f-11e8-b4ae-00155d684600
   rawtype: 516e7cb5-6ecf-11d6-8ff8-00022d09712b
   label: swap0
   length: 2147483648
   offset: 210763776
   type: freebsd-swap
   index: 3
   end: 4605951
   start: 411648
4. Name: da0p4
   Mediasize: 134005915648 (125G)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r1w1e1
   efimedia: HD(4,GPT,0a711d98-5f2f-11e8-b4ae-00155d684600,0x464800,0xf99b000)
   rawuuid: 0a711d98-5f2f-11e8-b4ae-00155d684600
   rawtype: 516e7cba-6ecf-11d6-8ff8-00022d09712b
   label: zfs0
   length: 134005915648
   offset: 2358247424
   type: freebsd-zfs
   index: 4
   end: 266336255
   start: 4605952
Consumers:
1. Name: da0
   Mediasize: 136365211648 (127G)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r2w2e3

Geom name: da1
modified: false
state: OK
fwheads: 255
fwsectors: 63
last: 1073741783
first: 40
entries: 128
scheme: GPT
Providers:
1. Name: da1p1
   Mediasize: 549753716736 (512G)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r1w1e1
   efimedia: HD(1,GPT,7efc24e2-197d-11e9-a9a6-00155d687d03,0x800,0x3ffff000)
   rawuuid: 7efc24e2-197d-11e9-a9a6-00155d687d03
   rawtype: 516e7cba-6ecf-11d6-8ff8-00022d09712b
   label: (null)
   length: 549753716736
   offset: 1048576
   type: freebsd-zfs
   index: 1
   end: 1073739775
   start: 2048
Consumers:
1. Name: da1
   Mediasize: 549755813888 (512G)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r1w1e2
```

Let me know if there are any other things necessary to debug.  It looks as if
between 12 and 13 I need an upgrade to some parts of the bootloader, but
PkgBase doesn't install it (though I'm not sure why I can't then mount root if
I use the loader from the CD: I can do `zpool import` from the CD, so the new
kernel should be able to handle this pool).

-- 
You are receiving this mail because:
You are the assignee for the bug.