Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Oct 2023 15:49:04 -0700
From:      "Edward Sanford Sutton, III" <mirror176@hotmail.com>
To:        questions@freebsd.org
Subject:   Re: How to reinstall *ALL* pkgs
Message-ID:  <CO1PR11MB4770FD554C7C8F3750A56B0CE6D6A@CO1PR11MB4770.namprd11.prod.outlook.com>
In-Reply-To: <CAMtcK2o1Hxx7DxP-4fqWdw3MQrFq5A7W-MO4mcL3PR0ES6qQXg@mail.gmail.com>
References:  <CAGBxaX=utxjVf7w-2=iSrhoDvy%2BrC1PCVPY8RSWu8CzXOf70ng@mail.gmail.com> <CAMtcK2o1Hxx7DxP-4fqWdw3MQrFq5A7W-MO4mcL3PR0ES6qQXg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 10/16/23 21:14, paul beard wrote:
> I have done something like this…
> ls /var/db/pkg/ | sed -r 's/(.*)-[0-9]/\1\ /g' | cut -f1 -d" "
> 
> and pass that to pkg or to a file to clean it up (the sqlite databases are
> in there and don't need installing via pkg).

The sqlite databases are where the packages are listed for current 
FreeBSD installations; perhaps you still have the old entries predating 
pkgng (wasn't it pkg_* commands back then?) As a result, I would not 
trust those entries outside the database files to be up to date.

I recommend keeping a list of packages you installed separately. 
Manually requesting all packages be reinstalled should leave all of them 
marked with their autoremove flag set to 0; `pkg autoremove` will see 
them as all intentionally installed and weren't just brought in to be a 
dependency so will always be kept around. That can be changed with `pkg 
set -A 0` (or 1 if you want it to think it was just brought in as a 
dependency you otherwise don't want to keep if unneeded). If not 
polluted by "remove and reinstall all packages by list of currently 
installed packages" then you can create a list of packages you installed 
with `pkg query -e '%a = 0' %o`. See pkg(8) and its pkg-* related 
manpages it has as 'see also' have examples to lead you down that route.

If you haven't maintained that list or just want a list of packages that 
have nothing depending on them try `pkg prime-origins > 
/root/prime-origins` then consider if there are any 'missing' programs 
you want to guarantee are not removed if dependency branching changes in 
the future; you can manually add them to this list. The equivalent list 
but including all packages is `pkg origin` (why the plurality change on 
the commands?).

> I know pkg has all kind of flags and syntax but I can never keep track of
> it all.
> 
> On Mon, Oct 16, 2023 at 8:53 PM Aryeh Friedman <aryeh.friedman@gmail.com>
> wrote:
> 
>> I tried pkg upgrade -f and got the following:
>>
>> root@neomarx:~ # pkg upgrade -f
>> Updating FreeBSD repository catalogue...
>> FreeBSD repository is up to date.
>> All repositories are up to date.
>> Checking for upgrades (1475 candidates): 100%
>> Processing candidates (1475 candidates): 100%
>> Checking integrity...Child process pid=1821 terminated abnormally: Killed
>>
>> How do I proceed from here?

There was a post on the forums from 2018 recommending `pkg-static 
install -f pkg;pkg upgrade -f` and the user said they also had to 
increase their swap space to succeed. Depending on the package and the 
parameters it is created with, some do take a lot of RAM to process; I 
mostly made my own from poudriere and usually maximized compression 
figuring with 32GB RAM that xz high memory use would be fine.

If still not working and in case no one has a better suggestion, my plan 
would have been to try creating a list of packages in case you don't 
have it already, remove all packages, and reinstall all packages. If pkg 
commands are failing, I don't know if uninstall could be performed 
cleanly without better understanding the pkg database format to manually 
read/confirm steps are happening.

Another thing that could be worthwhile is trying to see if failures can 
be spotted with `pkg check -an` with additional flags -dsv may help 
narrow down some problems.

>> --
>> Aryeh M. Friedman, Lead Developer, http://www.PetiteCloud.org
>>
>>
> 




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CO1PR11MB4770FD554C7C8F3750A56B0CE6D6A>