Possible bug in how BEs are managed in a pkgbase system.

On my laptop I have three different BEs:
Code:
[5:24][fmc000@tu45b-freebsd ~]$ bectl list
BE                   Active Mountpoint Space Created
FreeBSD-15.0-RELEASE -      -          1.43G 2025-10-17 08:36
FreeBSD-15.0-STABLE  -      -          15.6G 2025-10-11 11:33
default              NR     /          31.0G 2025-06-24 14:32
[5:24][fmc000@tu45b-freebsd ~]$
with default being 14.3 . This morning I decided to update all of them and I found that FreeBSD-src-sys was inconsistent:
Code:
[5:20][fmc000@tu45b-freebsd ~]$ doas pkg check -a      
Checking all packages:  19%
FreeBSD-src-sys-14.snap20251020184531: checksum mismatch for /usr/src/sys/Makefile
FreeBSD-src-sys-14.snap20251020184531: checksum mismatch for /usr/src/sys/README.md
FreeBSD-src-sys-14.snap20251020184531: checksum mismatch for /usr/src/sys/amd64/Makefile
FreeBSD-src-sys-14.snap20251020184531: checksum mismatch for /usr/src/sys/amd64/acpica/acpi_machdep.c
FreeBSD-src-sys-14.snap20251020184531: checksum mismatch for /usr/src/sys/amd64/acpica/acpi_wakeup.c
...
FreeBSD-src-sys-14.snap20251020184531: checksum mismatch for /usr/src/sys/xen/xenbus/xenbusb.c
FreeBSD-src-sys-14.snap20251020184531: checksum mismatch for /usr/src/sys/xen/xenbus/xenbusb_back.c
FreeBSD-src-sys-14.snap20251020184531: checksum mismatch for /usr/src/sys/xen/xenbus/xenbusb_front.c
FreeBSD-src-sys-14.snap20251020184531: checksum mismatch for /usr/src/sys/xen/xenbus/xenbusvar.h
FreeBSD-src-sys-14.snap20251020184531: checksum mismatch for /usr/src/sys/xen/xenstore/xenstorevar.h
Checking all packages: 100%
[5:31][fmc000@tu45b-freebsd ~]$
It looks like default's /usr/src was overwritten by one of the other two BEs:
Code:
[5:43][fmc000@tu45b-freebsd /usr/src/sys]$ find . -exec grep " 1500040" {} \; 
#if __FreeBSD_version >= 1500040
#if __FreeBSD_version >= 1500040
#if __FreeBSD_version >= 1500040
#if __FreeBSD_version >= 1500040
#if __FreeBSD_version >= 1500040
#if __FreeBSD_version >= 1500040
#if __FreeBSD_version >= 1500040
#if __FreeBSD_version >= 1500040
#if __FreeBSD_version >= 1500040
#if __FreeBSD_version >= 1500040
#if __FreeBSD_version >= 1500040
#if __FreeBSD_version >= 1500040
#if __FreeBSD_version >= 1500040
#if __FreeBSD_version >= 1500040
#if __FreeBSD_version >= 1500040
#if __FreeBSD_version >= 1500040
#if __FreeBSD_version >= 1500040
#if __FreeBSD_version >= 1500040
#if __FreeBSD_version >= 1500040
#if __FreeBSD_version >= 1500040
#if __FreeBSD_version >= 1500040
#if __FreeBSD_version >= 1500040
#if __FreeBSD_version >= 1500040
#if __FreeBSD_version >= 1500040
#if __FreeBSD_version >= 1500040
#if __FreeBSD_version >= 1500040
#if __FreeBSD_version >= 1500040
#if __FreeBSD_version >= 1500040
#if __FreeBSD_version >= 1500040
#if __FreeBSD_version >= 1500040
[5:44][fmc000@tu45b-freebsd /usr/src/sys]$
otherwise I don't see how 14.3 source code may reference to 15.x . I then reinstalled 14.3 FreeBSD-src-sys and this is what I found:
Code:
[5:45][fmc000@tu45b-freebsd /usr/src/sys]$ find . -exec grep " 1500040" {} \; 
#if __FreeBSD_version >= 1500040
#if __FreeBSD_version >= 1500040
#if __FreeBSD_version >= 1500040
#if __FreeBSD_version >= 1500040
#if __FreeBSD_version >= 1500040
#if __FreeBSD_version >= 1500040
#if __FreeBSD_version >= 1500040
#if __FreeBSD_version >= 1500040
#if __FreeBSD_version >= 1500040
#if __FreeBSD_version >= 1500040
#if __FreeBSD_version >= 1500040
#if __FreeBSD_version >= 1500040
#if __FreeBSD_version >= 1500040
#if __FreeBSD_version >= 1500040
#if __FreeBSD_version >= 1500040
[5:46][fmc000@tu45b-freebsd /usr/src/sys]$
That's half of them (15 instead of 30). Moreover, all of these instances are in "pkgsave" files:
Code:
[5:53][fmc000@tu45b-freebsd /usr/src/sys]$ doas find . -name "*.pkgsave" -exec  rm {} \;
[5:53][fmc000@tu45b-freebsd /usr/src/sys]$ find . -exec grep " 1500040" {} \;                    
[5:54][fmc000@tu45b-freebsd /usr/src/sys]$ doas pkg check -a                          
Checking all packages: 100%
[5:57][fmc000@tu45b-freebsd /usr/src/sys]$

Am I missing something obvious or is this really a bug in how BEs are handled in a pkgbase system, specifically /usr/src, which is a ZFS dataset?

Code:
[5:57][fmc000@tu45b-freebsd /usr/src/sys]$ df -h .        
Filesystem     Type    Size    Used   Avail Capacity  Mounted on
zroot/usr/src  zfs      13G    374M     13G     3%    /usr/src
[6:01][fmc000@tu45b-freebsd /usr/src/sys]$
 
Code:
zroot/usr/src zfs 13G 374M 13G 3% /usr/src
/usr/src/ isn't part of the BE. It's stored outside of it. Followup question is probably, how do you make it part of the BE? Simplest solution; zfs destroy zroot/usr/src
 
/usr/src/ isn't part of the BE. It's stored outside of it. Followup question is probably, how do you make it part of the BE? Simplest solution; zfs destroy zroot/usr/src
Yes, maybe I wasn't clear but this was my point (sorry about that). /usr/src/ was created as a ZFS dataset by the installer and now that it's used by a package it probably shouldn't be the case anymore.
 
Yes, maybe I wasn't clear but this was my point (sorry about that). /usr/src/ was created as a ZFS dataset by the installer and now that it's used by a package it probably shouldn't be the case anymore.
On my 14.3-RELEASE (non pkgbasified btw):
Code:
[1-0] # zfs list | grep zroot/usr/src
zroot/usr/src                                  862M   799G   862M  /usr/src
The reason/consequence of a separate dataset is that it is outside of the BE structure as set up by default, as SirDice mentioned. That, AFAIK, has always been the case.
Specifically: why do you think this should be different in a package-based base environment?
 
Because in a pkgbase environment /usr/src is used by a package, specifically FreeBSD-src-sys. If you happen to have multiple BEs when you update this package you will overwrite the contents of the same package in the other BEs.
 
Because in a pkgbase environment /usr/src is used by a package, specifically FreeBSD-src-sys. If you happen to have multiple BEs when you update this package you will overwrite the contents of the same package in the other BEs.
You don't need to install FreeBSD-src-sys. Another way is to do a git checkout of the source tree, and simply switch branches. In that situation you don't want to make /usr/src/ part of the BE.
 
Yeah, I know that. I still believe that this is kind of conflicts shouldn't happen and that there just be some kind of mechanism to prevent them but I guess I'm overreacting.
 
Back
Top