PEAR upgrade in DAB Jessie

apmuthu

Well-Known Member
Feb 26, 2009
807
8
58
Chennai - India & Singapore
github.com
While creating a Debian 8 (Jessie) template using DAB,
Code:
apt-get install php-pear
is successful, but thereafter
Code:
pear upgrade
fails since
Code:
/etc/resolv.conf
has not yet been created with a valid nameserver as that happens only on VM creation. A possible workaround is:
Code:
    apt-get install php-pear

    echo "nameserver 8.8.8.8" > ${BASEDIR}/etc/resolv.conf
    dab exec pear upgrade
    dab exec pear install mail Net_SMTP Auth_SASL
    rm -f ${BASEDIR}/etc/resolv.conf
 
Last edited:
Even the above still fails with:
Code:
install: php-pear
echo "nameserver 8.8.8.8" > /var/lib/vz/private/90000/etc/resolv.conf
dab exec pear upgrade
Error getting channel info from pear.php.net: Connection to `pear.php.net:80' failed: php_network_getaddresses: getaddrinfo failed: Name or service not known
Error getting channel info from pear.php.net: Connection to `pear.php.net:80' failed: php_network_getaddresses: getaddrinfo failed: Name or service not known
Error getting channel info from pear.php.net: Connection to `pear.php.net:80' failed: php_network_getaddresses: getaddrinfo failed: Name or service not known
Error getting channel info from pear.php.net: Connection to `pear.php.net:80' failed: php_network_getaddresses: getaddrinfo failed: Name or service not known
Error getting channel info from pear.php.net: Connection to `pear.php.net:80' failed: php_network_getaddresses: getaddrinfo failed: Name or service not known
Error getting channel info from pecl.php.net: Connection to `pecl.php.net:80' failed: php_network_getaddresses: getaddrinfo failed: Name or service not known
Nothing to upgrade
dab exec pear install mail Net_SMTP Auth_SASL
No releases available for package "pear.php.net/mail"
No releases available for package "pear.php.net/Net_SMTP"
No releases available for package "pear.php.net/Auth_SASL"
install failed
ve_exec failed - status 1
ve_exec failed - status 1
make: *** [all] Error 1

Hence the only way possible is as was done for wheezy in my Aug 2014 post Offline PEAR Install in DAB Makefile.
 
In the DAB files folder, the logfile shows only localhost loopback:
Code:
...
...
Creating config file /etc/php5/mods-available/curl.ini with new version
php5_invoke: Enable module curl for apache2 SAPI
php5_invoke: Enable module curl for cli SAPI
Setting up php5-apcu (4.0.7-1) ...
php5_invoke: Enable module apcu for apache2 SAPI
php5_invoke: Enable module apcu for cli SAPI
Setting up php-apc (4.0.7-1) ...
Processing triggers for libapache2-mod-php5 (5.6.22+dfsg-0+deb8u1) ...
Processing triggers for libc-bin (2.19-18+deb8u4) ...

dab: exec /sbin/ifconfig
lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

dab exec cat /etc/network/interfaces
auto lo
iface lo inet loopback

Must we try a bridged dhcp and temporarily restart networking? DAB gets it's stuff from the internet through the PVE host's internet connection - how can that be leveraged to enable a pear upgrade during template build?
 
Last edited:
Please provide DAB commands for chroot and whether it will work in the old PVE 3.x DAB for OpenVZ template generation especially when only the bootstrap files are available at that time during the build. At that point in the build process if we error out and enter the build container using pvebash 90000 private we can do a pear upgrade with just the /etc/resolv.conf present.
 
Finally got it!
Place a file called dopear.sh with the following contents in the DAB build folder:
Code:
#! /bin/bash

pear upgrade
pear install mail Net_SMTP Auth_SASL

In the Makefile, insert the following (includes the php-pear install request as well):
Code:
    dab install libjs-jquery php-apc php5-apcu php-pear php5-mysql php5-curl php-pear
#    # Pear v 1.9.5 gets installed
    install -m 0755 dopear.sh ${BASEDIR}/dopear.sh
    echo "nameserver 8.8.8.8" > ${BASEDIR}/etc/resolv.conf
    /usr/sbin/chroot ${BASEDIR} /dopear.sh
    rm -f ${BASEDIR}/etc/resolv.conf
    rm -f ${BASEDIR}/dopear.sh
#    # Pear gets upgraded to v 1.10.1
    sed -e 's/5\.1\.0/6.1.0/g' -i ${BASEDIR}/usr/share/php/Net/SMTP.php

It works like a charm!
Thanks @LnxBil.

Tested in PVE 3.4 DAB for OpenVZ based on Jessie 64 bit.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!