Epic Voyage logo

Epic Voyage

The Wanderer's Journal

Main menu

  • Home

Geek Stuff: Hacking cPanel's cPAddons

cPanel has some bugs. If you are trying to install a cPAddon and only see this error message:

Unable to set configuration! This will need done manually!

You may be falling prey to a bug in the procconfigfile sub. This is located in /usr/local/cpanel/Cpanel/cPAddons.pm.

The fault lies in the usage of _log_say(), which utilizes print(). Normally that would be fine except that procconfigfile() replaces the STDOUT pointer (due to mapping) that print defaults to using. This is only a temporary and is shortly restored – but it does obscure the error message.

This fix is to update the WARN call (circa line 2662):

my $inplace_errors = '';
my $inplace_error_count = 0;

{
    # my %inplace_errors;
    local $^I              = '.bak';
    local @ARGV            = map { "$dir/$_" } @{$fls};
    local $SIG{'__WARN__'} = sub {
        # my $err = shift();
        # $inplace_errors{$ARGV} = {
        #     'errno_int' => int($!),
        #     'errno_str' => "$!",
        #     'raw_warn'  => $err,
        # };
        $inplace_error_count++;
        $inplace_errors .= "Could not open $ARGV: $!";
    };

And then print out the error messages at the end of the function:

_log_say($inplace_errors) if $inplace_errors ne '';
rnreturn if $inplace_error_count;
rnreturn 1;

Happy debugging. In my case, it turned out that the configuration files were not being created because the site layout tarball that I had uploaded was not world-readable (cPanel extracts it as the user that is installing).

Once you know the location of the cPAddon processing code, the rest becomes easier. Hopefully you already know Perl if you are creating a new cPAddon.

Overheard at the Tavern

To pass lightly from old laws to new ones is a certain means to weakening the inmost essence of all law whatever. — Aristotle
Another »

Since This Page Loaded...

0 million dollars have been spent by Washington.
0.00 dollars per person in the US.

And that is only Federal spending...

0 babies have died worldwide in an abortion.
0 babies were in the United States.

0 Americans have contracted an STD.

About Me

{author}
Chris is probably out getting lost somewhere. He has a tendency to do that. Please don't worry unless he fails to show up again sometime in the next week.

Copyright 2024. All rights reserved.