Fatal error on server provision [composer: install composer]

Hi I’m trying to provision a procution server and the task is failing on:
[composer: install composer]

the following error

FAILED! => {"cache_update_time": 0, "cache_updated": false, "changed": false, "failed": true, "msg": "'/usr/bin/apt-get -y -o \"Dpkg::Options::=--force-confdef\" -o \"Dpkg::Options::=--force-confold\" --force-yes  install 'php5-composer'' failed: E: Unable to correct problems, you have held broken packages.\n", "stderr": "E: Unable to correct problems, you have held broken packages.\n", "stdout": "Reading package lists...\nBuilding dependency tree...\nReading state information...\nSome packages could not be installed. This may mean that you have\nrequested an impossible situation or if you are using the unstable\ndistribution that some required packages have not yet been created\nor been moved out of Incoming.\nThe following information may help to resolve the situation:\n\nThe following packages have unmet dependencies:\n php5-composer : Depends: php5-cli but it is not going to be installed or\n                          hhvm but it is not installable\n", "stdout_lines": ["Reading package lists...", "Building dependency tree...", "Reading state information...", "Some packages could not be installed. This may mean that you have", "requested an impossible situation or if you are using the unstable", "distribution that some required packages have not yet been created", "or been moved out of Incoming.", "The following information may help to resolve the situation:", "", "The following packages have unmet dependencies:", " php5-composer : Depends: php5-cli but it is not going to be installed or", "                          hhvm but it is not installable"]}```

I updated trellis and bedrock today to the latest releases. I've googled around the error messages but haven't been able to sort it out. I'd love some help in getting this resolved!!

It’s not always possible to upgrade Trellis versions and seamlessly re-provision a server. Sometimes manual intervention is needed to fix situations like this. In the future we’ll try and do a better job of documenting “breaking” changes and how to fix them.

Seems like you’re going from a version of Trellis with PHP5 or HHVM install to the latest with PHP7 installed? This actually did work seamlessly at first but the Ubuntu PHP ppa has recently changed a lot which might be breaking this.

I don’t know the exact solution for this but it probably involves manually uninstalling PHP5/HHVM and then re-provision again after to get PHP7 installed.

Another choice is to just destroy the server and create a new one if, hopefully, all your configuration changes were done through Ansible. And always back up the DB first and/or anything local on the server like uploads.

There’s always a possibility that the switch to PHP7 may break something on your site as well. The odds are slim but you never know, might be worth it to try on another server first.

It is actually a brand new DO droplet - though the project has been previously running on a staging server on a separate droplet.

It seemed odd to me that the php5 stuff should be there.

I tried to run aptitude -f install php5-composer and the alert is:

 php7.0-cli : Breaks: php5-cli (< 5.6.16+dfsg-4~) but 5.5.9+dfsg-1ubuntu4.14 is to be installed.```
I'm looking back over my files to see if I can see where the php 5 version dependancy might be coming from.

Not sure how you updated Trellis but maybe it left behind old code. We actually use a galaxy role for Composer now: https://github.com/geerlingguy/ansible-role-composer

It doesn’t even use apt to install Composer so php5-composer shouldn’t be anywhere in the code anymore.

Just to confirm, that yes you must have some old code still in there. It was changed with the switch to PHP7 in December: https://github.com/roots/trellis/commit/1c8cea31f878fc42f0c76ec40ba25fe1f1a9e529

Mm. yes that looks like it could be the culprit. I’ll check and re-update my trellis and see how that works

That was indeed the problem. For some reason everythig was up to date, but I still had a roles/composer/
folder there that should have been removed:

All is good!