The error is there:
cp: cannot create regular file
'/mnt/packer-amazon-chroot-volumes/xvdf/etc/resolv.conf':
No such file or directory
You haven't created the directory. Repeating my advice use the *amazon-ebs
*builder
instead, at least until you get comfortable with packer and as log as you
don't need a special feature of the *amazon-chroot* builder.
On Thursday, September 15, 2016 at 6:18:52 PM UTC+2, Sergey Esin wrote:
>
> Hi,
>
> I am newbie in Packer, would like to use Packer with amazon-chroot builder
> to customize CoreOS-stable-1122.2.0-hvm (officia public AMI ID in EU
> Ireland region: ami-e3d6ab90)
>
>
> Packer config is really simple:
>
> $ cat coreos-1122.2.0-hvm-aws-chroot.json
> {
> "variables": {
> "aws_access_key": "",
> "aws_secret_key": ""
> },
> "builders": [{
> "name": "build-aws-hmv",
> "type": "amazon-chroot",
> "access_key": "{{user `aws_access_key`}}",
> "secret_key": "{{user `aws_secret_key`}}",
> "ami_virtualization_type": "hvm",
> "region": "eu-west-1",
> "source_ami": "ami-0092eb73",
> "ami_name": "packer-example {{timestamp}} coreos",
> "tags": {
> "component": "allapps",
> "version": "404"
> }
> }],
>
> "provisioners": [{
> "type": "shell",
> "inline": [
> "docker pull centos:7"
> ]
> }]
> }
>
>
>
> $ ./packer validate coreos-1122.2.0-hvm-aws-chroot.json
> Template validated successfully.
>
>
>
>
>
> I am getting this error:
>
> $ ./packer build coreos-1122.2.0-hvm-aws-chroot.json
> build-aws-hmv output will be in this color.
>
> ==> build-aws-hmv: Prevalidating AMI Name...
> ==> build-aws-hmv: Gathering information about this EC2 instance...
> ==> build-aws-hmv: Error retrieving the ID of the instance Packer is
> running on.
> ==> build-aws-hmv: Please verify Packer is running on a proper AWS EC2
> instance.
> Build 'build-aws-hmv' errored: Error retrieving the ID of the instance
> Packer is running on.
> Please verify Packer is running on a proper AWS EC2 instance.
>
> ==> Some builds didn't complete successfully and had errors:
> --> build-aws-hmv: Error retrieving the ID of the instance Packer is
> running on.
> Please verify Packer is running on a proper AWS EC2 instance.
>
> ==> Builds finished but no artifacts were created.
>
>
>
>
> AMI "ami-0092eb73" that I am using in my config above was created the
> following way:
>
> 1. Used original public CoreOS image (ami-e3d6ab90) to run instance.
> 2. Stopped the instance and took an AMI
> 3. Run the instance back and left it in running state
>
>
> What's wrong with my config?
>
>
> Do I understand right that in order to be able to use amazon-chroot
> builder with Packer I have to leave my instance running?
>
>
>
> p.s. The following example.json works fine for me (so it's all fine with
> AWS IAM permissions):
>
> $ cat example.json
> {
> "variables": {
> "aws_access_key": "",
> "aws_secret_key": ""
> },
> "builders": [{
> "type": "amazon-ebs",
> "access_key": "{{user `aws_access_key`}}",
> "secret_key": "{{user `aws_secret_key`}}",
> "region": "eu-west-1",
> "source_ami": "ami-f95ef58a",
> "instance_type": "t2.micro",
> "ssh_username": "ubuntu",
> "ami_name": "packer-example {{timestamp}}"
> }]
> }
>
>
--
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/4366692d-dfab-4875-847e-eeb9a3afc83a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.