# pkg keeps reinstalling already autoremoved packages



## alx82 (Dec 11, 2018)

I have a poudriere repository that I use to build firefox, cmus, scilab and few other packages.
Now, I have some packages that I don't longer need, and no other installed packages depend on them. 


```
sudo pkg autoremove
Installed packages to be REMOVED:
    ORBit2-2.14.19_2
    lapack-3.5.0_5
    blas-3.5.0_4
    gcc7-7.3.0_6
    isl-0.19
    libdaemon-0.14_1
    libsamplerate-0.1.9
    libssh2-1.8.0,3
```

Once the above packages get removed with autoremove, pkg will re-install them when i try to install any other package on my system, for example 


```
#pkg install terminus-ttf
New packages to be INSTALLED:
    terminus-ttf: 4.46.0 [FreeBSD]
    libdaemon: 0.14_1 [FreeBSD]
    ORBit2: 2.14.19_2 [FreeBSD]
    libsamplerate: 0.1.9 [custom]
    lapack: 3.5.0_5 [FreeBSD]
    blas: 3.5.0_4 [FreeBSD]
    gcc7: 7.3.0_6 [FreeBSD]
    isl: 0.19 [custom]
    libssh2: 1.8.0,3 [FreeBSD]
```

It is really annoying, and I don't seem to find a way to solve it. Any help?


----------



## SirDice (Dec 11, 2018)

So, you're installing packageA and it has a dependency on packageB. You then remove packageA and autoremove removes packageB. You then install packageC which also has a dependency on packageB. How is autoremove supposed to know you're going to install packageC afterwards?


----------



## steveharriss (Dec 11, 2018)

Can't you use the pkgclean command and the -f option to only keep those packages you list in that file?


----------



## ShelLuser (Dec 11, 2018)

Also keep in mind that ports have 2 kinds of dependencies: run dependencies and build dependencies (see ports(7)). The first will be propagated and listed in the package details but the build dependencies won't.

(edit) This doesn't seem to apply here because you're using pkg to install software, I overlooked that part. I kind of assumed you were using this on the local host itself.


----------



## alx82 (Dec 11, 2018)

SirDice said:


> So, you're installing packageA and it has a dependency on packageB. You then remove packageA and autoremove removes packageB. You then install packageC which also has a dependency on packageB. How is autoremove supposed to know you're going to install packageC afterwards?



Now this is not my case, the autoremoved packages are no longer needed by any installed package afterwards. I used the example of installing a font which does not depend on anything in order to avoid this confusion, and yet here we are...


----------



## alx82 (Dec 11, 2018)

To clarify, the packages removed by pkg autoremove are no longer needed at all, despite that pkg keeps re-installing packages such as gcc7 when I install even a font..


----------



## SirDice (Dec 11, 2018)

Ah, right. I've had this happen too. It's usually caused by other packages not being up to date and dependencies getting twisted. Try making sure everything is fully updated; `pkg upgrade`. Force an update of your local cache too; `pkg update -f`. Then use pkg-check(8) to verify everything.


----------



## alx82 (Dec 11, 2018)

SirDice said:


> Ah, right. I've had this happen too. It's usually caused by other packages not being up to date and dependencies getting twisted. Try making sure everything is fully updated; `pkg upgrade`. Force an update of your local cache too; `pkg update -f`. Then use pkg-check(8) to verify everything.



Thanks for the suggestion, I've done that with no luck , pkg-check gives no problem at all with/without those useless packages installed.


----------



## SirDice (Dec 11, 2018)

I see you're mixing two repositories, one custom and one official. That could be a cause. I would recommend getting everything from your custom repository and disabling the FreeBSD one. Each repository could have different dependencies based on the options you've set on your custom repository. And you could end up mixing your latest custom repository with a quarterly official repository, which can lead to all sorts of version differences.


----------



## alx82 (Dec 11, 2018)

I'm using head on both, if I use only my custom repository, then I have to compile all packages that I need (and that I eventually will need) on my custom repository, which takes a lot of time. I only have few customized packages on my poudriere server.


----------



## SirDice (Dec 11, 2018)

Yes, it's going to take longer. But it's the only way to make sure all dependencies line up correctly.

Note that poudriere typically only rebuilds updated packages, so you only occasionally have to rebuild _everything_. And with sufficient hardware building ~1000 packages only takes a few hours. In this respect I've noticed that I/O performance has a much bigger impact on build times than raw CPU power.


----------



## Sevendogsbsd (Dec 11, 2018)

I have had to do what SirDice suggested and get everything from a single, custom repo. Yes, compile times can take a while, but then as he mentioned, you won't (or shouldn't) have any dependency issues.


----------



## Sevendogsbsd (Dec 11, 2018)

SirDice said:


> In this respect I've noticed that I/O performance has a much bigger impact on build times than raw CPU power.


 
Interesting: my build server has 12 real, 24 virtual Xeon cores, 2x15k rpm SAS spinning disks and is about 9 years old. My PC has 4 real and 8 virtual i7 cores, but uses all SSD and is about 1 year old. There is only about a 1 hour difference in build times between the 2 machines, for about 800 packages. 

Not a scientific measurement at all, but I was surprised at how close the build times are. I mainly use the big Xeon monster because I want to keep my PC clean and separated from the build environment.


----------



## SirDice (Dec 11, 2018)

I wanted to run my build servers as bhyve(8) VMs. Building my packages in the VM however took more than 24 hours while my lowly Core i5 "server" did the same in 6 hours. So that idea went out the window pretty quickly. And I've kept the Core i5 as my primary build server. Building is mostly done at night, if needed I just run an update script and go to bed.


----------



## Sevendogsbsd (Dec 11, 2018)

I quickly figured out to only do updates maybe every week or so: update ports tree, build and just let it go. It generally takes about 4-4.5 hours so I let it run over night or while I am doing things around the house.

I was so used to Linux and binary updates, I have had to back up and change my habits. No worries, it's worth it!


----------

