Last updated 14 Nov 2024
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 | Find previous server uptime |
Source | 22.04.5 LTS (Jammy Jellyfish) |
Error | VPS went offline e.g., every 3 to 4 weeks |
Solution | The wtmp file logs all logins and system boots. Use the last command to read this filelast -f /var/log/wtmp reboot |
Remark | Sometimes a VPS may go offline often and you don’t know why. The cron job can be used to schedule a periodic reboot, but the frequency of the reboot depends on the historical uptimes. |
Topic | Generate an SSH Key Pair |
Source | UNIX |
Error | n/a |
Solution | To SSH from A to B without password A: ssh-keygen -t rsa A: cp $HOME/.ssh/id_rsa.pub B |
Remark | Generate an SSH key pair on local and copy the public key (id_rsa.pub) to hosts that require remote connection in from the local. |
Topic | Yum install ius-release-el7.rpm |
Source | CentOS 7 |
Error | Cannot open: https://centos7.iuscommunity.org/ius-release.rpm. Skipping. |
Solution | #yum -y install https://centos7.iuscommunity.org/ius-release.rpm |
Remark | IUS got new URLs and check the ius site for RHEL/CentOS 7 setup |
Topic | Yum -y install PHP packages for LEMP stack |
Source | CentOS 7 |
Error | ERROR: Service ‘web’ failed to build: The command ‘/bin/sh -c yum -y install nginx-1.12.2 openssl –enablerepo=nginx && yum -y install https://centos7.iuscommunity.org/ius-release.rpm && 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 |
Solution | yum -y install \ |
Remark | Check available packages at https://repo.ius.io/7/x86_64/packages/p/ |
Topic | sudo yum update – Error: docker-ce requires containerd.io >= 1.4.1 |
Source | CentOS 7 |
Error | $ sudo yum update Error: of the providers can be installed |
Solution | $ sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo |
Remark | The server had docker installed beforehand. |
Topic | Error: Failed to download metadata for repo ‘appstream’ |
Source | CentOS 7 / CentOS 8 |
Error | $ sudo yum install gitlab-runner |
Solution | $ sudo yum install dnf -y $ sudo dnf upgrade |
Remark | The upgrade path is CentOS 7 -> CentOS 8 -> CentOS 8 Stream |
Topic | 500 Internal Server Error when loading web page using .htaccess .htpasswd |
Source | Apache/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 |
Remark | $ sudo a2enmod rewrite is commonly mentioned on the Internet but $ sudo a2enmod authz_groupfile is also required in this case. |
Topic | Change static IP address on Ubuntu 20.04.4 LTS |
Source | VNC Viewer > bash |
Error | [Set 123.123.123.123 as new IP with subnet 255.255.255.0]$ ifconfig ens3 123.123.123.123/24 iface eth0 inet static address 123.123.123.123 netmask 255.255.255.0 gateway 123.123.123.1 dns-nameservers 8.8.8.8 8.8.4.4 [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 |
Remark | A 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. |
Topic | Failed to synchronize cache for repo ‘AppStream’ on CentOS 8 |
Source | CentOS 8 |
Error | Error: Failed to synchronize cache for repo ‘AppStream’ |
Solution | $ sed -i 's/mirrorlist=/#mirrorlist=/g' /etc/yum.repos.d/CentOS-* |
Remark | There are two lines in some CentOS-* files. The solution is to comment out the deprecated mirrorlist.centos.org and uncomment the vault.centos.org#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=AppStream&infra=$infra |
Topic | Error: Unable to find a match: certbot on AlmaLinux 8.6 |
Source | AlmaLinux 8.x | Let’s Encrypt cerbot |
Error | $ sudo dnf -y install certbot |
Solution | sudo dnf makecache --refresh |
Remark | dnf update is optional but dnf install epel-release probably need to be installed. |
Topic | MongoDB: v5.x and v6.x installed but mongod service failed to start |
Source | Debian 10 (buster) | Official MongoDB Manual > Install on Debian |
Error | $ sudo systemctl status mongod |
Solution | $sudo service mongod stop $ cd /etc/apt/sources.list.d/ $ wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add - |
Remark | The 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. |
Topic | Upgrade from system Python 3.6 to 3.8 |
Source | MindsDB in Docker on AlmaLinux 8.x |
Error | 2022-09-05 08:55:44,919 - ERROR - /opt/conda/lib/python3.7/site-packages/snowflake/connector/options.py:99: 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' |
Remark | Linuxize: How to Install Python 3.8 on CentOS 8 |
Topic | Change Python and Pip version for User in Linux |
Source | AlmaLinux 8.x |
Error | n.a |
Solution | $ vi ~/.bashrc alias pip='/usr/local/bin/pip3.8' $ . ~/.bashrc $ pip --version |
Remark | linuxconfig.org: How to change from default to alternative Python version on Debian Linux |
Topic | Origin is unreachable | Error code 523 |
Source | AlmaLinux 8.x |
Error | Origin is unreachable | Error code 523 Visit cloudflare.com 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 |
Remark | If it is not due to Nginx conf, Let’s Encrypt SSL and DNS setup, then it is probably the firewall! |
Topic | Find Installed Google Chrome Version |
Source | Debian / AlmaLinux |
Error | None |
Solution | $ google-chrome --version |
Remark | ChromeDriver (WebDriver for Chrome) must be compatible with Google Chrome browser version. Use case: Selenium setup |
Topic | Make Python modules (selenium/ webdriver-manager) available to all users |
Source | Debian |
Error | user2 has access to Selenium but not user1 hence Python-selenium scripts will fail when executed by user1.user1@~$ pip3 freeze | grep selenium |
Solution | $ sudo pip3 install --system selenium==4.6.0 |
Remark | Use --system to install using the system scheme (overrides--user on Debian systems) so that all users will have access to Selenium libraries. |
Topic | Install 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 setup.py 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* |
Remark | There 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 |
Topic | Postfix – SASL authentication failure: No worthy mechs found |
Source | Debian |
Error | $ tail -f mail.log postfix/smtp[538803]: warning: SASL authentication failure: No worthy mechs found postfix/smtp[538803]: CC87B806E7: to=test-devops@example.com, relay=smtp.mail.com[xx.xx.xx.xx]:587, delay=570, delays=569/0.01/0.92/0, dsn=4.7.0, status=deferred (SASL authentication failed; cannot authenticate to server smtp.mail.com[xx.xx.xx.xx]: no mechanism available) |
Solution | $ apt-get install libsasl2-modules |
Remark | An error occurs during the sending of an email to a relayhost (main.cf) using Postfix. |
Topic | Selenium – RequestsDependencyWarning: urllib3 (1.25.2) or chardet (3.0.4) doesn’t match a supported version! |
Source | Ubuntu |
Error | $ python /home/user/selenium/script.py /home/user/venv/lib/python3.8/site-packages/requests/init.py:89: RequestsDependencyWarning: urllib3 (1.26.1) or chardet (3.0.4) doesn’t match a supported version! warnings.warn(“urllib3 ({}) or chardet ({}) doesn’t match a supported “ |
Solution | $ pip3 install --upgrade requests |
Remark | driver = webdriver.Chrome("/usr/bin/chromedriver", options=options) This is due to different requests module installed by the OS and the python dependencies in the local installation. |
Topic | Google Chrome and chromedriver – /bin/sh: 1: google-chrome-dev: not found Exception: No such driver version 115.0.5790.110 for linux64 |
Source | Ubuntu |
Error | $ python /home/user/selenium2022/script.py File "/home/user/.local/lib/python3.8/site-packages/webdriver_manager/drivers/chrome.py" |
Solution | MUST install BOTH chrome and chromedriver – Guide: https://skolo.online/documents/webscrapping/#step-1-download-chrome$ wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb E.g., Above will install Google Chrome 115.0.5790.110 Go https://chromedriver.chromium.org/downloads/version-selection leads to https://googlechromelabs.github.io/chrome-for-testing/ On download page, one will see chrome or chromedriver in table column 1 – Get linux64 |
Remark | Both Google Chrome and chromedriver are required to work together. The browser and driver must be same version. You may download current stable (google-chrome-stable_current_amd64.deb), install, check version and download matching chromedriver. |
Topic | Selenium + Chrome + chromedriver – Exception: No such driver version 115.0.5790.110 for linux64 |
Source | Ubuntu |
Error | Exception: No such driver version 115.0.5790.110 for linux64$ chromedriver --version ChromeDriver 115.0.5790.110 Followed all steps to install selenium (via pip), matching chrome and chromedriver but still does not work when run selenium python script. |
Solution | $ pip uninstall selenium The correct version webdriver-manager will be installed. |
Remark | If chrome browser and chromedriver are installed properly and matching version, just need to sort out Selenium and webdriver-manager via pip |
Topic | PHP mail() fails to send email via script but success with command-line | Postfix Ignores PHP mail() function |
Source | Ubuntu |
Error | [Success – from=mail@myserver.com]$ echo "This is a test email body." | mail -s "Subject" -a "From: mail@myserver.com" recipient@gmail.com [Fail – from=<www-data>] Aug 17 15:01:46 devops1 postfix/qmgr[558698]: B4D8F136DE1: removed |
Solution | $ sudo vi /etc/postfix/canonical www-data mail@myserver.com $ sudo postmap /etc/postfix/canonical |
Remark | After install and config Postfix, the mail in command line works via relayhost. However, PHP mail() does not work even if /var/log/mail.log: status=sent (250 OK… This is because the from=www-data instead of relayhost sender email address. Solution here |
Topic | Deprecated ‘network-scripts’ package breaks yum and dnf update in RHEL9 based OS templates |
Source | RHEL9 based OS (e.g., CentOS Stream 9, AlmaLinux 9 and Rocky 9) |
Error | $ sudo yum update Error: Problem: package network-scripts-10.11.5-1.el9.x86_64 from @System requires initscripts(x86-64) = 10.11.5-1.el9, but none of the providers can be installed – cannot install both initscripts-10.11.6-1.el9.x86_64 from baseos and initscripts-10.11.5-1.el9.x86_64 from @System – cannot install both initscripts-10.11.6-1.el9.x86_64 from baseos and initscripts-10.11.5-1.el9.x86_64 from baseos – cannot install the best update candidate for package initscripts-10.11.5-1.el9.x86_64 – problem with installed package network-scripts-10.11.5-1.el9.x86_64 (try to add ‘ --allowerasing ‘ to command line to replace conflicting packages or ‘--skip-broken ‘ to skip uninstallable packages or ‘--nobest ‘ to use not only best candidate packages) |
Solution | $ sudo yum update --skip-broken $ sudo dnf update --skip-broken However, if the above still does not work, try $ dnf upgrade --refresh --allowerasing |
Remark | The deprecated ‘network-scripts’ package, still required by SolusVM 1, is the cause of this error. If you erase the network scripts package --allowerasing within your VPS and configure NetworkManager instead, please keep in mind that by doing this, the ‘reconfigure network’ button in SolusVM will not work. |