hashicorp / hashicorp/packer-plugin-amazon
AMI BUILDER (CHROOT) Attachment point /dev/sdf is already in use (parallel builds)
- Dominant language
- Go
- Stars
- 91
- Forks
- 141
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 3
Description
_This issue was originally opened by @gardleopard as hashicorp/packer#3060. It was migrated here as a result of the [Packer plugin split](https://github.com/hashicorp/packer/issues/8610#issuecomment-770034737). The original body of the issue is below._
Packer 0.8.6
This issue is a little bit tricky to reproduce. You need to run multiple builds on the same host. I think it happens when a build launches at the same time as an other build frees its EBS volume.
To reproduce this I run 6 terminals with the same build. I start one build and when its around the logging of "==> amazon-chroot: Unmounting the root device..." I start the 5 other builds. The builds are just using shell provisioner doing:
```
apt-get update
apt-get install --force-yes -y vim
apt-get install --force-yes -y telnet
```
The base ami is ubuntu trusty and the packages are already installed. This is just a simple build to reproduce the bug.
I can see in the build log of one of the builds that I started before that /dev/sdf is used there and unmounted at about the same time as the failing build is starting up. This is the error message I get:
```
amazon-chroot output will be in this color.
==> amazon-chroot: Prevalidating AMI Name...
==> amazon-chroot: Gathering information about this EC2 instance...
==> amazon-chroot: Inspecting the source AMI...
==> amazon-chroot: Checking the root device on source AMI...
==> amazon-chroot: Creating the root volume...
==> amazon-chroot: Attaching the root volume to /dev/sdf
==> amazon-chroot: Error attaching volume: InvalidParameterValue: Invalid value '/dev/sdf' for unixDevice. Attachment point /dev/sdf is already in use
==> amazon-chroot: status code: 400, request id: []
==> amazon-chroot: Deleting the created EBS volume...
Build 'amazon-chroot' errored: Error attaching volume: InvalidParameterValue: Invalid value '/dev/sdf' for unixDevice. Attachment point /dev/sdf is already in use
status code: 400, request id: []
==> Some builds didn't complete successfully and had errors:
--> amazon-chroot: Error attaching volume: InvalidParameterValue: Invalid value '/dev/sdf' for unixDevice. Attachment point /dev/sdf is already in use
status code: 400, request id: []
==> Builds finished but no artifacts were created.
```
https://gist.github.com/gardleopard/597378585a698c09f3f5
Contributor guide
Assessment
This issue has not been assessed yet.