[Bug 229594] Incorrect "No such geom" error when executing gpart with invalid or incorrect gpt partition number

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Sat Jul 7 23:57:21 UTC 2018


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=229594

            Bug ID: 229594
           Summary: Incorrect "No such geom" error when executing gpart
                    with invalid or incorrect gpt partition number
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: bin
          Assignee: bugs at FreeBSD.org
          Reporter: mqudsi at neosmart.net

After upgrading a zpool, a message is displayed to execute something along the
lines of "sudo gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 da0" (my
quote is not along the lines, rather the instructions are to make substitutions
to the quoted text as needed).

I'm sure I'm not the only one that has executed that text as-is forgetting to
substitute `da0` with whatever device `zroot` is on.

This is the output of `zpool status`:

```
...
        NAME        STATE     READ WRITE CKSUM
        tank        ONLINE       0     0     0
          mirror-0  ONLINE       0     0     0
            da0     ONLINE       0     0     0
            da1     ONLINE       0     0     0
...
        NAME                                          STATE     READ WRITE
CKSUM
        zroot                                         ONLINE       0     0    
0
          gptid/c3ae7a7e-bc4c-11e3-ab8c-4437e6acfe08  ONLINE       0     0    
0
```

Here, `gptid/c3ae7a7e-bc4c-11e3-ab8c-4437e6acfe08` is da2, and as such, I
should have substituted `da0` for `da2` before executing `gpart` above.

However, `da0`, `da1`, and `da2` are all valid devices:

```
mqudsi at freebsd ~> sysctl -a kern.disks
kern.disks: da2 da1 da0 cd0
mqudsi at freebsd ~> geom disk list | grep "Geom name"
Geom name: cd0
Geom name: da0
Geom name: da1
Geom name: da2
```

However, the problem is that the error code is bubbled up from the actual
target of the gpart command (after taking into account the `-i` parameter) such
that ultimately an operation was attempted on `/dev/da0p1` which is indeed NOT
a geom device (since the disk is consumed whole by zfs in this configuration)
but then the error code is munged into an error _message_ that drops the index
but keeps the drive, leading to a misleading error about `da0` not being a geom
device.

Solution: The error message should by `sprintf("%sp%d", arg_geom_disk,
arg_p_index)`.

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


More information about the freebsd-bugs mailing list