From nobody Mon Feb 27 07:58:03 2023 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PQCXv00tlz3tmQm for ; Mon, 27 Feb 2023 07:58:07 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PQCXt6bc0z3tLG; Mon, 27 Feb 2023 07:58:06 +0000 (UTC) (envelope-from bapt@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677484686; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=336V4beVfsWCkHkcokpYT/Gra1NgynaOXoAH65Luquk=; b=Tle/BbZ/LE4mn3KQLgDQQarH6C4lzr0tEXyNhUVYecEZJTVsAUfrFKhutrD04S9/Firkr3 qIXKyqOOGn0Edc210OscFVui1wkMY4GOMj0I+qWfWtMmCESbRiXMFpi0F4PY+hZl7qPJNQ 2l4iY7FdEFis2Ec62XRFJwdWs/BSlVxsGjQHaE/VEJszkzXv55/BV0DqS51Fqu5o1dXgo5 N3vgzEqY6EypU+P6zVxhUKGC397iO6R/Zw375/GUqotc5EPfMzHzUXI4AgrwQSnE+H8+2S ruD/pAkLeOKzbikrt2k9fczeo1/94zGEmfATtWIjvhTzxY2g1XiDu/mehKFWCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677484686; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=336V4beVfsWCkHkcokpYT/Gra1NgynaOXoAH65Luquk=; b=A0OdVSYwpcNtQnTT+TgXv+fxbBdmf7MjUwEErdHh4fvKefN0ptR1Eoksxo0OLMu1GmwLdV qc3pDD9OQ7PdG3r+jPKYXGybiYHL0AmoYEmqnT01RySFiDubDgVPNr1XVBJ/DvQPAfC8QZ SolQDX6yFHTruevCxlPOLToE4QbEzsd7OcA65kYyDIEY0ziiJcIG2YkuGGQ1L9C2JRvSEr uEqEwZ9WmnutYM/Hgw6RPXJeH2MbMRIncSMvvL9EPbfnm0srFkGtw3ko4aF1IXtq7iiv8n x/uMVtt/DWp8MGFVH7Q5IKCZf+ZoazoXgG7EbA5vBPMLPZH08H8PE2koMPvHdw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677484686; a=rsa-sha256; cv=none; b=SRqx6mBaQapFRicjQ4zKPb5cNEYeg/rXqA4uDTz13t2orRSNVzh+1ndMUG2g6qGONyjXxF VITfvXHPV5CCRGHb5RLB5r1vUI8hriMDOzBFtKqfOLCXHLiQkd+WHWy30ceqbcbscY9f3h B8XBb1CK3TNqb7mFKBZZS+2M3Bv5VO/GIElsJscnMtOKxWD+NmAjynbu+hyonXOnJuISOw iZFFckt+/YZ6nGjLzRMr5JRd32pC7wnZCrlfdMj1KLwoe/LqFzvElI85njs7s+QbrzAzmD tu9nmT5sEG3QEaUSvCtgh4j1dcJn0pcOiaFfVH6wVcqrO6YvaqBFJxpeeo0g4g== Received: from aniel.nours.eu (nours.eu [IPv6:2001:41d0:8:3a4d::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: bapt) by smtp.freebsd.org (Postfix) with ESMTPSA id 4PQCXt4CRhzynv; Mon, 27 Feb 2023 07:58:06 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: by aniel.nours.eu (Postfix, from userid 1001) id 836C61AA251; Mon, 27 Feb 2023 08:58:03 +0100 (CET) Date: Mon, 27 Feb 2023 08:58:03 +0100 From: Baptiste Daroussin To: Michael Schuster Cc: FreeBSD Hackers Subject: Re: pkg(8): difference between "-c /path" and "-r /path" Message-ID: <20230227075803.ugvcrasatmtrycnf@aniel.nours.eu> References: List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-ThisMailContainsUnwantedMimeParts: N On Sun, Feb 26, 2023 at 10:07:14AM +0100, Michael Schuster wrote: > Hi, > > This question is (as of yet) more of the "fill in background info" type: > From the "pkg(8)" man-page: > > -c , --chroot > pkg will chroot in the environment. > > -r , --rootdir > pkg will install all packages within the specified directory>. > > up to now, I've leaned towards "pkg -c /path " when > installing/updating a BE mounted at /path, but, given some results in the > past that weren't quite clear to me (yes, that's a bit vague, sorry), I've > been wondering whether "-r /path" would have been better. > > I'd appreciate thoughts/advice/comments, TIA > Michael pkg -c will chroot (real chroot as in chroot(2)) into the directory at early stage and execute everything from the inside. This means that for post install script the kernel of the host needs to be able to run the binary withing the guest (for instance you cannot cross install). For the packages themselves it is transparent if that is the case. pkg -r, will run everything from the host and with the provided rootdir prepend to all path in the packages and database, post install scripts needs to know about PKG_ROOTDIR variable (which is not the case for many of them in the ports tree). triggers will be deffered (to be run at next boot). pkg -r allows cross installation (preparing an arm64 rootdir on a amd64 host). In long term pkg -r is preferred, right now pkg -c is probably most of the time safest. Best regards, Bapt