Is Ubuntu 22.04 supported with any version of Foreman yet?

Made some progress @gol19
Needed to add a file

root@foreman:/etc/apache2# cat sites-available/06-pub.conf
Alias /pub /var/www/html/pub

<Location /pub>
  <IfModule mod_passenger.c>
    PassengerEnabled off
  </IfModule>
  Options +FollowSymLinks +Indexes
  Require all granted
</Location>

then enable the site, and the alias and autoindex apache2 mods

a2enmod alias
a2enmod autoindex
a2ensite 06-pub.conf

looks like most setup guides assume you have katello running which sets up /pub based on my limited understanding.
https://github.com/theforeman/puppet-foreman_proxy_content/blob/master/manifests/pub_dir.pp
https://github.com/theforeman/puppet-foreman_proxy_content/blob/master/templates/httpd_pub.erb

After doing this, I was able to get my host past the PXE loader screen, it loads the Ubuntu22 installer but prompts for manual installation input. Hopefully I can pick up from here the rest of the autoinstaller setup

1 Like

I would like to install Ubuntu 22.04 via Foreman as well.

But even before the image could be loaded the following error occurs:

Trying to ping Gateway: x.x.x.x
ping: command not found

I was on the same boat, but Iā€™ve managed to automatically install Ubuntu 20.04.4 and Ubuntu 22.04 using Foreman.

In your PXE/PXEGrub template (or whatever are you using to PXE boot), there should be something like ds=nocloud-net;s=some_url - Ubuntuā€™s Autoinstall is looking for /meta-data, /user-data and /vendor-data files under this URL. In Foreman you can create the ā€œUser data templateā€ (there should be ā€œPreseed Autoinstall cloud-init user dataā€ in Foreman 3.3 installation you can use as a guidance). You can then point this URL to the http://foreman.example.com/userdata/ (your Foreman intallation) and Foreman should properly serve the correct templates for host under provisioning. Of course you need to properly assign this template for OS earlier for Foreman to know what to serve.

BTW, I donā€™t want to hijack this topic, but have a question related with the ā€œuserdataā€ endpoint (if needed I can create a new topic) - what should serve these data? My understanding was that this should be job for Foreman Proxy (with installed templates plugin), but in my testing installation, when I query the proxy endpoint from the client, I get only meta-data (with hostname defined as proxy hostname), for user-data I get error 500. I get the proper files directly from the Foreman server.

But Iā€™m totally new to Foreman (Iā€™m currently trying to evaluate different solutions for mass deployment bare metal servers in our environment, for now the Foreman is winning :wink: ), so maybe I missed or misunderstood something.

1 Like

Installing subscription-manager from both 20.04 and 22.04 repository doesnā€™t install apt-transport-katello. Works correctly from the debian10 repo.

# debian10
Ubuntu-18:~# apt-cache rdepends apt-transport-katello
apt-transport-katello
Reverse Depends:
  python-subscription-manager

Ubuntu-20:~# apt-cache rdepends apt-transport-katello
apt-transport-katello
Reverse Depends:

Ubuntu-22:~# apt-cache rdepends apt-transport-katello
apt-transport-katello
Reverse Depends:

Hi @rgp
Thanks for your feedback.

Iā€™ve added the dependency and tested it in a container:

# docker run --rm -it ubuntu:jammy

root@7ca3590c44ff:/# history
    1  apt-get update && apt-get install gpg wget
    2  wget https://apt.atix.de/atix_gpg.pub
    3  apt-key add atix_gpg.pub
    4  echo "deb https://apt.atix.de/Ubuntu22LTS/ stable main" >> /etc/apt/sources.list
    5  apt-get update && apt-get install subscription-manager

root@7ca3590c44ff:/# apt-cache rdepends apt-transport-katello
apt-transport-katello
Reverse Depends:
  python3-subscription-manager
2 Likes

Hey @dankowsk!
Foreman Smart Proxy doesnā€™t deliver the user-data templates because they are not available on the proxy (good point tho, would be nice if the proxy would have this capability). Therefore, it just forwards /userdata/ requests to the corresponding Foreman API. But, in order for this to work flawlessly, you gotta open port 8000 on the proxy and configure http forwarding as described in the orcharhino doc here.

Moreover, pay attention to your PXELinux template to reference the Proxy endpoint correctly. You have to use port 8000 on the Proxy, such that it forwards the request to your Foreman. The rendered template should look somehow like the following:

DEFAULT linux cloud-init autoinstall
LABEL linux cloud-init autoinstall
    KERNEL boot/ubuntu-22-04-DGjUR6nWp6Ze-vmlinuz
    INITRD boot/ubuntu-22-04-DGjUR6nWp6Ze-initrd
    APPEND url=http://my.foreman.proxy.com/pub/installation_media/ubuntu/x86_64.iso autoinstall ds=nocloud-net;s=http://my.foreman.proxy.com:8000/userdata/ root=/dev/ram0 ramdisk_size=1500000 fsck.mode=skip cloud-config-url=/dev/null ip=dhcp locale=en_US

I would also recommend to put the iso image itself on the Smart Proxy as you can see in the url part (in case your host may not be able to communicate with your Foreman directly).
Keep in mind - this is only important if you wanna deploy via a Smart Proxy which may have a different subnet. If your host is directly connected to your Foreman, you donā€™t need to use port 8000 of your proxy since it can use the Foreman directly instead.

Let me know if this helps or if you have more questions!

@LeperMessiah what Foreman version are you referring to? Did you setup the userdata template and associate it with your operating system?

I would like to install Ubuntu 22.04 via Foreman as well.

Have a look at this discussion (especially at the end). It may help you too @ryle249.

1 Like

Hi @bastian-src !

Thanks, I think that was the missing point. I was aware of opening port 8000, I missed the rest. :wink:

1 Like

Hey @gol19!
Youā€™re correct about the hardcoded debian part. Foreman 3.3 is not able to find the files in the Installation Media. Only with the latest foreman, there comes an exception for Ubuntu 22.04 which looks in the casper directory of the extracted image. You can solve this issue by creating a symbolic link accordingly.

The address you are referring is just an example: foreman.example.com is not a real address. Your pub directory should already be available at http://10.237.4.114/pub if thatā€™s the IP of your Foreman. If it is not available, you sould also run into problems on other operating systems since they install the katello certificates from here. So, you gotta fix that first.

Is there a how-to with all the necessary steps to solve this problem?
I donā€™t get it. If I open Index of /ubuntu/dists/jammy/main/installer-amd64
I canā€™t find the new installer there is only a subfolder /legacy-images/ which is empty.

Hey!

You can find all necessary steps with Foreman 3.4 documented here. In case you want to provision an Ubuntu 20.04.3+ host via a Smart Proxy, also pay attention to this.

In case you need more specific help, let me know!

Ok, I download the ISO image and extracted it.

/var/www/html/pub/installation_media/ubuntu/22.04-x86_64

drwxr-xr-x. 8 root root   135 Nov 24 11:52 ./
drwxr-xr-x. 3 root root    50 Nov 24 11:52 ../
dr-xr-xr-x. 3 root root    40 Apr 15  2022 boot/
-r--r--r--. 1 root root  2048 Aug  9 16:48 boot.catalog
dr-xr-xr-x. 2 root root  4096 Aug  9 16:48 casper/
dr-xr-xr-x. 3 root root    49 Aug  9 16:48 dists/
dr-xr-xr-x. 3 root root    18 Apr 15  2022 EFI/
dr-xr-xr-x. 2 root root     6 Aug  9 16:48 install/
-r--r--r--. 1 root root 11408 Aug  9 16:48 md5sum.txt
dr-xr-xr-x. 4 root root    36 Aug  9 16:48 pool/
lrwxrwxrwx. 1 root root     1 Aug  9 16:48 ubuntu -> ./

But I guess
/usr/share/foreman/app/models/operatingsystems/debian.rb has to be adapted as well

    if (guess_os == 'ubuntu' && major.to_i >= 20)
      'dists/$release/main/installer-$arch/current/legacy-images/netboot/' + guess_os + '-installer/$arch'
    else
      'dists/$release/main/installer-$arch/current/images/netboot/' + guess_os + '-installer/$arch'
    end

this one will not work.

It seems like you are not on Foreman 3.4. If you want Foreman to identify the boot files of Ubuntu 20.04.3+ images (so, including 22.04 and everything newer), you must include the changes in this commit:
https://github.com/theforeman/foreman/commit/35fc203805478a376b67fdde3a150f2ec9ce0e81

Moreover, you should have a look at the provisioning templates. Especially the following two are important for Ubuntu 20.04.3+ deployment and must be associated in your Operating System configuration.

1 Like

@bastian-src
I can not update to 3.4 as EL7 support is dropped with Foreman 3.4 :frowning:
(This problem should be solved at another time)

I switched the /usr/share/foreman/app/models/operatingsystems/debian.rb with your version from GitHub. :+1:
Then I added the preseed_default_pxelinux file you mentioned above.
But the VM will not start the installer the last step is:

HTTP://<hostname>/unattended/iPXE... ok

vsphere is complaining that VM is consuming too many CPU resources

In the template, I replaced the variables (KERNEL, INITRD, APPEND) with static values to make sure everything is fine. Then I downloaded the iso image, initrd and vmlinux manually.
All 3 links are working fine. Any idea what is missing?

Alright, reasonable. :+1: The debian.rb file change should be the most important commit for Ubuntu Autoinstall in Foreman 3.4.

It seems like your host tries to download the wrong boot template (it should use the previously mentioned PXELinux instead of some iPXE). What does your Operating System configuration in Foreman look like? Did you associate the template as I mentioned previously?

Can you maybe also provide a rendered version of your PXELinux template? After applying the commit, you shouldnā€™t adapt the KERNEL and INITRD paths anymore because Foreman detects them now. It recognizes the boot files in your installation media (in the /casper/) folder and downloads them to /var/lib/tftpboot/boot/<ubuntu-22-04-and-some-hash-code>-[initrd|vmlinuz]. The files might exist already from a previous run and you must delete them manually - otherwise, Foreman does not re-download them.

Just to be sure, we want to mount the image into VMware.
I thought that would be rather iPXE than good old PXE.

Anyhow, I change the template from iPXE to PXE.
For testing purposes, I removed all other templates. So it looks like that now:

This is the rendered template:

#
# This file was deployed via 'Preseed PXE 22.04' template
#
# Supported host/hostgroup parameters:
#
# blacklist = module1, module2
#   Blacklisted kernel modules
#
# lang = en_US
#   System locale
#
#
# WARNING
#
# Foreman will not download the kernel/initramdisk to PXE automatically. Please follow
# the official Ubuntu documentation and extract the files from the LiveCD (DVD) manually
# and optionally update the KERNEL and INITRD lines in this template.
#
DEFAULT linux cloud-init autoinstall
LABEL linux cloud-init autoinstall
    KERNEL boot/ubuntu-local-repo-kddGAsOXrj4S-vmlinuz
    INITRD boot/ubuntu-local-repo-kddGAsOXrj4S-initrd
    APPEND ip=dhcp url=http://<MYPUPPETSERVER>/pub/installation_media/ubuntu/22.04-x86_64.iso autoinstall root=/dev/ram0 ramdisk_size=1500000 fsck.mode=skip

I checked /var/lib/tftpboot/boot/ but both files:

  • ubuntu-local-repo-kddGAsOXrj4S-vmlinuz
  • ubuntu-local-repo-kddGAsOXrj4S-initrd
    are missing.

I gotta admit, I didnā€™t use iPXE before and just PXELinux or PXEGrub2.
Is there any difference when you deploy the machine now? Is it still looking for iPXE?

Since your boot files are missing, I assume Foreman runs into an error when extracting these. Does the corresponding Installation Media point to your http://<MYPUPPETSERVER>/pub/installation_media/ubuntu/22.04-x86_64?

Did you check /var/log/foreman/production.log? When you deploy your machine (e.g. click Build in foreman), there should appear some messages like the following:

<log time> Deploying TFTP PXELinux configuration for <host fqdn>
<log time> Skipping TFTP PXEGrub2 configuration for <host fqdn>
<log time> Skipping TFTP PXEGrub configuration for <host fqdn>
<log time> Skipping TFTP iPXE configuration for <host fqdn>
<log time> Fetching required TFTP boot files for <host fqdn>

At the time of the last command, there should also be something like this in your Smart Proxy (/var/log/foreman-proxy/proxy.log):

<log time> Started POST /tftp/fetch_boot_file
<log time> Started task /usr/bin/curl ... <installatio media path> ... </var/lib/tftpboot/boot/ubuntu-local-repo-kddGAsOXrj4S-vmlinuz>
<log time> Finished POST /tftp/fetch_boot_file

Regarding your template: It looks fine, despite the fact that you are missing this part from the original one (which I assume you left out on purpose for debugging). Without this, your machine is probably going to run into an error later on when the installer is actually booted - but letā€™s see when we get there :crossed_fingers:

APPEND .. ds=nocloud-net;s=http://<%= foreman_request_addr %>/userdata/ ..

@bastian-src
now I receive the following error

HTTP://<MYPUPPETSERVER>unattended/iPXE... No such file or diectory

Yes, the directory
http://<MYPUPPETSERVER>/pub/installation_media/ubuntu/22.04-x86_64
exists and I am able to download the iso with Firefox.

These are the lines from the log file

2022-11-29T10:18:48 [I|app|2f67287d] Started GET "/hosts/mynewhost.mydomain/review_before_build" for 10.10.4.55 at 2022-11-29 10:18:48 +0000
2022-11-29T10:18:48 [I|app|2f67287d]   Parameters: {"id"=>"mynewhost.mydomain"}
2022-11-29T10:18:51 [I|app|bd0d5371] Started PUT "/hosts/mynewhost.mydomain/setBuild?auth_object=mynewhost.mydomain&permission=build_hosts" for 10.10.4.55 at 2022-11-29 10:18:51 +0000
2022-11-29T10:18:51 [I|app|bd0d5371]   Parameters: {"utf8"=>"āœ“", "authenticity_token"=>"NLxHAZO52h+9rns0ZGLR59v5KeAbQODbf0x50LpTY6ZBDFWUb3tLPfG2/oRJSYdzLUSF6obyYXwPbHpC29C/eA==", "host"=>{"build"=>"0"}, "commit"=>"Build", "auth_object"=>"mynewhost.mydomain", "permission"=>"build_hosts", "id"=>"mynewhost.mydomain"}
2022-11-29T10:18:51 [I|app|bd0d5371] Generating HOST ISO image for mynewhost.mydomain
2022-11-29T10:18:52 [I|app|bd0d5371] Uploading ISO image /tmp/d20221129-32435-2p4kkg/mynewhost.mydomain.iso for mynewhost.mydomain
2022-11-29T10:18:54 [I|app|bd0d5371] Deploying TFTP PXELinux configuration for mynewhost.mydomain
2022-11-29T10:18:54 [I|app|bd0d5371] Skipping TFTP PXEGrub2 configuration for mynewhost.mydomain
2022-11-29T10:18:54 [I|app|bd0d5371] Skipping TFTP PXEGrub configuration for mynewhost.mydomain
2022-11-29T10:18:54 [I|app|bd0d5371] Skipping TFTP iPXE configuration for mynewhost.mydomain
2022-11-29T10:18:54 [I|app|bd0d5371] Fetching required TFTP boot files for mynewhost.mydomain
2022-11-29T10:18:54 [I|app|bd0d5371] Attaching ISO image to CDROM drive for mynewhost.mydomain
2022-11-29T10:18:54 [I|app|bd0d5371] Delete the autosign entry for mynewhost.mydomain
2022-11-29T10:18:54 [I|app|bd0d5371] Remove puppet certificate for mynewhost.mydomain
2022-11-29T10:18:55 [I|app|bd0d5371] Adding autosign entry for mynewhost.mydomain
2022-11-29T10:18:55 [I|app|bd0d5371] Redirected to https://<MYPUPPETSERVER>/hosts/mynewhost.mydomain
2022-11-29T10:18:55 [I|app|3676db99] Started GET "/hosts/mynewhost.mydomain" for 10.10.4.55 at 2022-11-29 10:18:55 +0000
2022-11-29T10:18:55 [I|app|3676db99]   Parameters: {"id"=>"mynewhost.mydomain"}
2022-11-29T10:18:56 [I|app|8351e5a2] Started GET "/hosts/mynewhost.mydomain/runtime?range=7" for 10.10.4.55 at 2022-11-29 10:18:56 +0000
2022-11-29T10:18:56 [I|app|8351e5a2]   Parameters: {"range"=>"7", "id"=>"mynewhost.mydomain"}
2022-11-29T10:18:56 [I|app|bd279e09] Started GET "/hosts/mynewhost.mydomain/vm" for 10.10.4.55 at 2022-11-29 10:18:56 +0000
2022-11-29T10:18:56 [I|app|ba4e2a67] Started GET "/hosts/mynewhost.mydomain/templates" for 10.10.4.55 at 2022-11-29 10:18:56 +0000
2022-11-29T10:18:56 [I|app|8858b597] Started GET "/hosts/mynewhost.mydomain/overview" for 10.10.4.55 at 2022-11-29 10:18:56 +0000
2022-11-29T10:18:56 [I|app|c824d9af] Started GET "/hosts/mynewhost.mydomain/nics" for 10.10.4.55 at 2022-11-29 10:18:56 +0000
2022-11-29T10:18:56 [I|app|bfb08f45] Started GET "/hosts/mynewhost.mydomain/resources?range=7" for 10.10.4.55 at 2022-11-29 10:18:56 +0000
2022-11-29T10:18:56 [I|app|bd279e09]   Parameters: {"id"=>"mynewhost.mydomain"}
2022-11-29T10:18:56 [I|app|ba4e2a67]   Parameters: {"id"=>"mynewhost.mydomain"}
2022-11-29T10:18:56 [I|app|bfb08f45]   Parameters: {"range"=>"7", "id"=>"mynewhost.mydomain"}
2022-11-29T10:18:56 [I|app|8858b597]   Parameters: {"id"=>"mynewhost.mydomain"}
2022-11-29T10:18:56 [I|app|c824d9af]   Parameters: {"id"=>"mynewhost.mydomain"}

I just removed

ds=nocloud-net;s=http://<%= foreman_request_addr %>/userdata/

to reduce it to the basic setup. If I am able to boot 22.04 I will add it again

Itā€™s weird to me that Foreman is still looking for an iPXE even tho you only set the PXELinux template. Especially, because the log you posted mentions that it deploys PXELinux and skips iPXE.

Can you also provide the Smart Proxy log (/var/log/foreman-proxy/proxy.log)? Did it contain the message I mentioned here?

Commenting on this:

Ok, so the directory exists, but does your Installation Media also contain that path? You should have an installation media configured like this:

And this must then be set in your Operating System configuration. According to this, your boot files are fetched and put in the corresponding tftpboot folder mentioned earlier.

Another think regarding the iPXE just came into my mind: When you deploy your host, do you set the PXE loader to PXELinux BIOS? It is in the Operating System tab.

The Installation Media is set on this page as well and must be the one I mentioned earlier (pointing to your local extracted iso in your pub directory)