How to Force Remove a Package Without Dependencies Using Yum [2 Methods]

LINUX
FUNDAMENTALS
A Complete Guide for Beginners Enroll Course Now

If you want to forcefully remove any package without its dependencies then you are in the right place. In this article, I will show you how to force remove a package without dependencies using yum. Yellowdog Updater Modified (yum) is a reputed package manager generally used in Red-hat-based Linux distros like RHEL, Fedora, and CentOS. It has the potential to handle dependencies automatically. Hence, it is not recommended to forcibly remove any package without dependencies, it may create an unexpected broken system. However, if it is required, you can do it easily by just following this article carefully.

Process flow chart to force remove a package without dependencies using Yum:

showing the process flowchart of 2 methods to force remove a package without dependencies using yum

[Distro Used Throughout the Tutorial: RHEL 9.2]

2 Easy Methods to Forcefully Remove a Package Without Dependencies Using Yum

While uninstalling any software package with yum, it removes the software package with all its unused dependencies which really great to some extent. However, if you want to keep those dependencies in your system, stick to this content to know the procedures in detail.

You can read our Comparative Analysis of Methods to distinguish between these two methods and pick one for your needs.

Method 01: Forcefully Removing a Package Without Dependencies Using Yum Command With the “–setopt” Flag

To remove packages without dependencies, you first need to disable the clean_requirements_on_remove option. In this case, you can use the ‘–setopt’ command with yum. Also, you can use the latest version of yum (dnf) to get a better performance. Here, I will describe two cases to do it.

Case 01: Force Remove a Package Without Dependencies Using Yum

In this case, the yum command is used to remove the Google Chrome package without dependencies. Follow the procedure step by step:

Steps to Follow >

➊ Open the Red-hat terminal.

âž‹ Write this command to remove the package without dependencies:

sudo yum --setopt=clean_requirements_on_remove=0 remove google-chrome-stable
EXPLANATION
  • sudo: Provides administrative privileges.
  • yum: Manages packages in Red-hat-based Linux.
  • –setopt=clean_requirements_on_remove=0: Sets the built-in command to disable the option clean_requirements_on_remove.
  • remove: Removes software packages.
  • google-chrome-stable: Package name.

Removing a package without dependencies with setopt option with yum

After writing your Red-hat Linux password, type ‘y’ to complete the removal of Google Chrome without its dependencies.

giving permission to complete the removal process

Finally, you are done with your uninstallation procedure.

➌ Now you can check the dependency list by running this command:

sudo yum deplist google-chrome-stable
EXPLANATION
  • deplist: Displays the dependencies of the requested packages.

Checking dependencies of the google chrome package using yum

In this picture, you can see that all the dependencies still exist after removing the software package.

Case 02: Force Remove a Package Without Dependencies Using Updated Yum (dnf)

dnf is the updated version of yum offering more benefits than yum. You can use it to get better results. Now, check the steps mentioned below to remove the package without dependencies:

Steps to Follow >

➊ Open the Red-hat terminal.

âž‹ To remove the package without dependencies using dnf, write the following code:

sudo dnf --setopt=clean_requirements_on_remove=0 remove google-chrome-stable
EXPLANATION
  • dnf: The latest version of yum that manages software packages in Red-hat-based Linux.

removing google chrome with setopt option using dnf

In this image, you can notice the removal of the Google Chrome package without its dependencies. Type ‘y’ there as shown in the picture to complete this procedure.

➌ After that, you can run this command to check all the dependencies of the package using dnf:

sudo dnf deplist google-chrome-stable
EXPLANATION
  • deplist: Shows the dependencies of the requested packages.

checking dependency using dnf

Now, you can check all the unused as well as necessary dependencies are still here.

Method 02: Forcefully Removing a Package Without Dependencies Using Yum Command With the “–noautoremove” Flag

yum autoremove command basically removes all the unnecessary dependencies from the Linux system. In the same way, the noautoremove option just does the opposite task. In this section, I will explain two cases of removing a package without dependencies.

Case 01: Force Remove a Package Without Dependencies Using Yum

Yum is the popular package manager used to install, remove, or manage packages in Red-hat Linux. Adding the noautoremove option with yum will allow you to remove any packages without their dependencies. To know how to do that, follow the procedure step by step:

Steps to Follow >

➊ Open the Red-hat terminal.

âž‹ Run the next command to remove the Google Chrome package without dependencies:

sudo yum remove google-chrome-stable --noautoremove
EXPLANATION
  • –noautoremove: Command option used to remove packages without dependencies.

force remove package without dependency with noautoremove option using yum

The command will start removing the package as soon as you give your Red-hat password. Afterward, it will ask for your permission. In this case, if you still wish to remove the package, you can proceed by typing ‘y’.

Now you can inspect the dependencies by following Step 3 of Case 01 under Method 01.

Case 02: Force Remove a Package Without Dependencies Using Modern Yum (dnf)

With the same command option (noautoremove), you can utilize the latest version of yum (dnf) which has promising dependency-resolving capacity. Check every step carefully to complete your job successfully:

Steps to Follow >

➊ Open the Red-hat terminal.

âž‹ Write the command to remove the Google Chrome without dependencies using dnf package manager:

sudo dnf remove google-chrome-stable --noautoremove
EXPLANATION
  • dnf: A powerful package manager and the next-generation version of yum.

force remove chrome without dependencies with noautoremove option using dnf

After running the command, you will be asked to write your Red-hat password. Type that password to initiate the process. Afterward, a prompt will appear to take your final permission to complete this action. Write ‘y’ there and get your job done.

Now you can check the dependencies by following Step 3 of Case 02 under Method 01.

Comparative Analysis of Methods to Force Remove a Package Without Dependencies Using Yum

As I have covered two methods in this article, you may get confused about which one to use. To clear up your confusion, read the pros and cons of each method and choose whatever you prefer.

Methods Pros Cons
Method 1
  • Simple to use.
  • Saves disk space.
  • Can cause unintended consequences
  • May create difficulty in troubleshooting.
Method 2
  • Ability to avoid unintended consequences.
  • Preserve custom configuration files.
  • Increases disk usage.
  • Maintenance complexity.

If you want to save disk space, you can opt for method 1 otherwise pick method 2 to ignore unwanted issues.

Note: Keep in mind that whatever method you use, always create a backup before making any changes to your system that will prevent your system from breaking.

Conclusion

In this article, I have gone through two different methods to force remove packages without dependencies. Moreover, I have explained two cases under method 1 and method 2. Yum and dnf package managers are used here with two different options to remove the Google Chrome package without its dependencies. However, it is not appreciable to force remove any package. Still, if you need this follow this article and don’t forget to have a backup before proceeding.

People Also Ask

How do I force RPM to install without dependencies?
You can use the – -nodeps option to make it happen. Write ‘sudo rpm -ivh – -nodeps <rpm package file>’ in the Red-hat terminal to complete your task.
How to skip broken dependencies with yum?
Generally speaking, yum lacks the ability to remove a single package from a list of dependencies. In that case, all the unresolved dependencies can be ignored by the command option – -skip-broken. Therefore, run this code ‘sudo yum remove – -skip-broken <package_name>’.
How do I clear my yum cache?
You can clean all the unnecessary metadata, headers, and cache files with the single command which is ‘sudo yum clean all’.
How to remove a package from Linux using RPM?
In order to do this just execute this command: ‘sudo rpm -e <package_name>’.

Related Articles


<< Go Back to Uninstall Packages in Linux | Package Management in Linux | Learn Linux Basics

5/5 - (3 votes)
Mitu Akter Mou

Hello, This is Mitu Akter Mou, currently working as a Linux Content Developer Executive at SOFTEKO for the Linuxsimply project. I hold a bachelor's degree in Biomedical Engineering from Khulna University of Engineering & Technology (KUET). Experiencing new stuff and gathering insights from them seems very happening to me. My goal here is to simplify the life of Linux users by making creative articles, blogs, and video content for all of them. Read Full Bio

Leave a Comment