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

File not found error for script provided to shell provisioner #245

Closed
benalexau opened this issue Nov 30, 2022 · 2 comments · Fixed by #249
Closed

File not found error for script provided to shell provisioner #245

benalexau opened this issue Nov 30, 2022 · 2 comments · Fixed by #249

Comments

@benalexau
Copy link

I use GitHub Actions to build an ArchLinuxARM-rpi-armv7-latest.tar.gz image using a file-based shell provisioner configured as follows:

    {
      "type": "shell",
      "scripts": [
        "build.sh"
      ]
    }

A file not found error is reported after the shell script is uploaded:

==> arm: Uploading resizerootfs => /tmp/resizerootfs
2022/11/29 23:27:20 packer-builder-arm plugin: 2022/11/29 23:27:20 Uploading to chroot dir: /tmp/3848570873/tmp/resizerootfs
2022/11/29 23:27:20 packer-provisioner-file plugin: [INFO] 449 bytes written for 'uploadData'
2022/11/29 23:27:20 [INFO] 449 bytes written for 'uploadData'
2022/11/29 23:27:20 packer-provisioner-file plugin: closing
2022/11/29 23:27:20 closing
2022/11/29 23:27:20 packer-builder-arm plugin: 2022/11/29 23:27:20 closing
2022/11/29 23:27:20 [INFO] (telemetry) ending file
2022/11/29 23:27:20 [INFO] (telemetry) Starting provisioner shell
==> arm: Provisioning with shell script: build.sh
2022/11/29 23:27:20 packer-provisioner-shell plugin: Opening build.sh for reading
2022/11/29 23:27:20 packer-provisioner-shell plugin: [INFO] 2736 bytes written for 'uploadData'
2022/11/29 23:27:20 [INFO] 2736 bytes written for 'uploadData'
2022/11/29 23:27:20 packer-builder-arm plugin: 2022/11/29 23:27:20 Uploading to chroot dir: /tmp/3848570873/tmp/script_5870.sh
2022/11/29 23:27:20 packer-builder-arm plugin: 2022/11/29 23:27:20 Executing: /bin/sh []string{"/bin/sh", "-c", "chroot /tmp/3848570873 /bin/sh -c \"chmod 0755 /tmp/script_5870.sh\""}
2022/11/29 23:27:20 packer-builder-arm plugin: 2022/11/29 23:27:20 Chroot execution exited with '127': '"chmod 0755 /tmp/script_5870.sh"'
2022/11/29 23:27:20 packer-builder-arm plugin: 2022/11/29 23:27:20 [INFO] RPC endpoint: Communicator ended with: 127
2022/11/29 23:27:20 [INFO] RPC client: Communicator ended with: 127
2022/11/29 23:27:20 [INFO] RPC endpoint: Communicator ended with: 127
2022/11/29 23:27:20 packer-provisioner-shell plugin: [INFO] RPC client: Communicator ended with: 127
2022/11/29 23:27:20 packer-builder-arm plugin: 2022/11/29 23:27:20 Executing: /bin/sh []string{"/bin/sh", "-c", "chroot /tmp/3848570873 /bin/sh -c \"chmod +x /tmp/script_5870.sh; PACKER_BUILDER_TYPE='arm' PACKER_BUILD_NAME='arm'  /tmp/script_5870.sh\""}
==> arm: -c: chmod +x /tmp/script_5870.sh; PACKER_BUILDER_TYPE='arm' PACKER_BUILD_NAME='arm'  /tmp/script_5870.sh: No such file or directory
2022/11/29 23:27:20 packer-builder-arm plugin: 2022/11/29 23:27:20 Chroot execution exited with '127': '"chmod +x /tmp/script_5870.sh; PACKER_BUILDER_TYPE='arm' PACKER_BUILD_NAME='arm'  /tmp/script_5870.sh"'
2022/11/29 23:27:20 packer-builder-arm plugin: 2022/11/29 23:27:20 [INFO] RPC endpoint: Communicator ended with: 127
2022/11/29 23:27:20 [INFO] 0 bytes written for 'stdout'
2022/11/29 23:27:20 [INFO] 132 bytes written for 'stderr'
2022/11/29 23:27:20 [INFO] RPC client: Communicator ended with: 127
2022/11/29 23:27:20 [INFO] RPC endpoint: Communicator ended with: 127
2022/11/29 23:27:20 packer-provisioner-shell plugin: [INFO] 0 bytes written for 'stdout'
2022/11/29 23:27:20 packer-provisioner-shell plugin: [INFO] 132 bytes written for 'stderr'
2022/11/29 23:27:20 packer-provisioner-shell plugin: [INFO] RPC client: Communicator ended with: 127
2022/11/29 23:27:20 [INFO] (telemetry) ending shell
==> arm: error while running provision hook: Script exited with non-zero exit status: 127. Allowed exit codes are: [0]
    arm: optional (please ignore) `fuser -k` failed with exit status 1:
    arm: unmounting /tmp/3848570873/sys
    arm: unmounting /tmp/3848570873/proc/sys/fs/binfmt_misc
    arm: unmounting /tmp/3848570873/proc
    arm: unmounting /tmp/3848570873/dev/pts
    arm: unmounting /tmp/3848570873/dev
    arm: unmounting /tmp/3848570873/boot-tmp
    arm: unmounting /tmp/3848570873
2022/11/29 23:27:23 [INFO] (telemetry) ending arm
Build 'arm' errored after 24 seconds 814 milliseconds: build was halted
==> Wait completed after 24 seconds 814 milliseconds

Please see here for the full JSON configuration and GitHub Actions workflow.

Possibly related to #244?

@dbast
Copy link
Collaborator

dbast commented Nov 30, 2022

@dbast dbast closed this as completed Nov 30, 2022
@benalexau
Copy link
Author

Thanks @dbast, much appreciated.

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

Successfully merging a pull request may close this issue.

2 participants