cPanel Unattended Installation on CentOS7 with Kickstart cfg file - ERROR

Emirsah

Registered
Apr 24, 2019
1
0
1
Turkey
cPanel Access Level
Root Administrator
Hi Everybody,

I am trying to install cPanel Unattended to CentOS 7.
Centos6 can also install without problems, but centos 6 support will be finished

My kickstart installation script is;
Code:
------------------------------------------

##################Kickstart Begin
# Run the installer
install

# Run the text install
text

# Network configuration
network --device eth0 --onboot=yes --bootproto=static --ip=192.168.2.200 --netmask=255.255.255.0 --gateway=192.168.2.1 --nameserver=192.168.2.1,8.8.8.8

# Use URL  installation media
url --url="Index of /centos/7.6.1810/os/x86_64"


# Root password
rootpw --plaintext 123a456A

# Firewall Options
firewall --disabled

# Selinux Options
selinux --disabled

# System authorization information
authconfig --enableshadow --enablemd5

# System language
lang en_US.UTF-8

# Keyboard layouts
keyboard us

# System timezone
timezone Europe/Istanbul

# Skip X config
skipx

# Overwrite the MBR
zerombr

# Partition clearing information
clearpart --all --initlabel --drives=vda

# System bootloader configuration
bootloader --location=mbr --driveorder=vda

################## PARTITIONING LVM
part /boot --fstype ext4 --size=500
part swap --fstype="swap" --recommended
part pv.01     --size=1024  --grow  --ondisk=vda
volgroup vg00 pv.01
logvol / --vgname=vg00  --fstype=ext4  --size=2048 --grow --name=lv_root
logvol /tmp --vgname=vg00 --fstype=ext4 --size=512 --name=lv_tmp

# Do not run the Setup Agent on first boot
firstboot --disabled

# Logging only information
logging info

# Reboot the system when the install is complete
reboot

################## Packages
%packages --ignoremissing --excludedocs
@base
wget
%end

################## Post Configuration - Output /tmp/ks-post.log
%post --log=/tmp/ks-post-removable.log
echo -e "NETWORKING=yes\nHOSTNAME=sr01.emirsah.com\nGATEWAY=192.168.2.1" > /etc/sysconfig/network
echo -e "nameserver 192.168.2.1\nameserver 8.8.8.8" > /etc/resolv.conf
echo -e "sr01.emirsah.com" > /etc/hostname
echo -e "127.0.0.1\tlocalhost localhost.localdomain\n192.168.2.200\tsr01.emirsah.com" > /etc/hosts
yum update -y && yum upgrade -y ""
systemctl stop NetworkManager.service && systemctl disable NetworkManager.service ""
cd /home && wget  https://securedownloads.cpanel.net/latest ""
chmod +x latest  && sh latest ""
%end
------------------------------------------

The error I received at installation;

Code:
[2019-04-24 16:41:53 +0300]      Verifying  : mysql-community-common-5.7.25-1.el7.x86_64                   2/6
[2019-04-24 16:41:53 +0300]      Verifying  : mysql-community-server-5.7.25-1.el7.x86_64                   3/6
[2019-04-24 16:41:53 +0300]      Verifying  : mysql-community-devel-5.7.25-1.el7.x86_64                    4/6
[2019-04-24 16:41:53 +0300]      Verifying  : mysql-community-client-5.7.25-1.el7.x86_64                   5/6
[2019-04-24 16:41:53 +0300]      Verifying  : mysql-community-libs-compat-5.7.25-1.el7.x86_64              6/6
[2019-04-24 16:41:54 +0300]
[2019-04-24 16:41:54 +0300]   Complete!
[2019-04-24 16:41:54 +0300]   Mysql installed from official repository.
[2019-04-24 16:41:54 +0300]   Building configuration.
[2019-04-24 16:41:54 +0300]   This step may produce some errors or warnings in the log. The errors are usually harmless and are a result of table changes between versions of MySQL or MariaDB.
[2019-04-24 16:41:54 +0300]   Running: /usr/local/cpanel/bin/build_mysql_conf
[2019-04-24 16:41:54 +0300]   The mysql.user table is missing, mysql_install_db will be called to recreate it.
[2019-04-24 16:42:42 +0300]   Waiting for “mysql” to start ……………failed.
[2019-04-24 16:42:42 +0300]   Waiting for “mysql” to start …………mysql has failed. Contact your system administrator if the service does not automagically recover.
[2019-04-24 16:42:52 +0300]   Waiting for “mysql” to start …………Running /usr/local/cpanel/scripts/mysqlconnectioncheck.
[2019-04-24 16:42:52 +0300]   Waiting for “mysql” to start …………Use of uninitialized value in string eq at /usr/local/cpanel/Cpanel/RestartSrv/Systemd.pm line 81.
[2019-04-24 16:42:52 +0300]   Waiting for “mysql” to start …………
[2019-04-24 16:42:52 +0300]   Done building configuration.
[2019-04-24 16:42:52 +0300]   Hooks system enabled.
[2019-04-24 16:42:52 +0300]   Checking for and running RPM::Versions 'post' hooks for any RPMs about to be installed
[2019-04-24 16:42:52 +0300]   All required 'post' hooks have been run
[2019-04-24 16:42:52 +0300]   Running: /usr/local/cpanel/scripts/check_cpanel_rpms --targets=MySQL41,MySQL50,MySQL51,MySQL55,MySQL56,MySQL57,MariaDB100,MariaDB101,MariaDB102,MariaDB103 --fix
Use of uninitialized value in string eq at /usr/local/cpanel/Cpanel/RestartSrv/Systemd.pm line 81.
Use of uninitialized value in string eq at /usr/local/cpanel/Cpanel/RestartSrv/Systemd.pm line 81.
Use of uninitialized value in string eq at /usr/local/cpanel/Cpanel/ServiceManager/Base.pm line 1210.
Waiting for “mysql” to start ………Use of uninitialized value in string eq at /usr/local/cpanel/Cpanel/RestartSrv/Systemd.pm line 81.
Running in chroot, ignoring request.
…Use of uninitialized value in string eq at /usr/local/cpanel/Cpanel/RestartSrv/Systemd.pm line 81.
Running in chroot, ignoring request.
…failed.

Cpanel::Exception::Services::StartError
Service Status

Service Error
        (XID 6tvfqw) The “mysql” service failed to start.

Use of uninitialized value in string eq at /usr/local/cpanel/Cpanel/RestartSrv/Systemd.pm line 81.
Running in chroot, ignoring request.
mysql has failed. Contact your system administrator if the service does not automagically recover.
2019-04-24 16:43:41  333 [15261] (FATAL): The system failed to run the /usr/local/cpanel/scripts/cpanel_initial_install script.

How to Unattended Installation cPanel on CentOS7 with Kickstart
 
Last edited by a moderator:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,261
463
Hello @Emirsah,

Here's a paraphrased quote from one of our Technical Analysts responding to a similar question:

The issue is that when your kickstart process is running the cPanel installer, it is actually still in the LiveOS for the CentOS installer, and isn't actually booted to the new server.

The way that Kickstart works around this is by running your postinstall stuff in a chroot.

However, the cpanel install script will use systemctl from within the chroot which will communicate with the running systemd PID 1, which is running outside of the chroot.

Systemd/systemctl refuses to start services under these circumstances.

This means that at the point where the installer needs to be able to start up MySQL, it can't. That is why the installation fails.

I believe the only solution would be to have your kickstart script do everything else it needs, then reboot to the new OS -- and you could then have the cPanel install script run post-reboot, where systemd won't be running in a chroot, and it won't complain.

I have seen some providers have their kickstart setup an @reboot cron job to run a shell script which waits until everything is up and running, runs the cPanel installer, and then removes it's own cron job.
Can you let me know if this information is helpful?

Thank you.