Bug #14323

Debian Libvirt SSH Image Provision fails

Added by Karli Sjöberg over 4 years ago. Updated over 4 years ago.

Compute resources - libvirt
Target version:
Bugzilla link:
Pull request:
Fixed in Releases:
Found in Releases:



Tried to create a new Debian host on libvirt compute resource succeeded even though it failed SSH and consequently didn´t get finished properly:
NoMethodError: undefined method `path' for nil:NilClass
/usr/local/share/foreman/app/models/operatingsystem.rb:112:in `medium_uri'
/usr/local/share/foreman/app/models/operatingsystems/debian.rb:13:in `preseed_path'
/usr/local/share/foreman/lib/foreman/renderer.rb:166:in `preseed_attributes'
/usr/local/share/foreman/lib/foreman/renderer.rb:121:in `load_template_vars'

Feels like it expects the creation to be network based even though it´s an image based provision. Looking at templates for the created host you can review the finish, PXELinux and user_data templates but clicking review on the provision template results in the same error. I have all of those templates defined for Debian OS, so that´s why I see them after creation is "completed", but only the finish template was "resolved" during creation, as it should.

FQDN for this host was "", IP address Debug production log attached.


production-debug.log production-debug.log 100 KB Karli Sjöberg, 03/22/2016 05:09 PM


#1 Updated by Dominic Cleal over 4 years ago

  • Status changed from New to Feedback

If it's using image provisioning then the host shouldn't be retrieving the preseed ("provision") template. It seems to be doing that here:

2016-03-22T21:44:11 [app] [I] Started GET "/unattended/provision?token=11a3b028-b8a0-4ad9-a2d3-38e7396d105b" for at [..]

The template's not rendering as the host is probably missing installation media, but that's normal for an image build.

I think you might have something in the finish template that's making a request to this template. Check through it for any references to foreman_url.

#2 Updated by Karli Sjöberg over 4 years ago

Yeah, that was the problem, thank you! Seems like Debian and RedHat finish scripts are a little different. With RedHat you can network install a host with just a provision template, whereas Debian needs both provision and finish for network installs. My first idea was to mod the 'Preseed default' into following the RedHat model so you´d use just the provision template for network install, and just the finish for image install, but that would be very...inelegant with the Debian installer, so I understand why it´s like that. So I thought maybe you could mod it so that you use both the provision and finish template for network install and just the finish for image install, but that would lead to a lot of things being done twice for network installs, so... The best idea I could come up with was to create a 'Preseed default image' template of finish type. I cloned the 'Preseed default finish' and borrowed the root password from the 'Kickstart default finish', and am pretty pleased with how it turned out. I have the .erb ready for pull, but I suspect more is needed to incorporate it by default in the web UI. Could you explain how that is done? If you want yet another pressed template, that is?:)


#3 Updated by Dominic Cleal over 4 years ago

  • Status changed from Feedback to Resolved

I think where possible we'd prefer to minimise the number of templates. In this case I think we can only have one finish template - having two different templates would mean only one could be associated to the OS at a time. One OS definition can be used for both image and network provisioning.

The template could contain conditionals based on @host.provision_method to skip certain steps for either network or image builds. If you've got improvements, please send PRs over to where we maintain them (they're synced into releases, no ticket required).

Also available in: Atom PDF