Author Archives: LinuxTech

Can’t create new tempfile Mysql

While working today came across new error in Mysql

[myfuncol_student.ow_base_config] error: Can't create new tempfile: './myfuncol_student/ow_base_config.TMD

Repairing the Mysql didn’t fix this issue

mysql> repair table ow_base_config;
+———————————+——–+———-+——————————————————————–+
| Table | Op | Msg_type | Msg_text |
+———————————+——–+———-+——————————————————————–+
| myfuncol_student.ow_base_config | repair | error | Can’t create new tempfile: ‘./myfuncol_student/ow_base_config.TMD’ |
| myfuncol_student.ow_base_config | repair | status | Operation failed |
+———————————+——–+———-+——————————————————————–+

I ran below command to fix this issue

 

root@hostonl [/var/lib/mysql]# myisamchk -r -f myfuncol_student/ow_base_config.MYI
– recovering (with sort) MyISAM-table ‘myfuncol_student/ow_base_config.MYI’
Data records: 228
– Fixing index 1
– Fixing index 2

Now database is working fine

mysql> repair table ow_base_config;
+———————————+——–+———-+———-+
| Table | Op | Msg_type | Msg_text |
+———————————+——–+———-+———-+
| myfuncol_student.ow_base_config | repair | status | OK |
+———————————+——–+———-+———-+
1 row in set (0.01 sec)

 

 

Blank PHPmyadmin page in cpanel

While working with one hosting client we came across an issue where PHPmyadmin was blank

On checking logs on /usr/local/cpanel/logs/error_log we could see below error

root@hosonline  [~]# tail -n 10 /usr/local/cpanel/logs/error_log
Cpanel::Server::write_buffer(Cpanel::Server=HASH(0x4abf5d8), “HTTP/1.1 401 Access Denied\x{d}\x{a}Set-Cookie: cprelogin=no; HttpOnl”…) called at /usr/local/cpanel/Cpanel/Server.pm line 1132
Cpanel::Server::write_content_to_socket(Cpanel::Server=HASH(0x4abf5d8), IO::Socket::SSL=GLOB(0x4a9c208), 0, “HTTP/1.1 401 Access Denied\x{d}\x{a}Set-Cookie: cprelogin=no; HttpOnl”…, SCALAR(0x20f8ae8)) called at /usr/local/cpanel/Cpanel/Server.pm line 626
Cpanel::Server::badpass(Cpanel::Server=HASH(0x4abf5d8), __CPANEL_HIDDEN__, 1) called at cpsrvd.pl line 2997
cpanel::cpsrvd::badpass(__CPANEL_HIDDEN__, 1) called at cpsrvd.pl line 5278
cpanel::cpsrvd::handle_auth() called at cpsrvd.pl line 1222
cpanel::cpsrvd::handle_one_connection() called at cpsrvd.pl line 1073
cpanel::cpsrvd::script() called at cpsrvd.pl line 437
PHP Fatal error: Class ‘AuthenticationCpanel’ not found in /usr/local/cpanel/base/3rdparty/phpMyAdmin/libraries/common.inc.php on line 876
PHP Fatal error: Class ‘AuthenticationCpanel’ not found in /usr/local/cpanel/base/3rdparty/phpMyAdmin/libraries/common.inc.php on line 876
PHP Fatal error: Class ‘AuthenticationCpanel’ not found in /usr/local/cpanel/base/3rdparty/phpMyAdmin/libraries/common.inc.php on line 876

The issue was diagnosed to missing libraries

We resolved the issue using below command by upgrading PHPmyadmin

/usr/local/cpanel/bin/updatephpmyadmin –force

Now PHPmyadmin works like Charm 🙂

 

configure: error: * uuid support not found (this typically means the uuid development ackage is missing)

While working on Asterisk on cpanel server I could come across below error while compiling Asterisk

configure: error: * uuid support not found (this typically means the uuid development ackage is missing)

The issue was due to missing module.

It was resolved by using below libraries

#yum install uuid-devel
#yum install libuuid-devel

Now compile in working fine for Asterisk

 

 

eth0: Timesync Tx Control register not set as expected

While working on Centos 6 install I had  a new guest today

Guest being but with error ” eth0: Timesync Tx Control register not set as expected”

Amazed to see this error for first time in centos 6 I google around finally to see its a bug and fix for it

I restarted networking using /etc/init.d/network restart and checked logs in

tail -n 100 /var/log/messages

e1000e: eth0 NIC Link is Down
e1000e 0000:03:00.0: eth0: Reset adapter
e1000e 0000:03:00.0: eth0: Reset adapter unexpectedly
e1000e 0000:03:00.0: eth0: Timesync Tx Control register not set as expected

 

A quick workaround is as follows:-

1. SSH into affected server

2. Add pcie_aspm=off kernel parameters to grub config, e.g.:-
# cd /boot/grub
# vim grub.conf
….
kernel /vmlinuz-2.6.32-431.5.1.el6.x86_64 ro root=/dev/mapper/vg_server-LogVol00 nomodeset rd_MD_UUID=c8cb6527:97bad21d:75373cd1:0dd9261b  KEYBOARDTYPE=pc KEYTABLE=us LANG=en_US.UTF-8 rd_LVM_LV=vg_server21/LogVol00 rd_LVM_LV=vg_server21/LogVol01 rd_NO_LUKS rd_MD_UUID=ec1c1858:b6c1ad58:6562ea8b:0e8113e2 crashkernel=auto SYSFONT=latarcyrheb-sun16 rd_NO_DM rhgb quiet pcie_aspm=off

– (Add pcie_aspm=off at the end of the kernel parameters)

3. Save and reboot

Now network should work fine

Then this is indicative of the CentOS 6.x kernel Intel e1000e driver issue, as described here:-
http://bugs.centos.org/view.php?id=6810
http://bugs.centos.org/view.php?id=6814

wkhtmltopdf install

if you are facing issues with install of  wkhtmltopdf

please follow below steps

Download the zip file using wget

root@hostonlinesupport4u.in[/home/online/public_html/onlinesupport4u.in/cgi-bin]#

wget http://wkhtmltopdf.googlecode.com/files/wkhtmltopdf-0.9.9-static-amd64.tar.bz2

–2015-07-20 03:15:00– http://wkhtmltopdf.googlecode.com/files/wkhtmltopdf-0.9.9-static-amd64.tar.bz2
Resolving wkhtmltopdf.googlecode.com… 64.233.168.82, 2607:f8b0:4003:c07::52
Connecting to wkhtmltopdf.googlecode.com|64.233.168.82|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 8218260 (7.8M) [application/x-bzip2]
Saving to: `wkhtmltopdf-0.9.9-static-amd64.tar.bz2′

100%[====================================================================================================================================================================================================>] 82,18,260 15.3M/s in 0.5s

2015-07-20 03:15:00 (15.3 MB/s) – `wkhtmltopdf-0.9.9-static-amd64.tar.bz2′ saved [8218260/8218260]

FINISHED –2015-07-20 03:15:00–
Downloaded: 1 files, 7.8M in 0.5s (15.3 MB/s)

 

Unzip the file using tar

root@hostonlinesupport4u.in[/home/online/public_html/onlinesupport4u.in/cgi-bin]#

tar xvjf wkhtmltopdf-0.9.9-static-amd64.tar.bz2

wkhtmltopdf-amd64
root@host234 [/home/fantasti/public_html/mealmerge.com/cgi-bin]# ls -la
total 54640
drwxr-xr-x. 2 fantasti fantasti 4096 Jul 20 03:15 ./
drwxr-x—. 5 fantasti nobody 4096 Jul 20 02:36 ../
-rwxr-xr-x. 1 fantasti fantasti 39419552 Jun 26 05:26 wkhtmltopdf*
-rw-r–r–. 1 root root 8218260 May 24 2010 wkhtmltopdf-0.9.9-static-amd64.tar.bz2
-rwxr-xr-x. 1 1000 1000 8301444 May 24 2010 wkhtmltopdf-amd64*

 

Rename wkhtmltopdf-amd64 to wkhtmltopdf
root@hostonlinesupport4u.in[/home/online/public_html/onlinesupport4u.in/cgi-bin]# mv wkhtmltopdf-amd64 wkhtmltopdf

 

Change Permissions using chmod to executable

root@hostonlinesupport4u.in[/home/online/public_html/onlinesupport4u.in/cgi-bin]# chmod +x wkhtmltopdf1

Now execute the file to see if any errors

# ./wkhtmltopdf1
You need to specify atleast one input file, and exactly one output file
Use – for stdin or stdout

Name:
wkhtmltopdf 0.9.6

Synopsis:
wkhtmltopdf [OPTIONS]… <input file> [More input files] <output file>

Description:
Converts one or more HTML pages into a PDF document, using wkhtmltopdf patched
qt.

General Options:
-b, –book Set the options one would usually set when
printing a book
–collate Collate when printing multiple copies
–copies <number> Number of copies to print into the pdf
file (default 1)
–cover <url> Use html document as cover. It will be
inserted before the toc with no headers
and footers
-H, –default-header Add a default header, with the name of the
page to the left, and the page number to
the right, this is short for:
–header-left='[webpage]’
–header-right='[page]/[toPage]’ –top 2cm
–header-line
–extended-help Display more extensive help, detailing
less common command switches
-h, –help Display help
-O, –orientation <orientation> Set orientation to Landscape or Portrait
-s, –page-size <size> Set paper size to: A4, Letter, etc.
–password <password> HTTP Authentication password
-p, –proxy <proxy> Use a proxy
-q, –quiet Be less verbose
-t, –toc Insert a table of content in the beginning
of the document
–username <username> HTTP Authentication username
-V, –version Output version information an exit

Contact:
If you experience bugs or want to request new features please visit
<http://code.google.com/p/wkhtmltopdf/issues/list>, if you have any problems
or comments please feel free to contact me: see
<http://www.madalgo.au.dk/~jakobt/#about>

 

now test conversion using below command

root@hostonlinesupport4u.in[/home/online/public_html/onlinesupport4u.in/cgi-bin]#

./wkhtmltopdf www.google.com google.pdf
Loading pages (1/5)
Resolving links (2/5)
Counting pages (3/5)
Printing pages (5/5)
Done

FTP issue Error: Failed to retrieve directory listing

Getting error while doing ftp in cpanel server

“Failed to retrieve directory listing”

 

Status: Connecting to 199.162.171.19:21…
Status: Connection established, waiting for welcome message…
Status: Initializing TLS…
Status: Verifying certificate…
Status: TLS connection established.
Status: Server does not support non-ASCII characters.
Status: Connected
Status: Retrieving directory listing…
Command: PWD
Response: 257 “/” is the current directory
Command: TYPE I
Response: 200 Type set to I
Command: PASV
Response: 227 Entering Passive Mode (199,162,171,19,200,207).
Command: MLSD
Error: Connection timed out after 20 seconds of inactivity
Error: Failed to retrieve directory listing
Status: Disconnected from server

 

The issue is due to IPtables

Fix for this is

Open the iptables config file

root@server [~]# vi /etc/sysconfig/iptables

Comment the below 2 lines

#-A INPUT -j REJECT –reject-with icmp-host-prohibited

#-A FORWARD -j REJECT –reject-with icmp-host-prohibited

and restart iptables

root@server [~]# /etc/init.d/iptables restart
iptables: Applying firewall rules: [ OK ]

Now FTP works fine

Status: Connecting to 197.162.171.19:21…
Status: Connection established, waiting for welcome message…
Status: Initializing TLS…
Status: Verifying certificate…
Status: TLS connection established.
Status: Server does not support non-ASCII characters.
Status: Connected
Status: Retrieving directory listing…
Command: PWD
Response: 257 “/” is your current location
Command: TYPE I
Response: 200 TYPE is now 8-bit binary
Command: PASV
Response: 227 Entering Passive Mode (197,162,171,19,139,185)
Command: MLSD
Error: Connection timed out after 20 seconds of inactivity
Error: Failed to retrieve directory listing
Status: Disconnected from server
Status: Connecting to 199.162.171.19:21…
Status: Connection established, waiting for welcome message…
Status: Initializing TLS…
Status: Verifying certificate…
Status: TLS connection established.
Status: Server does not support non-ASCII characters.
Status: Connected
Status: Retrieving directory listing…
Command: PWD
Response: 257 “/” is your current location
Command: TYPE I
Response: 200 TYPE is now 8-bit binary
Command: PASV
Response: 227 Entering Passive Mode (199,162,171,19,40,98)
Command: MLSD
Error: Connection timed out after 20 seconds of inactivity
Error: Failed to retrieve directory listing
Status: Disconnected from server
Status: Connecting to 199.162.171.19:21…
Status: Connection established, waiting for welcome message…
Status: Initializing TLS…
Status: Verifying certificate…
Status: TLS connection established.
Status: Server does not support non-ASCII characters.
Status: Connected
Status: Retrieving directory listing…
Status: Directory listing of “/” successful

Install ZendGuard on cPanel server

To install ZendGuard on cpanel server follow below steps

SSH to server as root user and run below script

root@online  [~]# /scripts/installzendopt

Updating digest list Fetching http://httpupdate.cpanel.net/cpanelsync/easy/targz.yaml (connected:0)…….(request attempt 1/12)…Using dns cache file /root/.HttpRequest/httpupdate.cpanel.net……searching for mirrors (mirror search attempt 1/3)……loaded mirror speeds from cache……mirror search success……connecting to 67.222.0.10…@67.222.0.10……connected……receiving…100%……request success……Done Downloading tarball for Zendopt Fetching http://httpupdate.cpanel.net/cpanelsync/easy/targz/Cpanel/Easy/Zendopt.pm.tar.gz.linux-generic-64 (connected:0)…….(request attempt 1/12)……connecting to 67.222.0.10…@67.222.0.10……connected……receiving…2%…5%…8%…10%…13%…16%…18%…21%…24%…26%…29%…32%…34%…37%…40%…42%…45%…48%…50%…53%…56%…58%…61%…64%…66%…69%…72%…74%…77%…80%…82%…85%…88%…90%…93%…96%…98%…100%……request success……Done Installing Zendopt Skipping install to /usr/local/php4, missing php.ini Determining PHP version Installing Zend Guard/Optimizer 6.0 for PHP 5.4 Activated Zend Guard/Optimizer

 

Now restart apache using below command to complete the process

root@hostonline [~]# service httpd restart

Innodb recovery

We were getting below error on checking

#  /etc/init.d/mysqld status

ERROR! MySQL is running but PID file could not be found

On trying to restart were getting below error

root@alpha [~]# /scripts/restartsrv_mysql
Waiting for “mysql” to restart …………
…failed.

Service Error
The “mysql” service failed to start.

Startup Log
Starting MySQL………… SUCCESS!

Log Messages
150627 23:53:37 mysqld_safe mysqld restarted
150627 23:53:37 mysqld_safe Number of processes running now: 0
150627 23:53:37 mysqld_safe mysqld restarted
150627 23:53:37 mysqld_safe mysqld restarted
150627 23:53:37 mysqld_safe Number of processes running now: 1
150627 23:53:37 mysqld_safe mysqld process hanging, pid 16496 – killed
150627 23:53:37 mysqld_safe mysqld process hanging, pid 16501 – killed
150627 23:53:37 mysqld_safe Number of processes running now: 2
/usr/sbin/mysqld[0x84cbc2]
/usr/sbin/mysqld[0x857c7a]
/usr/sbin/mysqld[0x91b362]
/usr/sbin/mysqld[0x9267d2]
/usr/sbin/mysqld[0x85942b]
/usr/sbin/mysqld[0x858f82]
150627 23:53:36 mysqld_safe mysqld restarted

mysql has failed. Contact your system administrator if the service does not automagically recover.

The error was due to corruption in innodb in server

We found the below fix successful to fix this issue

First make backup of my.cnf file as backup.my.cnf

Open the mysql configuration file  my.cnf which is in

root@alpha [~]# vi /etc/my.cnf

Add below entry in it

[mysqld]
innodb_force_recovery = 1

restart Mysql using below command in cpanel server

root@alpha [~]# /scripts/restartsrv_mysql

Waiting for “mysql” to restart ……waiting for “mysql” to initialize ……
…finished.

Service Status
mysql (/usr/sbin/mysqld –basedir=/usr –datadir=/var/lib/mysql –plugin-dir=/usr/lib64/mysql/plugin –user=mysql –log-error=/var/lib/mysql/alpha.redlogic.com.err –open-files-limit=100000 –pid-file=/var/lib/mysql/alpha.redlogic.com.pid) is running as mysql with PID 28440 (pidfile check method).

Startup Log
Starting MySQL.. SUCCESS!

Log Messages
150628  0:03:54 [Note] /usr/sbin/mysqld: ready for connections.
150628 00:03:53 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
150628 00:03:53 mysqld_safe mysqld from pid file /var/lib/mysql/alpha.redlogic.com.pid ended
150628  0:03:53 [Note] /usr/sbin/mysqld: Shutdown complete
150628  0:03:52 [Warning] /usr/sbin/mysqld: Forcing close of thread 119  user: ‘eximstats’
150628  0:03:50 [Note] /usr/sbin/mysqld: Normal shutdown
150627 23:56:34 [Note] /usr/sbin/mysqld: ready for connections.
150627 23:56:33 mysqld_safe mysqld from pid file /var/lib/mysql/alpha.redlogic.com.pid ended
150627 23:56:33 [Note] /usr/sbin/mysqld: Shutdown complete
150627 23:56:29 [Warning] /usr/sbin/mysqld: Forcing close of thread 1  user: ‘eximstats’
150627 23:56:29 [Warning] /usr/sbin/mysqld: Forcing close of thread 5  user: ”
150627 23:56:27 [Note] /usr/sbin/mysqld: Normal shutdown

mysql restarted successfully.

root@alpha [~]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.5.42-cll MySQL Community Server (GPL)

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql> quit
Bye
root@alpha [~]#

Mysql was up and running now

innodb_force_recovery=1
skip-grant-tables

lvremove to remove logical volume from LVG

How to create spare Logical volume partition in linux server

We had a default install of

 

Screenshot from 2015-06-25 22:06:22

[root@SRV-01 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_srv01-lv_root
50G 2.6G 45G 6% /
tmpfs 7.8G 0 7.8G 0% /dev/shm
/dev/sda1 477M 67M 385M 15% /boot
/dev/mapper/vg_srv01-lv_home
860G 72M 816G 1% /home

As KVM virtualization need spare LVM to create vps on we had to free /home partition which has no data in it

So the process starts

#Using vgdisplay check the VG present

[root@SRV-01 ~]# vgdisplay
— Volume group —
VG Name vg_srv01
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 4
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 3
Open LV 3
Max PV 0
Cur PV 1
Act PV 1
VG Size 931.02 GiB
PE Size 4.00 MiB
Total PE 238341
Alloc PE / Size 238341 / 931.02 GiB
Free PE / Size 0 / 0
VG UUID tBHSEL-UIHM-OMbu-9KWk-ZTW9-97j5-UzwQDl
#lvscan to check the LVM name

[root@SRV-01 ~]# lvscan
ACTIVE ‘/dev/vg_srv01/lv_root’ [50.00 GiB] inherit
ACTIVE ‘/dev/vg_srv01/lv_home’ [873.17 GiB] inherit
ACTIVE ‘/dev/vg_srv01/lv_swap’ [7.85 GiB] inherit

Before removing the Logical volume partition need to unmount it  else you get below error

[root@SRV-01 ~]# lvremove /dev/vg_srv01/lv_home
Logical volume vg_srv01/lv_home contains a filesystem in use.

 

So unmounted /home which has  /dev/vg_srv01/lv_home

[root@SRV-01 ~]# umount /home/

 

Now removed the logical volume using lvremove

[root@SRV-01 ~]# lvremove /dev/vg_srv01/lv_home
Do you really want to remove active logical volume lv_home? [y/n]: y
Logical volume “lv_home” successfully removed

Now /home  alias  /dev/vg_srv01/lv_home is free to create  VM on it

[root@SRV-01 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_srv01-lv_root
50G 2.6G 45G 6% /
tmpfs 7.8G 0 7.8G 0% /dev/shm
/dev/sda1 477M 67M 385M 15% /boot

Error from MySQL query: DBD::mysql::db do failed: Can’t find any matching row in the user table

Have you been getting below error

“Error from MySQL query: DBD::mysql::db do failed: Can’t find any matching row in the user table”

To fix this issue follow below method,

Please remove the following entry from /etc/my.cnf and then restart MySQL:

skip-name-resolve
Screenshot - Monday 22 June 2015 - 12:20:11  IST
The restart mysql using /scripts/restartsrv_mysql
This fixes the issue