Deprecated: Hook custom_css_loaded is deprecated since version jetpack-13.5! Use WordPress Custom CSS instead. Jetpack no longer supports Custom CSS. Read the WordPress.org documentation to learn how to apply custom styles to your site: https://wordpress.org/documentation/article/styles-overview/#applying-custom-css in /srv/www/srvfail.com/public_html/wp-includes/functions.php on line 6078
Linux Archives ⋆ SysAdminStuff

How to convert from CentOS 8 to CentOS 8 Stream

Here are the steps needed to convert from CentOS 8 to CentOS 8 Stream.

First backup anything important, the conversion process is fairly simple and smooth with no issues usually but just in case make backups of important stuff if anything goes wrong.

Second step is to install all pending updates on current CentOS 8 installation.

Update to latest version of packages with following command:

dnf update

After updates are installed reboot the machine to make sure latest kernel version is loaded and that everything is working normally with latest package versions before migrating to CentOS 8 Stream:

reboot

After the machine is back up install centos-release-stream package with following command

dnf install centos-release-stream
dnf install centos-release-stream

After centos-release-stream has been installed swap repos from CentOS Linux 8 repos to CentOS Stream 8 repos with following command

dnf swap centos-linux-repos centos-stream-repo
dnf swap centos-linux-repos centos-stream-repo

After repos have been swapped check if correct repos are listed in dnf with following command

dnf repolist

You should see CentOS Stream 8 repos listed now instead of CentOS Linux 8 repos that were there before.

dnf repolist before swap
dnf repolist after swap has been made

When CentOS 8 Stream repos have been set sync all installed packages with CentOS Stream versions using following command:

dnf distro-sync

After packages have been synced you can use cat /etc/redhat-release or hostnamectl command to check and confirm that you are now running CentOS Stream 8 OS.

This is an output of hostnamectl command before the sync:

hostnamectl 
   Static hostname: server0
         Icon name: computer-vm
           Chassis: vm
        Machine ID: ba45dac81f4e4f6f9c9bb2657914c81e
           Boot ID: e36de8bd66f1467983104acd47defac0
    Virtualization: kvm
  Operating System: CentOS Linux 8
       CPE OS Name: cpe:/o:centos:centos:8
            Kernel: Linux 4.18.0-348.2.1.el8_5.x86_64
      Architecture: x86-64

This is an output of hostnamectl command after dnf sync command has been run:

hostnamectl 
   Static hostname: server0
         Icon name: computer-vm
           Chassis: vm
        Machine ID: ba45dac81f4e4f6f9c9bb2657914c81e
           Boot ID: 526a47bb15b4420db4cc3cf364af9555
    Virtualization: kvm
  Operating System: CentOS Stream 8
       CPE OS Name: cpe:/o:centos:centos:8
            Kernel: Linux 4.18.0-348.7.1.el8_5.x86_64
      Architecture: x86-64

Reboot the server and check for any possible issues.

Install OpenLiteSpeed with PHP 8.1

These are the steps to install OpenLiteSpeed with lsphp81 on CentOS replacements like AlmaLinux 8 or RockyLinux 8.

First add LiteSpeed repositories for AlmaLinux 8 & CentOS 8 with following command:

rpm -Uvh http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el8.noarch.rpm

After you have installed the rpm package you will get /etc/yum.repos.d/litespeed.repo repo file which you will need to edit in order to avoid getting the following error when installing or updating packages with yum/dnf.

Invalid configuration value: failovermethod=priority in /etc/yum.repos.d/litespeed.repo; Configuration: OptionBinding with id "failovermethod" does not exist

This will happen because the ‘failovermethod’ option is not supported by dnf which comes with RHEL 8.

Comment out that line from /etc/yum.repos.d/litespeed.repo with following command:

sed -i 's/failovermethod=priority/#failovermethod=priority/' /etc/yum.repos.d/litespeed.repo

Install OpenLiteSpeed with following command:

dnf install openlitespeed

After you have installed OpenLiteSpeed install Extra Packages for Enterprise Linux (EPEL) repository with following command:

dnf install epel-release

After that install PHP 8.1 for OpenLiteSpeed with most commonly used packages:

dnf install lsphp81 lsphp81-common lsphp81-mysqlnd lsphp81-gd lsphp81-process lsphp81-mbstring lsphp81-xml lsphp81-opcache

If you wish to install a different version of PHP just replace lsphp81 with lsphp80 for PHP 8.0 or lsphp74 for PHP 7.4 and similar.

By default OpenLiteSpeed will run on port 8088 and its WebAdmin Console will run on port 7080.

OpenLiteSpeed WebAdmin Console will have default username admin but the admin password will be randomly generated.

If you want to reset OpenLiteSpeed admin password you can run /usr/local/lsws/admin/misc/admpass.sh script which can be used to set admin password to desired value.

If you run the script it will use username admin if you don’t specify any and will then ask you to input a new password for OpenLiteSpeed administration web interface.

/usr/local/lsws/admin/misc/admpass.sh 

Please specify the user name of administrator.
This is the user name required to login the administration Web interface.

User name [admin]: 

Please specify the administrator's password.
This is the password required to login the administration Web interface.

Password: 
Retype password: 
Administrator's username/password is updated successfully!

Bluetooth headphones and YouTube videos stop working after upgrade to Fedora 35

After upgrade from Fedora 34 to Fedora 35 Bluetooth headphones and speakers might stop working, and you might get the following error when trying to watch YouTube videos “If playback doesn’t begin shortly try restarting your device”

When checking /var/log/messages or journalctl -f you will see the following error logged when trying to open a video or enabling Bluetooth headphones or speakers.

pulseaudio[2366]: Failed to create sink input: sink is suspended.

Issue can be resolved by swapping pulseaudio packages with pipewire-pulseaudio using the following command

dnf swap --allowerasing pulseaudio pipewire-pulseaudio

Small WordPress backup script that sends email on failed backups and deletes old backups

This is a simple backup script in bash, for WordPress on Linux. It is based on the script from Small WordPress backup script post.
Like the script there it will dump MySQL database used by WordPress site and create a tar.gz file that will have WordPress site files and database dump.
This script will also send out an email if the backup process fails on any stage and delete old backups files.

#!/bin/bash

bkpDir=/local/backup/directory
webroot=/wordpress/install/directory/
bkpAge=90 #How many days of backup to keep

dbUser=$(grep DB_USER $webroot/wp-config.php | awk -F\' '{print$4}')
dbName=$(grep DB_NAME $webroot/wp-config.php | awk -F\' '{print$4}')
dbPassword=$(grep DB_PASSWORD $webroot/wp-config.php | awk -F\' '{print$4}')
dbDump="$bkpDir""$dbName"_$(date +'%F_%H_%M').sql

rUser=remoteuser
rHost=remoteserver
rDir=/remote/backup/directory/
rSSHport=22

email="user@example.tld"
errorFile="$bkpDir"errors

rm -f "$errorFile"

mysqldump -u $dbUser -p$dbPassword $dbName > $dbDump || echo "$(date +'%F %T') MySQL backup of $dbName failed." >> "$errorFile"

tar -czf "$bkpDir"srvfail_$(date +'%F_%H_%M').tar.gz $webroot $dbDump || echo "$(date +'%F %T') Tar process failed." >> "$errorFile"

rsync -az $bkpDir -e "ssh -p $rSSHport" $rUser@$rHost:$rDir --delete || echo "$(date +'%F %T') rsync to $rHost failed." >> "$errorFile"

rm -f "$bkpDir"*$(date -d "$bkpAge days ago" +'%F')*

if test -f "$errorFile"; then
    cat "$errorFile" | mail -s "Backup process on $(hostname) failed" "$email"
fi

It will create two backup files, one for database dump in format that looks like “dbname__2021-12-01-06-00.sql” and one tar.gz file that will look like “wpbackup_2021-12-01_06-00.tar.gz”.

Script can be saved as wpbackup.sh and put in crontab to run at a certain time like 6:00AM.

0 6 * * * /path/to/script/wpbackup.sh >/dev/null 2>&1

or if you want to have output of it in case of errors

0 6 * * * /path/to/script/wpbackup.sh > /var/log/wpbackup.log 2>&1

Brave browser fails to open because of locked profile

How to resolve an issue when Brave browser is not opening normally, it just opens a small window with Brave title but no content in it.

Checking /var/log/messages we see that trying to start Brave browser is causing a systemd-coredump like shown below.

Apr  8 12:23:24 localhost systemd-coredump[11272]: Process 11164 (brave) of user 1000 dumped core.#012#012Stack trace of thread 11164:#012#0  0x00005636c5d05f73 n/a (brave)#012#1  0x00005636c5d02a76 n/a (brave)#012#2  0x00005636c5d0297e n/a (brave)#012#3  0x00005636c4f5d451 n/a (brave)#012#4  0x00005636c4f5d08e n/a (brave)#012#5  0x00005636c3c086f9 n/a (brave)#012#6  0x00005636c381839a n/a (brave)#012#7  0x00005636c3818519 n/a (brave)#012#8  0x00005636c4f52ff7 n/a (brave)#012#9  0x00005636c4f50af4 n/a (brave)#012#10 0x00005636c4f70b56 n/a (brave)#012#11 0x00005636c41dbe8e n/a (brave)#012#12 0x00005636c4f6a52d n/a (brave)#012#13 0x00005636c4f6a3e0 n/a (brave)#012#14 0x00005636c4f6a444 n/a (brave)#012#15 0x00005636c41d5e85 n/a (brave)#012#16 0x00005636c38f85f9 n/a (brave)#012#17 0x00005636c51a9923 n/a (brave)#012#18 0x00005636c51a8b94 n/a (brave)#012#19 0x00005636c51a92f2 n/a (brave)#012#20 0x00005636c51aab71 n/a (brave)#012#21 0x00005636c51c99d8 n/a (brave)#012#22 0x00005636c76da92c n/a (brave)#012#23 0x00005636c76db453 n/a (brave)#012#24 0x00005636c773419a n/a (brave)#012#25 0x00005636c507136b n/a (brave)#012#26 0x00005636c507077a n/a (brave)#012#27 0x00005636c5071844 n/a (brave)#012#28 0x00005636c4e1b642 n/a (brave)#012#29 0x00005636c381e3b4 n/a (brave)#012#30 0x00005636c3c0116e n/a (brave)#012#31 0x00005636c381cc20 n/a (brave)#012#32 0x00005636c38201cb n/a (brave)#012#33 0x00005636c381ae00 n/a (brave)#012#34 0x00005636c4dc3127 n/a (brave)#012#35 0x00005636c4df8730 n/a (brave)#012#36 0x00005636c4dc17a1 n/a (brave)#012#37 0x00005636c2cc05b3 ChromeMain (brave)#012#38 0x00007f84431bc413 __libc_start_main (libc.so.6)#012#39 0x00005636c2a3502a _start (brave)#012#012Stack trace of thread 11194:#012#0  0x00007f84432959b7 epoll_wait (libc.so.6)#012#1  0x00005636c524d01a n/a (brave)#012#2  0x00005636c524a92f n/a (brave)#012#3  0x00005636c523f639 n/a (brave)#012#4  0x00005636c51ec418 n/a (brave)#012#5  0x00005636c51c99d8 n/a (brave)#012#6  0x00005636c52038c0 n/a (brave)#012#7  0x00005636c523a568 n/a (brave)#012#8  0x00007f84448c458e start_thread (libpthread.so.0)#012#9  0x00007f8443295683 __clone (libc.so.6)#012#012Stack trace of thread 11198:#012#0  0x00007f84448cab18 pthread_cond_timedwait@@GLIBC_2.3.2 (libpthread.so.0)#012#1  0x00005636c5236b30 n/a (brave)#012#2  0x00005636c52370c5 n/a (brave)#012#3  0x00005636c5237291 n/a (brave)#012#4  0x00005636c51f2d6f n/a (brave)#012#5  0x00005636c51f356f n/a (brave)#012#6  0x00005636c51f3304 n/a (brave)#012#7  0x00005636c523a568 n/a (brave)#012#8  0x00007f84448c458e start_thread (libpthread.so.0)#012#9  0x00007f8443295683 __clone (libc.so.6)#012#012Stack trace of thread 11199:#012#0  0x00007f84448cab18 pthread_cond_timedwait@@GLIBC_2.3.2 (libpthread.so.0)#012#1  0x00005636c5236b30 n/a (brave)#012#2  0x00005636c52370c5 n/a (brave)#012#3  0x00005636c5237291 n/a (brave)#012#4  0x00005636c51f2d6f n/a (brave)#012#5  0x00005636c51f356f n/a (brave)#012#6  0x00005636c51f3304 n/a (brave)#012#7  0x00005636c523a568 n/a (brave)#012#8  0x00007f84448c458e start_thread (libpthread.so.0)#012#9  0x00007f8443295683 __clone (libc.so.6)#012#012Stack trace of thread 11200:#012#0  0x00007f84448cab18 pthread_cond_timedwait@@GLIBC_2.3.2 (libpthread.so.0)#012#1  0x00005636c5236b30 n/a (brave)#012#2  0x00005636c52370c5 n/a (brave)#012#3  0x00005636c5237291 n/a (brave)#012#4  0x00005636c51f2d6f n/a (brave)#012#5  0x00005636c51f356f n/a (brave)#012#6  0x00005636c51f3304 n/a (brave)#012#7  0x00005636c523a568 n/a (brave)#012#8  0x00007f84448c458e start_thread (libpthread.so.0)#012#9  0x00007f8443295683 __clone (libc.so.6)#012#012Stack trace of thread 11184:#012#0  0x00007f84448ce9f2 waitpid (libpthread.so.0)#012#1  0x00005636c5235ced n/a (brave)#012#2  0x00005636c5233993 n/a (brave)#012#3  0x00005636c523a568 n/a (brave)#012#4  0x00007f84448c458e start_thread (libpthread.so.0)#012#5  0x00007f8443295683 __clone (libc.so.6)#012#012Stack trace of thread 11202:#012#0  0x00007f84448cab18 pthread_cond_timedwait@@GLIBC_2.3.2 (libpthread.so.0)#012#1  0x00005636c5236b30 n/a (brave)#012#2  0x00005636c52370c5 n/a (brave)#012#3  0x00005636c5237291 n/a (brave)#012#4  0x00005636c51f2d6f n/a (brave)#012#5  0x00005636c51f356f n/a (brave)#012#6  0x00005636c51f3304 n/a (brave)#012#7  0x00005636c523a568 n/a (brave)#012#8  0x00007f84448c458e start_thread (libpthread.so.0)#012#9  0x00007f8443295683 __clone (libc.so.6)#012#012Stack trace of thread 11203:#012#0  0x00007f84448cab18 pthread_cond_timedwait@@GLIBC_2.3.2 (libpthread.so.0)#012#1  0x00005636c5236b30 n/a (brave)#012#2  0x00005636c52370c5 n/a (brave)#012#3  0x00005636c5237291 n/a (brave)#012#4  0x00005636c51f2d6f n/a (brave)#012#5  0x00005636c51f356f n/a (brave)#012#6  0x00005636c51f3304 n/a (brave)#012#7  0x00005636c523a568 n/a (brave)#012#8  0x00007f84448c458e start_thread (libpthread.so.0)#012#9  0x00007f8443295683 __clone (libc.so.6)#012#012Stack trace of thread 11187:#012#0  0x00007f84448cab18 pthread_cond_timedwait@@GLIBC_2.3.2 (libpthread.so.0)#012#1  0x00005636c5236b30 n/a (brave)#012#2  0x00005636c52370c5 n/a (brave)#012#3  0x00005636c5237291 n/a (brave)#012#4  0x00005636c51f2d6f n/a (brave)#012#5  0x00005636c51f356f n/a (brave)#012#6  0x00005636c51f3304 n/a (brave)#012#7  0x00005636c523a568 n/a (brave)#012#8  0x00007f84448c458e start_thread (libpthread.so.0)#012#9  0x00007f8443295683 __clone (libc.so.6)#012#012Stack trace of thread 11205:#012#0  0x00007f84448cab18 pthread_cond_timedwait@@GLIBC_2.3.2 (libpthread.so.0)#012#1  0x00005636c5236b30 n/a (brave)#012#2  0x00005636c52370c5 n/a (brave)#012#3  0x00005636c5237291 n/a (brave)#012#4  0x00005636c51f2d6f n/a (brave)#012#5  0x00005636c51f356f n/a (brave)#012#6  0x00005636c51f3304 n/a (brave)#012#7  0x00005636c523a568 n/a (brave)#012#8  0x00007f84448c458e start_thread (libpthread.so.0)#012#9  0x00007f8443295683 __clone (libc.so.6)#012#012Stack trace of thread 11188:#012#0  0x00007f84448cab18 pthread_cond_timedwait@@GLIBC_2.3.2 (libpthread.so.0)#012#1  0x00005636c5236b30 n/a (brave)#012#2  0x00005636c52370c5 n/a (brave)#012#3  0x00005636c5237291 n/a (brave)#012#4  0x00005636c51f2d6f n/a (brave)#012#5  0x00005636c51f356f n/a (brave)#012#6  0x00005636c51f3304 n/a (brave)#012#7  0x00005636c523a568 n/a (brave)#012#8  0x00007f84448c458e start_thread (libpthread.so.0)#012#9  0x00007f8443295683 __clone (libc.so.6)#012#012Stack trace of thread 11208:#012#0  0x00007f84448ca72c pthread_cond_wait@@GLIBC_2.3.2 (libpthread.so.0)#012#1  0x00005636c52369f2 n/a (brave)#012#2  0x00005636c523721d n/a (brave)#012#3  0x00005636c5236f2f n/a (brave)#012#4  0x00005636c51aa898 n/a (brave)#012#5  0x00005636c51ec418 n/a (brave)#012#6  0x00005636c51c99d8 n/a (brave)#012#7  0x00005636c52038c0 n/a (brave)#012#8  0x00005636c523a568 n/a (brave)#012#9  0x00007f84448c458e start_thread (libpthread.so.0)#012#10 0x00007f8443295683 __clone (libc.so.6)#012#012Stack trace of thread 11193:#012#0  0x00007f84432959b7 epoll_wait (libc.so.6)#012#1  0x00005636c524d01a n/a (brave)#012#2  0x00005636c524a92f n/a (brave)#012#3  0x00005636c523f696 n/a (brave)#012#4  0x00005636c51ec418 n/a (brave)#012#5  0x00005636c51c99d8 n/a (brave)#012#6  0x00005636c52038c0 n/a (brave)#012#7  0x00005636c523a568 n/a (brave)#012#8  0x00007f84448c458e start_thread (libpthread.so.0)#012#9  0x00007f8443295683 __clone (libc.so.6)#012#012Stack trace of thread 11196:#012#0  0x00007f844328a3f1 __poll (libc.so.6)#012#1  0x00007f84445b53a6 n/a (libglib-2.0.so.0)#012#2  0x00007f84445b54d0 g_main_context_iteration (libglib-2.0.so.0)#012#3  0x00007f842af35c7d n/a (libdconfsettings.so)#012#4  0x00007f84445de2aa n/a (libglib-2.0.so.0)#012#5  0x00007f84448c458e start_thread (libpthread.so.0)#012#6  0x00007f8443295683 __clone (libc.so.6)#012#012Stack trace of thread 11179:#012#0  0x00007f844328a3f1 __poll (libc.so.6)#012#1  0x00005636c3b600d2 n/a (brave)#012#2  0x00005636c5202eaf n/a (brave)#012#3  0x00005636c523a568 n/a (brave)#012#4  0x00007f84448c458e start_thread (libpthread.so.0)#012#5  0x00007f8443295683 __clone (libc.so.6)#012#012Stack trace of thread 11207:#012#0  0x00007f84432959b7 epoll_wait (libc.so.6)#012#1  0x00005636c524d01a n/a (brave)#012#2  0x00005636c524a92f

When trying to start brave-browser or brave-browser-stable from command line we see the message saying that there is some other Brave process keeping the profile in use and that profile is locked.
Message will look something like this:
“The profile appears to be in use by another Brave process ($pid) on another computer ($hostname). Brave has locked the profile so that it doesn’t get corrupted. If you are sure no other processes are using this profile, you can unlock the profile and relaunch Brave.”

(brave-browser:9312): Gtk-WARNING **: 12:18:14.282: Failed to parse /home/user/.config/gtk-3.0/settings.ini: Key file does not have group ?Settings?
[9312:9312:0408/121814.419144:ERROR:process_singleton_posix.cc(323)] The profile appears to be in use by another Brave process (11497) on another computer (localhost.localdomain). Brave has locked the profile so that it doesn't get corrupted. If you are sure no other processes are using this profile, you can unlock the profile and relaunch Brave.
[9355:9355:0408/121814.421480:ERROR:sandbox_linux.cc(364)] InitializeSandbox() called with multiple threads in process gpu-process.
[9312:9312:0408/121814.435206:ERROR:desktop_window_tree_host_x11.cc(1120)] Not implemented reached in virtual void views::DesktopWindowTreeHostX11::InitModalType(ui::ModalType)
Segmentation fault (core dumped)

If the process exists we can try to kill that process.

~]$ kill -9 11497
bash: kill: (11497) - No such process

Even if the process is killed and doesn’t exists Brave browser can still keep the profile locked to process number.
Profile lock is maintained by a symlink on path /home/user/.config/BraveSoftware/Brave-Browser/SingletonLock which points to a file with hostname-pid naming format. If you delete the symlink the lock on the Brave browser profile is released.

~]$ ls -l /home/user/.config/BraveSoftware/Brave-Browser/SingletonLock 
lrwxrwxrwx. 1 user user 27 Apr 5 10:28 /home/user/.config/BraveSoftware/Brave-Browser/SingletonLock -> localhost.localdomain-11497

After the symlink is removed Brave browser should open normally.
This issue was on Fedora 29, it is possible path to lock file is different on other Linux distros.

Helpful link:

https://github.com/brave/browser-laptop/issues/11829