shantanoo-desai / packer-ubuntu-server-uefi

Packer Templates for creating Ubuntu Live Server Images with Packer + QEMU + Autoinstall (cloud-init)
Apache License 2.0
29 stars 13 forks source link

Failed to unmount /cdrom #7

Closed chrismorales closed 1 year ago

chrismorales commented 1 year ago

I cloned the repo and wanted to test out image creation but after the installation finishes it fails to unmount the cdrom and reboots back into the grub menu for installation. This happened for both focal and jammy.

shantanoo-desai commented 1 year ago

Can you try using the headless=false and see the logs of Cloud-Init? In most cases it is a problem with efibootmgr sequence.

See #2

shivaji17 commented 1 year ago

@chrismorales @shantanoo-desai I was able to solve the issue by following the suggestion from this comment

chrismorales commented 1 year ago

@shivaji17 that answer did not resolve my issue still failing to unmount cdrom. At this point I'm ready to give up even trying to build a ubuntu 20.04 uefi image. I was trying to resolve another issue with migrating my kickstart configuration to autoinstall but looks like subiquity has issue with unmounting cdrom after installation. I'm going to close this issue out. thank you for the help though.

shivaji17 commented 1 year ago

@shantanoo-desai Are you ok wtih using the approach mentioned in this comment by using late-commands:? If yes, can you please add this or can I raise a PR? Thanks.

shantanoo-desai commented 1 year ago

@shivaji17 Can confirm it will work for me locally. Added the suggestion in the main branch with some minor changes to the template. Release v0.4.2 should integrate this changes and work

shivaji17 commented 1 year ago

@shantanoo-desai I was ran make build-jammy and first two lines of output were following and when packer established connection with VM, packer crashed:

source /etc/os-release; PACKER_LOG=1 packer build -force -var host_distro=${ID} -var-file=./vars/jammy.pkrvars.hcl ./templates/ubuntu.pkr.hcl
/bin/sh: 1: source: not found
...
...
...
==> custom_build.qemu.custom_image: Connected to SSH!
2023/05/03 22:20:59 packer-builder-qemu plugin: Running the provision hook
2023/05/03 22:21:00 [INFO] (telemetry) Starting provisioner shell
2023/05/03 22:21:00 ConfigSpec failed: connection is shut down
panic: ConfigSpec failed: connection is shut down [recovered]
    panic: ConfigSpec failed: connection is shut down

goroutine 111 [running]:
log.Panic({0xc001146f88?, 0x6?, 0x200?})
    log/log.go:385 +0x65
github.com/hashicorp/packer/packer.(*cmdProvisioner).checkExit(0x7f949c725ae8?, {0x40aaa20, 0xc0000aa400}, 0x0)
    github.com/hashicorp/packer/packer/cmd_provisioner.go:47 +0x7f
github.com/hashicorp/packer/packer.(*cmdProvisioner).ConfigSpec.func1()
    github.com/hashicorp/packer/packer/cmd_provisioner.go:19 +0x39
panic({0x40aaa20, 0xc0000aa400})
    runtime/panic.go:838 +0x207
github.com/hashicorp/packer-plugin-sdk/rpc.(*commonClient).ConfigSpec(0xc000444ee0)
    github.com/hashicorp/packer-plugin-sdk@v0.3.4/rpc/common.go:47 +0x297
github.com/hashicorp/packer/packer.(*cmdProvisioner).ConfigSpec(0x499c5a0?)
    github.com/hashicorp/packer/packer/cmd_provisioner.go:22 +0x65
github.com/hashicorp/packer/hcl2template.decodeHCL2Spec({0x59e2ac8, 0xc0007ad710}, 0x518cc7c?, {0x7f94758653d8?, 0xc00000d5f0?})
    github.com/hashicorp/packer/hcl2template/decode.go:17 +0x39
github.com/hashicorp/packer/hcl2template.(*HCL2Provisioner).HCL2Prepare(0xc0010b2b70, 0xc0010b2060?)
    github.com/hashicorp/packer/hcl2template/types.hcl_provisioner.go:51 +0x447
github.com/hashicorp/packer/hcl2template.(*HCL2Provisioner).Provision(0xc0010b2b70, {0x59e2128, 0xc0007a0240}, {0x59e6fd0, 0xc0010b2030}, {0x59e52d0, 0xc000444040}, 0xc000444040?)
    github.com/hashicorp/packer/hcl2template/types.hcl_provisioner.go:71 +0x4e
github.com/hashicorp/packer/packer.(*ProvisionHook).Run(0xc000fd4040?, {0x59e2128, 0xc0007a0240}, {0x7f949c71a5b8?, 0x20?}, {0x59e6fd0, 0xc0010b2030}, {0x59e52d0?, 0xc000444040}, {0x43cc700, ...})
    github.com/hashicorp/packer/packer/provisioner.go:122 +0x1cb
panic: ConfigSpec failed: connection is shut down [recovered]
    panic: ConfigSpec failed: connection is shut down

goroutine 111 [running]:
log.Panic({0xc001146f88?, 0x6?, 0x200?})
    log/log.go:385 +0x65
github.com/hashicorp/packer/packer.(*cmdProvisioner).checkExit(0x7f949c725ae8?, {0x40aaa20, 0xc0000aa400}, 0x0)
    github.com/hashicorp/packer/packer/cmd_provisioner.go:47 +0x7f
github.com/hashicorp/packer/packer.(*cmdProvisioner).ConfigSpec.func1()
    github.com/hashicorp/packer/packer/cmd_provisioner.go:19 +0x39
panic({0x40aaa20, 0xc0000aa400})
    runtime/panic.go:838 +0x207
github.com/hashicorp/packer-plugin-sdk/rpc.(*commonClient).ConfigSpec(0xc000444ee0)
    github.com/hashicorp/packer-plugin-sdk@v0.3.4/rpc/common.go:47 +0x297
github.com/hashicorp/packer/packer.(*cmdProvisioner).ConfigSpec(0x499c5a0?)
    github.com/hashicorp/packer/packer/cmd_provisioner.go:22 +0x65
github.com/hashicorp/packer/hcl2template.decodeHCL2Spec({0x59e2ac8, 0xc0007ad710}, 0x518cc7c?, {0x7f94758653d8?, 0xc00000d5f0?})
    github.com/hashicorp/packer/hcl2template/decode.go:17 +0x39
github.com/hashicorp/packer/hcl2template.(*HCL2Provisioner).HCL2Prepare(0xc0010b2b70, 0xc0010b2060?)
    github.com/hashicorp/packer/hcl2template/types.hcl_provisioner.go:51 +0x447
github.com/hashicorp/packer/hcl2template.(*HCL2Provisioner).Provision(0xc0010b2b70, {0x59e2128, 0xc0007a0240}, {0x59e6fd0, 0xc0010b2030}, {0x59e52d0, 0xc000444040}, 0xc000444040?)
    github.com/hashicorp/packer/hcl2template/types.hcl_provisioner.go:71 +0x4e
github.com/hashicorp/packer/packer.(*ProvisionHook).Run(0xc000fd4040?, {0x59e2128, 0xc0007a0240}, {0x7f949c71a5b8?, 0x20?}, {0x59e6fd0, 0xc0010b2030}, {0x59e52d0?, 0xc000444040}, {0x43cc700, ...})
    github.com/hashicorp/packer/packer/provisioner.go:122 +0x1cb
github.com/hashicorp/packer-plugin-sdk/packer.(*DispatchHook).Run(0x1007b81a0?, {0x59e2128, 0xc0007a0240}, {0xc000fd4040, 0x10}, {0x59e6fd0, 0xc0010b2030}, {0x59e52d0, 0xc000444040}, {0x43cc700, ...})
    github.com/hashicorp/packer-plugin-sdk@v0.3.4/packer/hook.go:50 +0x172
github.com/hashicorp/packer-plugin-sdk/rpc.(*HookServer).Run(0xc0007a0080, 0xc001122120, 0xc00080e5b0)
    github.com/hashicorp/packer-plugin-sdk@v0.3.4/rpc/hook.go:78 +0x263
reflect.Value.call({0xc0007aa0c0?, 0xc00111d040?, 0x13?}, {0x518b294, 0x4}, {0xc000775ef8, 0x3, 0x3?})
    reflect/value.go:556 +0x845
reflect.Value.Call({0xc0007aa0c0?, 0xc00111d040?, 0x44d6f80?}, {0xc0000966f8, 0x3, 0x3})
    reflect/value.go:339 +0xbf
net/rpc.(*service).call(0xc0007a00c0, 0xc000834940?, 0xc?, 0xc0007c8170, 0xc000598400, 0xc000096748?, {0x3efbde0?, 0xc001122120?, 0x0?}, {0x3f71360, ...}, ...)
    net/rpc/server.go:381 +0x226
created by net/rpc.(*Server).ServeCodec
    net/rpc/server.go:478 +0x3fe

github.com/hashicorp/packer-plugin-sdk/packer.(*DispatchHook).Run(0x1007b81a0?, {0x59e2128, 0xc0007a0240}, {0xc000fd4040, 0x10}, {0x59e6fd0, 0xc0010b2030}, {0x59e52d0, 0xc000444040}, {0x43cc700, ...})
    github.com/hashicorp/packer-plugin-sdk@v0.3.4/packer/hook.go:50 +0x172
github.com/hashicorp/packer-plugin-sdk/rpc.(*HookServer).Run(0xc0007a0080, 0xc001122120, 0xc00080e5b0)
    github.com/hashicorp/packer-plugin-sdk@v0.3.4/rpc/hook.go:78 +0x263
reflect.Value.call({0xc0007aa0c0?, 0xc00111d040?, 0x13?}, {0x518b294, 0x4}, {0xc000775ef8, 0x3, 0x3?})
    reflect/value.go:556 +0x845
reflect.Value.Call({0xc0007aa0c0?, 0xc00111d040?, 0x44d6f80?}, {0xc0000966f8, 0x3, 0x3})
    reflect/value.go:339 +0xbf
net/rpc.(*service).call(0xc0007a00c0, 0xc000834940?, 0xc?, 0xc0007c8170, 0xc000598400, 0xc000096748?, {0x3efbde0?, 0xc001122120?, 0x0?}, {0x3f71360, ...}, ...)
    net/rpc/server.go:381 +0x226
created by net/rpc.(*Server).ServeCodec
    net/rpc/server.go:478 +0x3fe
Failed to report panic. This is safe to ignore: Post "https://checkpoint-api.hashicorp.com/v1/telemetry/packer": context deadline exceeded

!!!!!!!!!!!!!!!!!!!!!!!!!!! PACKER CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!

Packer crashed! This is always indicative of a bug within Packer.
A crash log has been placed at "crash.log" relative to your current
working directory. It would be immensely helpful if you could please
report the crash with Packer[1] so that we can fix this.

[1]: https://github.com/hashicorp/packer/issues

!!!!!!!!!!!!!!!!!!!!!!!!!!! PACKER CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!
make: *** [Makefile:32: build-jammy] Error 2

packer version: 1.8.6

shantanoo-desai commented 1 year ago

@shivaji17 Let me perform some local tests. Have you changed anything in the Packer template? Although I have the same packer version I cannot reproduce this bug.

shivaji17 commented 1 year ago

No

shantanoo-desai commented 1 year ago

what host operating system are you running? generally source is available on most machines

shantanoo-desai commented 1 year ago

related to https://github.com/hashicorp/packer/issues/12289 maybe so this is a packer related problem. Closing this issue since this repository cannot change packer's source code. @shivaji17 I would suggest you report this to the issue at hashicorp packer.

shivaji17 commented 1 year ago

Yes sure.