Linux Troubleshooting Guide

Linux Troubleshooting Guide

During my learning of DevOps tools, I have encountered numerous problems. These difficulties can range from solving the dependency requirement to installing the tools themselves. The majority of solutions to issues are found on the Internet, but some require more time to trial and error for the right fix. Below are some of the more common issues and solutions that could be useful to every Linux user. They are listed in the troubleshooting guide below.

Topic Generate an SSH Key Pair
SolutionTo SSH from A to B without password
A: ssh-keygen -t rsa
A: cp $HOME/.ssh/ B
RemarkGenerate an SSH key pair on local and copy the public key ( to hosts that require remote connection in from the local.
TopicYum install ius-release-el7.rpm
SourceCentOS 7
ErrorCannot open: Skipping.
Solution#yum -y install
yum -y install
RemarkIUS got new URLs and check the ius site for RHEL/CentOS 7 setup
TopicYum -y install PHP packages for LEMP stack
SourceCentOS 7
ErrorERROR: Service ‘web’ failed to build: The command ‘/bin/sh -c yum -y install nginx-1.12.2 openssl –enablerepo=nginx && yum -y install && yum -y install php71u-fpm php71u-cli php71u-mysqlnd php71u-soap php71u-xml php71u-zip php71u-json php71u-mcrypt php71u-mbstring php71u-zip php71u-gd –enablerepo=ius && yum clean all’ returned a non-zero code: 1
Solutionyum -y install
#php71u-fpm \
#php71u-cli \
#php71u-mysqlnd \
#php71u-soap \
#php71u-xml \
#php71u-zip \
#php71u-json \
#php71u-mcrypt \
#php71u-mbstring \
#php71u-zip \
#php71u-gd \
php74-fpm \
php74-cli \
php74-mysqlnd \
php74-soap \
php74-xml \
php74-zip \
php74-json \
php74-mcrypt \
php74-mbstring \
php74-zip \
RemarkCheck available packages at
Topicsudo yum update – Error: docker-ce requires >= 1.4.1
SourceCentOS 7
Error$ sudo yum update
package docker-ce-3:20.10.16-3.el7.x86_64 requires >= 1.4.1, but none
of the providers can be installed
Solution$ sudo yum-config-manager --add-repo
RemarkThe server had docker installed beforehand.
TopicError: Failed to download metadata for repo ‘appstream’
SourceCentOS 7 / CentOS 8
Error$ sudo yum install gitlab-runner
CentOS Linux 8 - AppStream 101 B/s | 38 B 00:00
Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
Solution$ sudo yum install dnf -y
$ sudo dnf update -y

$ sudo dnf upgrade
$ sudo dnf --disablerepo '*' --enablerepo=extras swap centos-linux-repos centos-stream-repos
RemarkThe upgrade path is CentOS 7 -> CentOS 8 -> CentOS 8 Stream
Topic500 Internal Server Error when loading web page using .htaccess .htpasswd
SourceApache/2.4.29 (Ubuntu)
Error# /var/log/apache2/error.log
.htaccess: Invalid command 'AuthGroupFile', perhaps misspelled or defined by a module not included in the server configuration
Solution$ a2enmod authz_groupfile
$ systemctl restart apache
Remark$ sudo a2enmod rewrite is commonly mentioned on the Internet but $ sudo a2enmod authz_groupfile is also required in this case.
TopicChange static IP address on Ubuntu 20.04.4 LTS
SourceVNC Viewer > bash
Error[Set as new IP with subnet]
$ ifconfig ens3
$ ifconfig ens3
$ cat /etc/network/interfaces

iface eth0 inet static
[if systemctl restart networking.service does not work]
$ systemctl list-unit-files | grep -i network
systemd-networkd.service enabled enable
$ systemctl restart systemd-networkd
Solution$ vi /etc/netplan/00-installer-config.yaml
(update new IP addresses, gateway4 and nameservers)
[Use try to check for yaml errors before apply]
$ netplan try
$ netplan apply
RemarkA KVM was migrated and reassigned a new IP. Using ifconfig to update the static IP does not work because on network restart will reinstate the old IP. In this case, updating the 00-installer-config.yaml and using command netplan worked.
TopicFailed to synchronize cache for repo ‘AppStream’ on CentOS 8
SourceCentOS 8
ErrorError: Failed to synchronize cache for repo ‘AppStream’
Solution$ sed -i 's/mirrorlist=/#mirrorlist=/g' /etc/yum.repos.d/CentOS-*
$ sed -i 's|#baseurl=|baseurl=|g' /etc/yum.repos.d/CentOS-*
RemarkThere are two lines in some CentOS-* files. The solution is to comment out the deprecated and uncomment the
TopicError: Unable to find a match: certbot on AlmaLinux 8.6
Source AlmaLinux 8.x | Let’s Encrypt cerbot
Error$ sudo dnf -y install certbot
Last metadata expiration check: 0:00:02 ago on Tue 23 Aug 2022 04:55:26 AM EDT.
No match for argument: certbot
Error: Unable to find a match: certbot
Solutionsudo dnf makecache --refresh
sudo dnf update
sudo dnf install epel-release
sudo dnf -y install certbot
sudo dnf install certbot python3-certbot-nginx
Remarkdnf update is optional but dnf install epel-release probably need to be installed.
TopicMongoDB: v5.x and v6.x installed but mongod service failed to start
SourceDebian 10 (buster) | Official MongoDB Manual > Install on Debian
Error$ sudo systemctl status mongod
mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
Active: failed (Result: signal) since Fri 2022-09-02 17:40:03 +08; 4s ago
Process: 3780 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=killed, signal=ILL)
Main PID: 3780 (code=killed, signal=ILL)
Solution$sudo service mongod stop
$sudo apt-get purge mongodb-org*
$ sudo rm -r /var/log/mongodb
$ sudo rm -r /var/lib/mongodb
$sudo apt-get autoremove

$ cd /etc/apt/sources.list.d/
$ rm -Rf mongodb-org-5.0.list mongodb-org-6.0.list

$ wget -qO - | sudo apt-key add -
$ sudo apt-get update
$ sudo apt-get install -y mongodb-org
RemarkThe common solution found on the Internet is chown -R mongodb:mongodb /var/lib/mongodb and chown mongodb:mongodb /tmp/mongodb-27017.sock but this does not work for this case. The reason was MongoDB v5 and v6 cannot run on QEMU VM which is mentioned on here. To check VM CPU, run cat /proc/cpuinfo. Above solution is to remove files from v5 or v6 installation attempts, remove them from souces.list.d and repeat installation step with v4.4 which is the latest patch releases for MongoDB 4.
TopicUpgrade from system Python 3.6 to 3.8
Source MindsDB in Docker on AlmaLinux 8.x
Error2022-09-05 08:55:44,919 - ERROR - /opt/conda/lib/python3.7/site-packages/snowflake/connector/ UserWarning: You have an incompatible version of 'pyarrow' installed (6.0.1), please install a version that adheres to: 'pyarrow<8.1.0,>=8.0.0; extra == "pandas"'
Solution$ sudo dnf groupinstall 'development tools'
$ sudo dnf install bzip2-devel expat-devel gdbm-devel \
ncurses-devel openssl-devel readline-devel wget \
sqlite-devel tk-devel xz-devel zlib-devel libffi-devel
$ wget${VERSION}/Python-${VERSION}.tgz
$ tar -xf Python-${VERSION}.tgz
$ cd Python-${VERSION}
$ ./configure --enable-optimizations
$ make -j 4
$ sudo make altinstall
$ python3.8 --version
RemarkLinuxize: How to Install Python 3.8 on CentOS 8
TopicChange Python and Pip version for User in Linux
Source AlmaLinux 8.x
Solution$ vi ~/.bashrc
User specific aliases and functions
alias python='/usr/local/bin/python3.8'

alias pip='/usr/local/bin/pip3.8'

$ . ~/.bashrc
$ python --version
Python 3.8.13

$ pip --version
pip 22.0.4 from /usr/local/lib/python3.8/site-packages/pip (python 3.8) How to change from default to alternative Python version on Debian Linux
TopicOrigin is unreachable | Error code 523
Source AlmaLinux 8.x
ErrorOrigin is unreachable | Error code 523
Visit for more information.
Browser Working
Cloudflare Working
Host Error
Solution$ sudo systemctl stop firewalld
To permanently enable or disable firewall on AlmaLinux
$ sudo systemctl disable firewalld
RemarkIf it is not due to Nginx conf, Let’s Encrypt SSL and DNS setup, then it is probably the firewall!
TopicFind Installed Google Chrome Version
SourceDebian / AlmaLinux
Solution$ google-chrome --version
Google Chrome 107.0.5304.121
RemarkChromeDriver (WebDriver for Chrome) must be compatible with Google Chrome browser version. Use case: Selenium setup
TopicMake Python modules (selenium/ webdriver-manager) available to all users
Erroruser2 has access to Selenium but not user1 hence Python-selenium scripts will fail when executed by user1.
user1@~$ pip3 freeze | grep selenium
su - user2
user2@~$ pip3 freeze | grep selenium
Solution$ sudo pip3 install --system selenium==4.6.0
RemarkUse --system to install using the system scheme (overrides
--user on Debian systems) so that all users will have access to Selenium libraries.
TopicInstall mysqlclient database connector for MySQL/MariaDB and Python 3.x failed
Source AlmaLinux
Error$ pip install mysqlclient
Using cached mysqlclient-2.1.1.tar.gz (88 kB)
× python bdist_wheel did not run successfully.
compilation terminated.
error: command '/usr/bin/gcc' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for mysqlclient
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
Solution$ ls /usr/bin/python*
$ python -V
Python 3.8.13
$ python3 -V
Python 3.8.13
$ python3.8 -m pip install mysqlclient
RemarkThere are many errors. Tried to update setuptools, wheel, gcc and reinstall mariadb-server etc. but none of these helped. The correct solution (at least in this case) is due to Multiple Python versions as mentioned here. Note that these errors occurred even after setting python and python3 to /usr/bin/python3.8 3 in ~/.bashrc Optional: $ sudo dnf remove python3 to remove old version 3.6

Last updated on 15-Mar-2023

Leave a Comment


No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *