lvestats-server: class sqlite3.OperationalError: no such table: history

Sometimes on a Cloudlinux server, you may receive following error in /var/log/messages

lvestats-server: <class 'sqlite3.OperationalError'>: no such table: history

The error is due to inconsistent lvestats database missing some fields and it can be recreated by

# /etc/init.d/lvestats stop

# mv /var/lve/lveinfo.db /var/lve/lveinfo.db_bad

# /etc/init.d/lvestats start

How to check installed perl modules on a server

To check the installed perl modules on a cpanel server, you can use the command provided below.

[email protected] [~]# instmodsh
Available commands are:
   l            - List all installed modules
   m <module>   - Select a module
   q            - Quit the program
cmd? l
Installed modules are:
   CPAN
   Compress::Raw::Bzip2
   Compress::Raw::Zlib
   Crypt::PasswdMD5
   DBI
   Digest::SHA1
   Encode::Locale
   Expect
   ExtUtils::MakeMaker
   File::Listing
   Filesys::Df
   GnuPG
   HTTP::Cookies
   HTTP::Daemon
   HTTP::Date
   HTTP::Message
   HTTP::Negotiate
   IO::Compress
   IO::HTML
   IO::Tty
   LWP
   LWP::MediaTypes
   Module::Build
   Module::Metadata
   Net::HTTP
   Perl
   Perl::OSType
   Regexp::Assemble
   Test::Deep
   Test::NoWarnings
   Test::Tester
   URI
   WWW::RobotRules
   local::lib
   version
cmd?

RTNETLINK answers: No such device on a Virtuozzo VPS

Sometimes a VPS may stop working all of a sudden and while checking the issue, you notice that the ifconfig command is not showing any IP on the server.

[email protected] [~]# ifconfig
[email protected] [~]#

After restarting the network, its showing the following error.

[email protected] [~]# /etc/init.d/network restart

Shutting down loopback interface: [ OK ]

Bringing up loopback interface: RTNETLINK answers: Operation not supported

Failed to bring up lo.

[FAILED]

Bringing up interface venet0: RTNETLINK answers: Operation not supported

Failed to bring up venet0.

[FAILED]

RTNETLINK answers: No such device

RTNETLINK answers: No such device

RTNETLINK answers: No such device

[email protected] [~]#

The issue is because of the iproute package which got updated causing issues on the server. You need to downgrade the package. To downgrade the package, use the steps provided below.

Login to the main node and download the RPM as per the arch.

[[email protected] ~]# wget http://repo.smartservermanagement.com/misc/iproute-2.6.32-23.el6.x86_64.rpm
[[email protected] ~]# cp iproute-2.6.32-23.el6.x86_64.rpm /vz/private/455113/fs/root/

Where 455113 is the container ID

[[email protected] ~]# vzctl enter 455113
[email protected] [~]# rpm -qa |grep iproute
iproute-2.6.32-31.el6.x86_64
[email protected] [~]#
[email protected] [/]# rpm -e iproute-2.6.32-31.el6.x86_64 --nodeps
[email protected] [/]# rpm -ivh iproute-2.6.32-23.el6.x86_64.rpm
warning: iproute-2.6.32-23.el6.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 192a7d7d: NOKEY
Preparing... ########################################### [100%]
1:iproute ########################################### [100%]
[email protected] [/]# service network restart
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface venet0: Determining if ip address 127.0.0.1 is already in use for device venet0...

The server is up now. 🙂

SecurityException in Application.cpp:188: Do not have root privileges. Executable not set-uid root

Sometimes, you may encounter with a website showing 500 internal server error and in apache error logs, it shows the following error message.

SecurityException in Application.cpp:188: Do not have root privileges. Executable not set-uid root?

Premature end of script headers: index.php

This error is because of the suphp binary which is missing its sticky/suid permissions. It can be fixed by executing the following command.

# chmod +s /opt/suphp/sbin/suphp

Once permissions are corrected, check the website, it should be working fine now.

Mysql error, Can’t create/write to file ‘/var/tmp1/#sql_e2f_0.MYI’ (Errcode: 2)]

Sometimes you may face the following error

Can’t create/write to file ‘/var/tmp1/#sql_e2f_0.MYI’ (Errcode: 2)]

This is because of big temporary tables created while executing a query due to which the tmp folder is full and unable to write the data there. The solution is to increase the size of tmp directory or change its path.

Try the following:

# mkdir /var/lib/mysql/tmp
# chown mysql:mysql /var/lib/mysql/tmp

Add the following line into the [mysqld] section:

tmpdir = /var/lib/mysql/tmp

 

Restart the service.

# /etc/init.d/mysql restart

No response from subprocess (/usr/local/cpanel/whostmgr/docroot/cgi/addon_nginx.cgi) with exit signal: 2

While accessing Nginx Admin in WHM, you may receive the following error;

No response from subprocess (/usr/local/cpanel/whostmgr/docroot/cgi/addon_nginx.cgi) with exit signal: 2

To resolve the issue, you need to install the following perl module;

[email protected] [~]# /scripts/perlinstaller Task::Cpanel::Core

Once installation is completed, refresh the page, it should be working fine without any error.

How to set limit to remove the Frozen emails automatically?

To set auto-delete for the frozen emails, you need to edit the exim configuration file on your server.

# vi /etc/exim.conf

timeout_frozen_after = 5d ( 5 Days )

# /etc/init.d/exim restart

That’s it!

How to generate random passwords in Linux

Following are the methods to generate random passwords on command line interface in Linux.

[email protected] [~]# mkpasswd -l 15 -d 3 -D 3

usage: mkpasswd [args] [user]

where arguments are:

-l # (length of password, default = 15)i want = 12

-d # (min # of digits, default = 3) i want = 4

-c # (min # of lowercase chars, default = 2) i want = 4

-C # (min # of uppercase chars, default = 2) i want = 4

-s # (min # of special chars, default = 1) i don’t want

-v (verbose, show passwd interaction)

-p prog (program to set password, default = /bin/passwd)

[email protected] [~]# mkpasswd -l 12
LWj}E0kMgl3f
[email protected] [~]#
[email protected] [~]# mkpasswd -s 3 -l 20
"PcziLb9EvFrm>4tb)pQ
[email protected] [~]#

mkpasswd -s 3 -l 20 that means the password will contain 3 special characters with 20 chars inside .

or

[email protected] [~]# openssl rand 12 -base64
MDn28PGbwU0zmDxG
[email protected] [~]#

this generates a random alphanumeric string.

Using pwgen

[email protected] [~]# yum install pwgen

Official CentOS repository does not provide pwgen RPM. But it is available on EPEL repository. So you need to enable EPEL repo as per the instructions found on [url=http://fedoraproject.org/wiki/EPEL]EPEL – FedoraProject[/url]. Then install pwgen using yum:

By default, pwgen generates easy to remember passwords with sufficient randomness. See example, below:

[email protected] [~]# pwgen 5 1
PfCdv

In the above command, pwgen creates one password of 5 characters length. The first argument to pwgen is length of password and second argument is number of passwords.

To generate complete random password, use the -s switch. Following command generates two random passwords of 25 characters length:

[email protected] [~]# pwgen -s 25 2
MmpIo4KpORFckt7tS2AXpOnmU V1p1SVhaTyOLLtvWZPDOfeABZ

As you have noticed, by default, pwgen creates passwords containing letters and decimal digits. To include special characters in the passwords, use -y switch. Below command creates one password of 20 characters length and password includes special characters:

[email protected] [~]# pwgen -s -y 20 1
Y8BAm>Pv1}\9O(kk|SI?

That’s it!