Troubleshooting Lando

If Lando starts messing with you

Its possible Lando will get itself in a twist. Hopefully these troubleshooting tips will help.

Good to know: You can view the logs from the containers using the command lando logs which will show all messages. You can also view the logs from a specific container using the command lando logs -s appserver where appserver is the name of the container. You can also follow logs with the -f switch.

Lando won't start and throws 'Read timed out' errors

After running lando start you might see errors like this:

Starting landoproxyhyperion5000gandalfedition_proxy_1 ...

ERROR: for landoproxyhyperion5000gandalfedition_proxy_1  UnixHTTPConnectionPool(host='localhost', port=None): Read timed out. (read timeout=60)

ERROR: for proxy  UnixHTTPConnectionPool(host='localhost', port=None): Read timed out. (read timeout=60)

The solution was to restart Docker (if on MacOS then quit Docker from the menu bar icon).

Lando drush commands warn about missing .env file

When running drush commands you might see the following:

warn: Trouble parsing .env file with Error: ENOENT: no such file or directory, open '.env'

This can be safely ignored as when you start the container it already passes in the contents of the .env file which drush inside the containers makes use of. You will only see this warning when running lando drush commands from anywhere but the git root (where the .env file lives).

Trying to run Lando commands, everything freezes on the command line

This is probably because you have xdebug on and in your IDE you are listening for debug connections. As xdebug is also enabled for PHP CLI in the containers this will essentially freeze things until you stop listening for debug connections. While a bit of a pain its not too bad once you're aware of the problem.

There is an open issue in the Lando issue queue to address this.

Drush commands won't work

If you see errors like:

Command cex was not found. Drush was unable to query the database. As a result, many commands are unavailable. Re-run your command with --debug to see relevant log messages.

You probably forgot to add lando before your command. So drush cex should be lando drush cex

Another possibility is a mismatch between database settings in settings.php (Drupal 7) or settings.local.php (Drupal 8+) and what the Lando config has defined. Check the .lando.yml file and make sure there is a creds section under database under services. It should look like this:

      user: database
      password: database
      database: database

This tells Lando's database service to use database for the user, password and name of the MySQL database.

Now check your settings.php or settings.local.php and make sure it looks something like this (Drupal 8+):

$databases['default']['default'] = array (
  'database' => 'database',
  'username' => 'database',
  'password' => 'database',
  'host' => 'database',
  'port' => '3306',
  'driver' => 'mysql',
  'prefix' => '',
  'collation' => 'utf8mb4_general_ci',

Note that the host is also database, this is the internal network host name for the database container.

Running lando npm start throws an error

If you see an error like:

Error: Node Sass does not yet support your current environment: Linux 64-bit with Unsupported runtime (57)

Its possible you had an old set of node_modules in your theme. Remove these with:

rm -rf node_modules

Then install them again with

lando npm install

Unable to run remote drush commands like sql-sync

If you try to run a drush command on a remote server and see an error like this:

[error]  The command could not be executed successfully (returned: Permission denied (publickey).

It probably means one of three things:

  1. You haven't set up a ~/.lando/config.yml file with the USER environement variable. Refer to the documentation to set this up.

  2. You might have the wrong user in your ~/.lando/config.yml file.

    For example, if you usually log in with something like ssh but your username on your computer is jhall then you'll need to edit the ~/.lando/config.yml file and change the value of the USER key to james.

  3. You have a passphrase protected ssh key. By default Lando won't pass in passphrase protected keys but does provide a config variable to allow it. Unfortunately this config variable does not work. Instead the solution is to pass in an environment variable set in your ~/.lando/config.yml file:

      LANDO_LOAD_PP_KEYS: "true"

    Restart your Lando project lando rebuild and your ssh keys should work. Note: you may need to enter your password multiple times.

Unable to access the site on port 80, or only able to access using https

You may well have other containers with a different system or another webserver hogging port 80. Lando will try other ports automatically like 8000 and 8080. To see which port Lando has assigned you can run lando info and look under the appserver section.

If you want to run Lando on port 80, first shut down your other web servers and then lando poweroff. Now when you lando start you should be able to access your site at http without specifying a port number.

Switching between Lando RC1 and RC13

Some sites may require a newer/older version of Lando, whilst this may sound like things will break for you, it doesn't appear to be an issue, simply follow the steps below. It may also be an idea to keep a copy of each version on your machine once you know they work.

Last updated: