# port install failed... how to undo



## ssn_bsd (Nov 1, 2009)

Attempting to install biology/p5-bioperl failed. The actual port is irrelevant. I'm wondering how to remove all of the dependencies that were installed up to the point of failure. 'pkg_deinstall -R p5-bioperl' does not work because p5-bioperl was never installed. pkg_cutleaves looks promising but at the moment I don't have the time to go through and mark all of the ports I want to keep. Is there a simple way to remove all of the dependency packages that were installed for a port that I attempted to install but was not successful?


----------



## DutchDaemon (Nov 1, 2009)

If you don't mind installing ports-mgmt/portmaster (just a script, no dependencies), you will find that `# portmaster -s` will do this. What it does is basically this: check every installed port to see if it is required by other ports, and if none of these other ports are installed, put it up for deinstallation (you just answer yes or no). See portmaster(8).


----------



## ssn_bsd (Nov 1, 2009)

Thanks. I have portupgrade installed, probably for the simple reason that it appeared first in the handbook. Are there any big concerns when combining portupgrade/portmanager/portmaster? Should I generally stick to using one to prevent mucking up the system or is it safe to utilize tools from all three?


----------



## DutchDaemon (Nov 1, 2009)

Stick to one, because they don't share any information between them. If you use portmaster -s, running pkgdb -F or -u will probably register the deinstalled stuff, but I'm not quite sure.


----------



## ssn_bsd (Nov 2, 2009)

'portmaster -s' only produced one package, unrelated to p5-bioperl, for removal. There are many p5-* packages that were installed as dependencies for p5-bioperl. They may be listed by pkg_version. Unfortunately, 'portmaster -s' does not detect them.


----------



## ssn_bsd (Nov 2, 2009)

I ended up identifying p5-bioperl dependencies with:

```
# make build-depends-list
/usr/ports/biology/p5-AcePerl
/usr/ports/biology/p5-Bio-ASN1-EntrezGene
/usr/ports/converters/p5-Convert-Binary-C
/usr/ports/databases/p5-DBD-mysql
/usr/ports/devel/p5-Class-AutoClass
/usr/ports/devel/p5-Clone
/usr/ports/devel/p5-Data-Stag
/usr/ports/devel/p5-IO-String
/usr/ports/devel/p5-IO-stringy
/usr/ports/devel/p5-Module-Build
/usr/ports/devel/p5-Set-Scalar
/usr/ports/devel/p5-Storable
/usr/ports/devel/p5-Test-Harness
/usr/ports/graphics/p5-GD
/usr/ports/graphics/p5-GD-SVG
/usr/ports/graphics/p5-GraphViz
/usr/ports/graphics/p5-SVG-Graph
/usr/ports/lang/perl5.8
/usr/ports/math/p5-Algorithm-Munkres
/usr/ports/math/p5-Graph
/usr/ports/math/p5-Math-Random
/usr/ports/misc/p5-Array-Compare
/usr/ports/net/p5-SOAP-Lite
/usr/ports/net/p5-URI
/usr/ports/print/p5-PostScript
/usr/ports/textproc/p5-SVG
/usr/ports/textproc/p5-Spreadsheet-ParseExcel
/usr/ports/textproc/p5-Text-ParseWords
/usr/ports/textproc/p5-Text-Shellwords
/usr/ports/textproc/p5-XML-DOM
/usr/ports/textproc/p5-XML-DOM-XPath
/usr/ports/textproc/p5-XML-Parser
/usr/ports/textproc/p5-XML-SAX
/usr/ports/textproc/p5-XML-SAX-Writer
/usr/ports/textproc/p5-XML-Twig
/usr/ports/textproc/p5-XML-Writer
/usr/ports/textproc/p5-libxml
/usr/ports/www/p5-HTML-Parser
/usr/ports/www/p5-libwww
```
I removed the corresponding packages with pkg_delete then ran:

```
# portmaster -s
```
This time several p5-* packages were detected and I was able to remove them. I do not understand why portmaster did not find them before I removed the packages listed above.


----------



## DutchDaemon (Nov 2, 2009)

I guess most of them are not 'single-level dependencies', but dependencies of other dependencies. I guess simply removing the original port does not expose those to portmaster -s unless more deeply nested dependencies have been removed too.


----------

