Fixing a Suddenly “Broken” cPanel Installation

Fixing a Suddenly “Broken” cPanel Installation
2 (40%) 5 votes

Sometimes out of nowhere cPanel will just break. You don’t know why, you don’t know when, and you don’t know how…it just happens. In my experience it’s usually when a cPanel update fails for some reason or perl is borked, but either way – it just sucks. This article will go over how to fix a malfunctioning cPanel installation or botched upgrade.

How do I know it’s broken?

It’s usually pretty obvious, but when you get error every time you open cPanel or WHM, or get perl errors when you try to run any of the scripts in /scripts, accompanied by a slew of errors in the cPanel error log (/usr/local/cpanel/logs/error_log), it’s clear that cPanel and/or Perl is malfunctioning.

The good thing is, cPanel and Perl can usually be fixed rather easily.

First things first, if you’re just getting a simple Perl error, you may just be missing a couple Perl modules. Take for example an error that looks like this:

Can't locate IPC/Open3.pm in @INC (@INC contains: /scripts /usr/local/cpanel /usr/local/lib/perl5/5.8.8/x86_64-linux /usr/local/lib/perl5/5.8.8 /usr/local/lib/perl5/site_perl/5.8.8/x86_64-linux /usr/local/lib/perl5/site_perl/5.8.8 /usr/local/lib/perl5/site_perl .) at /scripts/pkgacct line 22.
BEGIN failed--compilation aborted at /scripts/pkgacct line 22.

This references a Perl module that does not exist, in which case you can just install it. The name of the Perl module is indicated in the error, just replace the slash with double-colons and pass it through /scripts/perlinstaller :

/scripts/perlinstaller IPC::Open3

If you’re running cPanel 11.38 or higher, remove “perl*” from /etc/yum.conf (it will typically exist if you upgraded from an older version at some point in time) and try searching for the perl module through Yum:

yum search ipc |grep -i open3

Then installing it if it exists (this particular example is not perfect for this, but you catch my drift).  Alternatively, you can make sure that cPanel has what it needs by running the following:

/usr/local/cpanel/scripts/check_cpanel_rpms –fix

If that fixes the problem, great…you may have to do this a couple more times for other perl modules. But you know there’s a REAL problem when the Perl installer fails, or the perl module is made by cPanel and doesn’t exist in the standard CPAN or Yum repos. In that case, you may need to resync the cPanel scripts.

First, run the following command to get your cPanel version branch:

cat /usr/local/cpanel/version

This should return something like 11.xx.xx.xx. You can then look up your version here to see which branch you are on – STABLE, RELEASE, CURRENT, or EDGE. Use this branch to download the scripts folder from the cPanel repo. The below example is for STABLE:

wget -O scripts.tar.bz2 http://httpupdate.cpanel.net/cpanelsync/STABLE/scripts.tar.bz2
tar -xvC / -j -p -f scripts.tar.bz2
chmod 755 /scripts/cpanelsync
/scripts/cpanelsync httpupdate.cpanel.net /cpanelsync/STABLE/scripts /scripts
/scripts/upcp –force

Problem still not fixed? Try reinstalling Perl (Note: This is for cPanel 11.34 and earlier)

cd /usr/src
wget http://layer2.cpanel.net/perl588installer.tar.gz
tar -xvzf perl588installer.tar.gz
cd perl588installer
./install

Then run /scripts/upcp –force again to reinstall the cPanel files

zp8497586rq
Don't be selfish, share!Tweet about this on TwitterShare on RedditShare on TumblrBuffer this pageDigg thisShare on FacebookFlattr the authorEmail this to someoneShare on Google+Pin on PinterestPrint this pageShare on LinkedInShare on StumbleUpon

1 Comment

  1. Eric Gillette

    Slam dunk. . .came across a client’s server that was *all* jacked up!

    – Perl modules missing

    – PHP missing simple modules (Zend Optimizer, ionCube, etc)

    – Apache compiled with obvious modules missing (mod_suphp, mod_ssl, etc)

    I’m not sure who compiled his system originally, but jeez it was a drag and I was stumped for a bit, but this little article helped BIG time and I got him back in order. =0)

Log in