Troubleshooting Common CentOS 7 Problems: A Guide for System Administrators
First released in 2014, CentOS 7 is still a popular and widely-used operating system worldwide. Many organizations prefer to use CentOS for its stability, reliability, and security. As it is free and open source, it is actively maintained by CentOS developers and the wider community of users.
While using CentOS 7, users may encounter multiple issues related to packages, networking, performance, storage, and more. In this blog, we will discuss some common CentOS 7 problems that might occur and provide solutions to them to keep the system functioning correctly.
1. Unable to Install Packages Using Yum
Installing packages is one of the most essential tasks in the Linux operating system. Sometimes, users are unable to install packages using the Yum tool, which can be caused by various problems, such as incorrect package names, poor network connections, un-updated repositories, and others.
- Installing packages requires an active internet connection, so make sure that the server has network connectivity. Or, in a more advanced scenario, set up a reachable local mirror repository that you can pull updates from when running in a higher-security environment where internet access is restricted.
- Additionally, configure the necessary repositories properly and update the existing repositories. Check the content of the files under /etc/yum.repos.d/ . If you attempt to run yum and it fails because of a repository problem, it will usually let you know which one fails (in the error message). You can find its particular configuration file under the aforementioned directory.
- Ensure the package name you are trying to install is correct and available. Yum accepts globbing, so perhaps a yum list packagename* (or some combination of the name with “*”, may help you find the right package. Be careful, as if this is used liberally it will likely install additional packages that you were not expecting.
- Run the command yum clean all to clear the cache, and then try installing the package again. This will help in situations where a download was corrupted, or where there is an inconsistency between expected versions and already downloaded versions.
2. CentOS 7 Multilib Version Problems
Multilib refers to support for multiple architectures. When the versions of the x86_64 and i686 packages differ, this problem occurs. A package’s 64-bit and 32-bit components must have the same version if they are both present in the repository. (RedHat)
The issue would appear like this:
Protected multilib versions: package-2.x86_64 != package-1.i686
This happens when yum tries to install the same package for different architectures and versions.
Run this command to ensure the packages you wish to update are all in the repository and in the same version:
$ sudo yum list “package*” –showduplicates
In case there are packages with only one architecture but different versions, you can remove the older version and reinstall the newer version.
While uncommon, this scenario presents itself when, for example, there is a delay in mirror sync that leaves one version for 64 bits and a different version of the same package for 32 bits. In this case, the problem will also likely solve itself after some time, as the mirror resyncs or finishes the sync process altogether.
3. Broken Packages Issue
When you attempt to install a list of packages, it may happen that a few of the packages are installed improperly or installed just partially due to an unforeseen circumstance; these packages are typically referred to as broken packages.
You may have occasionally observed that your CentOS systems give you a broken package error every time you attempt to execute any update or attempt to install a new package. This prevents you from continuing the update or installation, putting a stopgap in your plans.
To solve this issue, first, run the following command to verify all the packages using information about the files taken from the package metadata in the rpm database:
$ sudo rpm -Va
Then reinstall all the packages using the below command if you see any broken package errors:
$ sudo yum reinstall \*
4. ifconfig Command Not Found
If you are a Linux user, you should know that the ifconfig command is a widely used tool to configure network interfaces. It also comes preinstalled in most Linux distributions, with the exception of some distributions like CentOS 7. As CentOS 7 has deprecated the command and does not include it by default, it displays an error saying the ifconfig command is not found. It is one of the most common CentOS 7 problems users encounter at the beginning.
To solve this issue, you will need to install the package net-tools:
$ sudo yum install net-tools
After the installation is completed, you can successfully run the ifconfig command on your CentOS 7 machine.
Alternatively, you may consider looking into the “ip” command, which through a different set of parameters and options, allows for the same functionality. Given its deprecated status, moving to “ip” eventually becomes a necessity.
5. CentOS 7 Dependency Problems
When a program or package depends on other programs or libraries to function correctly, these dependencies need to be maintained. Problems can arise in various ways if these dependencies are not in order.
Sometimes, a package may require certain libraries or other packages to function correctly. If these dependencies are missing, the package installation can fail. Different packages might require different versions of the same library. This can lead to conflicts if both versions cannot coexist peacefully in the system.
A package manager like Yum checks for dependencies needed by the package you’re installing when you use it to install a package. It then fetches and installs those dependencies along with the main package. Additionally, the RPM package manager allows you to query the dependencies of a package, which can help in troubleshooting dependency issues.
- Make sure all of your repositories are up to date. You can run the yum update command to ensure you have the latest package information from the repositories.
- Ensure that the repositories containing the necessary packages are enabled in your configuration.
- Sometimes, you may force installing or updating the package despite dependency issues. However, this should be the last option, as it can lead to an unstable system.
- Consider the more drastic, but ultimately effective, measure of moving your application to a container and running it from there. This would let you continue to use the application with the specific version of the dependency without conflicting with other packages. While more work intensive to set up, it will continue to work even if the host system is updated.
6. Forgotten Root Password
Another common CentOS 7 problem that users encounter is the forgotten root password. The root password is always required to run root-privileged tasks on the system.
You can reset the root password by booting into a single-user mode and running the “passwd root” command.
To enter single user mode, at the grub bootloader prompt, edit the kernel command line and add a “1” at the end, and proceed to boot the selected kernel. This should drop you into a root level session from where to execute the passwd command.
Mastering common CentOS 7 problems is essential for every system administrator to maintain robust and efficient systems. It helps sysadmins troubleshoot problems effectively that might arise in their CentOS 7 environments.
Another important thing to consider is that CentOS 7 will reach its end of life (EOL) on June 30, 2024. As a result, the CentOS Project will no longer provide CentOS 7 users with security updates, bug fixes, or other maintenance updates. Organizations and users who depend on CentOS 7 are advised to make plans for a migration to a supported distribution as soon as possible.
However, rushing migration is not a good idea without careful planning and thorough testing of all the resources. If migration is not an option for you now, TuxCare’s Extended Lifecycle Support for CentOS 7 provides four additional years of support after the end-of-life date. TuxCare will take care of all patches and fixes while you can continue enjoying a safe and secure computing environment.