This can be reproduced on 12-STABLE and 13-STABLE. Consider the following correct behavior with pkg (prod host): ================= root@deblndw011x:~ # uname -a FreeBSD deblndw011x.ad001.siemens.net 12.3-STABLE FreeBSD 12.3-STABLE 53bc9be1c GENERIC amd64 root@deblndw011x:~ # pkg upgrade git Updating ldadw-base repository catalogue... ldadw-base repository is up to date. All repositories are up to date. pkg: websvn-php74 has a missing dependency: php74-pear-Text_Diff Checking integrity... done (0 conflicting) The following 1 package(s) will be affected (of 0 checked): Installed packages to be UPGRADED: git: 2.37.3 -> 2.38.1_1 Number of packages to be upgraded: 1 The process will require 3 MiB more space. Proceed with this action? [y/N]: y [1/1] Upgrading git from 2.37.3 to 2.38.1_1... ===> Creating groups. Using existing group 'git_daemon'. ===> Creating users Creating user 'git_daemon' with uid '964'. pw: uid `964' has already been allocated pkg: PRE-INSTALL script failed root@deblndw011x:~ # echo $? 3 ================= "pkg upgrade" fails here since the create users pre-install scripts fails. The reason is that my passwd uses NIS with "+:*:::::" where, for historical reasons, the regular users have been created with id below 1000. (This I can't change for the moment, but simply depicts the bug): ================= # id 964 uid=964(krenek_k) gid=121(cad) groups=121(cad),305(svn5) ================= So pkg does the right here, it spawns the "sh -c .." process and this line fails: "${PW} useradd git_daemon -u 964 -g 964 -c "git daemon" -d /nonexistent -s /usr/sbin/nologin" (checked libpkg and pkg source) Now when running in the ports dir "make -d A install" gives me: ================= ... 221452 + /usr/bin/env 'PORTSDIR=/usr/ports' 'FORCE_POST=' /usr/local/sbin/pkg-static register -i /usr/ports/devel/git/work-default/stage -m /usr/ports/devel/git/work-default/.metadir -f /usr/ports/devel/git/work-default/.PLIST.mktmp 221453 Installing git-2.38.1_1... 221454 ===> Creating groups. 221455 Using existing group 'git_daemon'. 221456 ===> Creating users 221457 Creating user 'git_daemon' with uid '964'. 221458 pw: uid `964' has already been allocated 221459 pkg-static: PRE-INSTALL script failed 221460 If you installed the GITWEB option please follow these instructions: ... ================= Internally "fake-pkg" is invoked by "install" target. The exit code is ignored from pkg-static, but pkg-static does properly fail (test host): ================= root@deblndw013x1v:/usr/ports/devel/git # uname -a FreeBSD deblndw013x1v.ad001.siemens.net 13.1-STABLE FreeBSD 13.1-STABLE #16 ebaebf5b0: Sat Sep 17 10:55:01 CEST 2022 root@deblndw013x1v.ad001.siemens.net:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64 root@deblndw013x1v:/usr/ports/devel/git # /usr/local/sbin/pkg-static register -i /usr/ports/devel/git/work-default/stage -m /usr/ports/devel/git/work-default/.metadir -f /usr/ports/devel/git/work-default/.PLIST.mktmp root@deblndw013x1v:/usr/ports/devel/git # echo $? 1 ================= Surprisingly when "make fake-pkg" is invoked manually it does properly fail: ================= root@deblndw013x1v:/usr/ports/devel/git # make create-manifest root@deblndw013x1v:/usr/ports/devel/git # make fake-pkg ===> Registering installation for git-2.38.1_1 *** Error code 1 Stop. make: stopped in /usr/ports/devel/git ================ with "-d A": ================ Result of ${.MAKE.EXPORTED:u} is "LANG LC_ALL META_MODE" + /usr/bin/env 'PORTSDIR=/usr/ports' 'FORCE_POST=' /usr/local/sbin/pkg-static register -i /usr/ports/devel/git/work-default/stage -m /usr/ports/devel/git/work-default/.metadir -f /usr/ports/devel/git/work-default/.PLIST.mktmp *** Failed target: fake-pkg *** Failed command: /usr/bin/env PORTSDIR=/usr/ports FORCE_POST="" /usr/local/sbin/pkg-static register -i /usr/ports/devel/git/work-default/stage -m /usr/ports/devel/git/work-default/.metadir -f /usr/ports/devel/git/work-default/.PLIST.mktmp *** Error code 1 HashTable targets: size=128 numEntries=198 maxchain=5 HashTable Global variables: size=512 numEntries=1487 maxchain=9 Stop. make: stopped in /usr/ports/devel/git Global: .ERROR_TARGET = fake-pkg Global:delete .ERROR_CMD (not found) ============== While I don't understand fully why it fails, I am certain that the issue is in "bsd.port.mk" lines 5321 to 5372 where the ${INSTALL_COOKIE} depends on fake-pkg, but the build does not fail. While I can work around this issue by adding the user manually, but this depicts that there is clearly a bug in the framework. fake-pkg is supplied by _INSTALL_SUSEQ.
The git port is just an example because the user simply collides with the user from NIS.
Reset assignment since it's not a problem with git port
Port Manager, cann you have a look?
I don't have a NIS user, where does it come from?
(In reply to Mathieu Arnold from comment #4) From our local network setup, some smart guy before me decided that user ids can be below 1000, but regardless of this, the framework should properly fail here.
Here is the reason: https://github.com/freebsd/pkg/issues/2073 Combined with the patch of https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=267384 and this PR https://github.com/freebsd/pkg/pull/2111 the port is finally failing: gmake[3]: Leaving directory '/root/freebsd-ports/devel/git/work-default/git-2.39.2/contrib/subtree' ====> Compressing man pages (compress-man) ===> Staging rc.d startup script(s) ===> Installing for git-2.39.2 ===> Checking if git is already installed ===> Registering installation for git-2.39.2 [deblndw013x3j.ad001.siemens.net] Installing git-2.39.2... ===> Creating groups Using existing group 'git_daemon'. ===> Creating users Creating user 'git_daemon' with uid '964'. pw: uid `964' has already been allocated pkg-static: PRE-INSTALL script failed *** Error code 1 Stop. make[2]: stopped in /root/freebsd-ports/devel/git *** Error code 1 Stop. make[1]: stopped in /root/freebsd-ports/devel/git *** Error code 1 Stop. make: stopped in /root/freebsd-ports/devel/git