Could not find imported module support code for setup

I think this is probably a good guess: ansible runs locally, not on the remote server, so ansible errors have to be local (afaik). My first guess based on your errors would be a python version problem, since it looks like it’s trying to find python stuff that doesn’t exist.

I agree. I’m still wondering how I would troubleshoot this… I don’t really understand the error, I’ve never seen it before… I haven’t changed anything on my computer since a few weeks ago when all my bedrock/trellis sites were working :frowning:

Are you using recent Trellis?
Can you ssh into the Vagrant box and check what repositories are used for the packages?

I’m using an older version of trellis (I tried to update but something went wrong and I had to revert everything). Sorry for the dumb question, but can you tell me what you mean by “check what repositories are used for the packages”? After I ssh onto to local server, where should I look?

List all currently installed PHP related packages:
apt list --installed | grep php
Are those PHP packages from the ondrej/sury repository?
What repositories do /etc/apt/sources.list and /etc/apt/sources.list.d contain?
ondrey/sury?
Those PPAs are used by Trellis for more recent PHP packages.

apt list --installed | grep php actually returned nothing on two local servers I tried (neither are working - can’t spin up local environment or provision or deploy…). Should I just install php manually, or maybe this is indicative of a larger problem…

I installed php on one of the servers but still no luck. The source.list file on both contains the following:

# deb cdrom:[Ubuntu-Server 18.04.1 LTS _Bionic Beaver_ - Release amd64 (20180725)]/ bionic main restricted

#deb cdrom:[Ubuntu-Server 18.04.1 LTS _Bionic Beaver_ - Release amd64 (20180725)]/ bionic main restricted

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://archive.ubuntu.com/ubuntu/ bionic main restricted
# deb-src http://archive.ubuntu.com/ubuntu/ bionic main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://archive.ubuntu.com/ubuntu/ bionic-updates main restricted
# deb-src http://archive.ubuntu.com/ubuntu/ bionic-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://archive.ubuntu.com/ubuntu/ bionic universe
# deb-src http://archive.ubuntu.com/ubuntu/ bionic universe
deb http://archive.ubuntu.com/ubuntu/ bionic-updates universe
# deb-src http://archive.ubuntu.com/ubuntu/ bionic-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 
## team, and may not be under a free licence. Please satisfy yourself as to 
## your rights to use the software. Also, please note that software in 
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://archive.ubuntu.com/ubuntu/ bionic multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ bionic multiverse
deb http://archive.ubuntu.com/ubuntu/ bionic-updates multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ bionic-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu bionic partner
# deb-src http://archive.canonical.com/ubuntu bionic partner

deb http://security.ubuntu.com/ubuntu bionic-security main restricted
# deb-src http://security.ubuntu.com/ubuntu bionic-security main restricted
deb http://security.ubuntu.com/ubuntu bionic-security universe
# deb-src http://security.ubuntu.com/ubuntu bionic-security universe
deb http://security.ubuntu.com/ubuntu bionic-security multiverse
# deb-src http://security.ubuntu.com/ubuntu bionic-security multiverse

The source.listd directory was empty on the one I have not installed php on, and on the other it looks like this:

-rw-r--r-- 1 root root  146 Aug 27 15:46 ondrej-ubuntu-nginx-mainline-xenial.list
-rw-r--r-- 1 root root  124 Aug 27 15:46 ondrej-ubuntu-php-xenial.list
-rw-r--r-- 1 root root  124 Aug 27 15:46 ondrej-ubuntu-php-xenial.list.save

So the PPAs for PHP are there.
Can you apt update and then install php7.1-cli manually using apt?
Does that work, can it find the package for this version?

when I ran those commands it gave me this error:

On the server where I just installed php:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package php7.1-cli
E: Couldn't find any package by glob 'php7.1-cli'
E: Couldn't find any package by regex 'php7.1-cli'

On the other server:

E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.

Not trying to mislead you, but when I search for the package php7.1-cli in the ondrej PPA (that is used by Trelils), I can’t find it:

Also no php7.1 packages for focal (Ubuntu 20.04):
https://packages.ubuntu.com/search?lang=en&suite=focal&searchon=names&keywords=php7.1

Could it be that you are trying to install a very old PHP 7.x release?
PHP 7.4.x is the latest release.

Hm, that’s interesting. In my case I couldn’t install anything but php 7.0. But let me ask you a dumb question - am I supposed to be installing php on the local server manually? Every time I’ve done it in the past, I didn’t need to do any work on the vagrant server…

Trellis should install latest PHP 7.x (currently 7.4.x). The sury/ondrej PPA repository is used for up-to-date PHP packages (https://deb.sury.org/).

The php_version variable was recently introduced that allows easy global toggling of PHP version in Trellis.

  • What is the actual distribution running in the vagrant box? (ssh into it and use lsb_release -a).
    It must not be above 20.04 as this may be the reason for why there aren’t any PHP packages in the PPA (currently) for that distribution. I had this issue recently, see this thread:
    Deb.sury.org or groovy-updates,groovy-security?
  • What value does the php_version have in your Trellis project?

I figured that’s the case.

This is the output from running the command lsb_release on the local server:

No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 16.04.1 LTS
Release:	16.04
Codename:	xenial

and I didn’t see a php_version variable (I did a search with grep in the trellis directory - I think that’s a feature added to later trellis versions), BUT in /trellis/roles/php it’s all PHP 7.1. Earlier this month I tried to change it to PHP 7.4, but doing so broke the staging site, so I changed it back…

Right, so the issue is that the current distribution is too new for PHP 7.1, hence no packages are found.
The best path IMHO is to upgrade to PHP 7.4 and check the site error logs (its a dev/staging environment at last) and fix those errors. It could well be caused by missing PHP extensions rather than code incompatibilities.

Thanks for the quick reply. The current distribution of what is too new for PHP 7.1? Everything is fully reverted, so it’s the same as it was before I tried updating PHP, which is why my gut is that it should be closer to working with PHP 7.1, but tell me if I’m wrong about that…(and ALL local vagrant sites are broken)

Hmm, there is PHP 7.1 for some distributions on that PPA though:

For Ubuntu 21.04; 20.04 and 18.04.

So try package php7.1 version 7.1.33-40?

Edit: But I can’t find one for Ubuntu 16.04! So they removed it from the PPA? I think this is the most probable explanation.

so the only thing to do is try upgrading to PHP 7.4 (again)?

Yes, PHP 7.1 is EOL for at least one year now - no patches or updates. Also PHP 7.2 is also already EOL.
https://www.php.net/eol.php

IMHO there shouldn’t be many incompatibilities when updating from 7.1 to 7.4.
I experienced some performance improvements when updating on PHP 7.x.
Or update at least to PHP 7.3 which isn’t EOL yet which may be closer than 7.4, if this helps somehow.

Ok, thank you for your help. The whole thing kind of blew up when I pushed the new PHP/trellis version, but maybe I was too hasty to roll everything back… Wish me luck…

This topic was automatically closed after 42 days. New replies are no longer allowed.