outroll / vesta

VESTA Control Panel
http://vestacp.com
GNU General Public License v3.0
2.97k stars 1.03k forks source link

Ubuntu 16.04 installation fails on Error: php-fpm start failed #1025

Closed drsdre closed 7 years ago

drsdre commented 7 years ago

Operating System (OS/VERSION):

Ubuntu 16.04

VestaCP Version:

R17

Installed Software (what you got with the installer):

bash vst-install.sh --nginx yes --phpfpm yes --apache no --vsftpd no --proftpd no --exim no --dovecot no --spamassassin no --clamav no --named no --iptables yes --fail2ban yes --mysql yes --postgresql no --remi yes --quota no

Steps to Reproduce:

On first run of installation string above, it fails with:

...
--2017-01-09 09:59:50--  http://c.vestacp.com/ubuntu/16.04/php-fpm/www.conf
Resolving c.vestacp.com (c.vestacp.com)... 104.236.66.100
Connecting to c.vestacp.com (c.vestacp.com)|104.236.66.100|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 204 [text/plain]
Saving to: '/etc/php/7.0/fpm/pool.d/www.conf'

/etc/php/7.0/fpm/pool.d/www.conf      100%[=========================================================================>]     204  --.-KB/s    in 0s      

2017-01-09 09:59:51 (32.0 MB/s) - '/etc/php/7.0/fpm/pool.d/www.conf' saved [204/204]

insserv: script php-fpm: service php7.0-fpm already provided!
Error: php-fpm start failed

After a reboot, the php7.0-fpm server is started but as the installation process got terminated half way, VestaCP is not reachable.

Forcing the the installation will have it fail again at configuring php fpm 7.0:

insserv: script php-fpm: service php7.0-fpm already provided!
--2017-01-09 10:45:52--  http://c.vestacp.com/ubuntu/16.04/php-fpm/www.conf
Resolving c.vestacp.com (c.vestacp.com)... 104.236.66.100
Connecting to c.vestacp.com (c.vestacp.com)|104.236.66.100|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 204 [text/plain]
Saving to: '/etc/php/7.0/fpm/pool.d/www.conf'

/etc/php/7.0/fpm/pool.d/www.conf      100%[=========================================================================>]     204  --.-KB/s    in 0s      

2017-01-09 10:45:52 (25.2 MB/s) - '/etc/php/7.0/fpm/pool.d/www.conf' saved [204/204]

usage: update-rc.d [-n] [-f] <basename> remove
       update-rc.d [-n] <basename> disable|enable [S|2|3|4|5]
        -n: not really
        -f: force

The disable|enable API is not stable and might change in the future.
Usage: /etc/init.d/php-fpm7.0 {start|stop|status|restart|reload|force-reload}
Error: php-fpm start failed
drsdre commented 7 years ago

The issues seems to be related to line 872 of vst-install-ubuntu.sh:

php_fpm=$(ls /etc/init.d/php*-fpm* |cut -f 4 -d /)

The result of this function is two upstart jobs instead of the expected one job:

ls /etc/init.d/php*-fpm* |cut -f 4 -d /
php-fpm
php7.0-fpm
drsdre commented 7 years ago

The following changes fixes the situation for me. First of all I'm filtering out the symlinked php-fpm. Second I have added the ability to handle multiple PHP versions by looping through the resultset and thus all php-fpm init job are triggered. But only one php fpm init job can be symlinked, so most likely more changes are required to handle multiple PHP versions.

    for php_fpm in $(ls /etc/init.d/php*-fpm* |grep -v "php-fpm"|cut -f 4 -d /); do
        ln -s /etc/init.d/$php_fpm /etc/init.d/php-fpm > /dev/null 2>&1
        update-rc.d $php_fpm defaults
        service $php_fpm start
        check_result $? "php-fpm start failed"
    done
Lupul commented 7 years ago

Similar problem is found when editing php.ini or php-fpm configs (ex: :8083/edit/server/php-fpm/) Script v-change-sys-service-config cannot find the correct service name https://github.com/serghey-rodin/vesta/blob/master/bin/v-change-sys-service-config#L98

    if [ "$service" = 'php' ]; then
        if [ "$WEB_SYSTEM" = "nginx" ]; then
--          service=$(ls /usr/sbin/php*fpm* |cut -f 4 -d /)
++          service=$(ls /etc/init.d/php*fpm* |cut -f 4 -d /| sort | head -1)
        else
            service=$WEB_SYSTEM
        fi
    fi
SnAFKe commented 7 years ago

I've similar problem with a clean ubuntu 14.04.

I can't install vesta because php-fpm issue.

Saving to: ‘/etc/php5/fpm/pool.d/www.conf’

100%[======================================>] 204 --.-K/s in 0s

2017-02-23 01:22:25 (27.9 MB/s) - ‘/etc/php5/fpm/pool.d/www.conf’ saved [204/204]

update-rc.d: warning: start runlevel arguments (none) do not match php5-fpm Default-Start values (2 3 4 5) update-rc.d: warning: stop runlevel arguments (none) do not match php5-fpm Default-Stop values (0 1 6) usage: update-rc.d [-n] [-f] remove update-rc.d [-n] defaults [NN | SS KK] update-rc.d [-n] start|stop NN runlvl [runlvl] [...] . update-rc.d [-n] disable|enable [S|2|3|4|5] -n: not really -f: force

The disable|enable API is not stable and might change in the future. Error: php-fpm start failed

ls -la /etc/init.d/php*-fpm* -rwxr-xr-x 1 root root 4403 Feb 17 2014 /etc/init.d/php5-fpm lrwxrwxrwx 1 root root 20 Feb 23 01:05 /etc/init.d/php-fpm -> /etc/init.d/php5-fpm

# php -v PHP 5.5.9-1ubuntu4.21 (cli) (built: Feb 9 2017 20:54:58) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies

SnAFKe commented 7 years ago

Also happend in the installer when is in this part.

 System start/stop links for /etc/init.d/fail2ban already exist.
 * Starting authentication failure monitor fail2ban                               [ OK ]
Error: php-fpm restart failed
Error: can't create domain.com domain

Point to

https://github.com/serghey-rodin/vesta/blob/master/install/vst-install-ubuntu.sh#L1220

I'm not sure what is refering for when try to restart php-fpm

praisegeek commented 7 years ago

Fixed? Having similar issues as @SnAFKe mentioned

OS: Ubuntu 14.04.5 x64

bash vst-install.sh --nginx yes --phpfpm yes --apache no --named yes --remi yes --vsftpd yes --proftpd no --iptables yes --fail2ban yes --quota yes --exim yes --dovecot yes --spamassassin yes --clamav yes --mysql yes --postgresql yes --hostname panel.123.com --email 123@123.com --password 123

oquidave commented 7 years ago

There are some proposed changes to the v-restart-web-backend script;

php_fpm=$(ls /etc/init.d/php*-fpm* 2>/dev/null |cut -f 4 -d /)
if [ -z "$php_fpm" ]; then
    service $WEB_BACKEND restart >/dev/null 2>&1
else
    service $php_fpm restart >/dev/null 2>&1
fi

https://github.com/serghey-rodin/vesta/commit/76d518bf864fd6e53a36253c12d8e78d9c61a7a7 This solved my issue

Lupul commented 7 years ago

This previous mentioned commit does not work for Ubuntu 16.04 at least. The installer creates a symlink in that folder so it will return two files (as @SnAFKe shown earlier)

$ ls -l /etc/init.d/php*-fpm* 
lrwxrwxrwx 1 root root   22 Jul 30 04:11 /etc/init.d/php-fpm -> /etc/init.d/php7.0-fpm
-rwxr-xr-x 1 root root 4987 May 12 02:12 /etc/init.d/php7.0-fpm

So correct fix would either use the created symlink and not scan that folder or ignore symlinks when listing that folder content:

$ ls -l /etc/init.d/php*-fpm* | grep -v ^l |  cut -f 4 -d /
php7.0-fpm
mehargags commented 7 years ago

Hi, I was just installing an Apache-less VestaCP on Debian 8.7 and I installed PHP 7.1 side-by-side to PHP 5.6

I'd like to keep both PHP versions and edit manually (or create template later) to use PHP 5 or PHP 7 anytime.

But encountered this same problem of vestaCP Error: php-fpm pool doesn't exist

I'm not sure which file to edit in this comments above v-restart-web-backend , v-add-web-domain-backend , v-add-web-domain , v-add-domain

as I can't find what exact place you need to put the proposed change

php_fpm=$(ls /etc/init.d/php*-fpm* 2>/dev/null |cut -f 4 -d /)
if [ -z "$php_fpm" ]; then
    service $WEB_BACKEND restart >/dev/null 2>&1
else
    service $php_fpm restart >/dev/null 2>&1
fi

Please let me know solutions for this tagging @dpeca @serghey-rodin

dpeca commented 7 years ago

I never used php-fpm on production server (except testing long time ago on virtual machine) so my knowledge about php-fpm is very very small :(

anton-reutov commented 7 years ago

Debian 8, Ubuntu 14 officially is not supported php 7x by default On Ubuntu 16x i cant reproduce problem with restarting php-fpm during the installation process

working-name commented 6 years ago

Don't know why this is closed, it's still an issue today, March 22 2018. It fails to install on a brand new Ubuntu 14 minimal.

Nou4r commented 5 years ago

PUSH THIS!

Sakvojage commented 5 years ago

I have multiple php-fpm versions and face this issue as well.