Need to customize the foreman discovery iso -> fdi-bootable-3.3.1.iso

Problem: i need to customize the foreman discovery image

Expected outcome: while provitioining we need to update smart proxy url into formean-discovery iamge

Foreman and Proxy versions: 3.3

Foreman and Proxy plugin versions: 3.3

Distribution and version:

Other relevant data:

i need to modify fdi-bootable-3.3.1.iso so please suggest me any documnet
[root@boldforeman fdi-image]# pwd
/var/lib/tftpboot/boot/fdi-image
[root@boldforeman fdi-image]# ls -ltr
total 219904
-rw-r–r-- 1 foreman-proxy root 5393328 Jan 4 2017 vmlinuz0
-rw-r–r-- 1 foreman-proxy root 250 Jan 4 2017 README
-rw-r–r-- 1 foreman-proxy root 219778009 Jan 4 2017 initrd0.img
-rw-r–r-- 1 foreman-proxy root 153 Jan 4 2017 SHA256SUM
[root@boldforeman fdi-image]#

Hi @srikanthm
Please have a look at Building a Discovery Image in Provisioning Hosts.

Hi
My foreman server and smart proxy servers are configured on Centos 7.
i can be able to provision the server successfully. but while boot with image i have to give smart proxy server Intractive mode to discovery the Mac address so i need to automate it discovery image
whatever you suggested document will work centos7 please suggest me

Regards
Srikanth

while provitioining we need to update smart proxy url into formean-discovery iamge

I believe that remaster script is what you are looking for:

Hi

can you please suggest me how to modify about it ?

[root@bolforemanproxy boot]# pwd
/var/lib/tftpboot/boot
[root@bolforemanproxy boot]# cd fdi-image/
[root@bolforemanproxy fdi-image]# ls -ltr
total 219904
-rw-r–r-- 1 foreman-proxy root 5393328 Jan 4 2017 vmlinuz0
-rw-r–r-- 1 foreman-proxy root 250 Jan 4 2017 README
-rw-r–r-- 1 foreman-proxy root 219778009 Jan 4 2017 initrd0.img
-rw-r–r-- 1 foreman-proxy root 153 Jan 4 2017 SHA256SUM
[root@bolforemanproxy fdi-image]# pwd
/var/lib/tftpboot/boot/fdi-image

Helper script called discovery_remaster is being shipped with the foreman_discovery plugin. It can be used to make a copy of the ISO image with additional kernel command line options. Usage is simple:

sudo discovery-remaster fdi-bootable-3.5.X.iso "fdi.pxip=192.168.100.68/24 fdi.pxgw=192.168.100.1 fdi.pxdns=192.168.100.1 proxy.url=https://192.168.100.1:8443 proxy.type=proxy fdi.pxfactname1=myfact fdi.pxfactvalue1=somevalue fdi.pxmac=52:54:00:be:8e:8c fdi.pxauto=1"

do youwant to use above remaster script to update smart proxy URL ?

Hi,

do you boot the FDI from USB drive or via network? The following suggest network boot:

For network boot you can easily set cmdline options in /var/lib/tftpboot/grub2/grub.cfg (look for $common variable) resp. in the pxegrub2_discovery.

For USB drive boot you need to use discovery_remaster script to change ISO file, dump it to USB drive and boot from it.

1 Like

i need to boot with network as i need to install with ISO image without any interaction inputs .
if i am booting with ISO image it needs to be SCAN mac address and send to foreman server via proxy region wise network .

No interaction, this is understood.

Please read first this FDI manual (Foreman :: Plugin Manuals) for better understanding.

After this you tell us if you have PXE or PXE-less environment. Means if you boot FDI ISO from (virtual) USB drive/CD-ROM or via network (=PXE) and if you have DHCP in your network or not.

Depending on this information we can tell you a) which cmdline parameters needs to be set and b) how you can set them.

1 Like

I have Vsphere ( vmware network ) After selecting the DHCP network and providing the proxy server URL (https://hylforemanproxy.micron.com:9090), while booting with iso image ( fdi-bootable-3.3.1.iso) It will immediately send the MAC address to the Foreman server, where we will verify from the Hosts-> hots for discovery.

we are using CDROM in vmware network and booting with network and we have PXE boot environment for installation .

Then you need to do the following (e.g. on a Rocky8):

[root@rocky8 fdi]# dnf install isomd5sum mtools syslinux xorriso libguestfs-tools
[root@rocky8 fdi]# wget https://raw.githubusercontent.com/theforeman/foreman-discovery-image/b94bf01e26be01edffc1290b8c726f2d6ecdceec/aux/remaster/discovery-remaster
[root@rocky8 fdi]# bash ./discovery-remaster fdi-bootable-3.3.1.iso "proxy.url=https://<proxy-fqdn> proxy.type=proxy fdi.pxauto=1"

Upload resulting ISO to your vSphere, configure your VM to boot from it and have fun.

The package names might be different on other distributions. Do not take latest version (4a3c3d9) of discovery-remaster script from Github - does not work with older FDI ISO versions such as 3.3.1; b94bf01 as used in wget call is good enough.

For full automation you need to set:

  • proxy.url=https://<proxy-fqdn> – FQDN of your proxy, propably https://hylforemanproxy.micron.com
  • proxy.type=proxy – It’s a proxy, not Foreman directly
  • fdi.pxauto=1 – This does the automation magic, no need for manual confirmation

All of this is well described in the FDI manual.

Once i installed required rpms then i am getting errors while creating iso image.
[root@hylformanproxy image]# ls -ltr
total 242692
-rw-r–r-- 1 root root 248512512 Jan 4 2017 fdi-bootable-3.3.1.iso
-rw-r–r-- 1 root root 3802 Mar 27 10:48 discovery-remaster
[root@hylformanproxy image]# bash ./discovery-remaster fdi-bootable-3.3.1.iso “proxy.url=https://hylformanproxy.micron.com proxy.type=proxy fdi.pxauto=1”
Copying contents to temporary directory…
Making hardlinks so inodes can be cached to save space…
/tmp/tmp.zqEaMo9loo /var/tmp/image
ln: failed to access ‘isolinux/initrd.img’: No such file or directory
ln: failed to access ‘isolinux/vmlinuz’: No such file or directory
/var/tmp/image
Configuring bootloaders…
Copy grub config to the ESP image…
Can’t open /tmp/tmp.zqEaMo9loo/images/efiboot.img: No such file or directory
Cannot initialize ‘::’
Bad target ::EFI/BOOT/grub.cfg
Building new ISO image…
Warning: creating filesystem that does not conform to ISO-9660.
Size of boot image is 4 sectors → No emulation
4.13% done, estimate finish Mon Mar 27 10:49:20 2023
8.26% done, estimate finish Mon Mar 27 10:49:20 2023
12.40% done, estimate finish Mon Mar 27 10:49:20 2023
16.53% done, estimate finish Mon Mar 27 10:49:20 2023
20.65% done, estimate finish Mon Mar 27 10:49:20 2023
24.78% done, estimate finish Mon Mar 27 10:49:20 2023
28.92% done, estimate finish Mon Mar 27 10:49:20 2023
33.04% done, estimate finish Mon Mar 27 10:49:20 2023
37.18% done, estimate finish Mon Mar 27 10:49:20 2023
41.30% done, estimate finish Mon Mar 27 10:49:20 2023
45.44% done, estimate finish Mon Mar 27 10:49:20 2023
49.56% done, estimate finish Mon Mar 27 10:49:20 2023
53.69% done, estimate finish Mon Mar 27 10:49:20 2023
57.82% done, estimate finish Mon Mar 27 10:49:20 2023
61.95% done, estimate finish Mon Mar 27 10:49:20 2023
66.08% done, estimate finish Mon Mar 27 10:49:20 2023
70.21% done, estimate finish Mon Mar 27 10:49:20 2023
74.33% done, estimate finish Mon Mar 27 10:49:20 2023
78.47% done, estimate finish Mon Mar 27 10:49:20 2023
82.59% done, estimate finish Mon Mar 27 10:49:20 2023
86.73% done, estimate finish Mon Mar 27 10:49:20 2023
90.85% done, estimate finish Mon Mar 27 10:49:20 2023
94.99% done, estimate finish Mon Mar 27 10:49:20 2023
99.11% done, estimate finish Mon Mar 27 10:49:20 2023
Total translation table size: 6249
Total rockridge attributes bytes: 2866
Total directory bytes: 10240
Path table size(bytes): 78
Max brk space used 22000
121085 extents written (236 MB)
isohybrid: fdi-bootable-3.3.1-230327_104859.iso: unable to find efi image
Inserting md5sum into iso image…
md5 = 5bfe2370c18c9c92fc557b2455b0f5f9
Inserting fragment md5sums into iso image…
fragmd5 = bc47ae7bb53dda959e8f55fb9650f8de8cbe27d52a4928bd281c8ae2f85b
frags = 20
Setting supported flag to 0
Created: fdi-bootable-3.3.1-230327_104859.iso (BIOS-only compatible)
Cleaning up temporary directory…
[root@hylformanproxy image]#
[root@hylformanproxy image]#

[root@hylformanproxy tmp]# bash ./discovery-remaster fdi-bootable-3.3.1.iso “proxy.url=https://hylformanproxy.micron.com:9090 proxy.type=proxy fdi.pxauto=1” Copying contents to temporary directory…
Making hardlinks so inodes can be cached to save space…
/tmp/tmp.PGsYygtYuB /tmp
ln: failed to access ‘isolinux/initrd.img’: No such file or directory
ln: failed to access ‘isolinux/vmlinuz’: No such file or directory
/tmp
Configuring bootloaders…
Copy grub config to the ESP image…
Can’t open /tmp/tmp.PGsYygtYuB/images/efiboot.img: No such file or directory
Cannot initialize ‘::’
Bad target ::EFI/BOOT/grub.cfg
Building new ISO image…
Warning: creating filesystem that does not conform to ISO-9660.
Size of boot image is 4 sectors → No emulation
4.13% done, estimate finish Mon Mar 27 11:03:56 2023
8.26% done, estimate finish Mon Mar 27 11:03:56 2023
12.40% done, estimate finish Mon Mar 27 11:03:56 2023
16.53% done, estimate finish Mon Mar 27 11:03:56 2023
20.65% done, estimate finish Mon Mar 27 11:03:56 2023
24.78% done, estimate finish Mon Mar 27 11:03:56 2023
28.92% done, estimate finish Mon Mar 27 11:03:56 2023
33.04% done, estimate finish Mon Mar 27 11:03:56 2023
37.18% done, estimate finish Mon Mar 27 11:03:56 2023
41.30% done, estimate finish Mon Mar 27 11:03:56 2023
45.44% done, estimate finish Mon Mar 27 11:03:56 2023
49.56% done, estimate finish Mon Mar 27 11:03:56 2023
53.69% done, estimate finish Mon Mar 27 11:03:56 2023
57.82% done, estimate finish Mon Mar 27 11:03:56 2023
61.95% done, estimate finish Mon Mar 27 11:03:56 2023
66.08% done, estimate finish Mon Mar 27 11:03:56 2023
70.21% done, estimate finish Mon Mar 27 11:03:56 2023
74.33% done, estimate finish Mon Mar 27 11:03:56 2023
78.47% done, estimate finish Mon Mar 27 11:03:56 2023
82.59% done, estimate finish Mon Mar 27 11:03:56 2023
86.73% done, estimate finish Mon Mar 27 11:03:56 2023
90.85% done, estimate finish Mon Mar 27 11:03:56 2023
94.99% done, estimate finish Mon Mar 27 11:03:56 2023
99.11% done, estimate finish Mon Mar 27 11:03:56 2023
Total translation table size: 6249
Total rockridge attributes bytes: 2866
Total directory bytes: 10240
Path table size(bytes): 78
Max brk space used 22000
121085 extents written (236 MB)
isohybrid: fdi-bootable-3.3.1-230327_110335.iso: unable to find efi image
Inserting md5sum into iso image…
md5 = 54a8059397cc429d11c65e6e8c36af70
Inserting fragment md5sums into iso image…
fragmd5 = baad7e9492a71847262a6dd55c497f11697d9963752c529f39a9f9d77e31
frags = 20
Setting supported flag to 0
Created: fdi-bootable-3.3.1-230327_110335.iso (BIOS-only compatible)
Cleaning up temporary directory…
[root@hylformanproxy tmp]#

You are not using the correct version of discovery-remaster.

Please use the revision I specified.

This can be ignored for legacy BIOS, I got the same error.

I have downloaded. ISO (https://downloads.theforeman.org/discovery/releases/3.3/fdi-bootable-3.3.1.iso) image from Index of /discovery/releases/3.3 then followed steps to re create iso image but getting errors.
'Step 1) yum install isomd5sum mtools syslinux xorriso libguestfs-tools
step 2 ) wget https://downloads.theforeman.org/discovery/releases/3.3/fdi-bootable-3.3.1.iso
Step 3) bash ./discovery-remaster fdi-bootable-3.3.1.iso “proxy.url=https://hylformanproxy.micron.com proxy.type=proxy fdi.pxauto=1”

getting same error please suggest me

[root@hylformanproxy image]# bash ./discovery-remaster fdi-bootable-3.3.1.iso “proxy.url=https://hylformanproxy.micron.com proxy.type=proxy fdi.pxauto=1”
Copying contents to temporary directory…
Making hardlinks so inodes can be cached to save space…
/tmp/tmp.QUcLBeronJ /var/tmp/image
ln: failed to access ‘isolinux/initrd.img’: No such file or directory
ln: failed to access ‘isolinux/vmlinuz’: No such file or directory
/var/tmp/image
Configuring bootloaders…
Copy grub config to the ESP image…
Can’t open /tmp/tmp.QUcLBeronJ/images/efiboot.img: No such file or directory
Cannot initialize ‘::’
Bad target ::EFI/BOOT/grub.cfg
Building new ISO image…
Warning: creating filesystem that does not conform to ISO-9660.
Size of boot image is 4 sectors → No emulation
4.13% done, estimate finish Mon Mar 27 17:02:34 2023
8.26% done, estimate finish Mon Mar 27 17:02:34 2023
12.40% done, estimate finish Mon Mar 27 17:02:34 2023
16.53% done, estimate finish Mon Mar 27 17:02:34 2023
20.65% done, estimate finish Mon Mar 27 17:02:34 2023
24.78% done, estimate finish Mon Mar 27 17:02:34 2023
28.92% done, estimate finish Mon Mar 27 17:02:34 2023
33.04% done, estimate finish Mon Mar 27 17:02:34 2023
37.18% done, estimate finish Mon Mar 27 17:02:34 2023
41.30% done, estimate finish Mon Mar 27 17:02:34 2023
45.44% done, estimate finish Mon Mar 27 17:02:34 2023
49.56% done, estimate finish Mon Mar 27 17:02:34 2023
53.69% done, estimate finish Mon Mar 27 17:02:34 2023
57.82% done, estimate finish Mon Mar 27 17:02:34 2023
61.95% done, estimate finish Mon Mar 27 17:02:34 2023
66.08% done, estimate finish Mon Mar 27 17:02:34 2023
70.21% done, estimate finish Mon Mar 27 17:02:34 2023
74.33% done, estimate finish Mon Mar 27 17:02:34 2023
78.47% done, estimate finish Mon Mar 27 17:02:34 2023
82.59% done, estimate finish Mon Mar 27 17:02:34 2023
86.73% done, estimate finish Mon Mar 27 17:02:34 2023
90.85% done, estimate finish Mon Mar 27 17:02:34 2023
94.99% done, estimate finish Mon Mar 27 17:02:34 2023
99.11% done, estimate finish Mon Mar 27 17:02:34 2023
Total translation table size: 6249
Total rockridge attributes bytes: 2866
Total directory bytes: 10240
Path table size(bytes): 78
Max brk space used 22000
121085 extents written (236 MB)
isohybrid: proxy.type=proxy: unable to find efi image
Inserting md5sum into iso image…
md5 = 07915fda44f76beead2a23db2986ff08
Inserting fragment md5sums into iso image…
fragmd5 = 93e6e1915ca455bb35f46427a88fdbfeddaebee672a9e6f43ac25712843b
frags = 20
Setting supported flag to 0
Created: proxy.type=proxy (BIOS-only compatible)
Cleaning up temporary directory…
[root@hylformanproxy image]#

I double-checked and displayed errors are the same for me, including:

ln: failed to access ‘isolinux/initrd.img’: No such file or directory
ln: failed to access ‘isolinux/vmlinuz’: No such file or directory

According to your former post you should already have a modified image:

Upload this ISO to vSphere and boot your VM from it.

while booting with newly created image which is not moving further from this screenshot. please suggest me

It cannot find the kernel on the ISO.

This is very likely because of changed filenames for kernel + initrd at some point between FDI version 3.3.1 and latest 4.1.0.

Kernel filename in 3.3.1 is vmlinuz0, in 4.1.0 it’s vmlinuz.
initrd filename in 3.3.1 is initrd0.img, in 4.1.0 it’s initrd.img.

This was adapted in the discovery-remaster script in the last commit:

What does this mean? If you press Tab you should see (when using the link to the script I specified):

vmlinuz0 initrd=initrd0.img ...

If you see:

vmlinuz initrd=initrd.img ...

… then you are using a wrong version of discovery-remaster script.

If it’s vmlinuz0 / initrd0.img and it does not boot then there is more broken.

i have downloaded from new discovery remaster “wget foreman-discovery-image/aux/remaster/discovery-remaster at master · theforeman/foreman-discovery-image · GitHub
Please see below error

[root@hylformanproxy image]# ls -ltr
total 242868
-rw-r–r-- 1 root root 3762 Mar 27 14:18 dis
-rw-r–r-- 1 root root 248512512 Mar 27 17:00 fdi-bootable-3.3.1.iso
-rw-r–r-- 1 root root 180009 Mar 30 14:01 discovery-remaster
[root@hylformanproxy image]# bash ./discovery-remaster fdi-bootable-3.3.1.iso “proxy.url=https://hylformanproxy.micron.com proxy.type=proxy fdi.pxauto=1”
./discovery-remaster: line 8: syntax error near unexpected token newline' ./discovery-remaster: line 8:
[root@hylformanproxy image]#