I have changed the ssh_username from root to ubuntu, still it is same On Thursday, March 19, 2020 at 2:22:15 PM UTC+5:30, Rickard von Essen wrote: > > Ubuntu doesn't allow SSH'ing with root. And you need to use the user that > cloud-init set the ssh key for. In this case ssh_username should be ubuntu. > > On Thu, Mar 19, 2020, 06:32 'Ganesh Katakam' via Packer < > [email protected] <javascript:>> wrote: > >> I am very new to packer and this is my first script that too taken from >> packer website itself. While it is trying to do ssh with the instance it is >> failing. Can someone help me?? >> >> This is my template file: >> >> { >> "variables": { >> "aws_access_key": "", >> "aws_secret_key": "" >> }, >> "builders": [ >> { >> "type": "amazon-ebs", >> "access_key": "{{user `aws_access_key`}}", >> "secret_key": "{{user `aws_secret_key`}}", >> "region": "ap-south-1", >> "source_ami_filter": { >> "filters": { >> "virtualization-type": "hvm", >> "name": "ubuntu/images/*ubuntu-xenial-16.04-amd64-server-*", >> "root-device-type": "ebs" >> }, >> "owners": [ >> "099720109477" >> ], >> "most_recent": true >> }, >> "instance_type": "t2.micro", >> "ssh_username": "root", >> "ami_name": "fcp-runwayci {{timestamp}}", >> "tags":{ >> "Name": "GaneshK - {{timestamp}}" >> } >> } >> ], >> "provisioners": [ >> { >> "type": "shell", >> "script": "install.sh" >> } >> ] >> } >> >> This is my console output: >> >> 2020/03/19 05:22:54 [INFO] Packer version: 1.5.4 [go1.13.7 linux amd64] >> >> 2020/03/19 05:22:54 Checking 'PACKER_CONFIG' for a config file path >> >> 2020/03/19 05:22:54 'PACKER_CONFIG' not set; checking the default config >> file path >> >> 2020/03/19 05:22:54 Attempting to open config file: >> /home/ubuntu/.packerconfig >> >> 2020/03/19 05:22:54 [WARN] Config file doesn't exist: >> /home/ubuntu/.packerconfig >> >> 2020/03/19 05:22:54 Setting cache directory: >> /home/ubuntu/packer/packer_cache >> >> 2020/03/19 05:22:54 Creating plugin client for path: /usr/bin/packer >> >> 2020/03/19 05:22:54 Starting plugin: /usr/bin/packer >> []string{"/usr/bin/packer", "plugin", "packer-builder-amazon-ebs"} >> >> 2020/03/19 05:22:54 Waiting for RPC address for: /usr/bin/packer >> >> 2020/03/19 05:22:54 Received unix RPC address for /usr/bin/packer: addr >> is /tmp/packer-plugin972069966 >> >> 2020/03/19 05:22:54 packer-builder-amazon-ebs plugin: [INFO] Packer >> version: 1.5.4 [go1.13.7 linux amd64] >> >> 2020/03/19 05:22:54 packer-builder-amazon-ebs plugin: Checking >> 'PACKER_CONFIG' for a config file path >> >> 2020/03/19 05:22:54 packer-builder-amazon-ebs plugin: 'PACKER_CONFIG' not >> set; checking the default config file path >> >> 2020/03/19 05:22:54 packer-builder-amazon-ebs plugin: Attempting to open >> config file: /home/ubuntu/.packerconfig >> >> 2020/03/19 05:22:54 packer-builder-amazon-ebs plugin: [WARN] Config file >> doesn't exist: /home/ubuntu/.packerconfig >> >> 2020/03/19 05:22:54 packer-builder-amazon-ebs plugin: Setting cache >> directory: /home/ubuntu/packer/packer_cache >> >> 2020/03/19 05:22:54 packer-builder-amazon-ebs plugin: args: >> []string{"packer-builder-amazon-ebs"} >> >> 2020/03/19 05:22:54 packer-builder-amazon-ebs plugin: Plugin address: >> unix /tmp/packer-plugin972069966 >> >> 2020/03/19 05:22:54 packer-builder-amazon-ebs plugin: Waiting for >> connection... >> >> 2020/03/19 05:22:54 packer-builder-amazon-ebs plugin: Serving a plugin >> connection... >> >> 2020/03/19 05:22:54 Creating plugin client for path: /usr/bin/packer >> >> 2020/03/19 05:22:54 Starting plugin: /usr/bin/packer >> []string{"/usr/bin/packer", "plugin", "packer-provisioner-shell"} >> >> 2020/03/19 05:22:54 Waiting for RPC address for: /usr/bin/packer >> >> 2020/03/19 05:22:54 Received unix RPC address for /usr/bin/packer: addr >> is /tmp/packer-plugin020649790 >> >> 2020/03/19 05:22:54 packer-provisioner-shell plugin: [INFO] Packer >> version: 1.5.4 [go1.13.7 linux amd64] >> >> 2020/03/19 05:22:54 packer-provisioner-shell plugin: Checking >> 'PACKER_CONFIG' for a config file path >> >> 2020/03/19 05:22:54 packer-provisioner-shell plugin: 'PACKER_CONFIG' not >> set; checking the default config file path >> >> 2020/03/19 05:22:54 packer-provisioner-shell plugin: Attempting to open >> config file: /home/ubuntu/.packerconfig >> >> 2020/03/19 05:22:54 packer-provisioner-shell plugin: [WARN] Config file >> doesn't exist: /home/ubuntu/.packerconfig >> >> 2020/03/19 05:22:54 packer-provisioner-shell plugin: Setting cache >> directory: /home/ubuntu/packer/packer_cache >> >> 2020/03/19 05:22:54 packer-provisioner-shell plugin: args: >> []string{"packer-provisioner-shell"} >> >> 2020/03/19 05:22:54 packer-provisioner-shell plugin: Plugin address: unix >> /tmp/packer-plugin020649790 >> >> 2020/03/19 05:22:54 packer-provisioner-shell plugin: Waiting for >> connection... >> >> 2020/03/19 05:22:54 packer-provisioner-shell plugin: Serving a plugin >> connection... >> >> *amazon-ebs: output will be in this color.* >> >> 2020/03/19 05:22:54 Build debug mode: false >> >> 2020/03/19 05:22:54 Force build: false >> >> 2020/03/19 05:22:54 On error: >> >> 2020/03/19 05:22:54 Preparing build: amazon-ebs >> >> >> 2020/03/19 05:22:54 Waiting on builds to complete... >> >> 2020/03/19 05:22:54 Starting build run: amazon-ebs >> >> 2020/03/19 05:22:54 Running builder: amazon-ebs >> >> 2020/03/19 05:22:54 [INFO] (telemetry) Starting builder amazon-ebs >> >> 2020/03/19 05:22:54 packer-builder-amazon-ebs plugin: Found region >> ap-south-1 >> >> 2020/03/19 05:22:54 packer-builder-amazon-ebs plugin: [INFO] AWS Auth >> provider used: "EC2RoleProvider" >> >> 2020/03/19 05:22:54 packer-builder-amazon-ebs plugin: [INFO] (aws): No >> AWS timeout and polling overrides have been set. Packer will default to >> waiter-specific delays and timeouts. If you would like to customize the >> length of time between retries and max number of retries you may do so by >> setting the environment variables AWS_POLL_DELAY_SECONDS and >> AWS_MAX_ATTEMPTS to your desired values. >> >> *==> amazon-ebs: Prevalidating any provided VPC information* >> >> *==> amazon-ebs: Prevalidating AMI Name: fcp-runwayci 1584595374* >> >> 2020/03/19 05:22:55 packer-builder-amazon-ebs plugin: Using AMI Filters { >> >> 2020/03/19 05:22:55 packer-builder-amazon-ebs plugin: Filters: [{ >> >> 2020/03/19 05:22:55 packer-builder-amazon-ebs plugin: Name: >> "virtualization-type", >> >> 2020/03/19 05:22:55 packer-builder-amazon-ebs plugin: Values: >> ["hvm"] >> >> 2020/03/19 05:22:55 packer-builder-amazon-ebs plugin: },{ >> >> 2020/03/19 05:22:55 packer-builder-amazon-ebs plugin: Name: "name", >> >> 2020/03/19 05:22:55 packer-builder-amazon-ebs plugin: Values: >> ["ubuntu/images/*ubuntu-xenial-16.04-amd64-server-*"] >> >> 2020/03/19 05:22:55 packer-builder-amazon-ebs plugin: },{ >> >> 2020/03/19 05:22:55 packer-builder-amazon-ebs plugin: Name: >> "root-device-type", >> >> 2020/03/19 05:22:55 packer-builder-amazon-ebs plugin: Values: >> ["ebs"] >> >> 2020/03/19 05:22:55 packer-builder-amazon-ebs plugin: }], >> >> 2020/03/19 05:22:55 packer-builder-amazon-ebs plugin: Owners: >> ["099720109477"] >> >> 2020/03/19 05:22:55 packer-builder-amazon-ebs plugin: } >> >> amazon-ebs: Found Image ID: ami-011c09ac5e09ba22f >> >> *==> amazon-ebs: Creating temporary keypair: >> packer_5e7301ae-cdca-4b7f-abb6-cd895a22eae1* >> >> *==> amazon-ebs: Creating temporary security group for this instance: >> packer_5e7301af-ac07-b652-d8aa-c156c957fea3* >> >> 2020/03/19 05:22:55 packer-builder-amazon-ebs plugin: [DEBUG] Waiting for >> temporary security group: sg-01acbbe25bb8333cc >> >> 2020/03/19 05:22:56 packer-builder-amazon-ebs plugin: [DEBUG] Found >> security group sg-01acbbe25bb8333cc >> >> *==> amazon-ebs: Authorizing access to port 22 from [0.0.0.0/0 >> <http://0.0.0.0/0>] in the temporary security groups...* >> >> *==> amazon-ebs: Launching a source AWS instance...* >> >> *==> amazon-ebs: Adding tags to source instance* >> >> amazon-ebs: Adding tag: "Name": "Packer Builder" >> >> amazon-ebs: Instance ID: i-0362ec79eb337ebea >> >> *==> amazon-ebs: Waiting for instance (i-0362ec79eb337ebea) to become >> ready...* >> >> 2020/03/19 05:23:27 packer-builder-amazon-ebs plugin: [INFO] Not using >> winrm communicator, skipping get password... >> >> *==> amazon-ebs: Using ssh communicator to connect: 3.6.38.50* >> >> 2020/03/19 05:23:27 packer-builder-amazon-ebs plugin: [INFO] Waiting for >> SSH, up to timeout: 5m0s >> >> *==> amazon-ebs: Waiting for SSH to become available...* >> >> 2020/03/19 05:23:27 packer-builder-amazon-ebs plugin: Using host value: >> 3.6.38.50 >> >> 2020/03/19 05:23:42 packer-builder-amazon-ebs plugin: [DEBUG] TCP >> connection to SSH ip/port failed: dial tcp 3.6.38.50:22: i/o timeout >> >> 2020/03/19 05:23:47 packer-builder-amazon-ebs plugin: Using host value: >> 3.6.38.50 >> >> 2020/03/19 05:24:02 packer-builder-amazon-ebs plugin: [DEBUG] TCP >> connection to SSH ip/port failed: dial tcp 3.6.38.50:22: i/o timeout >> >> 2020/03/19 05:24:07 packer-builder-amazon-ebs plugin: Using host value: >> 3.6.38.50 >> >> 2020/03/19 05:24:22 packer-builder-amazon-ebs plugin: [DEBUG] TCP >> connection to SSH ip/port failed: dial tcp 3.6.38.50:22: i/o timeout >> >> 2020/03/19 05:24:27 packer-builder-amazon-ebs plugin: Using host value: >> 3.6.38.50 >> >> 2020/03/19 05:24:42 packer-builder-amazon-ebs plugin: [DEBUG] TCP >> connection to SSH ip/port failed: dial tcp 3.6.38.50:22: i/o timeout >> >> 2020/03/19 05:24:47 packer-builder-amazon-ebs plugin: Using host value: >> 3.6.38.50 >> >> 2020/03/19 05:25:02 packer-builder-amazon-ebs plugin: [DEBUG] TCP >> connection to SSH ip/port failed: dial tcp 3.6.38.50:22: i/o timeout >> >> 2020/03/19 05:25:07 packer-builder-amazon-ebs plugin: Using host value: >> 3.6.38.50 >> >> 2020/03/19 05:25:22 packer-builder-amazon-ebs plugin: [DEBUG] TCP >> connection to SSH ip/port failed: dial tcp 3.6.38.50:22: i/o timeout >> >> 2020/03/19 05:25:27 packer-builder-amazon-ebs plugin: Using host value: >> 3.6.38.50 >> >> 2020/03/19 05:25:42 packer-builder-amazon-ebs plugin: [DEBUG] TCP >> connection to SSH ip/port failed: dial tcp 3.6.38.50:22: i/o timeout >> >> 2020/03/19 05:25:47 packer-builder-amazon-ebs plugin: Using host value: >> 3.6.38.50 >> >> 2020/03/19 05:26:02 packer-builder-amazon-ebs plugin: [DEBUG] TCP >> connection to SSH ip/port failed: dial tcp 3.6.38.50:22: i/o timeout >> >> 2020/03/19 05:26:07 packer-builder-amazon-ebs plugin: Using host value: >> 3.6.38.50 >> >> 2020/03/19 05:26:22 packer-builder-amazon-ebs plugin: [DEBUG] TCP >> connection to SSH ip/port failed: dial tcp 3.6.38.50:22: i/o timeout >> >> 2020/03/19 05:26:27 packer-builder-amazon-ebs plugin: Using host value: >> 3.6.38.50 >> >> 2020/03/19 05:26:42 packer-builder-amazon-ebs plugin: [DEBUG] TCP >> connection to SSH ip/port failed: dial tcp 3.6.38.50:22: i/o timeout >> >> 2020/03/19 05:26:47 packer-builder-amazon-ebs plugin: Using host value: >> 3.6.38.50 >> >> 2020/03/19 05:27:02 packer-builder-amazon-ebs plugin: [DEBUG] TCP >> connection to SSH ip/port failed: dial tcp 3.6.38.50:22: i/o timeout >> >> 2020/03/19 05:27:07 packer-builder-amazon-ebs plugin: Using host value: >> 3.6.38.50 >> >> 2020/03/19 05:27:22 packer-builder-amazon-ebs plugin: [DEBUG] TCP >> connection to SSH ip/port failed: dial tcp 3.6.38.50:22: i/o timeout >> >> 2020/03/19 05:27:27 packer-builder-amazon-ebs plugin: Using host value: >> 3.6.38.50 >> >> 2020/03/19 05:27:42 packer-builder-amazon-ebs plugin: [DEBUG] TCP >> connection to SSH ip/port failed: dial tcp 3.6.38.50:22: i/o timeout >> >> 2020/03/19 05:27:47 packer-builder-amazon-ebs plugin: Using host value: >> 3.6.38.50 >> >> 2020/03/19 05:28:02 packer-builder-amazon-ebs plugin: [DEBUG] TCP >> connection to SSH ip/port failed: dial tcp 3.6.38.50:22: i/o timeout >> >> 2020/03/19 05:28:07 packer-builder-amazon-ebs plugin: Using host value: >> 3.6.38.50 >> >> 2020/03/19 05:28:22 packer-builder-amazon-ebs plugin: [DEBUG] TCP >> connection to SSH ip/port failed: dial tcp 3.6.38.50:22: i/o timeout >> >> *==> amazon-ebs: Timeout waiting for SSH.* >> >> *==> amazon-ebs: Terminating the source AWS instance...* >> >> 2020/03/19 05:28:27 packer-builder-amazon-ebs plugin: [DEBUG] SSH wait >> cancelled. Exiting loop. >> >> *==> amazon-ebs: Cleaning up any extra volumes...* >> >> *==> amazon-ebs: No volumes to clean up, skipping* >> >> *==> amazon-ebs: Deleting temporary security group...* >> >> *==> amazon-ebs: Deleting temporary keypair...* >> >> *Build 'amazon-ebs' errored: Timeout waiting for SSH.* >> >> >> ==> Some builds didn't complete successfully and had errors: >> >> 2020/03/19 05:28:58 [INFO] (telemetry) ending amazon-ebs >> >> 2020/03/19 05:28:58 machine readable: error-count []string{"1"} >> >> ==> Some builds didn't complete successfully and had errors: >> >> 2020/03/19 05:28:58 machine readable: amazon-ebs,error []string{"Timeout >> waiting for SSH."} >> >> ==> Builds finished but no artifacts were created. >> >> 2020/03/19 05:28:58 [INFO] (telemetry) Finalizing. >> >> --> amazon-ebs: Timeout waiting for SSH. >> >> >> ==> Builds finished but no artifacts were created. >> >> 2020/03/19 05:28:59 waiting for all plugin processes to complete... >> >> 2020/03/19 05:28:59 /usr/bin/packer: plugin process exited >> >> 2020/03/19 05:28:59 /usr/bin/packer: plugin process exited >> >> *The content of this e-mail is confidential and is intended solely for >> the use of the individual or entity to whom it is addressed. If you have >> received this e-mail by mistake, please reply to this e-mail and follow >> with its deletion. If you are not the intended recipient, please note that >> it shall be considered unlawful to copy, forward or in any manner reveal >> the contents of this e-mail or any part thereof to anyone. Although >> Freshworks has taken reasonable precautions to ensure no malware is present >> in this e-mail, Freshworks cannot accept responsibility for any loss or >> damage arising from the use of this e-mail or attachments.* >> >> -- >> This mailing list is governed under the HashiCorp Community Guidelines - >> https://www.hashicorp.com/community-guidelines.html. Behavior in >> violation of those guidelines may result in your removal from this mailing >> list. >> >> GitHub Issues: https://github.com/mitchellh/packer/issues >> IRC: #packer-tool on Freenode >> --- >> You received this message because you are subscribed to the Google Groups >> "Packer" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/packer-tool/16eb1c4c-68a8-4eac-bf9e-a3cc238d1778%40googlegroups.com >> >> <https://groups.google.com/d/msgid/packer-tool/16eb1c4c-68a8-4eac-bf9e-a3cc238d1778%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- **The content of this e-mail is confidential and is intended solely for the use of the individual or entity to whom it is addressed. If you have received this e-mail by mistake, please reply to this e-mail and follow with its deletion. If you are not the intended recipient, please note that it shall be considered unlawful to copy, forward or in any manner reveal the contents of this e-mail or any part thereof to anyone. Although Freshworks has taken reasonable precautions to ensure no malware is present in this e-mail, Freshworks cannot accept responsibility for any loss or damage arising from the use of this e-mail or attachments.**
-- This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list. GitHub Issues: https://github.com/mitchellh/packer/issues IRC: #packer-tool on Freenode --- You received this message because you are subscribed to the Google Groups "Packer" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/848a20a4-59be-447b-83a4-39447cfeb60c%40googlegroups.com.
