Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 4 Apr 2022 20:42:34 +0200
From:      Stefan Esser <se@FreeBSD.org>
To:        freebsd-pkg@freebsd.org
Cc:        Matthew Seaman <matthew@FreeBSD.org>
Subject:   Re: removing a pkg from pkg database without deleting the pkg itself
Message-ID:  <29ca5644-e6ae-178b-9fba-51b4531d37c5@FreeBSD.org>
In-Reply-To: <ce029d17-50e9-826c-2acb-a7ad7c78a89d@FreeBSD.org>
References:  <Ykrx7YW9rmCez2LC@cloud9.zyxst.net> <5dcfff1f-4cbd-992e-0ddc-b923b06c74e1@FreeBSD.org> <YksOcSkt8Ar%2B7eqk@cloud9.zyxst.net> <ce029d17-50e9-826c-2acb-a7ad7c78a89d@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--------------33yb4Sf0JBE4TQMWRjuQKTWS
Content-Type: multipart/mixed; boundary="------------YpTCGGPcnu3q9fLiqVTAYiXb";
 protected-headers="v1"
From: Stefan Esser <se@FreeBSD.org>
To: freebsd-pkg@freebsd.org
Cc: Matthew Seaman <matthew@FreeBSD.org>
Message-ID: <29ca5644-e6ae-178b-9fba-51b4531d37c5@FreeBSD.org>
Subject: Re: removing a pkg from pkg database without deleting the pkg itself
References: <Ykrx7YW9rmCez2LC@cloud9.zyxst.net>
 <5dcfff1f-4cbd-992e-0ddc-b923b06c74e1@FreeBSD.org>
 <YksOcSkt8Ar+7eqk@cloud9.zyxst.net>
 <ce029d17-50e9-826c-2acb-a7ad7c78a89d@FreeBSD.org>
In-Reply-To: <ce029d17-50e9-826c-2acb-a7ad7c78a89d@FreeBSD.org>

--------------YpTCGGPcnu3q9fLiqVTAYiXb
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Am 04.04.22 um 18:38 schrieb Matthew Seaman:
> On 04/04/2022 16:27, tech-lists wrote:
>> On Mon, Apr 04, 2022 at 03:35:16PM +0200, Stefan Esser wrote:
>>> Am 04.04.22 um 15:26 schrieb tech-lists:
>>>> Hi,
>>>>
>>>> I'd like to remove a pkg entry from the database so it's not managed=
 by pkg.
>>>
>>> The simplest way to exclude an installed package from being managed
>>> by pkg is to use "pkg lock":
>>>
>>> # pkg lock -y <pkgname>
>>>
>>> See "man pkg-lock" for more details.
>>
>> That will work for a time, but won't it stop other packages linked to =
it from
>> being updated?

If this package is installed as a dependency of some other package,
you can expect inconsistencies and conflicting dependencies to arise
over time.

>> The packages in question are nextcloud and drupal.

I have used "pkg lock" for NextCloud and it worked for me ...

>> The other thing is that even with pkg lock, I seem to recollect it'll =
still
>> show up in packages-that-
>> need-upgrading in the daily cronjob. I might be wrong about that thoug=
h.
>=20
> pkg(8) doesn't really have a concept of giving up management of a packa=
ge that
> it originally installed.

Not only that, but pkg does not manage individual packages, but wants
to have an intact dependency graph. Only "loosely" connected packages
can be excluded from that graph without issues cropping up over time.

In case of e.g. NextCloud you can manage the PHP interpreter and general
PHP modules with pkg and the nextcloud sub-tree independently using the
update procedure provided by NextCloud.

> What you could do is use 'pkg info' to generate a list of the files ins=
talled
> by the package.=C2=A0 Feed that into tar(1) to create a backup, then us=
e pkg(8) to
> delete the package and tar to recover the files from your backup.=C2=A0=
 There will
> be a short service outage while you do that: if that's not acceptable t=
hen you
> can probably adapt the procedure by using tar(1) or similar to copy the=
 package
> files to an alternate filesystem location, making whatever config chang=
es you
> need to in your webserver and application config to serve the site from=
 the new
> location, and then deleting the original package.

You can fetch the package with "pkg fetch" (or may already have a copy
in /var/cache/pkg) and directly extract from that file, without prior
installation via the pkg command. You have to check for any install
scripts, but these exist in only a small fraction of the ports.

The just go to the root directory and extract all files with paths that
start with /usr/local:

# tar xf /var/cache/pkg/<pkgfile> /usr/local

This should work for most packages, but there might be cases where the
more complex method suggested by Matthew gives slightly better results.

Regards, STefan

--------------YpTCGGPcnu3q9fLiqVTAYiXb--

--------------33yb4Sf0JBE4TQMWRjuQKTWS
Content-Type: application/pgp-signature; name="OpenPGP_signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="OpenPGP_signature"

-----BEGIN PGP SIGNATURE-----

wsB5BAABCAAjFiEEo3HqZZwL7MgrcVMTR+u171r99UQFAmJLPBoFAwAAAAAACgkQR+u171r99US+
hAf+JjyPtEvOfMPOG7BRmgoYN6VmhtsZjo5QYsly5wK4XXQF/hwHPaFBU2dsaUSHdrERONtfFgYT
gHuN3co4v7EKzzPIZYPJz5VOrk9bvtqEJMqv3syhUfwnUUk+Qzj9qTefJrsW6EtTQTiyP0ped3e8
C9Uj2Uj/t8a+yV8OUabGzKcENsvN3XIUg3i9VrcVjrtJClQLzRJ/i9VvoOfQ8OkR+FHk00EqslkZ
e54ujr7xQ4sMaFKgSnNnTE7gOeUNmyPzzJrjBzERMAaVE0w4me+2v0xB8JqDgj040b9wmY6cTp2T
uRk3qorf4qXYPHN1Lc412yQVRmTHhFJWk7BwoT1T8w==
=5oY8
-----END PGP SIGNATURE-----

--------------33yb4Sf0JBE4TQMWRjuQKTWS--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?29ca5644-e6ae-178b-9fba-51b4531d37c5>