Bug 276547

Summary: 'glabel label' command fails to set up label on a GEOM provider
Product: Base System Reporter: Alex Matei <matei35>
Component: kernAssignee: freebsd-geom (Nobody) <geom>
Status: Closed Not A Bug    
Severity: Affects Many People CC: markj
Priority: ---    
Version: 13.2-RELEASE   
Hardware: amd64   
OS: Any   

Description Alex Matei 2024-01-23 07:54:02 UTC
$ uname -a
FreeBSD eagle 13.2-RELEASE FreeBSD 13.2-RELEASE GENERIC amd64
$

GEOM provider labelization, 'automatic' method:
$ sudo glabel label -v test35 ada0p1
glabel: Can't store metadata on ada0p1: Operation not permitted.
$

GEOM provider labelization, 'manual' method works fine:
$ sudo glabel create -v test35 ada0p1
$ glabel list
...
Geom name: ada0p1
Providers:
1. Name: label/test35  // 'test35' disappears at system reboot
...
$
$ glabel stop test35
$ glabel list
...test35 is gone...
$
Comment 1 Mark Johnston freebsd_committer freebsd_triage 2024-01-26 19:38:29 UTC
I suspect that this is because something is holding /dev/ada0p1 open.  (For instance, is it providing a mounted filesystem?)  "glabel label" needs to write data to the last sector of the provider and so must open the device for writing, while "glabel create" creates a temporary label and so does not need to do this.

This might be "functions as designed," though the error message leaves something to be desired..
Comment 2 Alex Matei 2024-01-29 11:26:57 UTC
(In reply to Mark Johnston from comment #1)
Yes, /dev/ada0p1 is mounted.
Thanks for the update!
Comment 3 Mark Johnston freebsd_committer freebsd_triage 2024-01-29 14:24:43 UTC
Thanks for the update.  In that case I believe this is expected behaviour.  Please re-open the bug if you disagree, or can point to some documentation which suggests otherwise.