bin/187458: sysrc silently and unexpectedly bootstraps pkg

Adam McDougall mcdouga9 at egr.msu.edu
Tue Mar 11 22:40:01 UTC 2014


>Number:         187458
>Category:       bin
>Synopsis:       sysrc silently and unexpectedly bootstraps pkg
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Mar 11 22:40:00 UTC 2014
>Closed-Date:
>Last-Modified:
>Originator:     Adam McDougall
>Release:        10.0-STABLE
>Organization:
>Environment:
FreeBSD build10 10.0-STABLE FreeBSD 10.0-STABLE #0 r262298: Fri Feb 21 18:28:26 EST 2014     root at build10:/usr/obj/usr/src/sys/BUILD10  amd64
>Description:
Recently I began setting up some fresh FreeBSD installs and I used sysrc to enable some services in /etc/rc.conf that I would use later on.  From a fresh install, I have no ports or packages installed.  A few steps later I ran 'pkg bootstrap' and it told me pkg was already installed.  Huh?  The first time I thought I was crazy, the second time I tracked it down.  When sysrc runs, it runs some subroutines from /usr/share/bsdconfig/common.subr which runs  "ASSUME_ALWAYS_YES=1 pkg -vv" which will bootstrap pkg silently if it can, because it is not installed and it was told to assume yes.  In my environment, the end result is not problematic but it is confusing and very unexpected, especially the brief delay during the first execution while it bootstraps.
>How-To-Repeat:
on a system without pkg installed but with sysrc, run:

script output.log sh -x `which sysrc` test=yes

In output.log you'll see sysrc call /usr/share/bsdconfig/common.subr which runs "ASSUME_ALWAYS_YES=1 pkg -vv"   which will bootstrap pkg silently.

to check status, but if pkg is not already bootstrapped, it will silently attempt to and continue on after a short delay if it succeeds.
>Fix:
No specific fix suggestion.  If there is a way to check if pkg is actually installed and not just the /usr/sbin/pkg stub, maybe the full "ASSUME_ALWAYS_YES=1 pkg -vv" execution could be avoided.  Checking for /usr/local/sbin/pkg may be insufficient if some has it in a custom path.

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list