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

Allow running provisioners when recovery = true #95

Open
roblabla opened this issue Sep 18, 2023 · 2 comments
Open

Allow running provisioners when recovery = true #95

roblabla opened this issue Sep 18, 2023 · 2 comments

Comments

@roblabla
Copy link
Contributor

Currently when recovery = true, the provisioners will not run, as evidenced by this piece of code. I don't quite understand why. My use-case is having a packer file that boots the VM to recovery to disable SIP, reboot, and then run the repackaging steps to install some software. Would you be open to adapting the behavior to allow this use-case?

@edigaryev
Copy link
Contributor

I don't quite understand why.

Because there's no SSH when the VM is running in the recovery mode, and thus no provisioning capability

If we were to run the VM multiple times in a single packer build (let's say first with --recovery, and then without), it would be hard go grasp to which stage the boot_command and other configuration options will apply.

This is the reason we have a separate Packer configuration solely for disabling SIP, for example.

@roblabla
Copy link
Contributor Author

Because there's no SSH when the VM is running in the recovery mode, and thus no provisioning capability

Sure, but it's possible to reboot from recovery mode into normal mode, and have ssh from there. My boot_command does that, and I was very surprised when the provisioners weren't being run. I find the current behavior way more surprising, because my expectation is that packer will always try to run the provisioners 👀.

At the very least, I think this deserves to be documented somewhere (like here), because right now it's just a complete head-scratcher without reading the source ^^'.


For my use-case, I'm toying with the idea of making a custom provisioner that reboots the VM in recovery mode, does its shenanigans over VNC, and reboots it back to normal, essentially moving from having recovery: true in the builder to having a proper provisioning step that can be inserted with any other.

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

2 participants