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
Overview of the Issue
Packer is not handling line endings correctly when running on Windows. I have a provisioner that is running .sh files in an Ubuntu VM which errors with null.build_linux: /imagegeneration/helpers/os.sh: line 6: $'\r': command not found
This does not seem like a Packer bug. It's expected in the UNIX world that scripts have their lines terminated with LF.
In your case, since you're using a script that you provide through the scripts option, it gets copied over to the guest machine, which in this case being a Linux, expects LF-only in its shell scripts.
Packer does not do anything with those besides copying to the guest, so you should convert them to LF (in general I would advise always converting the line-feeds to LF and not CRLF for UNIX scripts).
I suggest using a tool like dos2unix for this purpose.
I'll close this issue for now since this is not a Packer problem on its own, but please feel free to reopen it and continue the conversation if you think I missed something in your description.
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Community Note
Overview of the Issue
Packer is not handling line endings correctly when running on Windows. I have a provisioner that is running .sh files in an Ubuntu VM which errors with
null.build_linux: /imagegeneration/helpers/os.sh: line 6: $'\r': command not found
Reproduction Steps
This seems to only be an issue on Windows.
Packer version
1.9.4
Simplified Packer Template
n/a
Operating system and Environment details
Windows 11 22h2 Build 22621.2428
Log Fragments and crash.log files
The text was updated successfully, but these errors were encountered: