Comments (14)
When you get to templating fixing :) here is what I did to have working preseed with your config:
http_content = {
"/preseed.cfg" = templatefile(var.preseed_file, {var=var})
}
And removed http_directory
.
Thanks for this discussion, it helped me to orient myself much faster.
from packer-build.
Next best thing to an actual pull-request is a bit of help (and gentle nagging) to get me to finish the templating stuff. Thanks, @kepi . 31a24eb pushed.
Unfortunately, I'm on an aarch64 (M1) machine at the moment and can't test the vbox builder and I haven't done a qemu build on this machine with Packer yet so I'm a little hesitant. If you felt like you wanted to give this a test run, that would be most apprecated.
from packer-build.
First, I am glad to see others benefitting from my "toy project". Second, Vagrant is meant to be an output, not a build-time dependency (although, I have considered using a Vagrant box to build a Vagrant box for some delightful VM-in-VM inception). Third, you don't need to modify the templates and can instead pass your desired variable overrides in using https://www.packer.io/guides/hcl/variables#assigning-variables --most things I could foresee wanting to configure are already broken out as variables.
Lastly, if you're running into problems, I will have to apologize if I managed to break everything as I am still in the middle of refactoring all the external file templating as per https://www.hashicorp.com/blog/using-template-files-with-hashicorp-packer. Try going back to commit 9190c8f and see if you can get your things working there first. Next, I would have to guess what's in your overridden preseed file--it's possible you have neglected to either template the values or fill in your desired keyboard layout there.
I am still hopeful I can find time to finish inlining all the preseed and vagrantfile templates into the main HCL2 templates with constructs like these:
http_content = {
"/preseed.cfg" = <<<EOF
d-i apt-setup/universe boolean true
d-i pkgsel/include string openssh-server cryptsetup build-essential libssl-dev libreadline-dev zlib1g-dev linux-source dkms nfs-common linux-headers-$(uname -r) perl cifs-utils software-properties-common rsync ifupdown consul
...
EOF
Also, I haven't had much time to work on this stuff recently and I confess I haven't tested things much of late (and I kinda didn't mean for completing this refactor to be delayed so long). If you do end up finding I've done something really silly, I would be happy to accept your pull-requests to correct the problem in this repo. Given that I have "broken the build" for everyone using this repo, I might go back and make a "legacy" branch for the 9190c8f commit as this should be the most recent point before I started the painful and necessary YAML -> JSON -> HCL2 permanent conversion process.
I am not currently aware of any bugs in Debian or Packer which might explain why just the keyboard stuff isn't working.
Feel free to create a gist in your GH account containing your preseed file and template copies and we can try to take a look at it together.
from packer-build.
@tylert thanks for your quick and detailed reply. I will test the mentioned commit asap.
My preseed is the same as yours right now, I reset it to get a working starting point (and failed as mentioned).
Sure, I want to adjust the language/locale/keyboard for my german/austrian environment later.
Can you confirm that the latest commit also fails to build for you?
I run packer-1.7.8 on Fedora 35, just as reference.
Will try your commit now, I only reply right now thinking of the different timezones we are in (keep up the conversation, otherwise it might always take a day or so ;-) ).
from packer-build.
The mentioned commit 9190c8f
contains YAML files ... as far as I see the current packer does not read those?
from packer-build.
I think your usage of variables in the preseed-file is the reason for the failing build.
The variables aren't interpreted as intended.
I look at this to solve this. With a hard-coded preseed file things work for me.
from packer-build.
Yes, the older commit provides a script to convert YAML 1.2 -> JSON and template the preseed files automatically--HCL2 finally now has feature-parity with the JSON support and (when finished) reduces the complexity of this repo immensely by removing the dependencies on that external templating script. The info you need to work with the YAML versions of those templates is shown here https://github.com/tylert/packer-build/tree/9190c8f1b4ebfee08b137932db829219af10aac8#using-packer-templates .
Have a look at https://learn.hashicorp.com/tutorials/packer/hcl2-upgrade if you wish to use this same YAML 1.2 -> JSON -> HCL2 trick as I used AFTER commit 9190c8f.
Yes, I was pretty sure the templating was the issue you were running into which is why I linked you to https://www.hashicorp.com/blog/using-template-files-with-hashicorp-packer in my earlier comment.
I hope this means you are unblocked and can easily override your keyboard/locale/language settings now. I would like wrap conditionals around lines such as https://github.com/tylert/packer-build/blob/master/source/debian/11_bullseye/base-uefi.preseed#L5 to make it easier to support more than a single language at a time.
I will leave your issue open here and use it to nag me to come back here to fix the templating before the end of the year (hopefully). 😄
from packer-build.
I made progress and rewrote my hcl-script to include all 4 releases of debian in one nice file.
So far I don't have a preseed template in place, that's the next phase. I might share my work as soon as it is worth showing ;-)
from packer-build.
See https://github.com/stefangweichinger/packer-builds/blob/main/debian-improved.pkr.hcl for my work in progress.
So far I have the templating disabled, but it worked already in general.
I added the qemu builder now, this isn't 100% yet, but the virtualbox-iso stuff works fine.
I separated the variables into an extra file and use "dynamic sources" and that loop construct to define all 4 debian-releases in one file. Feel free to comment and suggest ...
Yes, I took some of your content and modified it, if you want me to put that in a properly forked repo, tell me and I will rm that temporary draft repo.
from packer-build.
- I chose not to try to never combine templates for different releases of Debian or Ubuntu in a single file. For other distros, I have found that there are often changes in things like preseed contents or in package names from release to release that can obviate doing this "cleanly and easily" so I just decided to not bother doing this.
- Also, if you don't combine multiple distro releases in a single file, dropping support for a distro release is as simple as deleting a complete directory and adding support for a new release is often as simple as copying the previous release and changing a few variable defaults.
- If you wanted to invest a bit of time to try to get the qemu support and templating stuff working fully, I would be most happy to work with you to get your pull-request merged into this (my) repo.
- I would prefer to inline 100% of the provisioner scripts and post-processor stuff and cloud-init and preseed stuff all into the Packer template rather than have any external files. Ideally, the only external files would be variable overrides (for doing things like settings locale/language/keyboard/timezone stuff and for choosing a different username and password). The templates should really have all the variables and builders and everything all in a single file.
- My ideal layout for each OS + distro combination would be: a "base" image, a "base with UEFI support" image, a "base with LUKS encryption" image and a "base with LUKS encryption and UEFI support" image.
- Sorry for the delay in replying but this is a very busy time of year for me and there are a lot of projects and things currently going on so do not be too discouraged if I take a few days to get back to you.
from packer-build.
@tylert I am also quite busy, and don't find time for my fork right now. We'll keep in touch here ...
from packer-build.
- with my approach it should be "simple" to define packages per release. For example, buster installs "a,b,c", bullseye installs "b,c,d".
- I see pros and cons for each ... will decide that later. For now I "only" do Debian, so it might be manageable for me.
- I think I have qemu already. Testing templating right now.
- let's see how my configs will look like. Template file has to be separate anyway, just as an example.
- so far I don't do extra images. Trying to get the basic "loop" to work while also understanding things.
from packer-build.
See my progress at https://github.com/stefangweichinger/packer-builds
That "loop" of releases works now, personally I like that compact way of configuration.
I decided to separate the variables into variables.pkr.hcl
as recommended by the upstream docs.
Templating the preseed file: not yet fully OK. I seem to have the variable-names wrong. Suggestions welcome.
I don't need to define separate locales, for example, I just want to learn how to use that feature.
from packer-build.
I suspect this issue to be closed now.
from packer-build.
Related Issues (20)
- ubuntu/xenial/base-uefi.json freezes on GRUB menu HOT 3
- UEFI Booting on VirtualBox HOT 2
- gpus? HOT 1
- vagrant-libvirtd: possible hint HOT 1
- Bionic fails to build with Packer HOT 1
- Post-processor build failure on bionic HOT 3
- Crash with Bionic Beaver and Packer 1.2.4 HOT 3
- Build failed running post-processor: shell-local HOT 3
- Packer fix error (when running with packer 1.4.2) HOT 2
- Missing qemu.sh and vbox.sh HOT 1
- LUKS unattended builds do not complete automatically HOT 6
- Thanks for the inspiration! HOT 1
- Error getting SSH address 500 QEMU guest agent is not running HOT 3
- [preseed debian] Skip past "Force UEFI Install" installer prompt HOT 1
- qemuargs build options HOT 4
- [DEBUG] SSH handshake err
- Debian UEFI build HOT 4
- 'packer validate' throws errors HOT 4
- Errors in building packer HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from packer-build.