Trellis hanging on installing dependencies

I’m running the commands in WSL, but if I’m inside the windows directory /mnt/c/Github trellis new example.com hangs at installing dependencies

When I run trellis new example.com inside the WSL directory /home/user/ , I have no issue and it the project is created.

However, if I run trellis up in this directory I get the following error:

Line number: 0
Message: Gem::LoadError: can't activate vagrant-libvirt-0.10.8, already activated vagrant-libvirt-0.0.45

I’m not sure about the issue from the Windows directory, but we do encourage people to use WSL.

Have you tried re-installing Vagrant? That error message is from Vagrant itself; you can try running vagrant up directly to see if there’s any difference.

I’m assuming you’ve followed Vagrant and Windows Subsystem for Linux | Vagrant by HashiCorp as well

1 Like
dannytaki@DESKTOP-DANNY:~$ sudo apt install vagrant
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  adwaita-icon-theme augeas-lenses cpu-checker db-util db5.3-util debootstrap exfat-fuse exfat-utils extlinux f2fs-tools fontconfig fonts-lato genisoimage gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-x
  gtk-update-icon-cache hfsplus hicolor-icon-theme humanity-icon-theme ibverbs-providers icoutils ipxe-qemu ipxe-qemu-256k-compat-efi-roms ldmtool libaa1 libafflib0v5 libarchive-tools libaugeas0 libavc1394-0
  libboost-iostreams1.71.0 libboost-thread1.71.0 libbrlapi0.7 libcaca0 libcacard0 libcairo-gobject2 libcairo2 libcdparanoia0 libcolord2 libconfig9 libdate-manip-perl libdatrie1 libdv4 libepoxy0 libewf2 libf2fs-format4
  libf2fs5 libfdt1 libgbm1 libgdk-pixbuf2.0-0 libgdk-pixbuf2.0-bin libgdk-pixbuf2.0-common libgstreamer-plugins-base1.0-0 libgstreamer-plugins-good1.0-0 libgtk-3-0 libgtk-3-bin libgtk-3-common libguestfs-hfsplus
  libguestfs-perl libguestfs-reiserfs libguestfs-tools libguestfs-xfs libguestfs0 libhfsp0 libhivex0 libibverbs1 libiec61883-0 libintl-perl libintl-xs-perl libiscsi7 libjack-jackd2-0 libjansson4 libjs-jquery libldm-1.0-0
  libmp3lame0 libmpg123-0 libnetpbm10 libnl-3-200 libnl-route-3-200 libopus0 liborc-0.4-0 libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 libpmem1 librados2 libraw1394-11 librbd1 librdmacm1 librest-0.7-0 librsvg2-2
  librsvg2-common libruby2.7 libsamplerate0 libshout3 libslirp0 libsoup-gnome2.4-1 libspeex1 libspice-server1 libstring-shellquote-perl libsys-virt-perl libtag1v5 libtag1v5-vanilla libthai-data libthai0 libtheora0 libtsk13
  libtwolame0 libusbredirparser1 libv4l-0 libv4lconvert0 libvirglrenderer1 libvirt0 libvisual-0.4-0 libvpx6 libvte-2.91-0 libvte-2.91-common libwavpack1 libwayland-cursor0 libwayland-egl1 libwayland-server0
  libwin-hivex-perl libxcb-render0 libxcb-shm0 libxkbcommon0 libyajl2 libyara3 lsscsi lzop msr-tools mtools netpbm nfs-kernel-server osinfo-db ovmf qemu-block-extra qemu-system-common qemu-system-data qemu-system-gui
  qemu-system-x86 qemu-utils rake reiserfsprogs ruby ruby-bcrypt-pbkdf ruby-builder ruby-childprocess ruby-concurrent ruby-domain-name ruby-ed25519 ruby-erubis ruby-excon ruby-ffi ruby-fog-core ruby-fog-json
  ruby-fog-libvirt ruby-fog-xml ruby-formatador ruby-http-cookie ruby-i18n ruby-libvirt ruby-listen ruby-log4r ruby-mime-types ruby-mime-types-data ruby-minitest ruby-multi-json ruby-net-scp ruby-net-sftp ruby-net-ssh
  ruby-net-telnet ruby-netrc ruby-nokogiri ruby-oj ruby-pkg-config ruby-power-assert ruby-rb-inotify ruby-rest-client ruby-sqlite3 ruby-test-unit ruby-unf ruby-unf-ext ruby-vagrant-cloud ruby-xmlrpc ruby-zip ruby2.7
  rubygems-integration scrub seabios sharutils sleuthkit sqlite3 supermin syslinux syslinux-common ubuntu-mono vagrant-libvirt
Use 'sudo apt autoremove' to remove them.
The following packages will be upgraded:
  vagrant
1 upgraded, 0 newly installed, 0 to remove and 66 not upgraded.
Need to get 113 MB of archives.
After this operation, 264 MB of additional disk space will be used.
Get:1 https://apt.releases.hashicorp.com focal/main amd64 vagrant amd64 2.3.0 [113 MB]
Fetched 113 MB in 2s (54.9 MB/s)  
(Reading database ... 77986 files and directories currently installed.)
Preparing to unpack .../vagrant_2.3.0_amd64.deb ...
Unpacking vagrant (2.3.0) over (2.2.6+dfsg-2ubuntu3) ...
Setting up vagrant (2.3.0) ...
Processing triggers for man-db (2.9.1-1) ...
dannytaki@DESKTOP-DANNY:~$ vagrant
Vagrant failed to initialize at a very early stage:

The executable 'cmd.exe' Vagrant is trying to run was not
found in the PATH variable. This is an error. Please verify
this software is installed and on the path.

I uninstalled Vagrant and deleted ~/.vagrant.d by running the commands found on this page : Uninstalling Vagrant | Vagrant by HashiCorp

Then I reinstalled Vagrant when I just type vagrant command it fails with the above error about Vagrant not found in PATH variable. I also have Vagrant installed on Windows. Do I need to point my PATH variable to its folder and use the executable on windows?

Going to try re-installing Vagrant on Windows. When I am in WSL does Trellis use vagrant installed on Ubuntu or does it use the Windows vagrant?

Check the " Vagrant Installation" section on Vagrant and Windows Subsystem for Linux | Vagrant by HashiCorp

I was able to install Vagrant and run it within WSL fine on my Home computer, however, I still have the same issue on my work computer with running Vagrant and it producing the following error:

dannytaki@DESKTOP-DANNY:~$ vagrant
Vagrant failed to initialize at a very early stage:

The executable 'cmd.exe' Vagrant is trying to run was not
found in the PATH variable. This is an error. Please verify
this software is installed and on the path.

I followed the download page running the following commands:

wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor | sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
sudo apt update && sudo apt install vagrant

Before running those commands I uninstalled Vagrant following the documentation:

Output after running install commands:

dannytaki@DESKTOP-DANNY:~$ sudo apt update && sudo apt install vagrant
Hit:1 https://apt.releases.hashicorp.com focal InRelease
Hit:2 http://dl.google.com/linux/chrome/deb stable InRelease
Hit:3 http://security.ubuntu.com/ubuntu focal-security InRelease
Hit:4 http://archive.ubuntu.com/ubuntu focal InRelease
Hit:5 http://archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:6 http://archive.ubuntu.com/ubuntu focal-backports InRelease
Hit:7 https://gitsecret.jfrog.io/artifactory/git-secret-deb git-secret InRelease
Reading package lists... Done
Building dependency tree
Reading state information... Done
3 packages can be upgraded. Run 'apt list --upgradable' to see them.
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  vagrant
0 upgraded, 1 newly installed, 0 to remove and 3 not upgraded.
Need to get 0 B/107 MB of archives.
After this operation, 258 MB of additional disk space will be used.
Selecting previously unselected package vagrant.
(Reading database ... 99367 files and directories currently installed.)
Preparing to unpack .../vagrant_2.3.1_amd64.deb ...
Unpacking vagrant (2.3.1) ...
Setting up vagrant (2.3.1) ...

Why am I getting this error and how do I resolve it? It looks like Vagrant command isn’t finding an executable from within WSL.

I just removed WSL and Ubuntu and reinstalling everything, lol.

Jesus, finally, that worked.

2 Likes

Glad you got it all sorted :rocket:

dannytaki@DESKTOP-DANNY:~/example.com$ trellis up
Starting galaxy role install process
- composer (1.9.0) is already installed, skipping.
- ntp (2.3.1) is already installed, skipping.
- logrotate (v0.0.5) is already installed, skipping.
- swapfile (v2.0.32) is already installed, skipping.
- mailhog (2.3.0) is already installed, skipping.

Running command => vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
There are errors in the configuration of this machine. Please fix
the following errors and try again:

vm:
* The host path of the shared folder is not supported from WSL. Host
path of the shared folder must be located on a file system with
DrvFs type. Host path: /home/dannytaki/example.com/site
* The host path of the shared folder is not supported from WSL. Host
path of the shared folder must be located on a file system with
DrvFs type. Host path: /home/dannytaki/example.com/trellis
* The host path of the shared folder is not supported from WSL. Host
path of the shared folder must be located on a file system with
DrvFs type. Host path: .


exit status 1

Now I’m getting the following error. Do I need to set my local_path in wordpress_sites.yml in the group_vars->developement folder to a directory on my windows machine?

Here’s a related topic: Trellis not compatible with WSL 2

If you search Vagrant for DrvFs you can see many related issues: Search · DrvFs · GitHub

Unfortunately I don’t know the best solution to fix it. Within those issues there’s some solutions about changing the mount type + location. Or reverting to WSL 1.

I don’t use Windows myself so I can’t test it and say for certain what will fix it. Thanks for your patience trying to troubleshoot this.

Why does the Trellis documentation recommend running it in WSL? Should I just run everything in Windows or are there issues there? What do you use Mac?

Also this may be a dumb question, but is Trellis commited to the Git Repository along with Bedrock code?

Yeah, it’s all in the same repo. trellis-cli creates a project with this structure:

example.com/      # → Root folder for the project
├── trellis/      # → Your server configuration (a customized install of Trellis)
└── site/         # → A Bedrock-based WordPress site
    └── web/
        ├── app/  # → WordPress content directory (themes, plugins, etc.)
        └── wp/   # → WordPress core (don't touch! - managed by Composer)

Why does the Trellis documentation recommend running it in WSL?

We recommend WSL because it is (or was) the easier way to run Vagrant and Trellis. It’s also a more consistent and closer experience to macOS and Linux hosts which means the rest of our documentation and tools (like trellis-cli) will apply more directly.

We’re obviously missing some more details on the proper WSL setup (especially in version 2) since it seems like Vagrant has some bugs.

Should I just run everything in Windows or are there issues there?

It should be possible and I know lots of people have done that over the years. Vagrant has a native Windows build (as you know from before); trellis-cli has a Windows build too (or you can follow the manual instructions on the docs).

Ok cool! I installed Linux on my PC just to get this working, haha. When I run Trellis up the first I’m getting this error:

daniel@daniel-H170-Gaming-3:~/example.com$ trellis up
Starting galaxy role install process
- composer (1.9.0) is already installed, skipping.
- ntp (2.3.1) is already installed, skipping.
- logrotate (v0.0.5) is already installed, skipping.
- swapfile (v2.0.32) is already installed, skipping.
- mailhog (2.3.0) is already installed, skipping.

Running command => 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: Pruning invalid NFS exports. Administrator privileges will be required...
[sudo] password for daniel: 
==> 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
Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period.

If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.

If you're using a custom box, make sure that networking is properly
working and you're able to connect to the machine. It is a common
problem that networking isn't setup properly in these boxes.
Verify that authentication configurations are also setup properly,
as well.

If the box appears to be booting properly, you may want to increase
the timeout ("config.vm.boot_timeout") value.
exit status 1

However, running it immediately again gives me the following error:

daniel@daniel-H170-Gaming-3:~/example.com$ trellis up
Starting galaxy role install process
- composer (1.9.0) is already installed, skipping.
- ntp (2.3.1) is already installed, skipping.
- logrotate (v0.0.5) is already installed, skipping.
- swapfile (v2.0.32) is already installed, skipping.
- mailhog (2.3.0) is already installed, skipping.

Running command => vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'bento/ubuntu-20.04' version '202206.03.0' is up to date...
==> default: [vagrant-hostmanager:guests] Updating hosts file on active guest virtual machines...
==> default: [vagrant-hostmanager:host] Updating hosts file on your workstation (password may be required)...
==> default: Running provisioner: ansible...
    default: Running ansible-playbook...

PLAY [WordPress Server: Install LEMP Stack with PHP and MariaDB MySQL] *********

TASK [Gathering Facts] *********************************************************
[WARNING]: Unhandled error in Python interpreter discovery for host default:
Failed to connect to the host via ssh: Connection timed out during banner
exchange  Connection to 127.0.0.1 port 2222 timed out
fatal: [default]: UNREACHABLE! => {"changed": false, "msg": "Data could not be sent to remote host \"127.0.0.1\". Make sure this host can be reached over ssh: Connection timed out during banner exchange\r\nConnection to 127.0.0.1 port 2222 timed out\r\n", "unreachable": true}

PLAY RECAP *********************************************************************
default                    : ok=0    changed=0    unreachable=1    failed=0    skipped=0    rescued=0    ignored=0   

Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.
exit status 1

I see the VM is created in virtualbox too.

I ran Trellis Up a third time and received the following output:

daniel@daniel-H170-Gaming-3:~/example.com$ trellis up
Starting galaxy role install process
- composer (1.9.0) is already installed, skipping.
- ntp (2.3.1) is already installed, skipping.
- logrotate (v0.0.5) is already installed, skipping.
- swapfile (v2.0.32) is already installed, skipping.
- mailhog (2.3.0) is already installed, skipping.

Running command => vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'bento/ubuntu-20.04' version '202206.03.0' is up to date...
==> default: [vagrant-hostmanager:guests] Updating hosts file on active guest virtual machines...
==> default: [vagrant-hostmanager:host] Updating hosts file on your workstation (password may be required)...
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: flag to force provisioning. Provisioners marked to run always will still run.
==> default: Running action triggers after up ...
==> default: Running trigger...
==> default: Adding vagrant ssh-config for example.test to ~/.ssh/config

==> default: Machine 'default' has a post `vagrant up` message. This is a message
==> default: from the creator of the Vagrantfile, and not from Vagrant itself:
==> default: 
==> default: Your Trellis Vagrant box is ready to use!
==> default: * Composer and WP-CLI commands need to be run on the virtual machine
==> default:   for any post-provision modifications.
==> default: * You can SSH into the machine with `vagrant ssh`.
==> default: * Then navigate to your WordPress sites at `/srv/www`
==> default:   or to your Trellis files at `/home/vagrant/trellis`.
daniel@daniel-H170-Gaming-3:~/example.com$ 

Running trellis ssh development gives me the following output:

daniel@daniel-H170-Gaming-3:~/example.com$ trellis ssh development
Running command => ssh vagrant@example.test
Error running ssh: exit status 255
daniel@daniel-H170-Gaming-3:~/example.com$ trellis ssh development
Running command => ssh vagrant@example.test
Error running ssh: exit status 255

My Vagrant version is Vagrant 2.3.1. Documentation says Vagrant should be:

Vagrant (opens new window)>= 2.1.0, < 2.2.19

I’m going to try to downgrade it to a previous version and run it again.