# Provisioning Development requests sudo, gives /bin/sh: lsb_release: command not found

**URL:** https://discourse.roots.io/t/provisioning-development-requests-sudo-gives-bin-sh-lsb-release-command-not-found/21060
**Category:** trellis
**Tags:** trellis-cli, ansible
**Created:** 2021-07-06T03:12:20Z
**Posts:** 21

## Post 1 by @mZoo — 2021-07-06T03:12:20Z

Revisiting a Ubuntu 18, bionic project from a couple of years ago. I needed to regenerate the Vagrant, dev box and provisioning is failing.

I am using trellis-cli, latest version, with fresh `trellis init`.

```
# on the guest
lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.1 LTS
Release:	18.04
Codename:	bionic
```

I run:

```
$ ansible-playbook dev.yml -e env=development -vvv
```

Resulting in:

```
TASK [python_interpreter : Get Ubuntu release] ***********************************************************************************************************************************************************
task path: /Volumes/path/example.com/trellis/roles/python_interpreter/tasks/main.yml:2
[WARNING]: Failure using method (v2_runner_on_start) in callback plugin (<ansible.plugins.callback.output.CallbackModule object at 0x10deb5820>): 'show_per_host_start'
Callback Exception:
  File "/Volumes/path/example.com/trellis/.trellis/virtualenv/lib/python3.8/site-packages/ansible/executor/task_queue_manager.py", line 381, in send_callback
    method(*new_args, **kwargs)
   File "/Volumes/path/example.com/trellis/.trellis/virtualenv/lib/python3.8/site-packages/ansible/plugins/callback/default.py", line 256, in v2_runner_on_start
    if self.get_option('show_per_host_start'):
   File "/Volumes/path/example.com/trellis/.trellis/virtualenv/lib/python3.8/site-packages/ansible/plugins/callback/ __init__.py", line 91, in get_option
    return self._plugin_options[k]
<192.168.50.5> ESTABLISH LOCAL CONNECTION FOR USER: mikekilmer
<192.168.50.5> EXEC sudo -H -S -n -u root /bin/sh -c 'echo BECOME-SUCCESS-htfhjqrjjhejifgcowdeevzuynzjzjpi ; lsb_release -cs'
System info:
  Ansible 2.9.23; Darwin
  Trellis 1.0.2: March 13th, 2019
---------------------------------------------------
non-zero return code
sudo: a password is required
fatal: [192.168.50.5]: FAILED! => {
    "changed": false,
    "rc": 1,
    "stderr_lines": [
        "sudo: a password is required"
    ],
    "stdout": "",
    "stdout_lines": []
}
```

And running with sudo returns

```
non-zero return code
/bin/sh: lsb_release: command not found
fatal: [192.168.50.5]: FAILED! => {
    "changed": false,
    "rc": 127,
    "stderr_lines": [
        "/bin/sh: lsb_release: command not found"
    ],
    "stdout": "",
    "stdout_lines": []
}
```

Similar error [here](https://discourse.roots.io/t/unable-to-run-server-yml-till-the-end-of-the-file-for-missing-lsb-release/14580/3), but I don’t believe the cause is the same.

I had initially been using Ansible `v2.10` point something, and thought that might be the issue.

This trellis codebase hadn’t had a `requirements.txt` file, so it’s pre `trellis v1.1.0`.

Thanks for any suggestions.

---

## Post 2 by @mZoo — 2021-07-06T18:11:40Z

I was thinking that perhaps the python version (`v3`) was causing the issue, but same result with Python `v2`:

```
PLAY [Set ansible_python_interpreter] ********************************************************************************************************************************************************************
[WARNING]: You Ansible version is 2.9.23 but this version of Trellis has only been tested for compatability with Ansible 2.4.0.0 -> 2.7.5. It is advisable to check for Trellis updates or downgrade your
Ansible version.
META: ran handlers

TASK [python_interpreter : Get Ubuntu release] ***********************************************************************************************************************************************************
task path: /Volumes/Path/to/example.com/trellis/roles/python_interpreter/tasks/main.yml:2
[WARNING]: Failure using method (v2_runner_on_start) in callback plugin (<ansible.plugins.callback.output.CallbackModule object at 0x109177d10>): 'show_per_host_start'
Callback Exception:
  File "/Users/mikekilmer/.pyenv/versions/2.7.17/envs/.trellis/lib/python2.7/site-packages/ansible/executor/task_queue_manager.py", line 381, in send_callback
    method(*new_args, **kwargs)
   File "/Users/mikekilmer/.pyenv/versions/2.7.17/envs/.trellis/lib/python2.7/site-packages/ansible/plugins/callback/default.py", line 256, in v2_runner_on_start
    if self.get_option('show_per_host_start'):
   File "/Users/mikekilmer/.pyenv/versions/2.7.17/envs/.trellis/lib/python2.7/site-packages/ansible/plugins/callback/ __init__.py", line 91, in get_option
    return self._plugin_options[k]
<192.168.50.5> ESTABLISH LOCAL CONNECTION FOR USER: mikekilmer
<192.168.50.5> EXEC sudo -H -S -n -u root /bin/sh -c 'echo BECOME-SUCCESS-foblwtzmdokbuffugxwnecrbuhwagxbh ; lsb_release -cs'
System info:
  Ansible 2.9.23; Darwin
  Trellis 1.0.2: March 13th, 2019
---------------------------------------------------
non-zero return code
sudo: a password is required
fatal: [192.168.50.5]: FAILED! => {
    "changed": false,
    "rc": 1,
    "stderr_lines": [
        "sudo: a password is required"
    ],
    "stdout": "",
    "stdout_lines": []
}
```

---

## Post 3 by @mZoo — 2021-07-06T22:42:59Z

Following a return of [this issue](https://github.com/roots/trellis-cli/issues/129), decided to [update trellis](https://imwz.io/update-trellis-like-pro/) codebase (like a pro!)

(Note that in the above tutorial, the writer assumes that the root directory of your git project is in the `trellis` directory. If the project root is above the trellis directory:

```
.git
trellis
site
```

You will need to first run `git init` within the trellis directory, otherwise you will have a bunch of updated trellis files _above_ the trellis directory. I like the kDiff app for managing git merge conflicts.

Then destroyed and rebuilt `trellis/.trellis` using trellis-cli (`trellis init`), using Python v3.8.

Now I get this error:

```
==> 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.50.1:/System/Volumes/Data/Volumes/Path/To/example.com/site /vagrant-nfs-example.test

Stdout from the command:

mount.nfs: mounting 192.168.50.1:/System/Volumes/Data/Volumes/Path/To/example.com/site failed, reason given by server: No such file or directory
exit status 1
```

And at that point `vagrant reload` returns:

```
default: Running ansible-playbook...
ERROR! Unable to retrieve file contents
Could not find or access '/Volumes/Path/To/example.com/trellis/dotenv.yml' on the Ansible Controller.
If you are using a module and expect the file to exist on the remote, see the remote_src option
Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.
exit status 1
```

Remove the `example.test` entry from `~/.ssh/config`.

Try running `trellis up --with-galaxy` and it says there’s no `galaxy.yml` file, which I have added from the [Trellis repo](https://raw.githubusercontent.com/roots/trellis/master/galaxy.yml).

Destroy again (`vagrant destroy`), then run `trellis dotenv` then `trellis up --with-galaxy`.

Same error:

```
mount.nfs: mounting 192.168.50.1:/System/Volumes/Data/Volumes/Drive/Clients/Client/example.com/site failed, reason given by server: No such file or directory
exit status 1
```

The directory is there:

```
ls /System/Volumes/Data/Volumes/path/to/example.com/site
total 176
CHANGELOG.md LICENSE.md README.md auth.json composer.json composer.lock config/ scripts/ vendor/ web/ wp-cli.yml
```

---

## Post 4 by @mZoo — 2021-07-07T00:17:32Z

Try [this SO solution](https://stackoverflow.com/a/12661692/2223106) deleting and recreating the [exports file](https://www.thegeekdiary.com/understanding-the-etc-exports-file/):

```
$ sudo rm -f /etc/exports
$ sudo touch /etc/exports
$ vagrant destroy
$ trellis up
```

Now it looks like this:

```
# VAGRANT-BEGIN: 501 2fb1e1ab-22fb-4ab7-b408-ae01cea6fae3
"/System/Volumes/Data/Volumes/Path/To/example.com/site" -alldirs -mapall=501:20 192.168.50.5
"/System/Volumes/Data/Volumes/Path/To/example.com/trellis" -alldirs -mapall=501:20 192.168.50.5
# VAGRANT-END: 501 2fb1e1ab-22fb-4ab7-b408-ae01cea6fae3
```

Hmmm.

```
(virtualenv) which vagrant
/usr/local/bin/vagrant
(virtualenv) vagrant --version
Vagrant 2.2.16
```

VirtualBox `Version 6.1.22`

Same issue in another, newer Trellis codebase, on Big Sur, working from an external drive.

Was hopeful, again, briefly, when [this thread](https://discourse.roots.io/t/vagrant-up-fails-on-mounting-nfs-shared-folders/8637/35) suggested that iTerm may need further permissions (which it does), but I had already done that.

Noticed that the `etc/hosts` file didn’t have entries for the two trellis projects, which lead me to running `sudo trellis up`, which returned something new:

```
Installing plugin vagrant-bindfs
Installing plugin vagrant-hostmanager
`vagrant up` must be re-run now that plugins are installed
```

Same result with `trellis up`.

Tried installing `vagrant-vbguest` plugin with errors:

```
Vagrant failed to properly resolve required dependencies. These
errors can commonly be caused by misconfigured plugin installations
or transient network issues. The reported error is:

ERROR: Failed to build gem native extension.

    current directory: /Volumes/Ochosi/vagrant_home/gems/2.6.7/gems/oroku_saki-1.1.1/ext/oroku_saki
/opt/vagrant/embedded/bin/ruby -I /opt/vagrant/embedded/lib/ruby/2.6.0 -r ./siteconf20210706-30781-fsgyx5.rb extconf.rb
creating Makefile

current directory: /Volumes/Ochosi/vagrant_home/gems/2.6.7/gems/oroku_saki-1.1.1/ext/oroku_saki
make "DESTDIR=" clean

current directory: /Volumes/Ochosi/vagrant_home/gems/2.6.7/gems/oroku_saki-1.1.1/ext/oroku_saki
make "DESTDIR="
compiling memzero.c
clang: warning: no such sysroot directory: '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk' [-Wmissing-sysroot]
memzero.c:16:10: fatal error: 'assert.h' file not found
#include <assert.h>
         ^ ~~~~~~~~~
1 error generated.
make: *** [memzero.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Volumes/Ochosi/vagrant_home/gems/2.6.7/gems/oroku_saki-1.1.1 for inspection.
Results logged to /Volumes/Ochosi/vagrant_home/gems/2.6.7/extensions/x86_64-darwin-19/2.6.0/oroku_saki-1.1.1/gem_make.out
```

Now had to run `vagrant plugin expunge` before `trellis up` (`vagrant up`) would even run.

Incremented the `vagrant ip` [here](https://github.com/roots/trellis/blob/2e5bc068b3607cf3dc95f5b1f075ee6201d2a990/vagrant.default.yml#L2) as per @ben [recommendation](https://discourse.roots.io/t/vagrant-up-fails-on-mounting-nfs-shared-folders/8637/23).

# Wait a minute

Don’t know if this will solve the problem, but I am seeing that the IP address specified by `vagrant_ip` in the default file (above), is `vagrant_ip: '192.168.50.5'`, but in the error messages, it is `192.168.50.1`.

@swalkinshaw @strarsis your input would be very welcome.

---

## Post 5 by @mZoo — 2021-07-08T02:39:23Z

Wow. This is a long, lonely thread.

Tried downgrading from `vagrant v2.2.16` to `v2.2.15`. Also tried increasing the vagrant\_ip in `hosts/development` and `vagrant.default.yml`.

Still getting same error

```
mount.nfs: mounting 192.168.50.1:/System/Volumes/Data/Volumes/Ochosi/Clients/Example/example.com/site failed, reason given by server: No such file or directory
```

I think it’s looking for a file called `vagrant-nfs-example.test`, which is not present.

---

## Post 6 by @strarsis — 2021-07-08T12:07:59Z

My two cents here:  
Does this folder actually exist on your OS X system?: `/System/Volumes/Data/Volumes/Ochosi/Clients/Example/example.com/site`

Is `192.168.50.1` the IP address of your OS X workstation, at least for the internal VM/VirtualBox network?

---

## Post 7 by @mZoo — 2021-07-08T13:55:58Z

Thank you much. Yes, `/System/Volumes/Data/Volumes/Ochosi/Clients/Example/example.com/site` exists. Is it supposed to contain a file named, `vagrant-nfs-example.test`? And if so, what process generates that file?

Can you tell me how/where I check what the IP of my workstation, for Vagrant network is?

---

## Post 8 by @strarsis — 2021-07-08T14:04:37Z

A simple `ifconfig` in terminal should be enough to list the interfaces and their IP addresses.

---

## Post 9 by @mZoo — 2021-07-08T14:50:25Z

Cool. Yes, the referenced path exists, as [noted previously](https://discourse.roots.io/t/provisioning-development-requests-sudo-gives-bin-sh-lsb-release-command-not-found/21060/3). (I know, it’s a lot to read. Very much appreciate your time and wisdom.)

It looks like the virtualbox IP is the one in the error:

```
vboxnet0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
	ether 0a:00:27:00:00:00
	inet 192.168.50.1 netmask 0xffffff00 broadcast 192.168.50.255
vboxnet1: flags=8842<BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
	ether 0a:00:27:00:00:01
```

How does that IP relate to the one configured in `development/hosts` and `vagrant.default.yml`?

Good news, sort of. Same error on a different Trellis project:

```
mount.nfs: mounting 192.168.50.1:/System/Volumes/Data/Volumes/Ochosi/Clients/Another/another.com/site failed, reason given by server: No such file or directory
```

Permission issue, maybe?

---

## Post 10 by @strarsis — 2021-07-09T10:53:05Z

So I found a troubleshooting topic for this error:

> **[NFS - Synced Folders | Vagrant | HashiCorp Developer](https://developer.hashicorp.com/vagrant/docs/synced-folders/nfs)**
>
> In some cases the default shared folder implementations such as VirtualBox
> shared folders have high performance penalties. If you are seeing less than
> ideal performance with synced folders, NFS can offer a solution. Vagrant has
> built-in support to...

> - Check status of nfs-kernel-server `systemctl status nfs-kernel-server` for errors like `exportfs: Failed to stat /path : No such file or directory` . Then create the missing directory or remove the line from `/etc/exports` and restart the nfs-kerne-server `sysctemctl start nfs-kernel-server`

Also on that page check the section `For OS X, sudoers should have this entry:` and ensure those changes.

---

## Post 11 by @mZoo — 2021-07-09T13:57:49Z

Awesome. Getting closer. I can feel it.

As noted in above link, using [visudo](https://osxdaily.com/2014/02/06/add-user-sudoers-file-mac/), added the following to `/etc/sudoers` file:

```
Cmnd_Alias VAGRANT_EXPORTS_ADD = /usr/bin/tee -a /etc/exports
Cmnd_Alias VAGRANT_NFSD = /sbin/nfsd restart
Cmnd_Alias VAGRANT_EXPORTS_REMOVE = /usr/bin/sed -E -e /*/ d -ibak /etc/exports
%admin ALL=(root) NOPASSWD: VAGRANT_EXPORTS_ADD, VAGRANT_NFSD, VAGRANT_EXPORTS_REMOVE
```

In the guest (`vagrant ssh`):

```
vagrant@example:~$ mount -o vers=3,udp 192.168.50.1:/System/Volumes/Data/Volumes/Ochosi/Clients/example/example.com/site /vagrant-nfs-example.test
mount: only root can use "--options" option.
```

Using sudo:

```
sudo mount -o vers=3,udp 192.168.50.1:/System/Volumes/Data/Volumes/Ochosi/Clients/client/client.com/site /vagrant-nfs-example.test
mount.nfs: access denied by server while mounting 192.168.50.1:/System/Volumes/Data/Volumes/Ochosi/Clients/client/client.com/site
```

Have given [full disc access to nfsd](https://blog.docksal.io/nfs-access-issues-on-macos-10-15-catalina-75cd23606913).

The `/etc/exports` entry looks good:

```
# VAGRANT-BEGIN: 501 97e897e1-d468-4a41-bf42-a96eb4fc8306
"/System/Volumes/Data/Volumes/Ochosi/Clients/Client/example.com/site" -alldirs -mapall=501:20 192.168.50.6
"/System/Volumes/Data/Volumes/Ochosi/Clients/Client/example.com/trellis" -alldirs -mapall=501:20 192.168.50.6
# VAGRANT-END: 501 97e897e1-d468-4a41-bf42-a96eb4fc8306
```

With matching entry in `/etc/hosts`:

```
## vagrant-hostmanager-start id: 2fb1e1ab-22fb-4ab7-b408-ae01cea6fae3
192.168.50.5 example.test
192.168.50.5 www.example.test
## vagrant-hostmanager-end
```

Hey! Wait a minute! Those IDs (in `hosts` and `exports`) don’t match. Are they supposed to? Removed both entries and running this loop for the 40th time: `vagrant destroy -f && trellis up`.

This time there’s no `/etc/hosts` entry for `example.com`. Does the `vagrant-hostmanager-start id` matter? It’s just a comment, right?

Here’s something. The IP address I have set in `vagrant.default.yml` and `hosts/development` ends with a `6`, but in the hosts file entry was (i presume an older one) ending with a `5` as you can see above. I don’t imagine that makes any difference in terms of the inability to mount.

---

## Post 12 by @krishaamer — 2021-07-12T10:55:41Z

Same problem here while trying to re-provision a new install after changed WP env’s on MacOS Big Sur.

`sudo trellis provision development` results in.

```
TASK [python_interpreter : Get Ubuntu version] *********************************

System info:

Ansible 2.10.11; Darwin

Trellis 1.8.0: February 12th, 2021

---------------------------------------------------

non-zero return code

/bin/sh: lsb_release: command not found

fatal: [192.168.50.5]: FAILED! => {"changed": false, "rc": 127, "stderr_lines": ["/bin/sh: lsb_release: command not found"], "stdout": "", "stdout_lines": []}
```

–  
The one hint I found: ``lsb\_release` is a command that runs on Linux only: the "LSB" stands for "Linux Standard Base" and this refers to a standard baseline set of tools and libraries that Linux distributions can elect to support.` [https://stackoverflow.com/questions/39946101/make-dependencies-on-mac-gives-make-lsb-release-command-not-found-erro](https://stackoverflow.com/questions/39946101/make-dependencies-on-mac-gives-make-lsb-release-command-not-found-erro)

---

## Post 13 by @mZoo — 2021-07-18T03:26:59Z

Still unresoved trying to provision any of these Trellis vagrant boxes on Big Sur here as well.

---

## Post 14 by @mZoo — 2021-07-23T16:48:11Z

Running through some of the tips [here](https://www.thegeekdiary.com/mount-nfs-access-denied-by-server-while-mounting-how-to-resolve).

I’m not sure if the following is meant to be run on the host or guest:

```
tcpdump -s0 -i [eth#] host [ip_address] -w /tmp/tcpdump.pcap
```

With or without sudo, or if the ip\_address is supposed to be 192.168.50.1 or (in my case) `192.168.50.5` or `192.168.50.6` (depending on project).

Without sudo the result is

```
tcpdump: [eth#]: You don't have permission to capture on that device
((cannot open BPF device) /dev/bpf0: Permission denied)
```

Run as super user,

```
tcpdump: [eth#]: No such device exists
(BIOCSETIF failed: Device not configured)
```

That’s the same in guest and host.

Within the guest, still getting `mount.nfs: access denied by server while mounting 192.168.50.1:`.

I _think_ that “server” refers to the host machine, but am not sure _what_ within the host machine is doing the serving.

---

## Post 15 by @mZoo — 2021-07-23T18:41:40Z

I was able to get pas this hurdle by, as referenced at the bottom of the [Vagrant link](https://www.vagrantup.com/docs/synced-folders/nfs#troubleshooting-nfs-issues) from above, as well is in another local thread [here](https://discourse.roots.io/t/vagrant-up-fails-on-mounting-nfs-shared-folders/8637/14) by adding the `nfs_udp: false,` configuration to `Vagrantfile`.

I added it in two places, on lines [86 and 87](https://github.com/roots/trellis/blob/b6fde51906a5a8a6fad2860a8db585c7a0c4ae1a/Vagrantfile#L86).

I had wondered if `**extra_options` were command line options where this config pair could go, but it [appears](https://github.com/roots/trellis/blob/17430191bb7211545eb63ba3ba989ee95c262c5f/Vagrantfile#L71) they are settings for when `vagrant_mount_type == 'smb'`.

UDB, is [User Datagram Protocol](https://en.wikipedia.org/wiki/User_Datagram_Protocol). It looks like [Big Sur has added some security features](https://blog.privadovpn.com/make-your-vpn-work-with-big-sur/) that may have effected these types of connections.

---

## Post 16 by @mZoo — 2021-07-23T20:02:19Z

Whoops. Did I say that adding `nfs_udp: false` worked. It just appeared to work because I had already run `vagrant up`.

Then I get the [Composer could not find a composer.json file (MacOS Catalina)](https://discourse.roots.io/t/composer-could-not-find-a-composer-json-file-macos-catalina/16886) issue. So… still in the playground.

---

## Post 17 by @mZoo — 2021-08-02T23:17:55Z

Reverted back to OSX Mojave and provisioning as usual now.

---

## Post 18 by @mZoo — 2021-09-26T17:47:25Z

You ever make any progress on this, man? Seems to have popped up again for me.

---

## Post 19 by @mZoo — 2021-09-26T17:55:06Z

> [@strarsis](#):
>
> Check status of nfs-kernel-server `systemctl status nfs-kernel-server` for errors like `exportfs: Failed to stat /path : No such file or directory` . Then create the missing directory or remove the line from `/etc/exports` and restart the nfs-kerne-server `sysctemctl start nfs-kernel-server`

This would be if I were running the HOST MACHINE on Linux, as opposed to OS X, correct?

---

## Post 20 by @strarsis — 2021-09-27T12:58:07Z

Yes, the NFS kernel thing runs on the host machine and provides the shares that should be used by the Vagrant guests.

---

## Post 21 by @mZoo — 2021-12-30T02:34:05Z

Able to get working using `vagrant 2.2.18` on main hard drive, but not on external drive. Just glad to be able to develop at the moment. Will, potentially poke around with external file path later (no spaces in the path).
