fideloper / Vaprobash

Vagrant Provisioning Bash Scripts
1.93k stars 497 forks source link

Vaprobash installs PHP 5.3 due to failed add-apt-repository #406

Open outofcontrol opened 9 years ago

outofcontrol commented 9 years ago

Laravel failed to install as it requires PHP 5.4 or greater. After a little research it would appear this line fails:

sudo add-apt-repository -y ppa:ondrej/php5-5.6

After installing

sudo apt-get python-software-properties

and running add-apt-repository, apt-key update and apt-get update, then removing and reinstalling php, I was able to update to PHP 5.6.

I checked out the Vaprobash script today with : curl -L http://bit.ly/vaprobash > Vagrantfile

My install is using VMWare and not VirtualBox.

fideloper commented 9 years ago

Hi!

That's interesting -

Did you change the Vagrantfile to use Precise (12.04) over Trusty (14.04)?

To my knowledge, Ubuntu 12.10 + uses the package "software-properties-common" to get the "add-apt-repository" command. The first three scripts run should install that and PHP 5.6.

Do you have any error output during provisioning that you can copy and paste?

Thanks

On Wed Oct 29 2014 at 2:52:34 PM James Riordon notifications@github.com wrote:

Laravel failed to install as it requires PHP 5.4 or greater. After a little research it would appear this line fails:

sudo add-apt-repository -y ppa:ondrej/php5-5.6

After installing

sudo apt-get python-software-properties

and running add-apt-repository, apt-key update and apt-get update, then removing and reinstalling php, I was able to update to PHP 5.6.

I checked out the Vaprobash script today with : curl -L http://bit.ly/vaprobash > Vagrantfile

My install is using VMWare and not VirtualBox.

— Reply to this email directly or view it on GitHub https://github.com/fideloper/Vaprobash/issues/406.

fideloper commented 9 years ago

To be more clear, 12.04 and lower used packages 'python-software-properties to get the command add-apt-repository, while Ubuntu 12.10+ uses software-properties-common.

This uses Ubuntu 14.04 as the base box, which to my testing has worked normally.

outofcontrol commented 9 years ago

Did you change the Vagrantfile to use Precise (12.04) over Trusty (14.04)?

No.

Vagrant.configure("2") do |config|

  # Set server to Ubuntu 14.04
  config.vm.box = "ubuntu/trusty64"

  config.vm.define "Vaprobash" do |vapro|
  end

These are the two boxes used:

ubuntu/trusty64 (vmware_fusion, 0) ubuntu/trusty64 (virtualbox, 14.04)

To my knowledge, Ubuntu 12.10 + uses the package "software-properties-common" to get the "add-apt-repository" command. The first three scripts run should install that and PHP 5.6.

Do you have any error output during provisioning that you can copy and paste?

Using PHPStorm and my terminal retention was too short. I've successfully install under VirtualBox, same Vagrant file. I'll try again under VMWare as soon as I get the plugin to reinstall.

outofcontrol commented 9 years ago

Can you recreate the issue on your end, or do you want me to give it another try here?

fideloper commented 9 years ago

Made a new box yesterday (via Virtualbox) which seemed to work fine, but I don't have VMWare installed on this computer currently to test it out :/

outofcontrol commented 9 years ago

Here is the pertinent output from running Vaprobash with VMware on an up-to-date box:

Which box I'm using:

vagrant up
Bringing machine 'Vaprobash' up with 'vmware_fusion' provider...
==> Vaprobash: Checking if box 'ubuntu/trusty64' is up to date...
==> Vaprobash: Verifying vmnet devices are healthy...
==> Vaprobash: Preparing network adapters...
==> Vaprobash: Starting the VMware VM...
==> Vaprobash: Waiting for machine to boot. This may

Installation of PHP 5.3 instead of 5.6:

==> Vaprobash: >>> Installing PHP
==> Vaprobash: Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /tmp/tmp.kZaTJXho1Y --trustdb-name /etc/apt/trustdb.gpg --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyserver keyserver.ubuntu.com --recv-keys 4F4EA0AAE5267A6C
==> Vaprobash: gpg:
==> Vaprobash: requesting key E5267A6C from hkp server keyserver.ubuntu.com
==> Vaprobash: gpg:
==> Vaprobash: key E5267A6C: public key "Launchpad PPA for Ondřej Surý" imported
==> Vaprobash: gpg:
==> Vaprobash: Total number processed: 1
==> Vaprobash: gpg:
==> Vaprobash:               imported: 1
==> Vaprobash:   (RSA: 1)
==> Vaprobash: sudo
==> Vaprobash: :
==> Vaprobash: add-apt-repository: command not found
==> Vaprobash: gpg:
==> Vaprobash: key 437D05B5: "Ubuntu Archive Automatic Signing Key <ftpmaster@ubuntu.com>" not changed
==> Vaprobash: gpg:
==> Vaprobash: key FBB75451: "Ubuntu CD Image Automatic Signing Key <cdimage@ubuntu.com>" not changed
==> Vaprobash: gpg:
==> Vaprobash: Total number processed: 2
==> Vaprobash: gpg:
==> Vaprobash:              unchanged: 2

and...

==> Vaprobash: Setting up php5-curl (5.3.10-1ubuntu3.15) ...
==> Vaprobash: Setting up php5-gd (5.3.10-1ubuntu3.15) ...
==> Vaprobash: Setting up php5-gmp (5.3.10-1ubuntu3.15) ...
==> Vaprobash: Setting up php5-imagick (3.1.0~rc1-1) ...
==> Vaprobash: Creating config file /etc/php5/conf.d/imagick.ini with new version
==> Vaprobash: Setting up php5-intl (5.3.10-1ubuntu3.15) ...
==> Vaprobash: Setting up php5-mcrypt (5.3.5-0ubuntu1) ...
==> Vaprobash: Setting up libmemcached6 (0.44-1.1build1) ...
==> Vaprobash: Setting up php5-memcached (1.0.2-2) ...
==> Vaprobash: Creating config file /etc/php5/conf.d/memcached.ini with new version
==> Vaprobash: Setting up php5-mysql (5.3.10-1ubuntu3.15) ...
==> Vaprobash: Setting up php5-pgsql (5.3.10-1ubuntu3.15) ...
==> Vaprobash: Setting up php5-xdebug (2.1.0-1) ...
==> Vaprobash: Creating config file /etc/php5/conf.d/xdebug.ini with new version
==> Vaprobash: Setting up gs-cjk-resource (1.20100103-3) ...
==> Vaprobash: Setting up libgs9 (9.05~dfsg-0ubuntu4.2) ...
==> Vaprobash: Setting up ghostscript (9.05~dfsg-0ubuntu4.2) ...
==> Vaprobash: Processing triggers for libc-bin ...
==> Vaprobash: ldconfig deferred processing now taking place
==> Vaprobash:  * Restarting PHP5 FastCGI Process Manager php5-fpm
==> Vaprobash:    ...done.

Composer and Laravel installation:

==> Vaprobash: >>> Installing Composer
==> Vaprobash: #!/usr/bin/env php
==> Vaprobash: All settings correct for using Composer
==> Vaprobash: Downloading...
==> Vaprobash:
==> Vaprobash: Composer successfully installed to: /home/vagrant/composer.phar
==> Vaprobash:
==> Vaprobash: Use it: php composer.phar
==> Vaprobash: Running provisioner: shell...
    Vaprobash: Running: /var/folders/cr/wrxv811d58v1516d_63q0tlr0000gn/T/vagrant-shell20141103-1939-a97yra.sh
==> Vaprobash: >>> Installing Laravel
==> Vaprobash: Installing laravel/laravel (v4.2.0)
==> Vaprobash:   - Installing laravel/laravel (v4.2.0)
==> Vaprobash:     Downloading: connection...
==> Vaprobash:
==> Vaprobash:     Downloading: 0%
==> Vaprobash:
==> Vaprobash:
==> Vaprobash:
==> Vaprobash:     Downloading: 10%
==> Vaprobash:
==> Vaprobash:     Downloading: 25%
==> Vaprobash:
==> Vaprobash:     Downloading: 35%
==> Vaprobash:
==> Vaprobash:     Downloading: 60%
==> Vaprobash:
==> Vaprobash:     Downloading: 70%
==> Vaprobash:
==> Vaprobash:     Downloading: 85%
==> Vaprobash:
==> Vaprobash:     Downloading: 100%
==> Vaprobash: Created project in /vagrant/laravel
==> Vaprobash: Loading composer repositories with package information
==> Vaprobash: Installing dependencies (including require-dev)
==> Vaprobash: Your requirements could not be resolved to an installable set of packages.
==> Vaprobash:
==> Vaprobash:   Problem 1
==> Vaprobash:     - laravel/framework v4.2.9 requires php >=5.4.0 -> no matching package found.
==> Vaprobash:     - laravel/framework v4.2.8 requires php >=5.4.0 -> no matching package found.
==> Vaprobash:     - laravel/framework v4.2.7 requires php >=5.4.0 -> no matching package found.
==> Vaprobash:     - laravel/framework v4.2.6 requires php >=5.4.0 -> no matching package found.
==> Vaprobash:     - laravel/framework v4.2.5 requires php >=5.4.0 -> no matching package found.
==> Vaprobash:     - laravel/framework v4.2.4 requires php >=5.4.0 -> no matching package found.
==> Vaprobash:     - laravel/framework v4.2.3 requires php >=5.4.0 -> no matching package found.
==> Vaprobash:     - laravel/framework v4.2.2 requires php >=5.4.0 -> no matching package found.
==> Vaprobash:     - laravel/framework v4.2.11 requires php >=5.4.0 -> no matching package found.
==> Vaprobash:     - laravel/framework v4.2.10 requires php >=5.4.0 -> no matching package found.
==> Vaprobash:     - laravel/framework v4.2.1 requires php >=5.4.0 -> no matching package found.
==> Vaprobash:     - laravel/framework v4.2.0 requires php >=5.4.0 -> no matching package found.
==> Vaprobash:     - Installation request for laravel/framework 4.2.* -> satisfiable by laravel/framework[v4.2.0, v4.2.1, v4.2.10, v4.2.11, v4.2.2, v4.2.3, v4.2.4, v4.2.5, v4.2.6, v4.2.7, v4.2.8, v4.2.9].
==> Vaprobash:
==> Vaprobash: Potential causes:
==> Vaprobash:  - A typo in the package name
==> Vaprobash:  - The package is not available in a stable-enough version according to your minimum-stability setting
==> Vaprobash:    see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.
==> Vaprobash:
==> Vaprobash: Read <http://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
==> Vaprobash:  * Reloading web server config apache2
==> Vaprobash:    ...done.
==> Vaprobash: Running provisioner: shell...
    Vaprobash: Running: /var/folders/cr/wrxv811d58v1516d_63q0tlr0000gn/T/vagrant-shell20141103-1939-15yyv7v.sh
==> Vaprobash: stdin: is not a tty
==> Vaprobash: >>> Installing Screen
==> Vaprobash: dpkg-preconfigure: unable to re-open stdin: No such file or directory
==> Vaprobash: Selecting previously unselected package screen.
==> Vaprobash: (Reading database ...
==> Vaprobash: 27629 files and directories currently installed.)
==> Vaprobash: Unpacking screen (from .../screen_4.0.3-14ubuntu8_amd64.deb) ...
==> Vaprobash: Processing triggers for ureadahead ...
==> Vaprobash: Setting up screen (4.0.3-14ubuntu8) ...

I've saved the complete output incase you want to see that. As mentioned previously, installing on Virtualbox using the exact same script works perfectly. This is VMWare specific.

fideloper commented 9 years ago

The base.sh file installs software-properties-common instead of python-software-properties, so I'm not sure how that's working out at all.

Are you using an older Vagrantfile? Can you double check the version on the top is set to the latest tag?

fideloper commented 9 years ago

You aren't commenting out the base.sh script, right?

fideloper commented 9 years ago

Lastly, the issue of composer not installing Laravel correctly is likely because Laravel 4.2 requires php 5.4 or greater, so this is probably a result of the same error.

outofcontrol commented 9 years ago

vagrant version: Vagrant 1.6.2

Vagrant file:

# -*- mode: ruby -*-
# vi: set ft=ruby :

# Config Github Settings
github_username = "fideloper"
github_repo     = "Vaprobash"
github_branch   = "1.2.0"
github_url      = "https://raw.githubusercontent.com/#{github_username}/#{github_repo}/#{github_branch}"

Not commenting out base.sh :)

  # Provision Base Packages
  config.vm.provision "shell", path: "#{github_url}/scripts/base.sh", args: [github_url, server_swap, server_timezone]

Here is a diff of my Vagrantfile from the working VirtualBox install and the VMWare install:

diff sandboxA/Vagrantfile  sandboxC/Vagrantfile
12c12
< hostname        = "sandboxa.dev"
---
> hostname        = "sandboxb.dev"
20c20
< server_ip             = "192.168.10.30"
---
> server_ip             = "192.168.11.29"
100c100
<     vb.name = "Sandbox"
---
>     vb.name = "SandboxB"
fideloper commented 9 years ago

huh, idk. If you're using vmware, potentially it's using ubuntu 12.04 instead of 14.04, which could explain that. I don't know how add-apt-repository or the software-properties-common install could fail.

is there error output from when it runs base.sh ?

On Mon Nov 03 2014 at 10:55:54 AM James Riordon notifications@github.com wrote:

vagrant version: Vagrant 1.6.2

Vagrant file:

-- mode: ruby --

vi: set ft=ruby :

Config Github Settings

github_username = "fideloper" github_repo = "Vaprobash" github_branch = "1.2.0" github_url = "https://raw.githubusercontent.com/#{github_username}/#{github_repo}/#{github_branch}"

Not commenting out base.sh :)

Provision Base Packages

config.vm.provision "shell", path: "#{github_url}/scripts/base.sh", args: [github_url, server_swap, server_timezone]

Here is a diff of my Vagrantfile from the working VirtualBox install and the VMWare install:

diff sandboxA/Vagrantfile sandboxC/Vagrantfile 12c12

< hostname = "sandboxa.dev"

hostname = "sandboxb.dev" 20c20

< server_ip = "192.168.10.30"

server_ip = "192.168.11.29" 100c100

< vb.name = "Sandbox"

vb.name = "SandboxB"

— Reply to this email directly or view it on GitHub https://github.com/fideloper/Vaprobash/issues/406#issuecomment-61498823.

alexvikman commented 9 years ago

It would seem that it pulls 12.04 when using VMware Fusion (or VMware in general, I suppose).

$ vagrant up Bringing machine 'Vaprobash' up with 'vmware_fusion' provider... ==> Vaprobash: Box 'ubuntu/trusty64' could not be found. Attempting to find and install... Vaprobash: Box Provider: vmware_desktop, vmware_fusion, vmware_workstation Vaprobash: Box Version: >= 0 ==> Vaprobash: Adding box 'ubuntu/trusty64' (v0) for provider: vmware_desktop, vmware_fusion, >vmware_workstation Vaprobash: Downloading: http://files.vagrantup.com/precise64_vmware.box

This of course breaks things (add-apt-repository, for instance, which requires python-software-properties).

If I instead provision it using --provider virtualbox, it tells me the following:

$ vagrant up --provider virtualbox Bringing machine 'Vaprobash' up with 'virtualbox' provider... ==> Vaprobash: Box 'ubuntu/trusty64' could not be found. Attempting to find and install... Vaprobash: Box Provider: virtualbox Vaprobash: Box Version: >= 0 ==> Vaprobash: Loading metadata for box 'ubuntu/trusty64' Vaprobash: URL: https://vagrantcloud.com/ubuntu/trusty64 ==> Vaprobash: Adding box 'ubuntu/trusty64' (v14.04) for provider: virtualbox Vaprobash: Downloading: https://vagrantcloud.com/ubuntu/boxes/trusty64/versions/14.04/providers/virtualbox.box ==> Vaprobash: Successfully added box 'ubuntu/trusty64' (v14.04) for 'virtualbox'!

Which installs 14.04 just like it should.

$ vagrant ssh Welcome to Ubuntu 14.04.1 LTS (GNU/Linux 3.13.0-40-generic x86_64)

tzoro commented 9 years ago

Same issue here. Is there any workaround?

fideloper commented 9 years ago

Looks like it needs updating to a vmware box. Does anyone here who uses vmware know which box (trusty64) is appropriate? https://atlas.hashicorp.com/boxes/search?provider=vmware_desktop&q=trusty&sort=&utf8=%E2%9C%93

tzoro commented 9 years ago

Manually installed php 5.6 as temporary fix. Not sure which box would be good.