You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
When filing a bug, please include the following headings if possible. Any
example text in this template can be deleted.
Overview of the Issue
I'm trying to leverage shell-local to do some preparation steps before a packer build in my builder, and I'm doing my testing from WSL. According to the example in the docs, I can run a bash script and seemingly use a Linux-style path. However, I receive the following error when I do so:
There was an error splitting your absolute path; expected to find a drive
following the format ':/' but did not: absolute path:
/home/<user>/test/scripts/test.sh
Reproduction Steps
Steps to reproduce this issue:
Create a simple packer file using the null source and builder
OS: Windows 11 Pro
Windows Version: 23H2
Windows Build: 22631.3155
WSL2 version: 2.0.9.0
Ubuntu version: 22.04.04
Log Fragments and crash.log files
Error: Failed preparing provisioner-block "shell-local"""
on test.pkr.hcl line 10:
(source code not available)
on test.pkr.hcl line 10:
(source code not available)
There was an error splitting your absolute path; expected to find a drive
following the format ':/' but did not: absolute path:
/home/<user>/test/scripts/test.sh
There was an error splitting your absolute path; expected to find a drive
2024/02/17 10:11:54 [INFO] (telemetry) Finalizing.
following the format ':/' but did not: absolute path:
/home/<user>/test/scripts/test.sh
The text was updated successfully, but these errors were encountered:
Hi @ejbolt thanks for reaching out. Looking at the provided template I see that the script path ("./scripts/test.sh") is expressed as a Linux path and not as a Windows path, which is looks to be the culprit here. This is not documented alongside the attribute use_linux_pathing but the provisioner expects the script path to be Windows path, which Packer then converts behind the scenes to a Linux path.
Have you tried using the Windows path for the script?
Looking at the example you see the use of an absolute Windows path. Looking at the SDK I see that the provisioner validates for a Windows absolute path then converts it to a Linux absolute path prior to executing.
Please try using a Windows path and let me know if it resolves your issue.
As it turns out, I was being quite silly! When looking at the examples that mention WSL,, I thought I had to use those options when the script was inside the WSL guest. As it turns out, I can use it as I would on any Linux host:
Community Note
When filing a bug, please include the following headings if possible. Any
example text in this template can be deleted.
Overview of the Issue
I'm trying to leverage shell-local to do some preparation steps before a packer build in my builder, and I'm doing my testing from WSL. According to the example in the docs, I can run a bash script and seemingly use a Linux-style path. However, I receive the following error when I do so:
Reproduction Steps
Steps to reproduce this issue:
null
source and builderpacker validate .
orpacker build .
Packer version
Packer v1.10.1
Simplified Packer Template
Operating system and Environment details
OS: Windows 11 Pro
Windows Version: 23H2
Windows Build: 22631.3155
WSL2 version: 2.0.9.0
Ubuntu version: 22.04.04
Log Fragments and crash.log files
The text was updated successfully, but these errors were encountered: