cPanel

Occasionally, Webmail users (Horde or Roundcube) on cPanel server may see the following error: Server Error: UID SORT: Internal error occurred. Inbox may not load at all.

It's a permission issue which can be fixed by following command via Shell (root access is required):

/scripts/mailperm username

If it didn't fix, please check maillog:

grep domain.tld /var/log/maillog

You should search for any errors associated with Dovecot imap. You may find something similar to: 

May 21 12:52:21 node.xxxxxxxxxxxxxx.com dovecot: imap(email@domain.tld)<22396><g0urpGOJiPhRtza0>: Error: Mailbox INBOX: UID=17245: read(/home/HASH/mail/domain.tld/email/cur/1547548534.M108213P371628.node.xxxxxxxxxxxxxx.com,S=7766,W=7934:2,S) failed: Cached message size larger than expected (7766 > 0, box=INBOX, UID=17245) (read reason=mail stream)

In this case, move the corrupted file: 

mv /home/HASH/mail/domain.tld/email/cur/1547548534.M108213P371628.node.xxxxxxxxxxxxxx.com,S=7766,W=7934:2,S /home/HASH/mail/domain.tld/email/.Trash/cur/1547548534.M108213P371628.node.xxxxxxxxxxxxxx.com,S=7766,W=7934:2,S

 

Whenever i try to create a subdomain, i get the following error:

Cpanel::Exception::Database::Error/(XID 7yezck) Database /var/cpanel/bandwidth/XXXX.sqlite Error: database disk image is malformed at /usr/local/cpanel/Cpanel/Exception/CORE.pm line 77. Cpanel::Exception::create("Database::Error", Cpanel::ExceptionMessage::Raw=SCALAR(0x3b887d0), HASH(0x3b87d80)) called at /usr/local/cpanel/Cpanel/Exception/CORE.pm line 94 Cpanel::Exception::create_raw("Database::Error", "Database /var/cpanel/bandwidth/XXXX.sqlite Error: da"..., HASH(0x3b87d80)) called at /usr/local/cpanel/Cpanel/Exception.pm line 30 Cpanel::Exception::__ANON__(__CPANEL_HIDDEN__, __CPANEL_HIDDEN__..., HASH(0x3b87d80)) called at /usr/local/cpanel/Cpanel/DBI.pm line 193 Cpanel::DBI::_create_exception(Cpanel::DBI::SQLite::db=HASH(0x3b708d0), "DBD::SQLite::db selectrow_array failed: database disk image i"..., undef) called at /usr/local/cpanel/Cpanel/DBI.pm line 178 Cpanel::DBI::_error_handler("DBD::SQLite::db selectrow_array failed: database disk image i"..., Cpanel::DBI::SQLite::db=HASH(0x3b708d0), undef) called at /usr/local/cpanel/Cpanel/BandwidthDB/Base.pm line 110 Cpanel::BandwidthDB::Base::_get_schema_version(Cpanel::BandwidthDB::Write=HASH(0x3af0e90)) called at /usr/local/cpanel/Cpanel/BandwidthDB/Read.pm line 99 Cpanel::BandwidthDB::Read::_check_for_outdated_schema(Cpanel::BandwidthDB::Write=HASH(0x3af0e90)) called at /usr/local/cpanel/Cpanel/BandwidthDB/Read.pm line 88 Cpanel::BandwidthDB::Read::new("Cpanel::BandwidthDB::Write", "XXXX") called at /usr/local/cpanel/Cpanel/BandwidthDB/Write.pm line 43 Cpanel::BandwidthDB::Write::new("Cpanel::BandwidthDB::Write", "XXXX") called at /usr/local/cpanel/Cpanel/BandwidthDB.pm line 197 Cpanel::BandwidthDB::__ANON__() called at /usr/local/cpanel/3rdparty/perl/524/lib64/perl5/cpanel_lib/Try/Tiny.pm line 101 eval {...} called at /usr/local/cpanel/3rdparty/perl/524/lib64/perl5/cpanel_lib/Try/Tiny.pm line 92 Try::Tiny::try(CODE(0x3af39d0), Try::Tiny::Catch=REF(0x3aeece8)) called at /usr/local/cpanel/Cpanel/BandwidthDB.pm line 210 Cpanel::BandwidthDB::_try_to_create_instance("Cpanel::BandwidthDB::Write", "XXXX") called at /usr/local/cpanel/Cpanel/BandwidthDB.pm line 221 Cpanel::BandwidthDB::__ANON__() called at /usr/local/cpanel/3rdparty/perl/524/lib64/perl5/cpanel_lib/Try/Tiny.pm line 101 eval {...} called at /usr/local/cpanel/3rdparty/perl/524/lib64/perl5/cpanel_lib/Try/Tiny.pm line 92 Try::Tiny::try(CODE(0x3af33d0), Try::Tiny::Catch=REF(0x3ae9240)) called at /usr/local/cpanel/Cpanel/BandwidthDB.pm line 234 Cpanel::BandwidthDB::_try_to_create_instance_with_schema_update("Cpanel::BandwidthDB::Write", "XXXX") called at /usr/local/cpanel/Cpanel/BandwidthDB.pm line 181 Cpanel::BandwidthDB::_instantiate_for_root(__CPANEL_HIDDEN__, __CPANEL_HIDDEN__) called at /usr/local/cpanel/Cpanel/BandwidthDB.pm line 104 Cpanel::BandwidthDB::get_writer("XXXX") called at /usr/local/cpanel/Cpanel/Sub.pm line 233 Cpanel::Sub::addsubdomain(__CPANEL_HIDDEN__, 0, __CPANEL_HIDDEN__, 0, __CPANEL_HIDDEN__, __CPANEL_HIDDEN__, __CPANEL_HIDDEN__, __CPANEL_HIDDEN__, ...) called at bin/admin/Cpanel/domain.pl line 198 main::__ANON__() called at /usr/local/cpanel/3rdparty/perl/524/lib64/perl5/cpanel_lib/Try/Tiny.pm line 97 eval {...} called at /usr/local/cpanel/3rdparty/perl/524/lib64/perl5/cpanel_lib/Try/Tiny.pm line 92 Try::Tiny::try(CODE(0x3a7bf68), Try::Tiny::Catch=REF(0x1aa6010)) called at bin/admin/Cpanel/domain.pl line 211

Move the corrupted SQLlite database:

mv /var/cpanel/bandwidth/zadmin.sqlite{,.OFF}

Run the cPanel bandwidthdb regenerate scripts in background:

/scripts/build_bandwidthdb_root_cache_in_background

Then, the scripts is finished, run again:

/scripts/build_bandwidthdb_root_cache

 

Developers would know this…often times, we setup CRON Jobs to run on specific times to execute a specific file or perform a task but we really don’t know if it’s running as it should.

Now I know many developers choose to have a script that probably logs its execution on a log file somewhere or output it to a TXT file. This is one alternative but I found this little PHP script online on InkPlant. It quite useful because it does the same thing (outputting execution of the main file to a TXT document).

If you are adding a job through crontab, here’s a good way to know if it’s actually running:

  1. Create a blank text document named cron_test.txt and upload it into your script’s folder. Change the CHMOD settings or permissions on it to 777 so that its writable by the server.
     
  2. Create a new PHP file called “cron_test.php”. This script will basically execute a task of writing a line of details to cron_test.txt you created in Step 1.
    <?php
    $crontext = "Cron Run at ".date("r")." by ".$_SERVER['USER']."\n" ;
    $folder = substr($_SERVER['SCRIPT_FILENAME'],0,strrpos($_SERVER['SCRIPT_FILENAME'],"/")+1);
    $filename = $folder."cron_test.txt" ;
    $fp = fopen($filename,"a") or die("Open error!");
    fwrite($fp, $crontext) or die("Write error!");
    fclose($fp);
    echo "Wrote to ".$filename."\n\n" ;
    ?>

     

  3. Enter the following line to your Crontab or CPanel if you’re using one.
    * * * * * php /yourfolder/cron_test.php

     

  4. You should be able to see all the execution data on “cron_test.txt”.

Hope you found that useful. If you have a neater solution to test CRON jobs, please do share. I would love to know about it.

This user cpanel account reached disk quota limit and mail stopped working. User deleted about 4G of emails and released some disk space. Problem was that he still wasn’t able to login to webmail. This error was shown:

internal server error 500 user is over quota cpanel

It didn’t make sense since he released his disk space. Cpanels quota was showing new value, but login to webmail was still impossible.

What you have to do is remove cpanels overquota file manually. Let’s say that user user4 is having issue described above.

root@cpanel [~]# cd /var/cpanel/overquota/
root@cpanel [/var/cpanel/overquota]# ls
./  ../  user1  user2  user3  user4 
root@cpanel [/var/cpanel/overquota]# rm user4

After I deleted /var/cpanel/overquota/user4, webmail was started to working again.

  • Is there any way to monitor cpu usage and memory per user in cPanel?
  • Yes, login to your server though ssh and use following commands:
     
    1. For some specific user:

      top -c d2 -u username

      top -c d2 -u martin
       

    2. Resource usage for all users can be checked thourgh command:
      top -c d2

What is /scripts/removeacct?

This is the new command line script used to replace /scripts/killacct. It also is similar to the functionality provided in the Terminate an Account panel. The biggest difference is the new implementation of removing the DNS zone automatically. It also provides the option to keep the DNS zone via command flag.

Here's the usage dialog provided from the script:

Usage:
    /usr/local/cpanel/scripts/removeacct <user>

 Options:
    --force: Bypass confirmation dialog
    --keepdns: Keep zone files from DNS

To remove a cPanel account simply perform the following command:

/scripts/removeacct cpaneluser

This will provide a prompt to confirm if you'd like to continue with removing the account and the DNS zones for the user. The default option (selected by pressing Enter) is No. So you'll have to type 'y' before proceeding. To skip the confirmation dialog simply add the –force flag as shown:

/scripts/removeacct –force cpaneluser

 

Open the /etc/httpd/bin/apachectl file, and find the ulimit value, put the wanted value, then save the file.

Next type the following commands:

killall -9 httpd
httpd restart

Note: https://serverfault.com/questions/162817/cpanel-ulimit-n-keeps-resetting...

If you have logged into your VPS or server and noticed that you had an IP address that was not assigned to any accounts, yet you are unable to use it because it says you have 0 free ip addresses or that the IP address is assigned to nobody (or shared with nobody), you can fix it using this tutorial. This is usually caused by the termination of a reseller that was sharing a dedicated IP, before the IP was actually removed.  So when attempting to delete the IP from the system you may see that it is listed as “Shared IP address for nobody” and has no option to delete, even though there are no sites assigned to it. 

First you need to login to SSH. If you need help on how to use putty or login to SSH, please do a search on our knowledge base for "putty" and you will find a step by step tutorial on how to use putty to login to your server. 

After logging into your VPS or server as the root user, run the following two commands to rebuild the httpd.conf and the IP address pool:

 

/scripts/updateuserdomains
/scripts/rebuildhttpdconf

 

Then, login to WHM > “IP address functions” > “Rebuild the IP address pool”
Now, you should be able to use the dedicated IP and when running a report on free IP's avaia;ble, your IP will show up. You can now delete or assign this IP to an account on your server or VPS.

Today noticed the following error in the /usr/local/cpanel/logs/error_log

The system received an error from the “SQLite” database “/var/cpanel/eximstats_db.sqlite3”: SQLITE_IOERR (disk I/O error)

Move the corrupted SQLite database out of the way and import the Exim data:

ls -lah /var/cpanel/exim*
mv /var/cpanel/eximstats_db.sqlite3 /var/cpanel/eximstats_db.sqlite3.old
/scripts/restartsrv_tailwatchd
/scripts/slurp_exim_mainlog --force
rm -rf eximstats_db.sqlite3.old
/scripts/restartsrv_eximstats

Today noticed, one of our server DNS editor extremely slow, and can not add Addon domain in the cPanel interface. The error log contanin the following rows:

/var/cpanel/dnsadmin/sock is still not a local socket after trying to restart dnsadmin

To fix run this command:

ps x | grep '/usr/local/cpanel/scripts/restartsrv_dnsadmin' | grep -v grep | awk '{print $1}' | xargs --no-run-if-empty kill -9

 

If you have a user that is getting over disk quota error message, but they claim to not have that much in use, they may have their disk quota being reporting incorrectly.

The first thing you should do however, is check to see if this is indeed the case.  If you run the following command, you can get a listing of every file on the server that is owned by their username.

find / -user 'username' | du -sh

Once it displays the output, you can go through it to see if they have files located somewhere other then their home directory that is using up their space.  If you have determined that everything is accounted for, but does not add up to the space reported in cPanel, then you can run the following commands to correct their quotas.

/scripts/generate_maildirsize --verbose --allaccounts --force --confirm
/scripts/fixquotas
find /home/username/mail/ -name maildirsize | xargs rm -f

Once these 3 commands have been run, their cPanel should report the proper quotas again.

I believe that I have fixed the problem on my own, but it may still be a bug with cPanel.

I found the following file:

/var/cpanel/email_send_limits/max_deferfail_example.com

Deleting this file fixed the problem immediately. I'm guessing that the system should have deleted (or updated?) this file at some point, but didn't.