algo icon indicating copy to clipboard operation
algo copied to clipboard

GCE Stuck on Common: Gather Facts

Open stuartshapiro opened this issue 7 years ago • 7 comments

Describe the bug

The algo installer gets stuck on the common playbook gathering facts.

To Reproduce

Steps to reproduce the behavior:

  1. Prepare the virtual environment
  2. Prepare the GCE IAM project
  3. Start the algo installation

Expected behavior

The installer runs and completes (or throws an error)

Additional context

Full log


******s-MacBook-Pro:algo-master-010119 ******$ python -m ensurepip --user
Ignoring indexes: https://pypi.python.org/simple
Requirement already satisfied (use --upgrade to upgrade): setuptools in /Users/******/Library/Python/2.7/lib/python/site-packages
Requirement already satisfied (use --upgrade to upgrade): pip in /Users/******/Library/Python/2.7/lib/python/site-packages
******s-MacBook-Pro:algo-master-010119 ******$ python -m pip install --user --upgrade virtualenv
You are using pip version 6.1.1, however version 18.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Requirement already up-to-date: virtualenv in /Users/******/Library/Python/2.7/lib/python/site-packages
Requirement already up-to-date: setuptools>=18.0.0 in /Users/******/Library/Python/2.7/lib/python/site-packages (from virtualenv)
******s-MacBook-Pro:algo-master-010119 ******$ python -m virtualenv --python=`which python2` env &&
>     source env/bin/activate &&
>     python -m pip install -U pip virtualenv &&
>     python -m pip install -r requirements.txt
New python executable in /Users/******/Sites/algo-master-010119/env/bin/python
Installing setuptools, pip, wheel...
done.
Requirement already up-to-date: pip in ./env/lib/python2.7/site-packages (18.1)
Requirement already up-to-date: virtualenv in ./env/lib/python2.7/site-packages (16.2.0)
Requirement already satisfied, skipping upgrade: setuptools>=18.0.0 in ./env/lib/python2.7/site-packages (from virtualenv) (40.6.3)
Requirement already satisfied: ansible==2.5.2 in ./env/lib/python2.7/site-packages (from -r requirements.txt (line 1)) (2.5.2)
Requirement already satisfied: cryptography in ./env/lib/python2.7/site-packages (from ansible==2.5.2->-r requirements.txt (line 1)) (2.4.2)
Requirement already satisfied: jinja2 in ./env/lib/python2.7/site-packages (from ansible==2.5.2->-r requirements.txt (line 1)) (2.8)
Requirement already satisfied: PyYAML in ./env/lib/python2.7/site-packages (from ansible==2.5.2->-r requirements.txt (line 1)) (3.13)
Requirement already satisfied: setuptools in ./env/lib/python2.7/site-packages (from ansible==2.5.2->-r requirements.txt (line 1)) (40.6.3)
Requirement already satisfied: paramiko in ./env/lib/python2.7/site-packages (from ansible==2.5.2->-r requirements.txt (line 1)) (2.4.2)
Requirement already satisfied: idna>=2.1 in ./env/lib/python2.7/site-packages (from cryptography->ansible==2.5.2->-r requirements.txt (line 1)) (2.8)
Requirement already satisfied: enum34; python_version < "3" in ./env/lib/python2.7/site-packages (from cryptography->ansible==2.5.2->-r requirements.txt (line 1)) (1.1.6)
Requirement already satisfied: cffi!=1.11.3,>=1.7 in ./env/lib/python2.7/site-packages (from cryptography->ansible==2.5.2->-r requirements.txt (line 1)) (1.11.5)
Requirement already satisfied: asn1crypto>=0.21.0 in ./env/lib/python2.7/site-packages (from cryptography->ansible==2.5.2->-r requirements.txt (line 1)) (0.24.0)
Requirement already satisfied: ipaddress; python_version < "3" in ./env/lib/python2.7/site-packages (from cryptography->ansible==2.5.2->-r requirements.txt (line 1)) (1.0.22)
Requirement already satisfied: six>=1.4.1 in ./env/lib/python2.7/site-packages (from cryptography->ansible==2.5.2->-r requirements.txt (line 1)) (1.12.0)
Requirement already satisfied: MarkupSafe in ./env/lib/python2.7/site-packages (from jinja2->ansible==2.5.2->-r requirements.txt (line 1)) (1.1.0)
Requirement already satisfied: pynacl>=1.0.1 in ./env/lib/python2.7/site-packages (from paramiko->ansible==2.5.2->-r requirements.txt (line 1)) (1.3.0)
Requirement already satisfied: pyasn1>=0.1.7 in ./env/lib/python2.7/site-packages (from paramiko->ansible==2.5.2->-r requirements.txt (line 1)) (0.4.5)
Requirement already satisfied: bcrypt>=3.1.3 in ./env/lib/python2.7/site-packages (from paramiko->ansible==2.5.2->-r requirements.txt (line 1)) (3.1.5)
Requirement already satisfied: pycparser in ./env/lib/python2.7/site-packages (from cffi!=1.11.3,>=1.7->cryptography->ansible==2.5.2->-r requirements.txt (line 1)) (2.19)
(env) ******s-MacBook-Pro:algo-master-010119 ******$ gcloud init
Welcome! This command will take you through the configuration of gcloud.

Settings from your current configuration [default] are:
core:
  account: ******@gmail.com
  disable_usage_reporting: 'True'
  project: ******-algo

Pick configuration to use:
 [1] Re-initialize this configuration [default] with new settings 
 [2] Create a new configuration
Please enter your numeric choice:  1

Your current configuration has been set to: [default]

You can skip diagnostics next time by using the following flag:
  gcloud init --skip-diagnostics

Network diagnostic detects and fixes local network connection issues.
Checking network connection...done.                                            
Reachability Check passed.
Network diagnostic passed (1/1 checks passed).

Choose the account you would like to use to perform operations for 
this configuration:
 [1] ******@gmail.com
 [2] Log in with a new account
Please enter your numeric choice:  1

You are logged in as: [******@gmail.com].

Pick cloud project to use: 
 [1] ******-algo
 [2] Create a new project
Please enter numeric choice or text value (must exactly match list 
item):  1

Your current project has been set to: [******-algo].

Not setting default zone/region (this feature makes it easier to use
[gcloud compute] by setting an appropriate default value for the
--zone and --region flag).
See https://cloud.google.com/compute/docs/gcloud-compute section on how to set
default compute region and zone manually. If you would like [gcloud init] to be
able to do this for you the next time you run it, make sure the
Compute Engine API is enabled for your project on the
https://console.developers.google.com/apis page.

Created a default .boto configuration file at [/Users/******/.boto]. See this file and
[https://cloud.google.com/storage/docs/gsutil/commands/config] for more
information about configuring Google Cloud Storage.
Your Google Cloud SDK is configured and ready to use!

* Commands that require authentication will use ******@gmail.com by default
* Commands will reference project `******-algo` by default
Run `gcloud help config` to learn how to change individual settings

This gcloud configuration is called [default]. You can create additional configurations if you work with multiple accounts and/or projects.
Run `gcloud topic configurations` to learn more.

Some things to try next:

* Run `gcloud --help` to see the Cloud Platform services you can interact with. And run `gcloud help COMMAND` to get help on any gcloud command.
* Run `gcloud topic --help` to learn about advanced features of the SDK like arg files and output formatting
(env) ******s-MacBook-Pro:algo-master-010119 ******$ PROJECT_ID=******-algo
(env) ******s-MacBook-Pro:algo-master-010119 ******$ BILLING_ID="$(gcloud beta billing accounts list --format="value(ACCOUNT_ID)")"
(env) ******s-MacBook-Pro:algo-master-010119 ******$ gcloud beta billing projects link ${PROJECT_ID} --billing-account ${BILLING_ID}
billingAccountName: billingAccounts/013A39-D4E737-*****
billingEnabled: true
name: projects/******-algo/billingInfo
projectId: ******-algo
(env) ******s-MacBook-Pro:algo-master-010119 ******$ gcloud iam service-accounts create algo-vpn --display-name "Algo VPN"
Created service account [algo-vpn].
(env) ******s-MacBook-Pro:algo-master-010119 ******$ gcloud iam service-accounts keys create configs/gce.json \
>   --iam-account algo-vpn@${PROJECT_ID}.iam.gserviceaccount.com
created key [***********] of type [json] as [configs/gce.json] for [algo-vpn@******-algo.iam.gserviceaccount.com]
(env) ******s-MacBook-Pro:algo-master-010119 ******$ gcloud projects add-iam-policy-binding ${PROJECT_ID} \
>   --member serviceAccount:algo-vpn@${PROJECT_ID}.iam.gserviceaccount.com \
>   --role roles/compute.admin
Updated IAM policy for project [******-algo].
bindings:
- members:
  - serviceAccount:algo-vpn@******-algo.iam.gserviceaccount.com
  role: roles/compute.admin
- members:
  - user:******@gmail.com
  role: roles/owner
etag: BwV-bOmEnt4=
version: 1
(env) ******s-MacBook-Pro:algo-master-010119 ******$ gcloud projects add-iam-policy-binding ${PROJECT_ID} \
>   --member serviceAccount:algo-vpn@${PROJECT_ID}.iam.gserviceaccount.com \
>   --role roles/iam.serviceAccountUser
Updated IAM policy for project [******-algo].
bindings:
- members:
  - serviceAccount:algo-vpn@******-algo.iam.gserviceaccount.com
  role: roles/compute.admin
- members:
  - serviceAccount:algo-vpn@******-algo.iam.gserviceaccount.com
  role: roles/iam.serviceAccountUser
- members:
  - user:******@gmail.com
  role: roles/owner
etag: BwV-bOneIgQ=
version: 1
(env) ******s-MacBook-Pro:algo-master-010119 ******$ gcloud services enable compute.googleapis.com
Operation "operations/acf.102c10f3-60d9-4f06-9a6d-4e110a68f5f2" finished successfully.
(env) ******s-MacBook-Pro:algo-master-010119 ******$ ./algo -e "provider=gce" -e "gce_credentials_file=$(pwd)/configs/gce.json"

PLAY [Ask user for the input] **************************************************

TASK [Gathering Facts] *********************************************************
ok: [localhost]

TASK [Set facts based on the input] ********************************************
ok: [localhost]
[pause]
Name the vpn server
[algo]
:
algo-010119

TASK [pause] *******************************************************************
ok: [localhost]
[pause]
Do you want macOS/iOS clients to enable "VPN On Demand" when connected to cellular networks?
[y/N]
:
y

TASK [pause] *******************************************************************
ok: [localhost]
[pause]
Do you want macOS/iOS clients to enable "VPN On Demand" when connected to Wi-Fi?
[y/N]
:
y

TASK [pause] *******************************************************************
ok: [localhost]
[pause]
List the names of trusted Wi-Fi networks (if any) that macOS/iOS clients exclude from using the VPN
(e.g., your home network. Comma-separated value, e.g., HomeNet,OfficeWifi,AlgoWiFi)
:


TASK [pause] *******************************************************************
ok: [localhost]
[pause]
Do you want to install a DNS resolver on this VPN server, to block ads while surfing?
[y/N]
:
y

TASK [pause] *******************************************************************
ok: [localhost]
[pause]
Do you want each user to have their own account for SSH tunneling?
[y/N]
:
n

TASK [pause] *******************************************************************
ok: [localhost]
[pause]
Do you want the VPN to support Windows 10 or Linux Desktop clients? (enables compatible ciphers and key exchange, less secure)
[y/N]
:
n

TASK [pause] *******************************************************************
ok: [localhost]
[pause]
Do you want to retain the CA key? (required to add users in the future, but less secure)
[y/N]
:
n

TASK [pause] *******************************************************************
ok: [localhost]

TASK [Set facts based on the input] ********************************************
ok: [localhost]

PLAY [Provision the server] ****************************************************

TASK [Gathering Facts] *********************************************************
ok: [localhost]

--> Please include the following block of text when reporting issues:

Algo running on: Mac OS X 10.14.2
ZIP file created: Dec 20 06:21:04 2018
Python 2.7.10
Runtime variables:
    algo_provider "gce"
    algo_ondemand_cellular "True"
    algo_ondemand_wifi "True"
    algo_ondemand_wifi_exclude "_null"
    algo_local_dns "True"
    algo_ssh_tunneling "False"
    algo_windows "False"
    wireguard_enabled "True"
    dns_encryption "True"

TASK [Display the invocation environment] **************************************
changed: [localhost -> localhost]

TASK [Install the requirements] ************************************************
ok: [localhost -> localhost]

TASK [Generate the SSH private key] ********************************************
ok: [localhost]

TASK [Generate the SSH public key] *********************************************
ok: [localhost]

TASK [cloud-gce : Install requirements] ****************************************
ok: [localhost]

TASK [cloud-gce : set_fact] ****************************************************
ok: [localhost]

TASK [cloud-gce : set_fact] ****************************************************
ok: [localhost]

TASK [cloud-gce : set_fact] ****************************************************
ok: [localhost]

TASK [cloud-gce : Get regions] *************************************************
ok: [localhost]

TASK [cloud-gce : Set facts about the regions] *********************************
ok: [localhost]

TASK [cloud-gce : Set facts about the default region] **************************
ok: [localhost]
[cloud-gce : pause]
What region should the server be located in?
(https://cloud.google.com/compute/docs/regions-zones/)
    1. asia-east1-a
    2. asia-east1-b
    3. asia-east1-c
    4. asia-east2-a
    5. asia-east2-b
    6. asia-east2-c
    7. asia-northeast1-a
    8. asia-northeast1-b
    9. asia-northeast1-c
    10. asia-south1-a
    11. asia-south1-b
    12. asia-south1-c
    13. asia-southeast1-a
    14. asia-southeast1-b
    15. asia-southeast1-c
    16. australia-southeast1-a
    17. australia-southeast1-b
    18. australia-southeast1-c
    19. europe-north1-a
    20. europe-north1-b
    21. europe-north1-c
    22. europe-west1-b
    23. europe-west1-c
    24. europe-west1-d
    25. europe-west2-a
    26. europe-west2-b
    27. europe-west2-c
    28. europe-west3-a
    29. europe-west3-b
    30. europe-west3-c
    31. europe-west4-a
    32. europe-west4-b
    33. europe-west4-c
    34. northamerica-northeast1-a
    35. northamerica-northeast1-b
    36. northamerica-northeast1-c
    37. southamerica-east1-a
    38. southamerica-east1-b
    39. southamerica-east1-c
    40. us-central1-a
    41. us-central1-b
    42. us-central1-c
    43. us-central1-f
    44. us-east1-b
    45. us-east1-c
    46. us-east1-d
    47. us-east4-a
    48. us-east4-b
    49. us-east4-c
    50. us-west1-a
    51. us-west1-b
    52. us-west1-c
    53. us-west2-a
    54. us-west2-b
    55. us-west2-c
  
Enter the number of your desired region
[44]
:
44

TASK [cloud-gce : pause] *******************************************************
ok: [localhost]

TASK [cloud-gce : set_fact] ****************************************************
ok: [localhost]

TASK [cloud-gce : Network configured] ******************************************
changed: [localhost]

TASK [cloud-gce : Creating a new instance...] **********************************
changed: [localhost]

TASK [cloud-gce : set_fact] ****************************************************
ok: [localhost]

TASK [Set subjectAltName as afact] *********************************************
ok: [localhost]

TASK [Add the server to an inventory group] ************************************
changed: [localhost]

TASK [Additional variables for the server] *************************************
changed: [localhost]

TASK [Wait until SSH becomes ready...] *****************************************
ok: [localhost]

TASK [debug] *******************************************************************
ok: [localhost] => {
    "IP_subject_alt_name": "***.***.***.***"
}
Pausing for 20 seconds
(ctrl+C then 'C' = continue early, ctrl+C then 'A' = abort)

TASK [A short pause, in order to be sure the instance is ready] ****************
ok: [localhost]

PLAY [Configure the server and install required software] **********************

TASK [common : Check the system] ***********************************************
changed: [***.***.***.***]

TASK [common : include_tasks] **************************************************
included: /Users/******/Sites/algo-master-010119/roles/common/tasks/ubuntu.yml for ***.***.***.***
changed: [***.***.***.***] => (item=[u'python2.7', u'sudo'])

TASK [common : Ubuntu | Install prerequisites] *********************************

TASK [common : Ubuntu | Configure defaults] ************************************
changed: [***.***.***.***]

TASK [common : Gather facts] ***************************************************
ok: [***.***.***.***]

stuartshapiro avatar Jan 02 '19 00:01 stuartshapiro

(If you enclose your log output between triple backticks it will be easier to read.)

I think it might actually be getting stuck at the following step, which is:

 TASK [common : Install software updates]

GCE uses its own mirrors of some of the Ubuntu repositories so maybe one of them is having issues. You can probably log in to the instance and see what's trying to run:

ssh -i configs/algo.pem ubuntu@***.***.***.***

Is this issue repeatable? I installed to GCE us-east1-d just yesterday without issue so I think the problem might not be with Algo.

davidemyers avatar Jan 02 '19 01:01 davidemyers

Thanks, @davidemyers -- redid the formatting of the code to make things easier.

SSH'ed in, but didn't see anything continuously running in the task manager (but my linux skills aren't great). Unless there's a different troubleshooting that would be helpful, I'll try deploying again later today to see if it resolved itself.

stuartshapiro avatar Jan 02 '19 15:01 stuartshapiro

I'm still curious to know if it stalled on software updates. Please post the output of the following command, if any:

ps aux | grep apt | grep -v grep

davidemyers avatar Jan 02 '19 16:01 davidemyers

There wasn't any output

*****@algo-010119:~$ ps aux | grep apt | grep -v grep
*****@algo-010119:~$ 

stuartshapiro avatar Jan 02 '19 16:01 stuartshapiro

Thanks. I guess it wasn't stuck on an update.

davidemyers avatar Jan 02 '19 16:01 davidemyers

Not sure what happened, but seemed to resolve itself a few days later.

stuartshapiro avatar Jan 06 '19 17:01 stuartshapiro

same output, same issue for me still reproducible

lilienblum avatar Mar 06 '19 08:03 lilienblum