Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/bin/sh: 1: /home/ubuntu/packer/script_2501.sh: Permission denied #118

Open
hc-github-team-packer opened this issue Sep 7, 2022 · 0 comments

Comments

@hc-github-team-packer
Copy link

This issue was originally opened by @fredleger in hashicorp/packer#11968 and has been migrated to this repository. The original issue description is below.


Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Overview of the Issue

As stated in #5307 packer even at latest version upload temporary script files with wrong owner if the container is nut run as root

Reproduction Steps

source "docker" "container" {
  commit = true
  image  = "ubuntu:jammy"
  run_command = [
    "-d", "-i", "-t", "--user", "1000", "--entrypoint=/bin/sh", "--", "{{.Image}}"
  ]
}

Packer version

v1.8.3

Simplified Packer Template

see above

Operating system and Environment details

macosx ruuning rancher desktop for docker (so at the end linux)

Log Fragments and crash.log files

==> docker.container: Starting docker container...
    docker.container: Run command: docker run -v /Users/frederic/.packer.d/tmp2545466742:/packer-files -d -i -t --user 1000 --entrypoint=/bin/sh -- ubuntu:jammy
    docker.container: Container ID: eee892b4cf201e56176d93c5cd131b2ed6c76f4e4d342b8eed7c7479833718cc
==> docker.container: Pausing after run of step 'StepRun'. Press enter to continue. 
==> docker.container: Using docker communicator to connect: 172.17.0.2
==> docker.container: Pausing after run of step 'StepConnect'. Press enter to continue. 
==> docker.container: Pausing before the next provisioner . Press enter to continue. 
==> docker.container: Provisioning with shell script: /var/folders/n_/jtqch7ls28534bbt4hl905mr0000gn/T/packer-shell1344318242
==> docker.container: chmod: changing permissions of '/home/ubuntu/packer/script_2501.sh': Operation not permitted
==> docker.container: /bin/sh: 1: /home/ubuntu/packer/script_2501.sh: Permission denied
==> docker.container: Script exited with non-zero exit status: 126. Allowed exit codes are: [0]
==> docker.container: Step "StepProvision" failed

In the container:

buntu@3c5cc3a18ffc:~/packer$ ls -l
total 4
-rw------- 1 501 dialout 66 Sep  1 15:02 script_4966.sh

The owner id is 501 (which is my host user id) and not 1000 as it should be

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant