Pxe files - kernel, initrd

Problem:

How to find out which files in /srv/tftp/boot directory belongs to which OS?

Depending on the Foreman version, those files will be named after the OS type name. E.g. Redhat-x86_64-7.7-initram.img for OS of the type “Redhat” architecture “x86_64” and version 7.7.

However if you have another OS of this same kind named differently “e.g. My RHEL 7.7”, then the file will be overwritten on every provisioning. Newer versions of Foreman add first 12 characters SHA1 hash of the installation media URL encoded in base64 so it will be two different names.

I think it would be easy to include Operating System database ID to the name, so it would read something like Redhat-12-x86_86-7.7-vmlinuz, or the whole operating system name instead like My_RHEL_7.7-vmlinuz. I slightly prefer the former one because people tend to create weird names to things.

When using Katello, this is completely overriden. Then the naming convention is Product name and Content View ID. We would like to change that however because on deployments with many promotions this create unnecessary amount of boot files as the CV ID increases.

1 Like

My names contain only mirror name and SHA1 hash.
It would be much easier to have something like “debian_9.9” in file name.

root@foreman-2-proxy-1:/srv/tftp/boot# ls -w1 *linu*
centos-mirror-qVbSBrznIWMc-vmlinuz
centos-mirror-Y9DBxqXs2LJ9-vmlinuz
debian-mirror-dgxKgBg5J79O-linux
debian-mirror-gbCq4bcqf6Lp-linux
debian-mirror-wXTzvPQ8AfC3-linux
ubuntu-mirror-MlgxQLc5gvg6-linux
ubuntu-mirror-WKCIULkETfqj-linux

My current workaround is to do file command and google default kernel version for different distributions :slight_smile:

root@foreman-2-proxy-1:/srv/tftp/boot# file debian-mirror-*-linux | cut -d',' -f2
 version 4.9.0-11-amd64 (debian-kernel@lists.debian.org) #1 SMP Debian 4.9.189-3 (2019-09-02)
 version 3.16.0-6-amd64 (debian-kernel@lists.debian.org) #1 SMP Debian 3.16.56-1+deb8u1 (2018-05-08)
 version 4.19.0-6-amd64 (debian-kernel@lists.debian.org) #1 SMP Debian 4.19.67-2 (2019-08-28)

BTW; foreman doesn’t allow me to create same OS with identical major/minor numbers.

Oh you are right, what I described in my previous post was the previous behavior. Now the name is made of installation media name and SHA1 hash of the URL. Out of curiosity, why you need that? Foreman should manage PXE files for you.

I agree this is probably more confusing than it was (we occasionally saw incorrect OS entries but that was misconfiguration). We can put it back with planned refactoring Feature #26709: Rethink TFTP naming conventions for PXE files - Foreman

There was an error on debian mirror or somewhere in my squid, and i finished with wrong version of kernel and initrd and netinstall from that point failed.

Nevertheless, please confirm what I found:
It is always safe to delete this files, foreman will re-download latest version from mirror (installation media) if these files are missing (on next provisioning action)… In other words, if someone encounters a problem with debian netinstall kernel and initrd, it is safe to do: rm -rf /srv/tftp/boot/debian-mirror-* :slight_smile: )

Ehm, ehm. Yes, plus it will download with wget -c which means continue. If a file is refreshed on the server and bigger, it will actually append the rest and this will cause random issues (depending on the initramdisk data - weird stuff). Be aware, I always recommend to wipe out the TFTP directory. Exit and enter build mode to redownload TFTP files.

The issue I have linked actually aim to fix this problem.