Author Archives: LinuxTech

/tmp is 100% due to Mysql

Was having an issue where /tmp was getting 100% full every few minutes

on investigation i see the files of 3Gb over there in /tmp

#sql_436_0.MAD

ddvps20 tmp]# ls -al
total 3779332
drwxrwxrwt 12 root root 4096 Sep 21 10:24 .
dr-xr-xr-x 21 root root 4096 Sep 21 09:17 ..
drwxrwxrwt 2 root root 4096 Sep 21 09:17 .font-unix
drwxr-xr-x 2 cpanelsolr cpanelsolr 4096 Sep 21 10:22 hsperfdata_cpanelsolr
drwxr-xr-x 2 root root 4096 Sep 21 10:21 hsperfdata_root
drwxrwxrwt 2 root root 4096 Sep 21 09:17 .ICE-unix
drwx—— 2 root root 16384 Sep 21 09:56 lost+found
lrwxrwxrwx 1 root root 30 Sep 21 10:23 mysql.sock -> ../../var/lib/mysql/mysql.sock
-rw——- 1 cpdigita cpdigita 4096 Sep 21 10:11 .spamassassin1694OHMO4Dtmp
-rw——- 1 cpdigita cpdigita 0 Sep 21 10:17 .spamassassin1694voSq6Ctmp
-rw——- 1 cpdigita cpdigita 0 Sep 21 10:11 .spamassassin1694y0CJyjtmp
-rw——- 1 cpdigita cpdigita 0 Sep 21 10:04 .spamassassin18453ZHMaRtmp
-rw——- 1 cpdigita cpdigita 0 Sep 21 10:06 .spamassassin1845bypIDCtmp
-rw——- 1 cpdigita cpdigita 0 Sep 21 10:03 .spamassassin1845pCtlHqtmp
-rw-rw—- 1 mysql mysql 3866185728 Sep 21 10:07 #sql_436_0.MAD
-rw-rw—- 1 mysql mysql 8192 Sep 21 10:00 #sql_436_0.MAI
-rw——- 1 cpanelsolr cpanelsolr 165 Sep 21 10:22 start_2180387910403356223.properties
drwx—— 3 root root 4096 Sep 21 09:17 systemd-private-1d4af49159364e018772426d7df23a9d-named.service-8XVCsj
drwx—— 3 root root 4096 Sep 21 09:17 systemd-private-1d4af49159364e018772426d7df23a9d-named.service-FyUDBs
drwxrwxrwt 2 root root 4096 Sep 21 09:17 .Test-unix
drwxrwxrwt 2 root root 4096 Sep 21 09:17 .X11-unix
drwxrwxrwt 2 root root 4096 Sep 21 09:17 .XIM-unix

So mysql was going down due to /tmp being full

So as a work around found a better solution

To change the /tmp file to something else for mysql

vi /etc/my.cnf
tmpdir=/mysqltmp

Save the file with :wq

2. Create the /mysqltmp directory

Code:
mkdir /mysqltmp
chmod 1777 /mysqltmp



3. Restart MySQL and check that the tmpdir is now /mysqltmp
Code:
/etc/init.d/mysql restart
mysqladmin var | grep tmpdir
You should see the following return:

Code:
# mysqladmin var | grep tmpdir
| slave_load_tmpdir                       | /mysqltmp
| tmpdir                                  | /mysqltmp

Redirecting HTTP to HTTPS

Redirecting HTTP to HTTPS

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [R,L]

Redirect Only a Specific Domain

RewriteEngine On
RewriteCond %{HTTP_HOST} ^yourdomain\.com [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [R,L]
Redirecting to HTTPS on a specific folder, add the following:

[ERROR] Can’t init tc log Mariadb

2018-03-30 2:06:19 139671858284288 [Note] InnoDB: Dumping buffer pool(s) not yet started
2018-03-30 2:06:19 139672598403328 [Note] Plugin ‘FEEDBACK’ is disabled.
2018-03-30 2:06:19 139672598403328 [Note] Recovering after a crash using tc.log
2018-03-30 2:06:19 139672598403328 [ERROR] Can’t init tc log
2018-03-30 2:06:19 139672598403328 [ERROR] Aborting

Was getting above error in mysql errorlog

The solution to this issue was just to go ahead and delete tc.log

rm -rf /var/lib/mysql/tc.log

Went ahead and restart mysql.. Mysql was online

root@server lib]# rm -rf /var/lib/mysql/tc.log
[root@server lib]# /etc/init.d/mysql restart
MySQL server PID file could not be found! [FAILED]
Starting MySQL.180330 02:07:40 mysqld_safe Logging to ‘/var/lib/mysql/server.cpanel.com.err’.
180330 02:07:40 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
[ OK ]
[root@server lib]#

 

Column count of mysql.user is wrong

Was getting below error while trying to create mysql user in cpanel

Error from MySQL query :(XID 5yuvwf) The system received an error from the “MySQL” database “mysql”: 1805 (Column count of mysql.user is wrong. Expected 43, found 39. The table is probably corrupted):

The migration used a “mysqldump –all-databases” so it included the “mysql” database. Apparently the “mysql.proc” table changed between the versions. The fix on the new server is to run:

 

Below command fixed the issue

mysql_upgrade force

 

Windows OS not visible on dual boot

We had attempted a dual boot vps on KVM based vps

The os were installed using ISO

First to start with windows and then linux

However after installing linux the windows OS went missing

ON googling around found a solution

The issue was due to missing modules where we had to install module  ntfs-3g

[root@ohours ~]# yum install ntfs-3g
Loaded plugins: fastestmirror
base                                                                                                                                                                                 | 3.6 kB  00:00:00
extras                                                                                                                                                                               | 3.4 kB  00:00:00
updates                                                                                                                                                                              | 3.4 kB  00:00:00
(1/4): base/7/x86_64/group_gz                                                                                                                                                        | 156 kB  00:00:00
(2/4): extras/7/x86_64/primary_db                                                                                                                                                    | 167 kB  00:00:00
(3/4): updates/7/x86_64/primary_db                                                                                                                                                   | 6.0 MB  00:00:00
(4/4): base/7/x86_64/primary_db                                                                                                                                                      | 5.7 MB  00:00:01
Determining fastest mirrors
* base: centos.mirror.lstn.net
* extras: centos.mirror.lstn.net
* updates: centos.mirror.lstn.net
No package ntfs-3g available.
Error: Nothing to do

we  had to use epel repository to install  ntfs-3g as its not available with normal repository

#Command to enable epel repository

[root@ohours ~]# yum install epel-release
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: centos.mirror.lstn.net
* extras: centos.mirror.lstn.net
* updates: centos.mirror.lstn.net
Resolving Dependencies
–> Running transaction check
—> Package epel-release.noarch 0:7-9 will be installed
–> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================================================================================
Package                                               Arch                                            Version                                        Repository                                       Size
============================================================================================================================================================================================================
Installing:
epel-release                                          noarch                                          7-9                                            extras                                           14 k

Transaction Summary
============================================================================================================================================================================================================
Install  1 Package

Total download size: 14 k
Installed size: 24 k
Is this ok [y/d/N]: y
Downloading packages:
warning: /var/cache/yum/x86_64/7/extras/packages/epel-release-7-9.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Public key for epel-release-7-9.noarch.rpm is not installed
epel-release-7-9.noarch.rpm                                                                                                                                                          |  14 kB  00:00:00
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Importing GPG key 0xF4A80EB5:
Userid     : “CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>”
Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
Package    : centos-release-7-4.1708.el7.centos.x86_64 (@anaconda)
From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : epel-release-7-9.noarch                                                                                                                                                                  1/1
Verifying  : epel-release-7-9.noarch                                                                                                                                                                  1/1

Installed:
epel-release.noarch 0:7-9                                                                                                                                                                               

Complete!

[root@ohours ~]# yum install ntfs-3g
Loaded plugins: fastestmirror
epel/x86_64/metalink                                                                                                                                                                 |  16 kB  00:00:00
epel                                                                                                                                                                                 | 4.7 kB  00:00:00
(1/3): epel/x86_64/group_gz                                                                                                                                                          | 266 kB  00:00:00
(2/3): epel/x86_64/updateinfo                                                                                                                                                        | 899 kB  00:00:00
(3/3): epel/x86_64/primary_db                                                                                                                                                        | 6.3 MB  00:00:00
Loading mirror speeds from cached hostfile
* base: centos.mirror.lstn.net
* epel: mirror.oss.ou.edu
* extras: centos.mirror.lstn.net
* updates: centos.mirror.lstn.net
Resolving Dependencies
–> Running transaction check
—> Package ntfs-3g.x86_64 2:2017.3.23-1.el7 will be installed
–> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================================================================================
Package                                        Arch                                          Version                                                     Repository                                   Size
============================================================================================================================================================================================================
Installing:
ntfs-3g                                        x86_64                                        2:2017.3.23-1.el7                                           epel                                        263 k

Transaction Summary
============================================================================================================================================================================================================
Install  1 Package

Total download size: 263 k
Installed size: 612 k
Is this ok [y/d/N]: y
Downloading packages:
warning: /var/cache/yum/x86_64/7/epel/packages/ntfs-3g-2017.3.23-1.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEY
Public key for ntfs-3g-2017.3.23-1.el7.x86_64.rpm is not installed
ntfs-3g-2017.3.23-1.el7.x86_64.rpm                                                                                                                                                   | 263 kB  00:00:00
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
Importing GPG key 0x352C64E5:
Userid     : “Fedora EPEL (7) <epel@fedoraproject.org>”
Fingerprint: 91e9 7d7c 4a5e 96f1 7f3e 888f 6a2f aea2 352c 64e5
Package    : epel-release-7-9.noarch (@extras)
From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : 2:ntfs-3g-2017.3.23-1.el7.x86_64                                                                                                                                                         1/1
Verifying  : 2:ntfs-3g-2017.3.23-1.el7.x86_64                                                                                                                                                         1/1

Installed:
ntfs-3g.x86_64 2:2017.3.23-1.el7                                                                                                                                                                   

Complete!

#Using below command find the OS loaded in system

[root@ohours ~]# grub2-mkconfig > /dev/null
Generating grub configuration file …
Found linux image: /boot/vmlinuz-3.10.0-693.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-693.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-4754405db1084b4e8d440c2aef41bef8
Found initrd image: /boot/initramfs-0-rescue-4754405db1084b4e8d440c2aef41bef8.img
Found Windows Recovery Environment (loader) on /dev/sda1
done

if windows is not found the OS may have got formatted while installing other OS

However our windows os was intact as the results show

#make backup copy of grub.conf

sudo cp /boot/grub2/grub.cfg /boot/grub2/grub.cfg.old

#Recreate  the grub.conf to load windows and linux os using below command

sudo grub2-mkconfig -o /boot/grub2/grub.cfg

and now reboot and see both OS load

umount: /backup: device is busy

While trying to unmount a secondary drive I see below error

umount: /backup: device is busy.

(In some cases useful info about processes that use
the device is found by lsof(8) or fuser(1))

The issue was due to the drive /dev/sdb being used by some process

Below is the process on how to find process using drive and kill it and umount drive

# Command to unmount drive

root@oM1050 [/backup/weekly]# umount /backup
umount: /backup: device is busy.
(In some cases useful info about processes that use
the device is found by lsof(8) or fuser(1))

#command to see disk listing and name on which its mounted

root@oM1050 [/backup/weekly]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 48G 20G 26G 44% /
tmpfs 16G 0 16G 0% /dev/shm
/dev/sda1 865G 537G 285G 66% /home
/dev/sdc1 118G 93G 19G 84% /var
/dev/sdb 688G 686G 0 100% /backup

#command to find the process number which is using the drive

root@oM1050 [/backup/weekly]# fuser -m /dev/sdb
/dev/sdb: 11676c 12801c

# checking which process is running on it

root@oM1050 [/backup/weekly]# ps auxw|grep 11676
root 11676 0.0 0.0 109644 3088 pts/1 Ss 07:23 0:00 -bash
root 19587 0.0 0.0 105372 892 pts/1 S+ 07:32 0:00 grep 11676

# checking which process is running on it
root@oM1050 [/backup/weekly]# ps auxw|grep 12801
root 12801 1.2 0.0 106756 4544 pts/1 D 07:24 0:06 rm -i -rf 2018-02-14
root 19843 0.0 0.0 105372 896 pts/1 S+ 07:33 0:00 grep 12801

# killing the process which is engaged in /dev/sdb

root@oM1050 [/backup/weekly]# kill -9 12801
root@ok1050 [/backup/weekly]#
[1]+ Killed rm -i -rf 2018-02-14

and finally drive unmounted

root@ok1050 [~]# umount /backup
root@ok1050 [~]#

The system could not create the user “triltch” because it conflicts with an unmanaged MySQL database user and an unmanaged PostgreSQL database user

While creating a new account in server was getting below error

The issue was due to mysql user already being present in server

root@srv1 [~]# /scripts/wwwacct trill.com tritch hood773ud
+===================================+
| New Account Info |
+===================================+
| Domain: trill.com
| UserName: tritch
| PassWord: hood773ud
+===================================+

This ok? yes
Checking input data……Done
Validating system setup……Done
…Done
Validating IP……Done
Validating Username……Done
Validating Contact Email……Done
Checking for database conflicts…(XID vh9sa4) The system could not create the user “tritch” because it conflicts with an unmanaged MySQL database user and an unmanaged PostgreSQL database user.

Steps to fix this issue

Login to WHM

Go to PHPmyadmin

Select database Mysql

Go to Option search
Select all tables inside  in option  Inside tables

In option Words or values to search for (wildcard: “%”):  put up name of mysql user which is conflicting >>

Delete all the tables you get in search tables and issue should be resolved

You can also refer in below URL

Solution: cPanel error “cannot create account because it conflicts with an unmanaged MySQL database user”

 

SMTP AUTH is required for message submission on port 587

The ‘SMTP AUTH’ error usually happens when users try to send mails without properly authenticating their mail account in email clients such as Outlook or Thunderbird.

What causes the error ‘SMTP AUTH is required for message submission on port 587’ in cPanel/WHM servers

With the latest cPanel/WHM update, email accounts that were working fine till now, may find their mails getting undelivered, showing this error message in the Exim log:

2018-01-17 05:57:40 H=(cruxserver12.com) [174.136.14.87]:63927 F=<zimphost@gmail.com> rejected RCPT <technical424@gmail.com>: SMTP AUTH is required for message submission on port 587
2018-01-17 05:58:09 H=(cruxserver12.com) [174.136.14.87]:63932 F=<zimphost@gmail.com> rejected RCPT <technical424@gmail.com>: SMTP AUTH is required for message submission on port 587

This has happened due to a latest security feature implemented in cPanel/WHM – ‘SMTP AUTH’ requires SSL by default.

To combat spamming in servers and to provide secure email transmission, email clients that try to send mails without using secure transmission will be denied mail delivery through the server.

The option that determines this is ‘Require clients to connect with SSL or issue the STARTTLS command before they are allowed to authenticate with the server’, which is set to ‘On’ by default, in WHM -> Exim Configuration Editor.

Setting it to Off will fix this issue  🙂

 

 

Your system has run out of available ip addresses, or you do not have permission to use any more ip addresses WHMCS

While activating a new account I could see an error

Your system has run out of available ip addresses, or you do not have permission to use any more ip addresses

The issue was due to the server running out of spare dedicated IP address

The issue can be resolved in 2 ways

1) Adding additional IP address in server

2) By editing file  /var/cpanel/packages/abckhosting which is a package file which is assigned to customers.

SSH to server in question on which account is activated  and  edit the package file as mentioned

vi /var/cpanel/packages/abckhosting

The parameter IP=y needs to be changed to  IP=n to get account activated without adding new  IP address.

BWLIMIT=unlimited
CGI=y
CPMOD=paper_lantern
DIGESTAUTH=n
FEATURELIST=default
HASSHELL=n
IP=n
LANG=en
MAXADDON=5
MAXFTP=5
MAXLST=unlimited
MAXPARK=5
MAXPOP=unlimited
MAXSQL=10
MAXSUB=5
MAX_DEFER_FAIL_PERCENTAGE=unlimited
MAX_EMAIL_PER_HOUR=unlimited
QUOTA=100000
_PACKAGE_EXTENSIONS=

 

This did help in creating new account without adding additional IP address