hashicorp / packer

Packer is a tool for creating identical machine images for multiple platforms from a single source configuration.
http://www.packer.io
Other
15.12k stars 3.33k forks source link

Amazon EBS builder hangs in midair #673

Closed bracki closed 10 years ago

bracki commented 10 years ago

The builder seems to lose the SSH connection and never prints any output.

2013/12/02 12:24:46 /Users/jan/Projects/bin/packer-builder-amazon-ebs: 2013/12/02 12:24:46 Opening conn for SSH to tcp 10.5.2.57:22
2013/12/02 12:24:51 /Users/jan/Projects/bin/packer-builder-amazon-ebs: 2013/12/02 12:24:51 Opening conn for SSH to tcp 10.5.2.57:22
2013/12/02 12:24:56 /Users/jan/Projects/bin/packer-builder-amazon-ebs: 2013/12/02 12:24:56 Opening conn for SSH to tcp 10.5.2.57:22
2013/12/02 12:25:01 /Users/jan/Projects/bin/packer-builder-amazon-ebs: 2013/12/02 12:25:01 Opening conn for SSH to tcp 10.5.2.57:22
2013/12/02 12:25:06 /Users/jan/Projects/bin/packer-builder-amazon-ebs: 2013/12/02 12:25:06 Opening conn for SSH to tcp 10.5.2.57:22
2013/12/02 12:25:11 /Users/jan/Projects/bin/packer-builder-amazon-ebs: 2013/12/02 12:25:11 Opening conn for SSH to tcp 10.5.2.57:22
2013/12/02 12:25:16 /Users/jan/Projects/bin/packer-builder-amazon-ebs: 2013/12/02 12:25:16 Opening conn for SSH to tcp 10.5.2.57:22
2013/12/02 12:25:21 /Users/jan/Projects/bin/packer-builder-amazon-ebs: 2013/12/02 12:25:21 Opening conn for SSH to tcp 10.5.2.57:22
2013/12/02 12:25:25 /Users/jan/Projects/bin/packer-builder-amazon-ebs: 2013/12/02 12:25:25 remote command exited with '2':   sudo -E puppet apply --verbose --modulepath='/tmp/packer-puppet-masterless/module-0' --manifestdir='/tmp/packer-puppet-masterless/manifests' --detailed-exitcodes /tmp/packer-puppet-masterless/manifests/foo.pp
2013/12/02 12:25:25 0 bytes written for 'stderr'
2013/12/02 12:25:25 82444 bytes written for 'stdout'
2013/12/02 12:25:25 /Users/jan/Projects/bin/packer-command-build: 2013/12/02 12:25:25 0 bytes written for 'stderr'
2013/12/02 12:25:25 /Users/jan/Projects/bin/packer-command-build: 2013/12/02 12:25:25 82444 bytes written for 'stdout'
2013/12/02 12:25:25 82444 bytes written for 'stdout'
2013/12/02 12:25:25 0 bytes written for 'stderr'
2013/12/02 12:25:26 /Users/jan/Projects/bin/packer-builder-amazon-ebs: 2013/12/02 12:25:26 Opening conn for SSH to tcp 10.5.2.57:22
SIGQUIT: quit
PC=0xa074e

syscall.Syscall6()
    /usr/local/Cellar/go/1.1.2/libexec/src/pkg/syscall/asm_darwin_amd64.s:39 +0x5
syscall.wait4(0x18a1, 0xc2000003e8, 0x0, 0xc2000cd240, 0x100000001, ...)
    /usr/local/Cellar/go/1.1.2/libexec/src/pkg/syscall/zsyscall_darwin_amd64.go:32 +0x7b
syscall.Wait4(0x18a1, 0x585b8c, 0x0, 0xc2000cd240, 0xc2ffffffff, ...)
    /usr/local/Cellar/go/1.1.2/libexec/src/pkg/syscall/syscall_bsd.go:137 +0x6c
os.(*Process).wait(0xc2001094a0, 0xc2000a05a0, 0x0, 0x0)
    /usr/local/Cellar/go/1.1.2/libexec/src/pkg/os/exec_unix.go:22 +0xea
os.(*Process).Wait(0xc2001094a0, 0x100000001, 0x1e3ff, 0x480ab4)
    /usr/local/Cellar/go/1.1.2/libexec/src/pkg/os/doc.go:43 +0x25
os/exec.(*Cmd).Wait(0xc2000d4000, 0xc2001094c0, 0x1)
    /usr/local/Cellar/go/1.1.2/libexec/src/pkg/os/exec/exec.go:310 +0x197
github.com/mitchellh/panicwrap.Wrap(0xc2000babe0, 0x0, 0x0, 0x0)
    /Users/jan/Projects/src/github.com/mitchellh/panicwrap/panicwrap.go:166 +0x753
main.realMain(0x0)
    /Users/jan/Projects/src/github.com/mitchellh/packer/packer.go:59 +0x54b
main.main()
    /Users/jan/Projects/src/github.com/mitchellh/packer/packer.go:22 +0x1c

goroutine 2 [syscall]:

goroutine 4 [syscall]:
os/signal.loop()
    /usr/local/Cellar/go/1.1.2/libexec/src/pkg/os/signal/signal_unix.go:21 +0x1c
created by os/signal.init·1
    /usr/local/Cellar/go/1.1.2/libexec/src/pkg/os/signal/signal_unix.go:27 +0x2f

goroutine 6 [semacquire]:
sync.runtime_Semacquire(0xc20014f100)
    /usr/local/Cellar/go/1.1.2/libexec/src/pkg/runtime/zsema_darwin_amd64.c:165 +0x2e
sync.(*Cond).Wait(0xc200107030)
    /usr/local/Cellar/go/1.1.2/libexec/src/pkg/sync/cond.go:74 +0x95
io.(*pipe).read(0xc200107000, 0xc200108800, 0x800, 0x800, 0x0, ...)
    /usr/local/Cellar/go/1.1.2/libexec/src/pkg/io/pipe.go:52 +0x1f2
io.(*PipeReader).Read(0xc200000360, 0xc200108800, 0x800, 0x800, 0x84, ...)
    /usr/local/Cellar/go/1.1.2/libexec/src/pkg/io/pipe.go:130 +0x5d
github.com/mitchellh/panicwrap.trackPanic(0xc200103210, 0xc200000360, 0xc2001031b0, 0xc2000d3f80, 0x11e1a300, ...)
    /Users/jan/Projects/src/github.com/mitchellh/panicwrap/panicwrap.go:228 +0x4d2
created by github.com/mitchellh/panicwrap.Wrap
    /Users/jan/Projects/src/github.com/mitchellh/panicwrap/panicwrap.go:136 +0x39b

goroutine 7 [syscall]:
syscall.Syscall()
    /usr/local/Cellar/go/1.1.2/libexec/src/pkg/syscall/asm_darwin_amd64.s:15 +0x5
syscall.read(0x4, 0xc20010c000, 0x8000, 0x8000, 0xc200102100, ...)
    /usr/local/Cellar/go/1.1.2/libexec/src/pkg/syscall/zsyscall_darwin_amd64.go:900 +0x70
syscall.Read(0x4, 0xc20010c000, 0x8000, 0x8000, 0x33c4a0, ...)
    /usr/local/Cellar/go/1.1.2/libexec/src/pkg/syscall/syscall_unix.go:132 +0x5a
os.(*File).read(0xc200000398, 0xc20010c000, 0x8000, 0x8000, 0xc20010c000, ...)
    /usr/local/Cellar/go/1.1.2/libexec/src/pkg/os/file_unix.go:174 +0x60
os.(*File).Read(0xc200000398, 0xc20010c000, 0x8000, 0x8000, 0x84, ...)
    /usr/local/Cellar/go/1.1.2/libexec/src/pkg/os/file.go:95 +0x96
io.Copy(0xc2001032a0, 0xc200000368, 0xc200103270, 0xc200000398, 0x1b5518, ...)
    /usr/local/Cellar/go/1.1.2/libexec/src/pkg/io/io.go:348 +0x1c6
os/exec.func·003(0xc2000db0b0, 0x1d664)
    /usr/local/Cellar/go/1.1.2/libexec/src/pkg/os/exec/exec.go:207 +0x60
os/exec.func·004(0xc2000d3fe0)
    /usr/local/Cellar/go/1.1.2/libexec/src/pkg/os/exec/exec.go:276 +0x2a
created by os/exec.(*Cmd).Start
    /usr/local/Cellar/go/1.1.2/libexec/src/pkg/os/exec/exec.go:277 +0x732

goroutine 8 [select]:
github.com/mitchellh/panicwrap.func·002()
    /Users/jan/Projects/src/github.com/mitchellh/panicwrap/panicwrap.go:158 +0xd0
created by github.com/mitchellh/panicwrap.Wrap
    /Users/jan/Projects/src/github.com/mitchellh/panicwrap/panicwrap.go:164 +0x740
rax     0x2000007
rbx     0xc2000a0008
rcx     0x585aa0
rdx     0x0
rdi     0x18a1
rsi     0xc2000003e8
rbp     0xd
rsp     0x585aa0
r8      0x0
r9      0x0
r10     0xc2000cd240
r11     0x202
r12     0xb7c791b7815
r13     0x188c544dbd88
r14     0x133bffabdf747000
r15     0x0
rip     0xa074e
rflags  0x202
cs      0x7
fs      0x0
gs      0x0
bracki commented 10 years ago

Seems related: https://github.com/mitchellh/packer/issues/626

mitchellh commented 10 years ago

Is this consistent for you? Is it possible to see your template?

bracki commented 10 years ago

It depends. I had one case where packer played nicely but puppet failed due to reasons.

{
    "builders": [
        {
            "ami_name": "foo {{timestamp}}",
            "instance_type": "m1.large",
            "region": "eu-west-1",
            "source_ami": "ami-1234567",
            "ssh_username": "root",
            "subnet_id": "subnet-1234567",
            "type": "amazon-ebs",
            "vpc_id": "vpc-1234567"
        }
    ],
    "provisioners": [
        {
            "scripts": [
                "scripts/base.sh"
            ],
            "type": "shell"
        },
        {
            "manifest_file": "../../configuration-management/manifests/dev-masterless.pp",
            "module_paths": [
                "../../configuration-management/modules"
            ],
            "type": "puppet-masterless"
        }
    ]
}
bracki commented 10 years ago

Ha, turns out I compiled it with the wrong Go version (1.1.2). Go 1.2 works.