Help w/ Provisioning Ubuntu 22.04 using PXE-less boot disk and NFS share Installation Media

Problem:
When attempting to download a Host Image or Full Host Image for a new Ubuntu 22.04 Host, I get the error: undefined method `medium_uri’ for nil:NilClass

Expected outcome:
Host Image/Full Host Image downloads successfully

Foreman and Proxy versions:
Foreman version: 3.8.0

Foreman and Proxy plugin versions:

  • foreman-tasks 8.3.3
  • foreman_ansible 12.0.7
  • foreman_bootdisk 21.0.4
  • foreman_discovery 22.0.4
  • foreman_puppet 6.0.1
  • foreman_remote_execution 11.1.1
  • foreman_setup 8.0.1
  • foreman_templates 9.4.0

Distribution and version:
AlmaLinux 8.9

Other relevant data:
This is a new Foreman server. I am attempting to replace our old Foreman server (which I did not set up, and hardly ever used).

Restrictions/situation:

  • I need to deploy Ubuntu 22.04
  • I need to use PXE-less provisioning with a boot disk. Our network admins can’t/won’t set up PXE booting.
  • I’ve created an Installation media for Ubuntu 22.04 using an NFS share, rather than the standard recommended web path from the manual, because this Foreman was set up without Katello (the previous Foreman admin says Katello wasn’t needed). Setting up an NFS share on our SAN seemed a lot easier than trying to re-jig Foreman to properly host the files via https, or setting up a whole new webserver.
    • The manual said “Ensure the path in /pub/ matches the path in your Preseed default PXELinux Autoinstall template.” I don’t know how to do this, and this is probably the source of the problem.

Here’s some additional error output:

[root@sys-fore-0p03 foreman_media]# foreman-rake errors:fetch_log request_id=d4472a20
Foreman version: 3.8.0
Plugins:
 - foreman-tasks 8.3.3
 - foreman_ansible 12.0.7
 - foreman_bootdisk 21.0.4
 - foreman_discovery 22.0.4
 - foreman_puppet 6.0.1
 - foreman_remote_execution 11.1.1
 - foreman_setup 8.0.1
 - foreman_templates 9.4.0

2024-01-09T11:33:47 [I|app|d4472a20] Started GET "/disks/full_hosts/2" for 142.207.95.82 at 2024-01-09 11:33:47 -0800
2024-01-09T11:33:47 [I|app|d4472a20] Processing by ForemanBootdisk::DisksController#full_host as HTML
2024-01-09T11:33:47 [I|app|d4472a20]   Parameters: {"id"=>"2"}
2024-01-09T11:33:47 [W|app|d4472a20] Could not find a provider for sys-test-0d01.unbc.ca. Providers returned {"MediumProviders::Default"=>["Invalid medium 'Ubuntu mirror' for 'Ubuntu 22.04.3'"]}
2024-01-09T11:33:47 [W|app|d4472a20] undefined method `medium_uri' for nil:NilClass
2024-01-09T11:33:47 [I|app|d4472a20] Backtrace for 'undefined method `medium_uri' for nil:NilClass' error (NoMethodError): undefined method `medium_uri' for nil:NilClass
 d4472a20 | /usr/share/foreman/app/models/operatingsystems/debian.rb:19:in `preseed_path'
 d4472a20 | /usr/share/foreman/app/services/foreman/renderer/scope/variables/base.rb:14:in `preseed_path'
 d4472a20 | /usr/share/foreman/app/services/foreman/renderer/scope/variables/base.rb:82:in `preseed_attributes'
 d4472a20 | /usr/share/foreman/app/services/foreman/renderer/scope/variables/base.rb:30:in `load_variables_base'
 d4472a20 | /usr/share/foreman/app/services/foreman/renderer/scope/variables.rb:20:in `block in load_variables'
 d4472a20 | /usr/share/foreman/app/services/foreman/renderer/scope/variables.rb:18:in `each'
 d4472a20 | /usr/share/foreman/app/services/foreman/renderer/scope/variables.rb:18:in `load_variables'
 d4472a20 | /usr/share/foreman/app/services/foreman/renderer/scope/base.rb:30:in `initialize'
 d4472a20 | /usr/share/foreman/app/services/foreman/renderer/scope/template.rb:9:in `initialize'
 d4472a20 | /usr/share/foreman/app/services/foreman/renderer.rb:39:in `new'
 d4472a20 | /usr/share/foreman/app/services/foreman/renderer.rb:39:in `get_scope'
 d4472a20 | /usr/share/gems/gems/foreman_bootdisk-21.0.4/app/services/foreman_bootdisk/renderer.rb:11:in `render_template'
 d4472a20 | /usr/share/gems/gems/foreman_bootdisk-21.0.4/app/services/foreman_bootdisk/iso_generator.rb:44:in `render_template'
 d4472a20 | /usr/share/gems/gems/foreman_bootdisk-21.0.4/app/services/foreman_bootdisk/iso_generator.rb:18:in `generate_full_host'
 d4472a20 | /usr/share/gems/gems/foreman_bootdisk-21.0.4/app/controllers/foreman_bootdisk/disks_controller.rb:58:in `full_host'
 d4472a20 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
 d4472a20 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/abstract_controller/base.rb:228:in `process_action'
 d4472a20 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_controller/metal/rendering.rb:30:in `process_action'
 d4472a20 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/abstract_controller/callbacks.rb:42:in `block in process_action'
 d4472a20 | /usr/share/gems/gems/activesupport-6.1.7.6/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
 d4472a20 | /usr/share/foreman/app/controllers/concerns/foreman/controller/timezone.rb:10:in `set_timezone'
 d4472a20 | /usr/share/gems/gems/activesupport-6.1.7.6/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
 d4472a20 | /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:32:in `clear_thread'
 d4472a20 | /usr/share/gems/gems/activesupport-6.1.7.6/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
 d4472a20 | /usr/share/foreman/app/controllers/concerns/foreman/controller/topbar_sweeper.rb:12:in `set_topbar_sweeper_controller'
 d4472a20 | /usr/share/gems/gems/activesupport-6.1.7.6/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
 d4472a20 | /usr/share/gems/gems/audited-5.3.3/lib/audited/sweeper.rb:16:in `around'
 d4472a20 | /usr/share/gems/gems/activesupport-6.1.7.6/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
 d4472a20 | /usr/share/gems/gems/audited-5.3.3/lib/audited/sweeper.rb:16:in `around'
 d4472a20 | /usr/share/gems/gems/activesupport-6.1.7.6/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
 d4472a20 | /usr/share/gems/gems/activesupport-6.1.7.6/lib/active_support/callbacks.rb:137:in `run_callbacks'
 d4472a20 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/abstract_controller/callbacks.rb:41:in `process_action'
 d4472a20 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_controller/metal/rescue.rb:22:in `process_action'
 d4472a20 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_controller/metal/instrumentation.rb:34:in `block in process_action'
 d4472a20 | /usr/share/gems/gems/activesupport-6.1.7.6/lib/active_support/notifications.rb:203:in `block in instrument'
 d4472a20 | /usr/share/gems/gems/activesupport-6.1.7.6/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
 d4472a20 | /usr/share/gems/gems/activesupport-6.1.7.6/lib/active_support/notifications.rb:203:in `instrument'
 d4472a20 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_controller/metal/instrumentation.rb:33:in `process_action'
 d4472a20 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_controller/metal/params_wrapper.rb:249:in `process_action'
 d4472a20 | /usr/share/gems/gems/activerecord-6.1.7.6/lib/active_record/railties/controller_runtime.rb:27:in `process_action'
 d4472a20 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/abstract_controller/base.rb:165:in `process'
 d4472a20 | /usr/share/gems/gems/actionview-6.1.7.6/lib/action_view/rendering.rb:39:in `process'
 d4472a20 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_controller/metal.rb:190:in `dispatch'
 d4472a20 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_controller/metal.rb:254:in `dispatch'
 d4472a20 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
 d4472a20 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/routing/route_set.rb:33:in `serve'
 d4472a20 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/journey/router.rb:50:in `block in serve'
 d4472a20 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/journey/router.rb:32:in `each'
 d4472a20 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/journey/router.rb:32:in `serve'
 d4472a20 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/routing/route_set.rb:842:in `call'
 d4472a20 | /usr/share/gems/gems/railties-6.1.7.6/lib/rails/engine.rb:539:in `call'
 d4472a20 | /usr/share/gems/gems/railties-6.1.7.6/lib/rails/railtie.rb:207:in `public_send'
 d4472a20 | /usr/share/gems/gems/railties-6.1.7.6/lib/rails/railtie.rb:207:in `method_missing'
 d4472a20 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/routing/mapper.rb:20:in `block in <class:Constraints>'
 d4472a20 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/routing/mapper.rb:49:in `serve'
 d4472a20 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/journey/router.rb:50:in `block in serve'
 d4472a20 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/journey/router.rb:32:in `each'
 d4472a20 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/journey/router.rb:32:in `serve'
 d4472a20 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/routing/route_set.rb:842:in `call'
 d4472a20 | /usr/share/gems/gems/apipie-dsl-2.5.0/lib/apipie_dsl/static_dispatcher.rb:67:in `call'
 d4472a20 | /usr/share/gems/gems/apipie-rails-1.2.2/lib/apipie/static_dispatcher.rb:68:in `call'
 d4472a20 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/static.rb:24:in `call'
 d4472a20 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/static.rb:24:in `call'
 d4472a20 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/static.rb:24:in `call'
 d4472a20 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/static.rb:24:in `call'
 d4472a20 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/static.rb:24:in `call'
 d4472a20 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/static.rb:24:in `call'
 d4472a20 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/static.rb:24:in `call'
 d4472a20 | /usr/share/foreman/lib/foreman/middleware/libvirt_connection_cleaner.rb:9:in `call'
 d4472a20 | /usr/share/foreman/lib/foreman/middleware/telemetry.rb:10:in `call'
 d4472a20 | /usr/share/gems/gems/apipie-rails-1.2.2/lib/apipie/middleware/checksum_in_headers.rb:27:in `call'
 d4472a20 | /usr/share/gems/gems/rack-2.2.8/lib/rack/tempfile_reaper.rb:15:in `call'
 d4472a20 | /usr/share/gems/gems/rack-2.2.8/lib/rack/etag.rb:27:in `call'
 d4472a20 | /usr/share/gems/gems/rack-2.2.8/lib/rack/conditional_get.rb:27:in `call'
 d4472a20 | /usr/share/gems/gems/rack-2.2.8/lib/rack/head.rb:12:in `call'
 d4472a20 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/http/permissions_policy.rb:22:in `call'
 d4472a20 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/http/content_security_policy.rb:19:in `call'
 d4472a20 | /usr/share/foreman/lib/foreman/middleware/logging_context_session.rb:22:in `call'
 d4472a20 | /usr/share/gems/gems/rack-2.2.8/lib/rack/session/abstract/id.rb:266:in `context'
 d4472a20 | /usr/share/gems/gems/rack-2.2.8/lib/rack/session/abstract/id.rb:260:in `call'
 d4472a20 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/cookies.rb:697:in `call'
 d4472a20 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
 d4472a20 | /usr/share/gems/gems/activesupport-6.1.7.6/lib/active_support/callbacks.rb:98:in `run_callbacks'
 d4472a20 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
 d4472a20 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/actionable_exceptions.rb:18:in `call'
 d4472a20 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/debug_exceptions.rb:29:in `call'
 d4472a20 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
 d4472a20 | /usr/share/gems/gems/railties-6.1.7.6/lib/rails/rack/logger.rb:37:in `call_app'
 d4472a20 | /usr/share/gems/gems/railties-6.1.7.6/lib/rails/rack/logger.rb:28:in `call'
 d4472a20 | /usr/share/gems/gems/sprockets-rails-3.4.2/lib/sprockets/rails/quiet_assets.rb:13:in `call'
 d4472a20 | /usr/share/foreman/lib/foreman/middleware/logging_context_request.rb:11:in `call'
 d4472a20 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
 d4472a20 | /usr/share/gems/gems/request_store-1.5.1/lib/request_store/middleware.rb:19:in `call'
 d4472a20 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/request_id.rb:26:in `call'
 d4472a20 | /usr/share/gems/gems/rack-2.2.8/lib/rack/method_override.rb:24:in `call'
 d4472a20 | /usr/share/gems/gems/rack-2.2.8/lib/rack/runtime.rb:22:in `call'
 d4472a20 | /usr/share/gems/gems/activesupport-6.1.7.6/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
 d4472a20 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/executor.rb:14:in `call'
 d4472a20 | /usr/share/gems/gems/rack-2.2.8/lib/rack/sendfile.rb:110:in `call'
 d4472a20 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/ssl.rb:77:in `call'
 d4472a20 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/host_authorization.rb:142:in `call'
 d4472a20 | /usr/share/gems/gems/secure_headers-6.5.0/lib/secure_headers/middleware.rb:11:in `call'
 d4472a20 | /usr/share/gems/gems/railties-6.1.7.6/lib/rails/engine.rb:539:in `call'
 d4472a20 | /usr/share/gems/gems/railties-6.1.7.6/lib/rails/railtie.rb:207:in `public_send'
 d4472a20 | /usr/share/gems/gems/railties-6.1.7.6/lib/rails/railtie.rb:207:in `method_missing'
 d4472a20 | /usr/share/gems/gems/rack-2.2.8/lib/rack/urlmap.rb:74:in `block in call'
 d4472a20 | /usr/share/gems/gems/rack-2.2.8/lib/rack/urlmap.rb:58:in `each'
 d4472a20 | /usr/share/gems/gems/rack-2.2.8/lib/rack/urlmap.rb:58:in `call'
 d4472a20 | /usr/share/gems/gems/puma-6.3.1/lib/puma/configuration.rb:270:in `call'
 d4472a20 | /usr/share/gems/gems/puma-6.3.1/lib/puma/request.rb:100:in `block in handle_request'
 d4472a20 | /usr/share/gems/gems/puma-6.3.1/lib/puma/thread_pool.rb:344:in `with_force_shutdown'
 d4472a20 | /usr/share/gems/gems/puma-6.3.1/lib/puma/request.rb:99:in `handle_request'
 d4472a20 | /usr/share/gems/gems/puma-6.3.1/lib/puma/server.rb:443:in `process_client'
 d4472a20 | /usr/share/gems/gems/puma-6.3.1/lib/puma/server.rb:245:in `block in run'
 d4472a20 | /usr/share/gems/gems/puma-6.3.1/lib/puma/thread_pool.rb:151:in `block in spawn_thread'
 d4472a20 | /usr/share/gems/gems/logging-2.3.1/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'
2024-01-09T11:33:47 [I|app|d4472a20]   Rendered common/500.html.erb within layouts/application (Duration: 6.2ms | Allocations: 1539)
2024-01-09T11:33:47 [I|app|d4472a20]   Rendered layouts/base.html.erb (Duration: 7.0ms | Allocations: 4040)
2024-01-09T11:33:47 [I|app|d4472a20]   Rendered layout layouts/application.html.erb (Duration: 16.4ms | Allocations: 6716)
2024-01-09T11:33:47 [I|app|d4472a20] Completed 500 Internal Server Error in 181ms (Views: 23.0ms | ActiveRecord: 37.0ms | Allocations: 24747)

Sounds like your Ubuntu OS is not properly set up.
As a first step I would suggest to double-check that. Under “Hosts” → “Operatingsystems”, select “Ubuntu Mirror”. That should be set up to have “Path” point to your NFS share for the installation medium and OS Family should be set to Debian. Also ensure that in the “Locations” and “Organizations” tabs, the correct ones are selected (in the right side list) for the host you want to install.
Afterwards, go to “Hosts” → “Operatingsystems”, select “Ubuntu 22.04.3” Make sure that “Family” is also set to “Debian” and on the “Installation Media” tab the “Ubuntu Mirror” medium is enabled (again, in the list on the right).

Thanks for responding!

Under “Hosts” > “Provisioning Setup” > “Operating Systems”, there is no “Ubuntu mirror”. Did you mean “Hosts” > “Provisioning Setup” > “Installation Media”?

In the “Hosts” > “Provisioning Setup” > “Installation Media” page, I did not touch the existing “Ubuntu mirror”. Instead I created a new Medium called “Ubuntu 22.04 NFS”, which has the NFS Path, and Operating System Family is set to “Debian”. The “Locations” and “Organizations” are selected in those tabs.

In “Hosts” > “Provisioning Setup” > “Operating Systems”, there is an “Ubuntu 22.04.3” entry that I created. It has the “Family” set to “Debian”, and the “Installation Media” tab has my “Ubuntu 22.04 NFS” medium selected.

Should I edit the “Ubuntu mirror” Medium instead of creating my own “Ubuntu 22.04 NFS” Medium? It didn’t seem appropriate to alter the pre-existing Media entries.

I tried editing the “Ubuntu mirror” media to have the NFS path instead of the http path. Now I get the following error when attempting to download a Full Host Image for the Host:

Oops, we’re sorry but something went wrong Failed to open TCP connection to 10.255.250.90:80 (Connection refused - connect(2) for “10.255.250.90” port 80)

Looks like it’s trying to use the HTTP port to connect to the NFS source. How do I fix that?

I searched for this error, and found Full Bootdisk with NFS install media - Support - TheForeman, which says (if I understand correctly) that NFS Installation Media is not a tested/supported option, and that I should use HTTP instead. I suppose that hasn’t changed since 2021?

Yes, that’s what I meant.

I made some assumptions based on the error message you posted. Since you have edited the “Ubuntu Mirror” now, the result will be the same.

Since I’m not a dev on Foreman, I cannot say for sure, but the commit history of the plugin does not hint at any changes here.
I guess your best bet would be to host the Image somewhere on a dedicated HTTP server and use that HTTP path for the provisioning image (or, if you have internet access from your servers, maybe just use the upstream mirror, but I guess that’s not the case).

As far as I can tell from reading on this support community, using the upstream mirror is no longer an option for Ubuntu 22. There are certain files needed that are no longer publicly hosted by Canonical, so you must host the extracted iso locally.

Yesterday I found an internal web host to put the extracted .iso into. That successfully allowed me to download a Full Host Image. However, it failed during the boot process, when it tried to download and mount the .iso file. It looks like it can only do that via http, and the web host I was using redirects all http to https.

I think I’ll have to bite the bullet and re-install Foreman, this time with Katello included, so that it will have the necessary Apache config to host the Ubuntu 22 iso files locally.

1 Like

For anyone else coming across this in the future, I recommend installing Foreman with Katello. I don’t think you need to bother with enabling/using any of the other Katello features, but at the bare minimum having it included means you get the http web server config needed to locally host the Ubuntu 22.04 .iso and extracted files.

If you have a separate http (not https!) web server to host the Ubuntu .iso and files, that would probably work as well. I just prefer not to have any unnecessary dependencies outside of the Foreman server itself.