# Don't bash FreeBSD's pkg too much!



## Deleted member 63539 (Aug 23, 2020)

Some new users bashed FreeBSD's pkg too much. It could be because they come from Linux and were used to the Linux way. As a Linux user (Debian) migrated to FreeBSD, I found FreeBSD's pkg to be _*reliable*_. Compared to its Linux counterparts, I would say it's really reliable. I'm impressed because of it cleanness:

e.g: try to install libreoffice: `doas pkg install libreoffice`, then remove it: `doas pkg remove libreoffice`, then remove the leftovers: `doas pkg autoremove`. You would see all of the leftovers being removed. This is not the case on Linux, as packages installed as dependency could depend on each others, so even if you uninstalled libreoffice with `sudo apt purge libreoffice`, when running `sudo apt autoremove` you would never have all of the leftovers removed as with FreeBSD's pkg. After a while you littered your system too much and the only solution is a clean reinstall. This is also one of the reason why we, Linux users, embraced containers like docker very much, because they helped us not to litter our system!


----------



## AngryChris (Aug 23, 2020)

gh_origin said:


> Some new users bashed FreeBSD's pkg too much. It could be because they come from Linux and were used to the Linux way. As a Linux user (Debian) migrated to FreeBSD, I found FreeBSD's pkg to be _*reliable*_. Compared to its Linux counterparts, I would say it's really reliable. I'm impressed because of it cleanness:
> 
> e.g: try to install libreoffice: `doas pkg install libreoffice`, then remove it: `doas pkg remove libreoffice`, then remove the leftovers: `doas pkg autoremove`. You would see all of the leftovers being removed. This is not the case on Linux, as packages installed as dependency could depend on each others, so even if you uninstalled libreoffice with `sudo apt purge libreoffice`, when running `sudo apt autoremove` you would never have all of the leftovers removed as with FreeBSD's pkg. After a while you littered your system too much and the only solution is a clean reinstall. This is also one of the reason why we, Linux users, embraced containers like docker very much, because they helped us not to litter our system!


You are mistaken. The apt command also has an autoremove argument that does exactly what it does on FreeBSD. Red Hat's yum and dnf commands can do the same thing by rolling back the transaction that installed the package you're wanting to get rid of. That transaction contains all the dependent packages, which are then also removed.

If you want to bash Linux (that seems to go on a lot around here) feel free. But do so based on accurate information, not wrongheaded assumptions.


----------



## a6h (Aug 23, 2020)

gh_origin said:


> .g: try to install libreoffice:  doas pkg install libreoffice


I'm not a doas(1) user, but no objection. To follow up on your remarks, yes I agreed, Ialso think FreeBSD commands are more clean that linux. At the moment I have I'm particularly thinking about searching ports/packages. A lot easier in FreeBSD than linux.


----------



## ekvz (Aug 23, 2020)

gh_origin said:


> `sudo apt autoremove` you would never have all of the leftovers removed



Is this really the case? As far as i know apt's autoremove translates to "remove automatically installed packages without reverse dependencies" so even if it's not instantly picking the packages that enter this state only when a package that currently fits the criteria gets removed wouldn't at least repeatedly running autoremove until nothing is found catch them all or am i missing something here?

Having said that FreeBSDs pkg command seems perfectly fine. I've yet to memorize the more seldom used parameters but until now it has always done what i wanted without giving me any reason for complaining.


----------



## Deleted member 63539 (Aug 23, 2020)

AngryChris said:


> You are mistaken. The apt command also has an autoremove argument that does exactly what it does on FreeBSD. Red Hat's yum and dnf commands can do the same thing by rolling back the transaction that installed the package you're wanting to get rid of. That transaction contains all the dependent packages, which are then also removed.
> 
> If you want to bash Linux (that seems to go on a lot around here) feel free. But do so based on accurate information, not wrongheaded assumptions.


Yeah you turned on auto attack mode. Re-read my post again to see that I'm already mentioned `apt autoremove`. I have used Debian for a long time and not a noob about its packaging system. Please keep that in mind.


----------



## jmos (Aug 24, 2020)

Apt can be configured. And apt knows - beside "depends" - things like "suggested" and "recommended" (and beside "remove" there's a "purge"). The defaults are on comfort, not on minimally.

But the main problem on switching to a new system is: You quickly find out what the new system cannot do. At least not in the way you're used to. But you don't know the alternative approaches yet, and you can't use the advantages yet either. You miss the familiar and have no clue that there might even be a better solution. At the beginning you're mostly seeing disadvantages. That takes time.


----------



## Deleted member 63539 (Aug 24, 2020)

jmos said:


> Apt can be configured. And apt knows - beside "depends" - things like "suggested" and "recommended" (and beside "remove" there's a "purge"). The defaults are on comfort, not on minimally.


Apt by default configured to treat recommended packages as dependencies and there is suggested packages, too. But if you configure Apt to not treat recommended packages as dependencies, many packages will stop functioning because Apt's meta-package depends on it to work.

On Apt, you can easily found you are in such a situation: you installed package A and it grabs a bunch of dependencies with it, when you removed A and issue Apt autoremove, there is nothing to remove! Guess what? That is a meta-package, that grabs many other meta-packages and normal packages, when you remove the meta-package A, other packages as not being the direct dependencies of it were not affected. And how do you remove the leftovers? Yeah, there is /var/log/apt/history.log but it's not in format that you could easy copy and paste to Apt purge. You need to use regular expression to strip the contents inside the brackets and strip the commas out before you could feed it to Apt purge. This is the only regular expression I know when I still used Debian, since I used it intensively: https://stackoverflow.com/a/640016

This not happen with pkg. Even though being a simpler and not as sophisticated as Apt, when you remove a meta-package and issue pkg autoremove, all of the leftovers are gone.


----------

