Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I wanted to uninstall a specific package in Gentoo and browsed through the emerge man page. I found the --unmerge option:

WARNING: This action can remove important packages! Removes all matching packages. This does no checking of dependencies, so it may remove packages necessary for the proper operation of your system.Its arguments can be atoms or ebuilds. For a dependency aware version of --unmerge, use --depclean or --prune.

However, I'd like emerge to check whether the package I want to uninstall is required by any other installed package in the system. --depclean and --prune don't provide that functionality:

  • --depclean removes packages that were installed as dependencies, but are not needed anymore
  • --prune "removes all but the highest installed version of a package from your system"

Is there no dependency-checking version of --unmerge?

share|improve this question
add comment

4 Answers 4

up vote 9 down vote accepted

I don't think depclean works the way you described. Without any arguments it does, but if you pass it a package name it works like unmerge with an additional dependency check. From emerge(1):

Depclean serves as a dependency aware version of --unmerge. When given one or more atoms, it will unmerge matched packages that have no reverse dependencies. Use --depclean together with --verbose to show reverse dependencies.

I always use --depclean (-c) to unmerge individual packages; it works fine

share|improve this answer
    
Thanks, that was what I was looking for! –  daniel kullmann Jul 12 '12 at 7:14
add comment

Sometimes, emerge --unmerge gives this warning message:

 * This action can remove important packages! In order to be safer, use
 * `emerge -pv --depclean <atom>` to check for reverse dependencies before
 * removing packages.

It seems that this is the recommended way to do dependency checking before unmerging a package. I still hope, though, that there is a better, more automated, way to achieve this.

share|improve this answer
add comment

Another way to achieve the same result (although it's not a command that unmerges with dependency checking): emerge --deselect package, which removes the package from the world file. Now, running emerge --depclean will remove that package iff it's not required by any other package.

share|improve this answer
    
Does that mean that emerge --depclean removes all packages that were installed using emerge --oneshot (unless those packages are needed by a package from world)? –  daniel kullmann Jul 11 '12 at 14:15
    
@danielkullmann yes. it computes the whole dependency graph and removes what's not pulled by any package in world. You can use emerge --noreplace --select to add already installed packages without recompiling them, btw. –  njsg Jul 11 '12 at 14:51
add comment

gentoolkit comes to help:

equery d <atom>

You can check dependencies first, then proceed to remove the package after inspecting its dependencies.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.