Bug 291043 - etcupdate fails to build tree since fork of stable/15
Summary: etcupdate fails to build tree since fork of stable/15
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: 15.0-STABLE
Hardware: Any Any
: --- Affects Only Me
Assignee: Mark Johnston
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2025-11-16 17:42 UTC by tschweikle
Modified: 2025-12-01 17:20 UTC (History)
3 users (show)

See Also:
markj: mfc-stable15+
markj: mfc-stable14-
markj: mfc-stable13-


Attachments
etcupdate failed extracting new tree (61.26 KB, text/plain)
2025-11-16 17:42 UTC, tschweikle
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description tschweikle 2025-11-16 17:42:15 UTC
Created attachment 265453 [details]
etcupdate failed extracting new tree

etcupdate fails to build new tree if FreeBSD is installed from scratch, then /usr/src compiled using commands:

1. remove /usr/src, /usr/obj: rm -rf /usr/src /usr/obj; mkdir /usr/src /usr/obj
2. pull new sources: git clone https://github.com/freebsd/freebsd-src.git /usr/src
3. checkout stable/15: git checkout stable/15
4. cd /usr/src/sys/amd64/conf; ln -s /root/kernel/FBSD15 .

Now sources are ready to compile:
5. make buildworld KERNCONF=FBSD15
6. make buildkernel KERNCONF=FBSD15
7. make installkernel KERNCONF=FBSD15

8. Now remove etcupdate db: rm -rf /var/db/etcupdate; mkdir /var/db/etcupdate
We'll start with a blank etcupdate db.
9. etcupdate extract

This fails with "Failed to build new tree".
Nothing is created in /var/db/etcupdate, except "log" (attached).

If you instead do:
1. remove /usr/src, /usr/obj: rm -rf /usr/src /usr/obj; mkdir /usr/src /usr/obj
2. pull new sources: git clone https://github.com/freebsd/freebsd-src.git /usr/src
3. checkout stable/14: git checkout stable/14
4. cd /usr/src/sys/amd64/conf; ln -s /root/kernel/FBSD14 .
5. make buildworld KERNCONF=FBSD14
6. make buildkernel KERNCONF=FBSD14
7. make installkernel KERNCONF=FBSD14
8. rm -rf /var/db/etcupdate; mkdir /var/db/etcupdate
9. etcupdate extract

Will work as expected.


"etcupdate extract" works for:
- stable/13
- stable/14

"etcupdate extract" fails to write new tree for:
- stable/15
- current

All systems tested are "root on zfs" with settings as advised by chapter 2.5 - Using bsdinstall. Systems are set up by bsdinstall with:

# mount
zroot on / (zfs, local, nfsv4acls)
devfs on /dev (devfs)
zroot/home on /home (zfs, local, nosuid, nfsv4acls)
zroot/home/sct-muc on /home/sct-muc (zfs, local, nosuid, nfsv4acls)
zroot/tmp on /tmp (zfs, local, nosuid, nfsv4acls)
zroot/usr on /usr (zfs, local, nfsv4acls)
zroot/usr/ports on /usr/ports (zfs, local, nosuid, nfsv4acls)
zroot/usr/ports/distfiles on /usr/ports/distfiles (zfs, local, noexec, nosuid, nfsv4acls)
zroot/usr/ports/packages on /usr/ports/packages (zfs, local, noexec, nosuid, nfsv4acls)
zroot/usr/src on /usr/src (zfs, local, noexec, nosuid, nfsv4acls)
zroot/var on /var (zfs, local, nfsv4acls)
zroot/var/crash on /var/crash (zfs, local, noexec, nosuid, nfsv4acls)
zroot/var/db on /var/db (zfs, local, noexec, nosuid, nfsv4acls)
zroot/var/db/pkg on /var/db/pkg (zfs, local, nosuid, nfsv4acls)
zroot/var/empty on /var/empty (zfs, local, noexec, nosuid, read-only, nfsv4acls)
zroot/var/log on /var/log (zfs, local, noexec, nosuid, nfsv4acls)
zroot/var/mail on /var/mail (zfs, local, noexec, nosuid, nfsv4acls)
zroot/var/run on /var/run (zfs, local, noexec, nosuid, nfsv4acls)
zroot/var/tmp on /var/tmp (zfs, local, nosuid, nfsv4acls)
procfs on /proc (procfs, local)
linprocfs on /usr/compat/linux/proc (linprocfs, local)
fdescfs on /dev/fd (fdescfs)

Setup is the same for FreeBSD 13, 14, 15 and CURRENT.


If you already have an etcupdate database, etcupdate works as expected for all systems: FreeBSD 13, 14, 15 and CURRENT.
It is only "etcupdate extract" witch fails!

Comparing "etcupdate" from FreeBSD 14 with "etcupdate" from FreeBSD 15 there is no difference, except with FreeBSD 14 "mergemaster" is available, while it is not with FreeBSD 15.

If "etcupdate" fails within log you'll find:
===> krb5/util/ss (obj,all,install)
[Creating objdir /var/db/etcupdate/etcupdate-3aVqeOA/usr/obj/usr/src/amd64.amd64/tmp/obj-tools/krb5/util/ss...]
rm -f ct_c.awk
cp /usr/src/crypto/krb5/src/util/ss/ct_c_awk.in ct_c.awk
sed -e '/^#/d' /usr/src/crypto/krb5/src/util/ss/ct_c_sed.in > ct_c.sed
sh /usr/src/crypto/krb5/src/util/ss/config_script /usr/src/crypto/krb5/src/util/ss/mk_cmds.sh  /var/db/etcupdate/etcupdate-3aVqeOA/usr/obj/usr/src/amd64.amd64/tmp/obj-tools/krb5/util/ss awk sed > mk_cmds
chmod 755 mk_cmds
rm -f et-h-ss_err.et et-h-ss_err.c et-h-ss_err.h
cp /usr/src/crypto/krb5/src/util/ss/ss_err.et et-h-ss_err.et
compile_et -d /usr/src/crypto/krb5/src/util/et --textdomain mit-krb5 et-h-ss_err.et
+ /usr/bin/awk -f /usr/src/crypto/krb5/src/util/et/et_h.awk 'outfile=et-h-ss_err.h' et-h-ss_err.et
+ /usr/bin/awk -f /usr/src/crypto/krb5/src/util/et/et_c.awk 'outfile=et-h-ss_err.c' 'textdomain=mit-krb5' 'localedir=' et-h-ss_err.et
mv et-h-ss_err.h ss_err.h
rm -f et-h-ss_err.et et-h-ss_err.h
./mk_cmds /usr/src/crypto/krb5/src/util/ss/std_rqs.ct
make[4]: exec(./mk_cmds): Permission denied
*** Error code 1

Stop.
make[4]: stopped making "all" in /usr/src/krb5/util/ss
*** Error code 1

Stop.
make[3]: stopped making "bootstrap-tools" in /usr/src
       10.53 real         9.24 user         0.89 sys
*** Error code 1

Stop.
make[2]: stopped making "_bootstrap-tools" in /usr/src
*** Error code 1

Stop.
make[1]: stopped making "buildetc" in /usr/src
*** Error code 1

Stop.
make: stopped making "buildetc" in /usr/src

Running failing command manually: it will run, without any "Permission denied".

FreeBSD 14: FreeBSD fbsd14.fritz.box 14.3-STABLE FreeBSD 14.3-STABLE stable/14-n272832-04bb91e9c5f7 FBSD14 amd64
FreeBSD 15: FreeBSD fbsd15.fritz.box 15.0-STABLE FreeBSD 15.0-STABLE stable/15-n281149-ff9dbbc2c6f4 FBSD15 amd64
Comment 1 Mark Johnston freebsd_committer freebsd_triage 2025-11-21 17:58:35 UTC
A workaround for the proximate issue: https://reviews.freebsd.org/D53861
Comment 2 ivy freebsd_committer freebsd_triage 2025-11-22 00:05:50 UTC
the problem is caused by reporter having /var/db mounted noexec, which is not default.  more comments in the review.
Comment 3 Dag-Erling Smørgrav freebsd_committer freebsd_triage 2025-11-22 12:24:06 UTC
While we wait for a fix, since you run `etcupdate extract` after `buildworld`, you can use the `-B` option to tell it to use the already-built object tree instead of building a new one.

Note however that `etcupdate extract` is supposed to be run with a source tree that matches what's already installed, not what you're upgrading to.
Comment 4 commit-hook freebsd_committer freebsd_triage 2025-11-24 14:29:38 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=673924122470463dfb9089e12b1b4496783a77b8

commit 673924122470463dfb9089e12b1b4496783a77b8
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2025-11-21 17:54:38 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2025-11-24 14:28:42 +0000

    krb5: Use sh to run mk_cmds

    Otherwise etcupdate apparently can fail if its private object directory
    under /var/db is in a filesystem mounted noexec.  We shouldn't be
    building this target at all, but for now, just apply this workaround.

    PR:             291043
    Reviewed by:    ivy, cy, des
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D53861

 krb5/util/ss/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 5 commit-hook freebsd_committer freebsd_triage 2025-12-01 16:39:13 UTC
A commit in branch stable/15 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=0db8e36b2baa1979bb503ada3483bf9b0b1d5d3b

commit 0db8e36b2baa1979bb503ada3483bf9b0b1d5d3b
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2025-11-21 17:54:38 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2025-12-01 16:37:57 +0000

    krb5: Use sh to run mk_cmds

    Otherwise etcupdate apparently can fail if its private object directory
    under /var/db is in a filesystem mounted noexec.  We shouldn't be
    building this target at all, but for now, just apply this workaround.

    PR:             291043
    Reviewed by:    ivy, cy, des
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D53861

    (cherry picked from commit 673924122470463dfb9089e12b1b4496783a77b8)

 krb5/util/ss/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 6 Mark Johnston freebsd_committer freebsd_triage 2025-12-01 17:20:28 UTC
I believe this is now fixed everywhere (MIT krb5 is not in 14 or earlier), please re-open if that's not the case.