Trellis hanging on installing dependencies

Just going from the outputs you’ve pasted, it doesn’t look like Vagrant has ever successfully provisioned the machine; it’s only booted up.

1st attempt: time out waiting for machine to boot
2nd: machines boots, but provision fails (Ansible playbook fails because it can’t SSH into the VM)
3rd: machine boots up, but because provision attempted to run before, it’s not run at all this time

There’s two ways to force a provision in Vagrant:

  1. destroy the box and run vagrant up
  2. run vagrant provision

Running Vagrant up from within the Trellis directory gives the following ouput:

daniel@daniel-H170-Gaming-3:~/example.com/trellis$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'bento/ubuntu-20.04'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'bento/ubuntu-20.04' version '202206.03.0' is up to date...
==> default: Setting the name of the VM: example.test
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: hostonly
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Connection reset. Retrying...
    default: 
    default: Vagrant insecure key detected. Vagrant will automatically replace
    default: this with a newly generated keypair for better security.
    default: 
    default: Inserting generated public key within guest...
    default: Removing insecure key from the guest if it's present...
    default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Setting hostname...
==> default: Configuring and enabling network interfaces...
==> default: Installing NFS client...
==> default: Exporting NFS shared folders...
==> default: Preparing to edit /etc/exports. Administrator privileges will be required...
[sudo] password for daniel: 
==> default: Mounting NFS shared folders...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

mount -o vers=3,udp 192.168.56.1:/home/daniel/example.com/site /vagrant-nfs-example.com

Stdout from the command:



Stderr from the command:

mount.nfs: requested NFS version or transport protocol is not supported

I uninstalled Vagrant and reinstalled it using version Vagrant 2.2.18. I also deleted my /etc/exports file and recreated an empty file and deleted the VM and all associated files and still received the same error output on Mounting NFS Shared folders…

==> default: Mounting NFS shared folders...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

mount -o vers=3,udp 192.168.56.1:/home/daniel/example.com/site /vagrant-nfs-example.com

Stdout from the command:



Stderr from the command:

mount.nfs: requested NFS version or transport protocol is not supported

So obviously there’s some issue with NFS.
There’s two options:

  1. switch to another mount type (even just temporarily)
  2. Fix NFS

To try another mount type, create a vagrant.local.yml file and add this:

vagrant_mount_type: virtualbox

To fix NFS, according to the Vagrant docs, both the Linux host and guest need NFS installed. On the guest this should be done automatically, so I assume your host OS is missing it.

I’m not sure what OS you’re running, but on Ubuntu you can do sudo apt install nfs-kernel-server. Here’s a decent looking page on troubleshooting it more.

edit: in either case, I suggest destroying the VM first and starting again.

Going to try the first option. I had already installed nfs-kernel-server and had it running in the previous attempts.

Hell yes! That worked I successfully SSH’d into the VM and I can see the synced folders in /srv/www/example.com and the wordpress page is being served at example.test. That’s awesome. Now I need to figure out how server deployments work and provisioning works as well as rollbacks. Thank you!!

The solution that worked was this:

To try another mount type, create a vagrant.local.yml file and add this:

vagrant_mount_type: virtualbox
1 Like

Glad it’s all working :slight_smile: Thanks for the patience and troubleshooting. Vagrant makes a lot of this easier but there can still be so many issues that are dependent on a person’s machine or setup which makes it hard.

NFS might give you better performance (or not… see this issue) so if you notice slowness it might be worth trying to get NFS working again in the future.