Skip to content
This repository has been archived by the owner on Sep 26, 2018. It is now read-only.

Facebook Community Cellular Manager CLOUD errors = [DEPRECATION WARNING]: Instead of sudo/sudo_user, use become/become_user #20

Closed
PeterCielos opened this issue Dec 21, 2016 · 9 comments

Comments

@PeterCielos
Copy link

PeterCielos commented Dec 21, 2016

Hello,

Following the instructions per Facebook's CommunityCellularManager for CLOUD, I am getting errors

I did a git checkout of the following Facebook Community Cellular Manager:

buntu@ubuntu:~/CommunityCellularManager$ sudo git log -n1
commit 9e5415d
Author: Steve Muir muir@fb.com
Date: Mon Dec 19 11:31:50 2016 -0800

Only ignore top-level static dir, not deeper ones

Summary:
The .gitignore rule was intended to only exclude cloud/static, not
cloud/endagaweb/static. The typo meant the static images and such weren't
pushed to GH. A subsequent push will restore them.

Reviewed By: shaddi

Differential Revision: D4341788

fbshipit-source-id: 4741c24327c9e6d3af485e2b6084d532c835a064

Here is what I'm running:

lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.5 LTS
Release: 14.04
Codename: trusty

I have the following installed:

ubuntu@ubuntu:~/CommunityCellularManager/cloud$ pip3 --version
pip 9.0.1 from /usr/local/lib/python2.7/dist-packages (python 2.7)

ubuntu@ubuntu:~/CommunityCellularManager/cloud$ pip --version
pip 9.0.1 from /usr/local/lib/python2.7/dist-packages (python 2.7)

ubuntu@ubuntu:~/CommunityCellularManager/cloud$ vagrant --version
Vagrant 1.8.7

VBoxManage --version
4.3.36_Ubuntur105129

ansible --version
ansible 2.3.0

Here is the error message I receive:

**DEBUG ssh: Checking key permissions: /home/ubuntu/CommunityCellularManager/cloud/.vagrant/machines/db/virtualbox/private_key
INFO interface: detail: Running ansible-playbook...
INFO interface: detail: db: Running ansible-playbook...
db: Running ansible-playbook...
INFO interface: detail: PYTHONUNBUFFERED=1 ANSIBLE_NOCOLOR=true ANSIBLE_HOST_KEY_CHECKING=false ANSIBLE_SSH_ARGS='-o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o ControlMaster=auto -o ControlPersist=60s' ansible-playbook --connection=ssh --timeout=30 --limit="db" --inventory-file=/home/ubuntu/CommunityCellularManager/cloud/.vagrant/provisioners/ansible/inventory -v ansible/postgres.dev.yml
PYTHONUNBUFFERED=1 ANSIBLE_NOCOLOR=true ANSIBLE_HOST_KEY_CHECKING=false ANSIBLE_SSH_ARGS='-o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o ControlMaster=auto -o ControlPersist=60s' ansible-playbook --connection=ssh --timeout=30 --limit="db" --inventory-file=/home/ubuntu/CommunityCellularManager/cloud/.vagrant/provisioners/ansible/inventory -v ansible/postgres.dev.yml
INFO subprocess: Starting process: ["/usr/local/bin/ansible-playbook", "--connection=ssh", "--timeout=30", "--limit=db", "--inventory-file=/home/ubuntu/CommunityCellularManager/cloud/.vagrant/provisioners/ansible/inventory", "-v", "ansible/postgres.dev.yml"]
INFO subprocess: Command not in installer, restoring original environment...
DEBUG subprocess: Selecting on IO
DEBUG subprocess: stdout: Using /home/ubuntu/CommunityCellularManager/cloud/ansible.cfg as config file
INFO interface: detail: Using /home/ubuntu/CommunityCellularManager/cloud/ansible.cfg as config file

Using /home/ubuntu/CommunityCellularManager/cloud/ansible.cfg as config file
DEBUG subprocess: stderr: [DEPRECATION WARNING]: Instead of sudo/sudo_user, use become/become_user and
make sure become_method is 'sudo' (default).
This feature will be removed in a
future release. Deprecation warnings can be disabled by setting
deprecation_warnings=False in ansible.cfg.
INFO interface: detail: [DEPRECATION WARNING]: Instead of sudo/sudo_user, use become/become_user and
make sure become_method is 'sudo' (default).
This feature will be removed in a
future release. Deprecation warnings can be disabled by setting
deprecation_warnings=False in ansible.cfg.

[DEPRECATION WARNING]: Instead of sudo/sudo_user, use become/become_user and
make sure become_method is 'sudo' (default).
This feature will be removed in a
future release. Deprecation warnings can be disabled by setting
deprecation_warnings=False in ansible.cfg.
DEBUG subprocess: stdout:
PLAY [db] **********************************************************************
INFO interface: detail:
PLAY [db] **********************************************************************

PLAY [db] **********************************************************************
DEBUG subprocess: stdout:
TASK [Gathering Facts] *********************************************************
INFO interface: detail:
TASK [Gathering Facts] *********************************************************

TASK [Gathering Facts] *********************************************************
DEBUG subprocess: stdout: fatal: [db]: UNREACHABLE! => {"changed": false, "msg": "SSH Error: data could not be sent to the remote host. Make sure this host can be reached over ssh", "unreachable": true}
INFO interface: detail: fatal: [db]: UNREACHABLE! => {"changed": false, "msg": "SSH Error: data could not be sent to the remote host. Make sure this host can be reached over ssh", "unreachable": true}

fatal: [db]: UNREACHABLE! => {"changed": false, "msg": "SSH Error: data could not be sent to the remote host. Make sure this host can be reached over ssh", "unreachable": true}
DEBUG subprocess: stdout: to retry, use: --limit @/home/ubuntu/CommunityCellularManager/cloud/ansible/postgres.dev.retry

PLAY RECAP *********************************************************************
db : ok=0 changed=0 unreachable=1 failed=0

INFO interface: detail: to retry, use: --limit @/home/ubuntu/CommunityCellularManager/cloud/ansible/postgres.dev.retry

PLAY RECAP *********************************************************************
db : ok=0 changed=0 unreachable=1 failed=0

to retry, use: --limit @/home/ubuntu/CommunityCellularManager/cloud/ansible/postgres.dev.retry

PLAY RECAP *********************************************************************
db : ok=0 changed=0 unreachable=1 failed=0

DEBUG subprocess: Waiting for process to exit. Remaining to timeout: 31999
DEBUG subprocess: Exit status: 4
ERROR warden: Error occurred: Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.**

I've tried to add become/become_user to the Ansible.cfg file all with the same error.

Any assistance would be greatly appreciated!

@9muir
Copy link
Contributor

9muir commented Dec 21, 2016

I don't think the 'become/sudo' stuff is the cause of your problems, since those are ostensibly just warnings (but we will fix them). What's the output of vagrant ssh-config db?

@PeterCielos
Copy link
Author

9muir,

Thank you for replying.

Here is the output for your requested command:

ubuntu@ubuntu:~/CommunityCellularManager/client$ sudo vagrant ssh-config db
The machine with the name 'db' was not found configured for
this Vagrant environment.

The issues I'm having are the same anyone would have if they simply followed the instructions per https://github.com/facebookincubator/CommunityCellularManager/tree/master/cloud

@9muir
Copy link
Contributor

9muir commented Dec 22, 2016

What's the command you ran to try to provision the database VM? vagrant up db (or vagrant provision db if the VM is already created) should work if just run from the cloud directory. It looks like when you ran vagrant ssh-config db you were in the client directory (you don't need to use sudo). What does vagrant status report in the cloud directory?

@PeterCielos
Copy link
Author

PeterCielos commented Dec 22, 2016

9muir,

Your correct I issued the command from the "client" directory mistakenly.
Thank you for pointing that out.

But as you can see below, sometimes you HAVE to issue the "sudo" command BEFORE vagrant because not all vagrant commands work alone without "sudo".

Per your instructions, I've tried the following commands from the "Cloud" directory:

ubuntu@ubuntu:~/CommunityCellularManager/cloud$ sudo vagrant ssh-config db
The provider for this Vagrant-managed machine is reporting that it
is not yet ready for SSH. Depending on your provider this can carry
different meanings. Make sure your machine is created and running and
try again. Additionally, check the output of vagrant status to verify
that the machine is in the state that you expect. If you continue to
get this error message, please view the documentation for the provider
you're using.

ubuntu@ubuntu:~/CommunityCellularManager/cloud$ vagrant status
Vagrant failed to initialize at a very early stage:

The home directory you specified is not accessible. The home
directory that Vagrant uses must be both readable and writable.

You specified: /home/ubuntu/.vagrant.d

ubuntu@ubuntu:~/CommunityCellularManager/cloud$ sudo vagrant status
Current machine states:

web aborted (virtualbox)
db aborted (virtualbox)
rmq not created (virtualbox)
cert not created (virtualbox)
smpp not created (virtualbox)
vpn not created (virtualbox)

This environment represents multiple VMs. The VMs are all listed
above with their current state. For more information about a specific
VM, run vagrant status NAME.

ubuntu@ubuntu:~/CommunityCellularManager/cloud$ sudo vagrant up db

Bringing machine 'db' up with 'virtualbox' provider...
==> db: Checking if box 'ubuntu/trusty64' is up to date...
==> db: Clearing any previously set forwarded ports...
==> db: Clearing any previously set network interfaces...
==> db: Preparing network interfaces based on configuration...
db: Adapter 1: nat
db: Adapter 2: hostonly
==> db: Forwarding ports...
db: 22 (guest) => 2222 (host) (adapter 1)
==> db: Running 'pre-boot' VM customizations...
==> db: Booting VM...
==> db: Waiting for machine to boot. This may take a few minutes...
db: SSH address: 127.0.0.1:2222
db: SSH username: vagrant
db: SSH auth method: private key
db: Warning: Remote connection disconnect. Retrying...
db: Warning: Remote connection disconnect. Retrying...
==> db: Machine booted and ready!
[db] GuestAdditions 4.3.36 running --- OK.
==> db: Checking for guest additions in VM...
==> db: Setting hostname...
==> db: Configuring and enabling network interfaces...
==> db: Mounting shared folders...
db: /vagrant => /home/ubuntu/CommunityCellularManager/cloud
==> db: Machine already provisioned. Run vagrant provision or use the --provision
==> db: flag to force provisioning. Provisioners marked to run always will still run.

ubuntu@ubuntu:~/CommunityCellularManager/cloud$ sudo vagrant up db --provision

Bringing machine 'db' up with 'virtualbox' provider...
==> db: Checking if box 'ubuntu/trusty64' is up to date...
==> db: Running provisioner: ansible...
db: Running ansible-playbook...
PYTHONUNBUFFERED=1 ANSIBLE_FORCE_COLOR=true ANSIBLE_HOST_KEY_CHECKING=false ANSIBLE_SSH_ARGS='-o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o ControlMaster=auto -o ControlPersist=60s' ansible-playbook --connection=ssh --timeout=30 --limit="db" --inventory-file=/home/ubuntu/CommunityCellularManager/cloud/.vagrant/provisioners/ansible/inventory -v ansible/postgres.dev.yml
Using /home/ubuntu/CommunityCellularManager/cloud/ansible.cfg as config file
[DEPRECATION WARNING]: Instead of sudo/sudo_user, use become/become_user and
make sure become_method is 'sudo' (default).
This feature will be removed in a
future release. Deprecation warnings can be disabled by setting
deprecation_warnings=False in ansible.cfg.

PLAY [db] **********************************************************************

TASK [Gathering Facts] *********************************************************
fatal: [db]: UNREACHABLE! => {"changed": false, "msg": "SSH Error: data could not be sent to the remote host. Make sure this host can be reached over ssh", "unreachable": true}
to retry, use: --limit @/home/ubuntu/CommunityCellularManager/cloud/ansible/postgres.dev.retry

PLAY RECAP *********************************************************************
db : ok=0 changed=0 unreachable=1 failed=0

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

ubuntu@ubuntu:~/CommunityCellularManager/cloud$ sudo vagrant ssh-config db

Host db
HostName 127.0.0.1
User vagrant
Port 2222
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile /home/ubuntu/CommunityCellularManager/cloud/.vagrant/machines/db/virtualbox/private_key
IdentitiesOnly yes
LogLevel FATAL

ubuntu@ubuntu:~/CommunityCellularManager/cloud$

@9muir
Copy link
Contributor

9muir commented Dec 23, 2016

One thing to try: you don't usually have to download and install the base OS manually when using Vagrant, so something funky may be happening there.

@9muir
Copy link
Contributor

9muir commented Dec 23, 2016

Sorry, that comment was meant for your other issue. GitHub not a great mobile UI

@kheimerl
Copy link
Contributor

Running vagrant as root is going to cause a lot of weird issues. SSH keys are going to be all over the place and it shouldn't be necessary to do that.

@sharma-sagar
Copy link

faced same issue on going through error logs I tried changing in postgres.dev.yml:
sudo: yes to become : true ,
and sudo_user with become_user and this fixed my issue.

@kheimerl
Copy link
Contributor

kheimerl commented Nov 23, 2017 via email

facebook-github-bot pushed a commit that referenced this issue Dec 12, 2017
Summary:
I encountered this error when setting the cloud VMs up on a new computer.

```
TASK [Add Endaga DB] ***********************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: OperationalError: FATAL:  Peer authentication failed for user "postgres"
fatal: [db]: FAILED! => {"changed": false, "msg": "unable to connect to database: FATAL:  Peer authentication failed for user \"postgres\"\n"}
	to retry, use: --limit @/home/sago/Documents/PCARI/DEV3/CCM_20171212/CommunityCellularManager/cloud/ansible/postgres.dev.retry

PLAY RECAP *********************************************************************
db                         : ok=2    changed=1    unreachable=0    failed=1

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

Replacing sudo/sudo_user with become/become_user fixed this and the DB vm was completed without any hiccups.
This is also partially mentioned in #20
Closes #90

Differential Revision: D6544987

Pulled By: 9muir

fbshipit-source-id: 20d639a581f9e8fc455d9706282f7a2a3832fa67
@9muir 9muir closed this as completed Jan 3, 2018
matt9j referenced this issue in uw-ictd/CommunityCellularManager Jan 5, 2018
Summary:
I encountered this error when setting the cloud VMs up on a new computer.

```
TASK [Add Endaga DB] ***********************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: OperationalError: FATAL:  Peer authentication failed for user "postgres"
fatal: [db]: FAILED! => {"changed": false, "msg": "unable to connect to database: FATAL:  Peer authentication failed for user \"postgres\"\n"}
	to retry, use: --limit @/home/sago/Documents/PCARI/DEV3/CCM_20171212/CommunityCellularManager/cloud/ansible/postgres.dev.retry

PLAY RECAP *********************************************************************
db                         : ok=2    changed=1    unreachable=0    failed=1

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

Replacing sudo/sudo_user with become/become_user fixed this and the DB vm was completed without any hiccups.
This is also partially mentioned in #20
Closes facebookarchive#90

Differential Revision: D6544987

Pulled By: 9muir

fbshipit-source-id: 20d639a581f9e8fc455d9706282f7a2a3832fa67
eprueves added a commit to eprueves/CommunityCellularManager that referenced this issue Sep 6, 2018
Summary:
I encountered this error when setting the cloud VMs up on a new computer.

```
TASK [Add Endaga DB] ***********************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: OperationalError: FATAL:  Peer authentication failed for user "postgres"
fatal: [db]: FAILED! => {"changed": false, "msg": "unable to connect to database: FATAL:  Peer authentication failed for user \"postgres\"\n"}
	to retry, use: --limit @/home/sago/Documents/PCARI/DEV3/CCM_20171212/CommunityCellularManager/cloud/ansible/postgres.dev.retry

PLAY RECAP *********************************************************************
db                         : ok=2    changed=1    unreachable=0    failed=1

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

Replacing sudo/sudo_user with become/become_user fixed this and the DB vm was completed without any hiccups.
This is also partially mentioned in facebookarchive#20
Closes facebookarchive#90

Differential Revision: D6544987

Pulled By: 9muir

fbshipit-source-id: 20d639a581f9e8fc455d9706282f7a2a3832fa67
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants