MK.pm (mkdir permissions)
Hello,
My server went to upgrade cPanel from 11.56.0.24 to 11.56.0.25 last night or early this morning. There were some errors. I than ran /scripts/upcp --force and received the same errors again. I think there might be a bug with one of the scripts. I think there's something wrong with /usr/local/cpanel/Cpanel/SafeDir/MK.pm when at or around 170. It looks like the script checks to see if a directory exists and if it doesn't, it tries to create the directory. The directory appears to exist but the script seems to be trying to create the directory anyways. This is the error message I get:
Here's the permissions of that directory:
It does in fact exist. The code in the MK.pm file is this:
I don't know a lot about perl, but to me, it seems the $exists variable isn't being properly populated. The directory exists, yet when we check to see if it does, perl thinks it doesn't. Any thoughts? I don't think this causes any real issues. I just thought the cPanel developers should be notified.
[2016-07-06 08:28:13 -0400] warn [Cpanel::SafeDir::MK] mkdir /var/cpanel/userhomes/cpanel/.cpanel/caches/dynamicui failed: Permission denied at /usr/local/cpanel/Cpanel/SafeDir/MK.pm line 177.
Cpanel::SafeDir::MK::safemkdir("/var/cpanel/userhomes/cpanel/.cpanel/caches/dynamicui", 448) called at /usr/local/cpanel/Cpanel/DynamicUI/Loader.pm line 304
Cpanel::DynamicUI::Loader::_get_dynamicui_cache_file_path_for_user("user_homedir", "/var/cpanel/userhomes/cpanel", "theme", "x3", "user_locale", "en", "brandingpkg", "") called at /usr/local/cpanel/Cpanel/DynamicUI/Loader.pm line 141
Cpanel::DynamicUI::Loader::__ANON__() called at /usr/local/cpanel/3rdparty/perl/522/lib64/perl5/cpanel_lib/Try/Tiny.pm line 80
eval {...} called at /usr/local/cpanel/3rdparty/perl/522/lib64/perl5/cpanel_lib/Try/Tiny.pm line 71
Try::Tiny::try(CODE(0x3230ba0), Try::Tiny::Catch=REF(0x321bd48)) called at /usr/local/cpanel/Cpanel/DynamicUI/Loader.pm line 156
Cpanel::DynamicUI::Loader::load_all_dynamicui_confs("theme", "x3", "ownerhomedir", "/var/cpanel/userhomes/cpanel", "brandingpkg", "", "user", "cpanel", "homedir", ...) called at /usr/local/cpanel/Cpanel/ModReg.pm line 212
Cpanel::ModReg::__ANON__() called at /usr/local/cpanel/Cpanel/AccessIds.pm line 242
Cpanel::AccessIds::__ANON__() called at /usr/local/cpanel/Cpanel/ForkSync.pm line 126
Cpanel::ForkSync::__ANON__() called at /usr/local/cpanel/Cpanel/ForkSync.pm line 48
Cpanel::ForkSync::__ANON__() called at /usr/local/cpanel/3rdparty/perl/522/lib64/perl5/cpanel_lib/Try/Tiny.pm line 80
eval {...} called at /usr/local/cpanel/3rdparty/perl/522/lib64/perl5/cpanel_lib/Try/Tiny.pm line 71
Try::Tiny::try(CODE(0x31f9740), Try::Tiny::Catch=REF(0x327cc00)) called at /usr/local/cpanel/Cpanel/ForkSync.pm line 53
Cpanel::ForkSync::__ANON__() called at /usr/local/cpanel/Cpanel/ForkAsync.pm line 36
eval {...} called at /usr/local/cpanel/Cpanel/ForkAsync.pm line 36
Cpanel::ForkAsync::do_in_child(CODE(0x32936c8)) called at /usr/local/cpanel/Cpanel/ForkSync.pm line 60
Cpanel::ForkSync::new("Cpanel::ForkSync", CODE(0x31f9638)) called at /usr/local/cpanel/Cpanel/ForkSync.pm line 129
Cpanel::ForkSync::do_in_child(CODE(0x327ccf0)) called at /usr/local/cpanel/Cpanel/AccessIds.pm line 245
Cpanel::AccessIds::do_as_user_group("cpanel", undef, CODE(0x3201fb8)) called at /usr/local/cpanel/Cpanel/AccessIds.pm line 132
Cpanel::AccessIds::do_as_user("cpanel", CODE(0x3201fb8)) called at /usr/local/cpanel/Cpanel/ModReg.pm line 228
Cpanel::ModReg::rebuildsprites("x3", "method=scale_60percent,format=png,imgtype=icon,subtype=img|fo"..., 0, 0, 1, 0, 0) called at /usr/local/cpanel/bin/rebuild_sprites line 173
bin::rebuild_sprites::rebuild(bin::rebuild_sprites=HASH(0x180bdc8)) called at /usr/local/cpanel/bin/rebuild_sprites line 47
bin::rebuild_sprites::run() called at /usr/local/cpanel/bin/rebuild_sprites line 25
[2016-07-06 08:28:13 -0400] warn [rebuild_sprites] Cpanel::Exception::IO::DirectoryCreateError/(XID 8fx3k8) The system failed to create the directory "/var/cpanel/userhomes/cpanel/.cpanel/caches/dynamicui" because of an error:
at /usr/local/cpanel/Cpanel/Exception.pm line 220.
Cpanel::Exception::new("Cpanel::Exception::IO::DirectoryCreateError", HASH(0x324ee00)) called at /usr/local/cpanel/Cpanel/Exception.pm line 73
Cpanel::Exception::create("IO::DirectoryCreateError", HASH(0x324ee00)) called at /usr/local/cpanel/Cpanel/DynamicUI/Loader.pm line 304
Cpanel::DynamicUI::Loader::_get_dynamicui_cache_file_path_for_user("user_homedir", "/var/cpanel/userhomes/cpanel", "theme", "x3", "user_locale", "en", "brandingpkg", "") called at /usr/local/cpanel/Cpanel/DynamicUI/Loader.pm line 141
Cpanel::DynamicUI::Loader::__ANON__() called at /usr/local/cpanel/3rdparty/perl/522/lib64/perl5/cpanel_lib/Try/Tiny.pm line 80
eval {...} called at /usr/local/cpanel/3rdparty/perl/522/lib64/perl5/cpanel_lib/Try/Tiny.pm line 71
Try::Tiny::try(CODE(0x3230ba0), Try::Tiny::Catch=REF(0x321bd48)) called at /usr/local/cpanel/Cpanel/DynamicUI/Loader.pm line 156
Cpanel::DynamicUI::Loader::load_all_dynamicui_confs("theme", "x3", "ownerhomedir", "/var/cpanel/userhomes/cpanel", "brandingpkg", "", "user", "cpanel", "homedir", ...) called at /usr/local/cpanel/Cpanel/ModReg.pm line 212
Cpanel::ModReg::__ANON__() called at /usr/local/cpanel/Cpanel/AccessIds.pm line 242
Cpanel::AccessIds::__ANON__() called at /usr/local/cpanel/Cpanel/ForkSync.pm line 126
Cpanel::ForkSync::__ANON__() called at /usr/local/cpanel/Cpanel/ForkSync.pm line 48
Cpanel::ForkSync::__ANON__() called at /usr/local/cpanel/3rdparty/perl/522/lib64/perl5/cpanel_lib/Try/Tiny.pm line 80
eval {...} called at /usr/local/cpanel/3rdparty/perl/522/lib64/perl5/cpanel_lib/Try/Tiny.pm line 71
Try::Tiny::try(CODE(0x31f9740), Try::Tiny::Catch=REF(0x327cc00)) called at /usr/local/cpanel/Cpanel/ForkSync.pm line 53
Cpanel::ForkSync::__ANON__() called at /usr/local/cpanel/Cpanel/ForkAsync.pm line 36
eval {...} called at /usr/local/cpanel/Cpanel/ForkAsync.pm line 36
Cpanel::ForkAsync::do_in_child(CODE(0x32936c8)) called at /usr/local/cpanel/Cpanel/ForkSync.pm line 60
Cpanel::ForkSync::new("Cpanel::ForkSync", CODE(0x31f9638)) called at /usr/local/cpanel/Cpanel/ForkSync.pm line 129
Cpanel::ForkSync::do_in_child(CODE(0x327ccf0)) called at /usr/local/cpanel/Cpanel/AccessIds.pm line 245
Cpanel::AccessIds::do_as_user_group("cpanel", undef, CODE(0x3201fb8)) called at /usr/local/cpanel/Cpanel/AccessIds.pm line 132
Cpanel::AccessIds::do_as_user("cpanel", CODE(0x3201fb8)) called at /usr/local/cpanel/Cpanel/ModReg.pm line 228
Cpanel::ModReg::rebuildsprites("x3", "method=scale_60percent,format=png,imgtype=icon,subtype=img|fo"..., 0, 0, 1, 0, 0) called at /usr/local/cpanel/bin/rebuild_sprites line 173
bin::rebuild_sprites::rebuild(bin::rebuild_sprites=HASH(0x180bdc8)) called at /usr/local/cpanel/bin/rebuild_sprites line 47
bin::rebuild_sprites::run() called at /usr/local/cpanel/bin/rebuild_sprites line 25
at /usr/local/cpanel/Cpanel/DynamicUI/Loader.pm line 155.
Cpanel::DynamicUI::Loader::__ANON__(Cpanel::Exception::IO::DirectoryCreateError=HASH(0x1a5ff58)) called at /usr/local/cpanel/3rdparty/perl/522/lib64/perl5/cpanel_lib/Try/Tiny.pm line 103
Try::Tiny::try(CODE(0x3230ba0), Try::Tiny::Catch=REF(0x321bd48)) called at /usr/local/cpanel/Cpanel/DynamicUI/Loader.pm line 156
Cpanel::DynamicUI::Loader::load_all_dynamicui_confs("theme", "x3", "ownerhomedir", "/var/cpanel/userhomes/cpanel", "brandingpkg", "", "user", "cpanel", "homedir", ...) called at /usr/local/cpanel/Cpanel/ModReg.pm line 212
Cpanel::ModReg::__ANON__() called at /usr/local/cpanel/Cpanel/AccessIds.pm line 242
Cpanel::AccessIds::__ANON__() called at /usr/local/cpanel/Cpanel/ForkSync.pm line 126
Cpanel::ForkSync::__ANON__() called at /usr/local/cpanel/Cpanel/ForkSync.pm line 48
Cpanel::ForkSync::__ANON__() called at /usr/local/cpanel/3rdparty/perl/522/lib64/perl5/cpanel_lib/Try/Tiny.pm line 80
eval {...} called at /usr/local/cpanel/3rdparty/perl/522/lib64/perl5/cpanel_lib/Try/Tiny.pm line 71
Try::Tiny::try(CODE(0x31f9740), Try::Tiny::Catch=REF(0x327cc00)) called at /usr/local/cpanel/Cpanel/ForkSync.pm line 53
Cpanel::ForkSync::__ANON__() called at /usr/local/cpanel/Cpanel/ForkAsync.pm line 36
eval {...} called at /usr/local/cpanel/Cpanel/ForkAsync.pm line 36
Cpanel::ForkAsync::do_in_child(CODE(0x32936c8)) called at /usr/local/cpanel/Cpanel/ForkSync.pm line 60
Cpanel::ForkSync::new("Cpanel::ForkSync", CODE(0x31f9638)) called at /usr/local/cpanel/Cpanel/ForkSync.pm line 129
Cpanel::ForkSync::do_in_child(CODE(0x327ccf0)) called at /usr/local/cpanel/Cpanel/AccessIds.pm line 245
Cpanel::AccessIds::do_as_user_group("cpanel", undef, CODE(0x3201fb8)) called at /usr/local/cpanel/Cpanel/AccessIds.pm line 132
Cpanel::AccessIds::do_as_user("cpanel", CODE(0x3201fb8)) called at /usr/local/cpanel/Cpanel/ModReg.pm line 228
Cpanel::ModReg::rebuildsprites("x3", "method=scale_60percent,format=png,imgtype=icon,subtype=img|fo"..., 0, 0, 1, 0, 0) called at /usr/local/cpanel/bin/rebuild_sprites line 173
bin::rebuild_sprites::rebuild(bin::rebuild_sprites=HASH(0x180bdc8)) called at /usr/local/cpanel/bin/rebuild_sprites line 47
bin::rebuild_sprites::run() called at /usr/local/cpanel/bin/rebuild_sprites line 25
[2016-07-06 08:28:13 -0400] warn [rebuild_sprites] write() called with undefined filename at /usr/local/cpanel/Cpanel/FileUtils/Write.pm line 68.
Cpanel::FileUtils::Write::_write_to_tmpfile(undef, "{\"conf\":{\"x3-hd-closehover\":{\"subtype\":\"img\",\"type\":\"image\",\""..., 416, CODE(0x1be6930)) called at /usr/local/cpanel/Cpanel/FileUtils/Write.pm line 58
Cpanel::FileUtils::Write::overwrite(undef, "{\"conf\":{\"x3-hd-closehover\":{\"subtype\":\"img\",\"type\":\"image\",\""..., 416) called at /usr/local/cpanel/Cpanel/DynamicUI/Loader.pm line 173
Cpanel::DynamicUI::Loader::__ANON__() called at /usr/local/cpanel/3rdparty/perl/522/lib64/perl5/cpanel_lib/Try/Tiny.pm line 80
eval {...} called at /usr/local/cpanel/3rdparty/perl/522/lib64/perl5/cpanel_lib/Try/Tiny.pm line 71
Try::Tiny::try(CODE(0x3230ba0), Try::Tiny::Catch=REF(0x3280010)) called at /usr/local/cpanel/Cpanel/DynamicUI/Loader.pm line 177
Cpanel::DynamicUI::Loader::load_all_dynamicui_confs("theme", "x3", "ownerhomedir", "/var/cpanel/userhomes/cpanel", "brandingpkg", "", "user", "cpanel", "homedir", ...) called at /usr/local/cpanel/Cpanel/ModReg.pm line 212
Cpanel::ModReg::__ANON__() called at /usr/local/cpanel/Cpanel/AccessIds.pm line 242
Cpanel::AccessIds::__ANON__() called at /usr/local/cpanel/Cpanel/ForkSync.pm line 126
Cpanel::ForkSync::__ANON__() called at /usr/local/cpanel/Cpanel/ForkSync.pm line 48
Cpanel::ForkSync::__ANON__() called at /usr/local/cpanel/3rdparty/perl/522/lib64/perl5/cpanel_lib/Try/Tiny.pm line 80
eval {...} called at /usr/local/cpanel/3rdparty/perl/522/lib64/perl5/cpanel_lib/Try/Tiny.pm line 71
Try::Tiny::try(CODE(0x31f9740), Try::Tiny::Catch=REF(0x327cc00)) called at /usr/local/cpanel/Cpanel/ForkSync.pm line 53
Cpanel::ForkSync::__ANON__() called at /usr/local/cpanel/Cpanel/ForkAsync.pm line 36
eval {...} called at /usr/local/cpanel/Cpanel/ForkAsync.pm line 36
Cpanel::ForkAsync::do_in_child(CODE(0x32936c8)) called at /usr/local/cpanel/Cpanel/ForkSync.pm line 60
Cpanel::ForkSync::new("Cpanel::ForkSync", CODE(0x31f9638)) called at /usr/local/cpanel/Cpanel/ForkSync.pm line 129
Cpanel::ForkSync::do_in_child(CODE(0x327ccf0)) called at /usr/local/cpanel/Cpanel/AccessIds.pm line 245
Cpanel::AccessIds::do_as_user_group("cpanel", undef, CODE(0x3201fb8)) called at /usr/local/cpanel/Cpanel/AccessIds.pm line 132
Cpanel::AccessIds::do_as_user("cpanel", CODE(0x3201fb8)) called at /usr/local/cpanel/Cpanel/ModReg.pm line 228
Cpanel::ModReg::rebuildsprites("x3", "method=scale_60percent,format=png,imgtype=icon,subtype=img|fo"..., 0, 0, 1, 0, 0) called at /usr/local/cpanel/bin/rebuild_sprites line 173
bin::rebuild_sprites::rebuild(bin::rebuild_sprites=HASH(0x180bdc8)) called at /usr/local/cpanel/bin/rebuild_sprites line 47
bin::rebuild_sprites::run() called at /usr/local/cpanel/bin/rebuild_sprites line 25
at /usr/local/cpanel/Cpanel/DynamicUI/Loader.pm line 176.
Cpanel::DynamicUI::Loader::__ANON__(__CPANEL_HIDDEN__...) called at /usr/local/cpanel/3rdparty/perl/522/lib64/perl5/cpanel_lib/Try/Tiny.pm line 103
Try::Tiny::try(CODE(0x3230ba0), Try::Tiny::Catch=REF(0x3280010)) called at /usr/local/cpanel/Cpanel/DynamicUI/Loader.pm line 177
Cpanel::DynamicUI::Loader::load_all_dynamicui_confs("theme", "x3", "ownerhomedir", "/var/cpanel/userhomes/cpanel", "brandingpkg", "", "user", "cpanel", "homedir", ...) called at /usr/local/cpanel/Cpanel/ModReg.pm line 212
Cpanel::ModReg::__ANON__() called at /usr/local/cpanel/Cpanel/AccessIds.pm line 242
Cpanel::AccessIds::__ANON__() called at /usr/local/cpanel/Cpanel/ForkSync.pm line 126
Cpanel::ForkSync::__ANON__() called at /usr/local/cpanel/Cpanel/ForkSync.pm line 48
Cpanel::ForkSync::__ANON__() called at /usr/local/cpanel/3rdparty/perl/522/lib64/perl5/cpanel_lib/Try/Tiny.pm line 80
eval {...} called at /usr/local/cpanel/3rdparty/perl/522/lib64/perl5/cpanel_lib/Try/Tiny.pm line 71
Try::Tiny::try(CODE(0x31f9740), Try::Tiny::Catch=REF(0x327cc00)) called at /usr/local/cpanel/Cpanel/ForkSync.pm line 53
Cpanel::ForkSync::__ANON__() called at /usr/local/cpanel/Cpanel/ForkAsync.pm line 36
eval {...} called at /usr/local/cpanel/Cpanel/ForkAsync.pm line 36
Cpanel::ForkAsync::do_in_child(CODE(0x32936c8)) called at /usr/local/cpanel/Cpanel/ForkSync.pm line 60
Cpanel::ForkSync::new("Cpanel::ForkSync", CODE(0x31f9638)) called at /usr/local/cpanel/Cpanel/ForkSync.pm line 129
Cpanel::ForkSync::do_in_child(CODE(0x327ccf0)) called at /usr/local/cpanel/Cpanel/AccessIds.pm line 245
Cpanel::AccessIds::do_as_user_group("cpanel", undef, CODE(0x3201fb8)) called at /usr/local/cpanel/Cpanel/AccessIds.pm line 132
Cpanel::AccessIds::do_as_user("cpanel", CODE(0x3201fb8)) called at /usr/local/cpanel/Cpanel/ModReg.pm line 228
Cpanel::ModReg::rebuildsprites("x3", "method=scale_60percent,format=png,imgtype=icon,subtype=img|fo"..., 0, 0, 1, 0, 0) called at /usr/local/cpanel/bin/rebuild_sprites line 173
bin::rebuild_sprites::rebuild(bin::rebuild_sprites=HASH(0x180bdc8)) called at /usr/local/cpanel/bin/rebuild_sprites line 47
bin::rebuild_sprites::run() called at /usr/local/cpanel/bin/rebuild_sprites line 25
Here's the permissions of that directory:
drwx------ 2 root root 4.0K Apr 27 22:26 /var/cpanel/userhomes/cpanel/.cpanel/caches/dynamicui/
It does in fact exist. The code in the MK.pm file is this:
my $returnvalue;
foreach my $i ( 0 .. $#dir_parts ) {
my $newdir = join( '/', @dir_parts[ 0 .. $i ] );
next if $newdir eq '';
my $is_dir = -d $newdir;
my $exists = -e _;
if ( !$exists ) {
my $local_mode = defined $mode ? $mode : $DEFAULT_PERMISSIONS;
if ( mkdir( $newdir, $local_mode ) ) {
push @{$created}, $newdir if $created;
$returnvalue++;
}
else {
Cpanel::Logger::logger(
{
'message' => "mkdir $newdir failed: $!",
'level' => 'warn',
'service' => __PACKAGE__,
'output' => $errors
}
);
return;
}
}
elsif ( !$is_dir ) {
Cpanel::Logger::logger(
{
'message' => "Encountered non-directory $newdir in path of $dir: $!",
'level' => 'warn',
'service' => __PACKAGE__,
'output' => $errors
}
);
$! = Errno::ENOTDIR();
last;
}
}
return $returnvalue;
I don't know a lot about perl, but to me, it seems the $exists variable isn't being properly populated. The directory exists, yet when we check to see if it does, perl thinks it doesn't. Any thoughts? I don't think this causes any real issues. I just thought the cPanel developers should be notified.
-
There's s link on top of every page of this forum titled: Defects You should use that to report a bug. :) 0 -
Thank you! I don't know how I missed that! Thanks!!!! 0 -
I have opened a ticket. I think I've provided a fix as well, although I don't really know perl. I think line 168: my $exists = -e _;
Should actually read:my $exists = -e $_;
It's hard for me to test though because when I run /scripts/upcp --force, /usr/local/cpanel/Cpanel/SafeDir/MK.pm gets replaced with the broken copy. Hopefully I get a response from cPanel and they can tell me if possible solution works and implement it or they can find a fix that works and implement that. Thanks for the help!0 -
Hello, To update, per the support ticket, the issue was addressed by ensuring ownership on the /var/cpanel/userhomes/cpanel/ directory and it's sub-directories matched the default values. Thank you. 0 -
Hello, To update, per the support ticket, the issue was addressed by ensuring ownership on the /var/cpanel/userhomes/cpanel/ directory and it's sub-directories matched the default values. Thank you.
Yes, it turns out it wasn't a bug, but a problem with proper ownership of the directory. Sorry for the inconvenience.0 -
Yes, it turns out it wasn't a bug, but a problem with proper ownership of the directory. Sorry for the inconvenience.
No problem! We're always happy to investigate potential bug reports. Thanks for taking the time to report the issue.0 -
Hello, To update, per the support ticket, the issue was addressed by ensuring ownership on the /var/cpanel/userhomes/cpanel/ directory and it's sub-directories matched the default values. Thank you.
I have a similar problem but I don't know exactly what permissions to change or what they should be changed to. My error log seems to be triggered by a Cron that is set by software by Installatron. And it also only started with 11.56.0.25 upgrade. It only occurs on one of my two servers - both have Installatron. The one with the error is fully dedicated - the other is a VPS. I don't have any problems except for a regular error message. Any suggestions would be appreciated.0 -
I have a similar problem but I don't know exactly what permissions to change or what they should be changed to. My error log seems to be triggered by a Cron that is set by software by Installatron. And it also only started with 11.56.0.25 upgrade. It only occurs on one of my two servers - both have Installatron. The one with the error is fully dedicated - the other is a VPS. I don't have any problems except for a regular error message. Any suggestions would be appreciated.
Could you let us know the specific error message you are receiving? Thank you.0 -
The "error" is in an email generated by a logscanner by CSF. These emails arrive every hour but are usually quite small but every 12 hours I get a much longer one. The time stamp of the extra "errors" is exactly the time of the installatron cron. I have attached a copy of the body of the email - including the reference to errors to do with sprites and slices which I believe I can ignore. The relevant lines are line 8 through 339. Thanks. 0 -
I suggest reporting the issue to the support team for Installatron, as this is a third-party application. It's possible you may need to update to a newer version of their software, or they may need to address a bug in their application. Thank you. 0
Please sign in to leave a comment.
Comments
10 comments