Author Archives: LinuxTech

MySQL: Stale lock file prevents the service from starting

Attempting to start the MySQL service results in the following error:

[ERROR] Unix socket lock file is empty /var/lib/mysql/mysql.sock.lock. 
[ERROR] Unable to setup unix socket lock file.

Below were the errors in mysql error log

2021-01-06T01:29:39.630848Z 0 [Note] – ‘127.0.0.1’ resolves to ‘127.0.0.1’;
2021-01-06T01:29:39.630871Z 0 [Note] Server socket created on IP: ‘127.0.0.1’.
2021-01-06T01:29:39.630932Z 0 [ERROR] Unix socket lock file is empty /var/lib/mysql/mysql.sock.lock.
2021-01-06T01:29:39.630943Z 0 [ERROR] Unable to setup unix socket lock file.
2021-01-06T01:29:39.630952Z 0 [ERROR] Aborting

Description 

A stale lock file is preventing the MySQL service from starting up. The ‘stat’ command can be used to compare the age of the lock file to the current time, in order to confirm that the lock file is stale:

# stat /var/lib/mysql/mysql.sock.lock

The above command should confirm the presence of an old lock file that is empty.

Workaround

It can be difficult to determine why a stale lock file was left behind, however, moving the stale lock file aside should allow MySQL to start up normally. The following commands will need to be executed as the root user via WHM’s Terminal application, or via shell:

# mkdir -v /root/stale_mysql_lock_files
# mv -v /var/lib/mysql/mysql.sock.lock /root/stale_mysql_lock_files
# /usr/local/cpanel/scripts/restartsrv_mysql

adminbin Cpanel/cpmysql/DBCACHE: exit 11

Currently aware of an issue when updating to MariaDB 10.3.26 or MariaDB 10.2.35. Which causes MySQL Databases interface within cPanel to display invalid errors such as, but not limited to: “The MySQL server is currently offline”.

While the error in cPanel may indicate that the MySQL service is offline, it is an issue with grants and MySQL is just inaccessible for the cPanel user. We do recommend checking the service directly to confirm that it is online – in the cases, we have seen MySQL is still online.

You may temporarily resolve the issue by downgrading to the previous minor version of MariaDB using the steps outlined

Follow below steps

yum downgrade MariaDB-server MariaDB-common MariaDB-shared MariaDB-client MariaDB-compat MariaDB-devel

If your server has not yet been affected by the issue, we recommend yum-locking the MariaDB packages in place to avoid the package from being updated. This can be completed by executing the following:

yum install -y yum-plugin-versionlock && yum versionlock MariaDB-* 

And restart mysql to resolve the issue

Install Brotli on Apache 2.4 on cPanel

[root@server /]# yum install brotli
Loaded plugins: fastestmirror, getpagespeed, universal-hooks
Loading mirror speeds from cached hostfile
epel/x86_64/metalink | 8.6 kB 00:00:00

  • EA4: 208.74.123.61
  • cpanel-addons-production-feed: 208.74.123.61
  • cpanel-plugins: 208.74.123.61
  • base: mirrors.radwebhosting.com
  • epel: pubmirror2.math.uh.edu
  • extras: centos.mirror.lstn.net
  • updates: repos.dfw.quadranet.com
    Resolving Dependencies
    –> Running transaction check
    —> Package brotli.x86_64 0:1.0.7-5.el7 will be installed
    –> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================================================================================

Package Arch Version Repository Size

Installing:
brotli x86_64 1.0.7-5.el7 epel 318 k

Transaction Summary

Install 1 Package

Total download size: 318 k
Installed size: 1.5 M
Is this ok [y/d/N]: y
Downloading packages:
brotli-1.0.7-5.el7.x86_64.rpm | 318 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : brotli-1.0.7-5.el7.x86_64 1/1
Verifying : brotli-1.0.7-5.el7.x86_64 1/1

Installed:
brotli.x86_64 0:1.0.7-5.el7

Complete!

Now go to Home »Service Configuration »Apache Configuration >> Include Editor >> Pre main include

Add below entries and save a

<IfModule mod_brotli.c>
    AddOutputFilterByType BROTLI_COMPRESS text/html text/plain text/xml text/css text/javascript application/x-javascript application/javascript application/json application/x-font-ttf application/vnd.ms-fontobject image/x-icon
    </IfModule>

Check using below command to find encoding. It should show br

[root@server /]# curl -I -H ‘Accept-Encoding: br’ https://tuanpools.com
HTTP/1.1 200 OK
Date: Wed, 28 Oct 2020 14:31:36 GMT
Server: Apache
Link: https://tuanpools.com/wp-json/; rel=”https://api.w.org/”
Vary: Accept-Encoding
Content-Encoding: br
Content-Length: 1
Content-Type: text/html; charset=UTF-8

[root@server /]#

WHMCS client area blank

I was having an issue where WHMCS admin panel was working fine

However client area was showing blank page

So I enabled error logging in WHMCS in configuration.php file using below paraneter

$display_errors = true;

and tried accessing WHMCS client area
It showed Memory error which was a PHP memory issue 

Increasing PHP memory fixed the issue

error: libcare:3 bad rotation count ‘5

Got an error from Anacron below error

error: libcare:3 bad rotation count ‘5 # keep 5 last archives’
error: found error in /var/log/libcare/*.log , skipping

The fix to this issue was

open file

/etc/logrotate.d/libcare

/var/log/libcare/*.log {
daily
rotate 5 #keep 5 last archives
missingok # it's ok if there is no such file
notifempty # do nothing if file is empty
compress
}

Remove line "#keep 5 last archives" and save file

This fixes the issue

Cannot open /var/log/sa/sa09: No such file or directory

Have been getting emails on below error

“Cannot open /var/log/sa/sa09: No such file or directory”

The solution is to reinstall cronie-anacron using command

yum reinstall cronie-anacron


Loaded plugins: fastestmirror, universal-hooks
Loading mirror speeds from cached hostfile

  • EA4: 208.74.123.61
  • cpanel-addons-production-feed: 208.74.123.61
  • cpanel-plugins: 208.74.123.61
  • base: mirror.oss.ou.edu
  • extras: mirror.oss.ou.edu
  • updates: mirror.netdepot.com
    EA4 | 2.9 kB 00:00:00
    cpanel-addons-production-feed | 2.9 kB 00:00:00
    cpanel-plugins | 2.9 kB 00:00:00
    MariaDB101 | 2.9 kB 00:00:00
    Resolving Dependencies
    There are unfinished transactions remaining. You might consider running yum-complete-transaction, or “yum-complete-transaction –cleanup-only” and “yum history redo last”, first to finish them. If those don’t work you’ll have to try removing/installing packages by hand (maybe package-cleanup can help).
    –> Running transaction check
    —> Package cronie-anacron.x86_64 0:1.4.11-23.el7 will be reinstalled
    –> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================================================================================

Package Arch Version Repository Size

Reinstalling:
cronie-anacron x86_64 1.4.11-23.el7 base 36 k

Transaction Summary

Reinstall 1 Package

Total download size: 36 k
Installed size: 41 k
Is this ok [y/d/N]: y
Downloading packages:
cronie-anacron-1.4.11-23.el7.x86_64.rpm | 36 kB 00:00:15
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : cronie-anacron-1.4.11-23.el7.x86_64 1/1
Verifying : cronie-anacron-1.4.11-23.el7.x86_64 1/1

Installed:
cronie-anacron.x86_64 0:1.4.11-23.el7

Complete!

Error Couldn’t find device with uuid

Got an error while working on a LVM system

[root@ok1x40 daily]# vgs
WARNING: Device for PV zwUwUP-OyCI-O3T4-c4l5-YCUV-8wpX-3UIA0x not found or rejected by a filter.
WARNING: Device for PV zwUwUP-OyCI-O3T4-c4l5-YCUV-8wpX-3UIA0x not found or rejected by a filter.
Couldn’t find device with uuid zwUwUP-OyCI-O3T4-c4l5-YCUV-8wpX-3UIA0x.
VG #PV #LV #SN Attr VSize VFree
vg 1 1 0 wz-pn- <9.88g 0
vg 1 16 0 wz–n- 1.86t <710.23g

It looked like some issue in Logical Volume..

lvs
WARNING: Device for PV KdplBp-AHJU-a9nD-Cv3N-V1Dl-acFu-M1oiQ0 not found or rejected by a filter.
WARNING: Device for PV KdplBp-AHJU-a9nD-Cv3N-V1Dl-acFu-M1oiQ0 not found or rejected by a filter.
Couldn’t find device with uuid KdplBp-AHJU-a9nD-Cv3N-V1Dl-acFu-M1oiQ0.
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
configuration vg -wi—–p- <14.88g
root vg -wi-ao—- <48.83g
swap vg -wi-ao—- 15.62g
tmp vg -wi-ao—- 1.00g
vsv1001-deqpg1f97cuqzllv-darhc65toodnoiui vg -wi-ao—- 403.00g
vsv1002-d9ty0zwjje9ticwc-plaognhtcimj2tza vg -wi-ao—- 150.00g
vsv1004-d3nvtg9syf3rzavo-ps55iqd91vmnoytn vg -wi-ao—- 10.00g
vsv1005-dxrby0mvwwes6y4i-qktbrsa2vsfgonip vg -wi-ao—- 10.00g
vsv1006-duver6l3z0elsem6-e5yeqjhnlqccv2le vg -wi-ao—- 10.00g
vsv1007-d7h7wgusx2j5iqio-hqrlux8q9a3uk6xj vg -wi-ao—- 20.00g
vsv1009-drn5od5wnepqauvh-rstq5mmff8lmcezb vg -wi-ao—- 95.00g
vsv1010-d0kngqlyhr3mfhjy-hp0fbxcr5bmvkdeg vg -wi-ao—- 90.00g
vsv1017-dmkzi0yoa1y8biuz-swjnad3tpe0wynef vg -wi-ao—- 250.00g
vsv1018-drohpkk0xl1xgrar-acglf0q089m0c8ic vg -wi-a—– 15.00g
vsv1018-dylb8pcyjrcomdqc-tafjzcwmstyqdu1t vg -wi-a—– 56.00g
vsv1020-dzh3wi7fy2sgpckv-4r02v2bksy4lxdgu vg -wi-a—– 10.00g

I dont see any drive having same UUID as shown as missing

So went ahead and rescanned using

 vgscan

now all things looks good

lvscan
ACTIVE '/dev/vg/swap' [15.62 GiB] inherit
ACTIVE '/dev/vg/tmp' [1.00 GiB] inherit
ACTIVE '/dev/vg/root' [<48.83 GiB] inherit
ACTIVE '/dev/vg/vsv1001-deqpg1f97cuqzllv-darhc65toodnoiui' [403.00 GiB] inherit
ACTIVE '/dev/vg/vsv1002-d9ty0zwjje9ticwc-plaognhtcimj2tza' [150.00 GiB] inherit
ACTIVE '/dev/vg/vsv1004-d3nvtg9syf3rzavo-ps55iqd91vmnoytn' [10.00 GiB] inherit
ACTIVE '/dev/vg/vsv1005-dxrby0mvwwes6y4i-qktbrsa2vsfgonip' [10.00 GiB] inherit
ACTIVE '/dev/vg/vsv1006-duver6l3z0elsem6-e5yeqjhnlqccv2le' [10.00 GiB] inherit
ACTIVE '/dev/vg/vsv1007-d7h7wgusx2j5iqio-hqrlux8q9a3uk6xj' [20.00 GiB] inherit
ACTIVE '/dev/vg/vsv1009-drn5od5wnepqauvh-rstq5mmff8lmcezb' [95.00 GiB] inherit
ACTIVE '/dev/vg/vsv1010-d0kngqlyhr3mfhjy-hp0fbxcr5bmvkdeg' [90.00 GiB] inherit
ACTIVE Original '/dev/vg/vsv1017-dmkzi0yoa1y8biuz-swjnad3tpe0wynef' [250.00 GiB] inherit
ACTIVE '/dev/vg/vsv1018-dylb8pcyjrcomdqc-tafjzcwmstyqdu1t' [56.00 GiB] inherit
ACTIVE '/dev/vg/vsv1020-dzh3wi7fy2sgpckv-4r02v2bksy4lxdgu' [10.00 GiB] inherit
ACTIVE '/dev/vg/vsv1018-drohpkk0xl1xgrar-acglf0q089m0c8ic' [15.00 GiB] inherit
ACTIVE '/dev/vg/vsv1018-dsm0mwrudbywwyld-5ijzvvkhs8qmci3t' [10.00 GiB] inherit
ACTIVE Snapshot '/dev/vg/backup-v1017-0-xlg20' [25.00 GiB] inherit
[root@ok1140 ~]#
[root@ok1140 ~]#

Roundcube from Mysql to Sqlite

As new cPanel versions come with Sqlite

While migrating from old server which has Mysql format to new Sqlite server

You need to convert to sqlite to preserve data and migrate without issues

Below is the command used on old server to convert Mysql ro sqlite for roundcube

/usr/local/cpanel/scripts/convert_roundcube_mysql2sqlite

YumRepo Error: All mirror URLs are not using ftp, http[s] or file.

Have been getting below error on one of the Centos 5 VM

where yum is not working and giving below error

yum update kernel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
Eg. Invalid release/repo/arch combination/
removing mirrorlist with no valid mirrors: /var/cache/yum/base/mirrorlist.txt
Error: Cannot find a valid baseurl for repo: base

uname -a
Linux vps.spring.com 2.6.32-042stab120.11 #1 SMP Wed Nov 16 12:05:45 MSK 2016 i686 i686 i386 GNU/Linux


root@vps [/]# cat /etc/redhat-release
CentOS release 5.11 (Final)

go to

cd /etc/yum.repos.d/

mv CentOS-Base.repo CentOS-Base.repo=bkp

vi CentOS-Base.repo

add below entries

[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=http://vault.centos.org/5.11/os/$basearch
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
exclude=redhat-logos

yum clean all

yum update

This has resolved the issue associated with yum on Centos 5