# pkg_cutleaves wants to uninstall everything



## dusty_fox (Apr 21, 2009)

I'm new to freebsd (typically a Gentoo user) and I'm having issues with pkg_cutleaves.

Every time I run it (I do so with the -l option just to see what it would like to do) it always lists packages I've installed (such as xorg-server) among the list to remove.  I can remedy this by putting these packages in an 'exclude' file, but the trouble is, pkg_cutleaves still wants to uninstall all the dependencies of those packages.  I thought it was supposed to check for them?

Am I missing something?  Also, is there a way to automatically add packages to your exclude file? (if you've used Gentoo before, like what emerge does with adding packages to the 'world' file?)

I'm basically trying to run the equivalent of 'emerge --depclean' that gentoo has.


----------



## dusty_fox (Apr 21, 2009)

hmm, I can't seem to find the edit button.  I use pkg_cutleaves -l*x* to exclude the packages in the exclude file, but pkg_cutleaves still wants to cut dependencies.


----------



## jb_fvwm2 (Apr 21, 2009)

One can do the same manually as the port:
#cd /var/db/pkg
#ls -lac a* | lookat   (requires /lookat/)
Usually if a +REQUIRED_BY is not present it can be removed if you
have run pkgdb -F and resolved stale dependencies.
then one can pkg_delete -f port-number && yell (requires /yell/)
Sorry to not answer you specific question or if the above is
mistaken in some regard or not explicit enough


----------



## DutchDaemon (Apr 21, 2009)

Note that pkg_cutleaves is not a tool for "just removing superfluous stuff". From the manual: [..] and *lets you decide* for each one if you want to keep or deinstall it [..]. 

All pkg_cutleaves does (like portmaster -L -> leaf ports) is show you which ports are not depended on by _other ports_; and yes, stuff like xorg-7.4_1 and xfce-4.6.0 belong in that category. They may be depended on by *you*. You decide.

Oh, and you can edit after 10 post && 10 days of membership.


----------



## dusty_fox (Apr 21, 2009)

DutchDaemon said:
			
		

> Note that pkg_cutleaves is not a tool for "just removing superfluous stuff". From the manual: [..] and *lets you decide* for each one if you want to keep or deinstall it [..].
> 
> All pkg_cutleaves does (like portmaster -L -> leaf ports) is show you which ports are not depended on by _other ports_; and yes, stuff like xorg-7.4_1 and xfce-4.6.0 belong in that category. They may be depended on by *you*. You decide.
> 
> Oh, and you can edit after 10 post && 10 days of membership.


Okay, that makes sense.  The only thing is, pkg_cutleaves wants to remove packages that say, for instance, xorg-server _depends_ on (like the proto stuff, libx11, etc.).  I don't know if I'm just feeding it the wrong options, or if my database is messed up, or what, or if I'm missing something really obvious 

I'm kind of liking freebsd so far though.


----------



## jb_fvwm2 (Apr 21, 2009)

I probably have other posts explaining how to fix the dependencies
(pkgdb -F, 4 "standard" answers to "stale dependency").  Search the
forums for "stale" probably...
btw.   I'd backup /var/db/pkg  ASAP ( several threads and posts
discuss the accidental removal and its consequences)


----------



## Mel_Flynn (Apr 21, 2009)

dusty_fox said:
			
		

> Okay, that makes sense.  The only thing is, pkg_cutleaves wants to remove packages that say, for instance, xorg-server _depends_ on (like the proto stuff, libx11, etc.).  I don't know if I'm just feeding it the wrong options, or if my database is messed up, or what, or if I'm missing something really obvious



proto stuff are build dependencies: only required to build other stuff, so they are not registered as dependencies and are safe to uninstall. This is what the exclude file is for. If you intend to build from source, you can add these to the exclude file, since each time you upgrade you'll have to install them again. Ports in the same category:
devel/bison
devel/qmake
autotools
devel/cmake
devel/gmake

However, it's possible your /var/db/pkg is missing +REQUIRED_BY files, so to be sure, install ports-mgmt/portmaster and run portmaster --check-depends.

Common cause for missing +REQUIRED_BY files: pkg_delete -f, either by you or a broken tool .


----------



## dusty_fox (Apr 21, 2009)

Mel_Flynn said:
			
		

> proto stuff are build dependencies: only required to build other stuff, so they are not registered as dependencies and are safe to uninstall. This is what the exclude file is for. If you intend to build from source, you can add these to the exclude file, since each time you upgrade you'll have to install them again. Ports in the same category:
> *devel/bison
> devel/qmake
> autotools
> ...


Ohhh I see - I did not know build dependencies were removed (Gentoo doesn't do that, so I was not expecting it).  I guess removing those would be fine, since I don't think I'll be upgrading freebsd as often as I upgrade Gentoo.

Things are starting to make sense!  Thanks everyone.


----------



## phoenix (Apr 22, 2009)

dusty_fox said:
			
		

> Okay, that makes sense.  The only thing is, pkg_cutleaves wants to remove packages that say, for instance, xorg-server _depends_ on (like the proto stuff, libx11, etc.).



Those are only needed during the building of the X ports.  It's not needed for running the X ports (BUILD_DEPENDS vs RUN_DEPENDS).  You can remove most of those from a running system and not even notice (until you do an upgrade via ports an they get re-installed).


----------

