Autoinstalling ubuntu-server 20.04.3 from the live-iso

Ah okay, this API endpoint has been introduced in Foreman 3.4 - so that makes sense now.

So, the installation process is started but it stops at this point? I haven’t seen it stopping at this point before.

How much RAM did you give the machine? (Ubuntu Autoinstall needs at least ~3GB).

That shouldn’t be an issue - but you should still see some event in your var/log/foreman/production log when the host downloads the userdata template from Foreman.

Yes the installation starts and then stays hung at this point. The VM has
4GB RAM allocated to it.

I can see a log generated in the

Am I using the correct templates?
Or any recommendations pls?

Do you see something similar to the following?

2023-10-24T11:39:17 [I|app|8dce6478] Started GET "/userdata/user-data?url=<foreman URL> for <host IP> at 2023-10-24 11:39:17 +0200
2023-10-24T11:39:17 [I|app|8dce6478] Processing by UserdataController#userdata as TEXT
2023-10-24T11:39:17 [I|app|8dce6478]   Parameters: {"url"=>"<foreman URL>", "userdatum"=>{}}
2023-10-24T11:39:18 [I|app|8dce6478]   Rendered text template (Duration: 0.0ms | Allocations: 1)
2023-10-24T11:39:18 [I|app|8dce6478] Completed 200 OK in 506ms (Views: 1.0ms | ActiveRecord: 65.8ms | Allocations: 76581)

There might be also some calls to userdata/vendor-data but those can be ignored.

The associated templates are fine. So, for further debugging, please post the rendered version of the Preseed default PXELinux Autoinstall and Preseed Autoinstall cloud-init user data templates :slight_smile:

I have never been able to install with this little RAM. We’ve told our techs they need at least 5GB. I’d be curious if you try with 6GB (or even 8GB) if your install works.

I also use 6 GB for Autoinstall.

Hi @bastian-src

Apologies for the delay in response…

These logs are not visible in var/log/foreman/production.

These are the templates I am using:

@esw Tried with 6GB RAM as well still getting the same error “can’t open /dev/sr0: No medium found”.

Then, the issue occurs probably before the userdata template is downloaded.

Can you please post the rendered version of your PXELinux template (masquerading any sensitive information of course)?

I am getting this in the preview section:

# This file was deployed via ‘<%= template_name %>’ template
# Supported host/hostgroup parameters:
# blacklist = module1, module2
# Blacklisted kernel modules
# lang = en_US
# System locale
# 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/filename-vmlinuz**
** INITRD boot/filename-initrd**
** APPEND ip=dhcp url=http://xxxxxxxx/pub/installation_media/ubuntu/20.04.6/ autoinstall ds=nocloud-net;s=http://foreman-server-domain/userdata/ root=/dev/ram0 ramdisk_size=1500000 fsck.mode=skip**

I’ve just compared your template to the latest version of it (that I just used for my own Ubuntu host deployment).
I recognized that in your version, there is no parameter cloud-config-url=/dev/null. There is currently a bug in the Ubuntu installer which let’s it download the iso image twice - passing this parameter prevents the installer from doing so. Look here for further information on this: server - pxe autoinstall fails with ubuntu 20.04.04 - Ask Ubuntu
You can create a custom template and add the paramter.

Besides that, your template looks fine.

Can you verify that your boot files are downloaded correctly?
There should be some files similar to these in your boot files directory /var/lib/tftpboot/boot/ on your Foreman:

-rw-r--r--. 1 foreman-proxy foreman-proxy  85M Mar 14  2023 ubuntu20lts-mirror-AETB3fdcwlLC-initrd
-rw-r--r--. 1 foreman-proxy foreman-proxy  14M Mar 14  2023 ubuntu20lts-mirror-AETB3fdcwlLC-vmlinuz

The naming could be different, but the file size is important. It should be similar to these.

PS: Have a look here on how to post code blocks (so you don’t run into formatting issues when sharing templates for example): An Unofficial Discourse User Reference Guide - TechForum Site and Post Help - Electronic Component and Engineering Solution Forum - TechForum │ Digi-Key


In your version of the template, you would have to change line 50 to the following:

    APPEND ip=dhcp url=http://<%= @preseed_server %><%= image_path %> autoinstall ds=nocloud-net;s=http://<%= foreman_request_addr %>/userdata/ root=/dev/ram0 ramdisk_size=1500000 fsck.mode=skip cloud-config-url=/dev/null

Thanks @bastian-src for the help…

These files are getting generated however I don’t think they are getting downloaded as the file sizes are very small in kb. I have to manually download initrd & vmlinuz files from the ISO and place here.

Tried with this modification also, still getting the same error:
“/init: line 49: can’t open /dev/sr0: No medium found
unable to find a medium container a live file system
Attempt interactive netboot from a URL?”

Then, it seems like this is the issue. Your machine probably can’t find the boot files.
When copying the files manually, did you check the file names? They must be exactly the same as the ones in your template:

KERNEL boot/filename-vmlinuz
INITRD boot/filename-initrd

yes they are exactly same.

Sharing the below info if it helps:
When I was trying without downloading the initrd & vmlinuz files manually, it was showing error " invalid or corrupt kernel image & was stuck at boot:".

Post downloading these files manually it is atleast starting the PXE however I am getting this error now “/init: line 49: can’t open /dev/sr0: No medium found”.

Any area we can check or any suggestions?

I would recommend downloading the whole image and extracting it again - just to check whether there is an issue with the boot files or the image itself.

Coming back to your original post:

I’m not entirely sure when that “Running scripts/caser-premount” step is run. But, I assume that your host downloads the ~2GB Iso image and starts installing, yes?

Then, it should download the Userdata template and you should find log entries as mentioned here:

When the error comes up, is an interactive shell opened?

Yes tried it, still the same issue.

Don’t think the image is getting downloaded because I get the error in 20 seconds when the device is booted from network.

I can see log “Started Get “/userdata/” for foreman-ip” however it ends with error “ActionController::RoutingError”

yes, it gives me the option to choose n/w static or dhcp, then few network setting & URL to download image which is starting with “”. As per my understanding this means the endpoint is not able to pick the image from my hosted ISO.

I just figured there is an issue with your URL here. It points to the directory, not the ISO image as it is supposed to.

The path comes from the corresponding Installation Media and the template should turn the directory path to an .iso suffix:

Check your Installation Media, the PXELinux template, and maybe test it with a static path to verify that’s the issue.


Also, check the links mentioned here in case you didn’t already:

So I don’t need to extract the ISO image on my apache server?
At present my ISO is extracted and I have removed the ‘.iso’ from the template as I was not getting the extracted ISO structure in the browser while checking.

You need both.

Since you want to deploy an Ubuntu 20.04 host with Autoinstall (so, an Ubuntu 20.04.3+ host), you just follow the 22.04 setup as described in the docs (for Ubuntu 20.04.0/1/2, it’s been different):

Thereby, Foreman needs the extracted iso image in order to download the boot files and the Ubuntu host needs the unextracted iso image for its installation.

We’re working on automating this process such that you only need to provide the iso image in the future and Foreman extracts the boot files on its own.

I hope this helps :crossed_fingers:

1 Like

Will try & get back :crossed_fingers:

Hey @bastian-src

Tried with the above suggestion. The good news is Ubuntu ISO is now getting downloaded & starting the installation :slight_smile: however now while installing it gets into GUI Desktop mode.

The last log I see on the screen before going into GUI is " Started session 1 of user ubuntu", at this stage non of the files like /etc/hosts or /etc/resolv.conf is update when I am checking on the terminal.

Sharing the below info if it helps:
The initrd & vmlinuz are still not getting downloaded, I have to manually download them.
The ISO file I am using is of Ubuntu Desktop.

Which ubuntu version are you installing? I believe Ubuntu only added autoinstall support for the Desktop version with 23.04+

So if you’re trying this with 22.04, autoinstall is not going to work unless you use the server ISO

1 Like