Fetching arbitrary files from http/ folder during debian install

I’ve been using iso-based packer builders to create debian machines using the http/preseed feature. Lately, I’ve worked through the substantial hurdles of troubleshooting (and decoding the documentation of) the debian-installer. I’m now able to do more and more “early provisioning” in the preseeded late_command of the debian-installer. It has now occurred to me that if packer is statically serving the content in the http/ folder over http:, I could simply fetch/wget arbitrary files from the packer project, in the target environment, during the preseeded debian installation.

In this way static, always-need-it items like installing ssh keys, ssl certs or other content could be “baked in” at the preseeded installation-time. It would seem that this approach could also speed up some packer builds, at least a little bit, depending on the complexity and overhead of your provisioners. And speaking of complexity, it would seem that baking things in earlier, statically, simplifies/reduces provisioning steps needed later. As an ansible fan, I’ve got a lot of provisioning code to maintain, and the more I can reduce the code I have to maintain, the better.

This seems obvious, but I can’t find any reference to pulling anything but the preseed file from http in the Packer Issues on github or here on Discuss. Let me know if you have experience doing this, or are interested in the idea. Perhaps if this pans out I can submit some changes to the Packer docs to inform people that this is possible, and provide some examples.

I suspect most people didn’t fathom to try this for the sole reason that troubleshooting the debian-installer is a PITA, so they’d rather just copy the files over later with their favorite packer provisioner…

EDIT: I found this discussion from 5 years ago that requests essentially the same thing, and has a recent-ish answer suggesting the use of debian-installer’s url parameter, and preseed-fetch command.

Well I’ll be damned. It just worked, first try. Happy Camper here! :smiling_face_with_three_hearts:

For anyone following in these footsteps, make sure to use the suggestion of the commenter, which is to apply this workaround to the old d-i preseed_fetch bug

2 Likes