From nobody Mon Feb 27 08:39:06 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 4PQDSC5nc9z3tqC1 for ; Mon, 27 Feb 2023 08:39:07 +0000 (UTC) (envelope-from bapt@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 4PQDSC5GnTz43g9; Mon, 27 Feb 2023 08:39:07 +0000 (UTC) (envelope-from bapt@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677487147; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IY35rUHgawRn81rPScg28+DRsc/WlY8FeOLxim7iKqA=; b=F9pLOoZtUvTCOYF3QDEeh1dM+UfD+9gqcAUJx+5tIk4LGZmP8u2KkIgwM17gCwkAaJiX8m gLhfc6NAF4XkdYXTZRrSYyWNVTEjWgU3qrisS8u0wj3F7p1bdVlVJ8BYaQYFumimgyA/NS QQybI+kuk/nlAeQ9+mNCp3ToFZ7Kz6H0AMG+IN6mjn3yZHaN3vhJ6bWvqTenn6j1HH5PSB zKA/r1Jj7EsS6We8l3nVIm0nIXn9cTrOGUAIXv0zQs1Ilt6gShgtBIXK97j8rc5sjBnEBr +9E1+k9IHp3unUeB9l1uij4fE2qp8uB1SpRvcfcPgMoFSjsK/lGBB/yki34h0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677487147; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IY35rUHgawRn81rPScg28+DRsc/WlY8FeOLxim7iKqA=; b=xp3NZly6hmbBZCGjyPg8BJTNoMla47HEcRTiz0yde4TBeCnnxQrS/sbaXv128e9iG7c0le 0I9xXjnFH2bLchOwK6O0qSa9bpcHcMtcaZizBYabgWXCBSiXWEh6ll+i1x17udK0WTBod8 4UZ0485eX1An1NE9Gw+sEhEHcunhnFOCBokaMppxdz6Yz5Bic38AyIrQ3Zw9IRMXf3RuE7 86uZqfMQ/gXM+RZ03J2+kULwrhaqhMjEjMpDmJCn0PGMQb17S2ktQ2dO7fL7Alh4eqwH2x BAhEbugTO01l20eXpiSOu0CcBCSD5EXLaH+mn3S7dME+vRPX8ppXARF+/EVPBg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677487147; a=rsa-sha256; cv=none; b=N22/VJ+e8yeyfN+nVC8VgIl3CDQHJYPoZzSfB9KXyJ8LmxbH1i1dFB0bS178OnlyWTfdOE Xdwnh3J11t0k8gIBXtwnGs5+zzbme2uzyTuHEZf/lu5mfxNM1MpqULVREzoEyHaFHV+p2Q HLFLIDJFABGczoj9M6VdhAZBqlngFTxzejOeqNhM9r7tg8BLtixb9ecPT0+FFQjrOzK2WE JOLrf+Knb0IIub6JjNsKaFBuB4mDlnnTs1xhLexN9z7qKoFvUJkUkEh6NfCIwBHOmlU08R z4+rvT6ht8GchsDO4QmW0/GT3WPdgoHi3GhqoQgmh5foGPKRXbsmL59k/G9k4Q== 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 4PQDSC3h2Jz10nZ; Mon, 27 Feb 2023 08:39:07 +0000 (UTC) (envelope-from bapt@freebsd.org) Received: by aniel.nours.eu (Postfix, from userid 1001) id 2D2A01AA503; Mon, 27 Feb 2023 09:39:06 +0100 (CET) Date: Mon, 27 Feb 2023 09:39:06 +0100 From: Baptiste Daroussin To: Michael Schuster Cc: FreeBSD Hackers Subject: Re: pkg(8): difference between "-c /path" and "-r /path" Message-ID: <20230227083906.foasrirso33jhn4c@aniel.nours.eu> References: <20230227075803.ugvcrasatmtrycnf@aniel.nours.eu> 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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-ThisMailContainsUnwantedMimeParts: N On Mon, Feb 27, 2023 at 09:04:34AM +0100, Michael Schuster wrote: > Guys, > > see inline > > On Mon, Feb 27, 2023 at 8:58 AM Baptiste Daroussin wrote: > > > > 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. > > my main use case is keeping the current installation (13 Release for > now) up to date and to have a fallback when installing new software; > in that case, if I understand your comments correctly so far, either > should work equally well. > Almost, right now pkg -c should work best as not 100% of the scritps in the ports tree are pkg -r aware. Best regards, Bapt