Hello,
I'm using Packer to create a Linux (Ubuntu) VirtualBox VM, usable on Windows ; one main feature is to have the C: shared with this VM.
It works like a charm when VM is packaged on Windows, but sharing the C path on Linux during VM creation fails (ie: when VM builded from continuous integration process - no Windows agents).
Technically, the builder config:
"vboxmanage[_post]": [
[
"sharedfolder", "add", "{{.Name}}", "--name", "c", "--hostpath", "C:/", "--automount"
]
],
Provides this correct VirtualBox command, but does nothing (no error, ...):
vboxmanage sharedfolder add vm-name --name c --hostpath C:/ --automount
Executed manually, this command provides a (logic) "Shared folder path 'C:' is not absolute" error.
If "/C:" used it works on Linux packaging or command line, but produced VM is not usable on Windows ("/C:" not valid on Windows). Using UNC path if a fail too.
Conclusion: Hard to configure a shared folder on Linux, usable on Windows without error.
A dirty workaround is to update SharedFolder parameter directly in the .vbox file, before the export (when VM is stopped).
=> Is there a way to add a custom script/command after the "provisioners" and before the export, to realize this hack ?
Many thanks in advance.
Best regards
Alix.