Ask Your Question

Removing packages with dependencies

asked 2013-10-08 10:52:37 -0600

Faisal Aslam gravatar image

I install Chromium in Fedora 19. I don't like it and removed it. Now using Google Chrome. I want to ask that what about the dependencies which were installed with Chromium? Should I have to remove dependencies one by one or is there any option like they have in Ubuntu

sudo apt-get clean

Is there any option like this to remove dependencies which are not in use. Please is there any command then let me know.

Also sorry for my bad English.

edit retag flag offensive close merge delete



How were you able to remove Chromium without removing its dependencies as well?

hawkfeather gravatar imagehawkfeather ( 2013-10-08 11:26:40 -0600 )edit

Often, not all dependencies are removed. That I believe is what Faisal wants to do.

nonamedotc gravatar imagenonamedotc ( 2013-10-08 11:42:06 -0600 )edit

Generally, if you use yum or rpm to remove a package, its otherwise-unneeded dependencies will also be removed. And sometimes, inexperienced users will simply delete an unwanted application, and I wondered if maybe that's what Faisal had done.

hawkfeather gravatar imagehawkfeather ( 2013-10-08 22:56:24 -0600 )edit

I just remove Chromium by this command rpm -e chromium

Faisal Aslam gravatar imageFaisal Aslam ( 2013-10-09 07:44:47 -0600 )edit

4 Answers

Sort by ยป oldest newest most voted

answered 2013-10-09 03:12:23 -0600

hawkfeather gravatar image

updated 2013-10-15 12:17:58 -0600

It turns out that yum also has an autoremove* option, same as that of Debian's apt-get.

$ sudo yum autoremove will remove any unneeded dependencies from your system. You should run that command straightaway after adding the clean_requirements_on_remove=1 line to your /etc/yum.conf file as described in the previous answer.

*- Found in the man page documentation for yum

edit flag offensive delete link more

answered 2013-10-08 11:41:05 -0600

none gravatar image

You could also add this option to /etc/yum.conf: clean_requirements_on_remove=1.

From man 5 yum.conf:

clean_requirements_on_remove When removing packages (by removal, update or obsoletion) go through each package's dependencies. If any of them are no longer required by any other package then also mark them to be removed. Boolean (1, 0, True, False, yes, no) Defaults to False

edit flag offensive delete link more


That's nice! Good to know!

nonamedotc gravatar imagenonamedotc ( 2013-10-08 11:42:54 -0600 )edit

This is one of those little flags that I didn't know existed. Thanks, this will be very useful.

cobra gravatar imagecobra ( 2013-10-09 05:09:16 -0600 )edit

answered 2013-10-08 12:28:27 -0600

skytux gravatar image

In my opinion, the best way to remove a package alongside its installed dependencies is with yum history.

In the first place, you need to identify the number (ID) of the transaction:

# yum history

Then, use that number to undo the complete transaction:

# yum history undo ID

(where ID is the first column number corresponding to the package you have installed).

Example. Suppose I want to remove python3-ipython and its dependencies, then I do the following:

# yum history

ID     | Command line             | Date and time    | Action(s)      | Altered
   230 | install python3-ipython  | 2013-10-07 12:56 | Install        |   16   
   229 | install python-pyside    | 2013-10-06 19:02 | Install        |    2   
   228 | --enablerepo=updates-tes | 2013-10-06 14:18 | Update         |    2   
   227 | update                   | 2013-10-06 13:48 | E, I, U        |   12 EE

# yum history undo 230

Undoing transaction 230, from Mon Oct  7 12:56:34 2013
    Dep-Install python3-dateutil-2.0-5.fc19.noarch            @fedora
    Install     python3-ipython-0.13.2-1.fc19.noarch          @fedora
    Dep-Install python3-ipython-console-0.13.2-1.fc19.noarch  @fedora
    Dep-Install python3-ipython-gui-0.13.2-1.fc19.noarch      @fedora
    Dep-Install python3-ipython-notebook-0.13.2-1.fc19.noarch @fedora
    Dep-Install python3-matplotlib-1.2.0-14.fc19.x86_64       @updates
    Dep-Install python3-mglob-0.4-8.fc19.noarch               @fedora
    Dep-Install python3-numpy-1:1.7.1-5.fc19.x86_64           @updates
    Dep-Install python3-pexpect-2.5.1-8.fc19.noarch           @updates
    Dep-Install python3-pygments-1.4-8.fc19.noarch            @fedora
    Dep-Install python3-pyparsing-1.5.6-8.fc19.noarch         @fedora
    Dep-Install python3-pytz-2012d-4.fc19.noarch              @fedora
    Dep-Install python3-setuptools-0.6.36-1.fc19.noarch       @fedora
    Dep-Install python3-simplegeneric-0.8-6.fc19.noarch       @fedora
    Dep-Install python3-tornado-2.2.1-4.fc19.noarch           @fedora
    Dep-Install python3-zmq-13.0.0-1.fc19.x86_64              @fedora
Resolving Dependencies
--> Running transaction check
---> Package python3-dateutil.noarch 0:2.0-5.fc19 will be erased
---> Package python3-ipython.noarch 0:0.13.2-1.fc19 will be erased
---> Package python3-ipython-console.noarch 0:0.13.2-1.fc19 will be erased
---> Package python3-ipython-gui.noarch 0:0.13.2-1.fc19 will be erased
---> Package python3-ipython-notebook.noarch 0:0.13.2-1.fc19 will be erased
---> Package python3-matplotlib.x86_64 0:1.2.0-14.fc19 will be erased
---> Package python3-mglob.noarch 0:0.4-8.fc19 will be erased
---> Package python3-numpy.x86_64 1:1.7.1-5.fc19 will be erased
---> Package python3-pexpect.noarch 0:2.5.1-8.fc19 will be erased
---> Package python3-pygments.noarch 0:1.4-8.fc19 will be erased
---> Package python3-pyparsing.noarch 0:1.5.6-8.fc19 will be erased
---> Package python3-pytz.noarch 0:2012d-4.fc19 will be erased
---> Package python3-setuptools.noarch 0:0.6.36-1.fc19 will be erased
---> Package python3-simplegeneric.noarch 0:0.8-6.fc19 will be erased
---> Package python3-tornado.noarch 0:2.2.1-4.fc19 will be erased
---> Package python3-zmq.x86_64 0:13.0.0-1.fc19 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

 Package                        Arch         Version                 Repository      Size
 python3-dateutil               noarch       2.0-5.fc19              @fedora        364 k
 python3-ipython                noarch       0.13.2-1.fc19           @fedora        0.0  
 python3-ipython-console        noarch       0.13.2-1.fc19           @fedora        5.6 M
 python3-ipython-gui            noarch       0.13.2-1.fc19           @fedora        803 k
 python3-ipython-notebook       noarch       0.13.2-1.fc19           @fedora        1.1 M
 python3-matplotlib             x86_64       1.2.0-14.fc19           @updates        50 M
 python3-mglob                  noarch       0.4-8.fc19              @fedora         22 k
 python3-numpy                  x86_64       1:1.7.1-5.fc19          @updates ...
edit flag offensive delete link more


This looks a little too much like a brute-force method to me, like it would remove dependencies regardless of whether they are needed by other packages and possibly leave you w\ a broken system. Am I right?

hawkfeather gravatar imagehawkfeather ( 2013-10-08 23:05:13 -0600 )edit

Well, it is a yum command... I'm not sure if it would remove dependencies needed by other packages. Every time I want to test a package, and then I don't like it, I remove it in that way, so I never experienced the situation you are describing here. But anyway it would be worth consulting a yum developer.

skytux gravatar imageskytux ( 2013-10-12 13:25:57 -0600 )edit

Thank yo very much!!... This save my life... I installed a component in a production server, and one of the dependencies of the software conflicted with a vital service (bad sysadmin, I know) and this post helped me to "go back in time" and undo my mistake.

hojendiz gravatar imagehojendiz ( 2018-12-05 14:22:39 -0600 )edit

answered 2013-10-08 11:04:08 -0600

nonamedotc gravatar image

My favorite is the yum plugin remove with leaves. This does exactly what you wanted. Install the plugin as follows -

yum install yum-plugin-remove-with-leaves

When you are removing a package, do

yum remove *packagename* --remove-leaves

This should get rid packages that were installed as dependencies but not needed anymore. This command works similar to apt-get autoremove

Note: Pay close attention to what packages yum wants to remove to avoid having a broken system (albeit rarely)

edit flag offensive delete link more

Question Tools


Asked: 2013-10-08 10:52:37 -0600

Seen: 78,119 times

Last updated: Oct 15 '13