weldr / lorax

Tools for creating images, including the Anaconda boot.iso, live disk images, iso's, and filesystem images.
GNU General Public License v2.0
290 stars 157 forks source link

does livemedia-creator only create live ISOs? #1413

Open duaneguthrie opened 1 month ago

duaneguthrie commented 1 month ago

this maybe a dumb question, but does livemedia-creator only create live ISOs? i am trying to build a custom iso that will install linux and application onto the hard drive of a server.

the livemedia-creator is hardcoded to pick the "live" path in templates and they include lines like. replace @ROOT@ 'inst.stage2=hd:LABEL=${isolabel|udev}' ${BOOTDIR}/isolinux.cfg while the non-"live" path has content like. replace @ROOT@ 'inst.stage2=hd:LABEL=${isolabel|udev}' ${BOOTDIR}/isolinux.cfg

what parameters do you pass to just boot to CD/USB then complete install to hard drive of server?

bcl commented 1 month ago

You can use the live iso to install, but you need to run Anaconda in the live environment to do it, and it installs a copy of the live environment. If you want a traditional boot.iso style of install you need to modify the templates used by Lorax and build a new boot.iso like this: https://weldr.io/lorax/lorax.html#quickstart

ETA: I also have a blog post I wrote a while back that may help if that's the direction you want to go in - https://www.brianlane.com/post/creating-the-anaconda-bootiso-with-lorax/

duaneguthrie commented 1 month ago

I appreciate greatly the feedback and the tow links. (I did need to look up ETA. :) ). i took the Lorax template directory. copied the directory. i replaced the live templates and config with the non live versions. i am not testing this out to see how close it is to dvd iso.

if this does not work, i wall call lorax directly, as show in the first link.

duaneguthrie commented 1 month ago

copying the non-live to the live and using livemedia-creator had one problem with build (there is no prebuilt .discinfo (i can fix that). it failed on switch over with an empty /sysroot dir. only other thing i see is media.repo file is missing. i can create that. so it seems close! any advice feel free to share.

i mounted a dvd iso and my iso . they are now very similar.

duaneguthrie commented 1 month ago

fyi

my sysroot is still empty on switchover druing install. so i added trace to the x86.tmpl tmplate. it shows the install command is sometimes saving data at ${inroot}DEST.

2024-07-25 19:25:28,236: '/var/tmp/lorax.imgutils.z38hfkc5/images/install.img' and '/var/tmp/lmc-work-t1zrf150/images/install.img' are the same file 2024-07-25 19:25:53,581: SUMMARY 2024-07-25 19:25:53,581: ------- 2024-07-25 19:25:53,581: Logs are in / 2024-07-25 19:25:53,581: Disk image is at /var/lmc/lmc-disk-qz7pexzm.img 2024-07-25 19:25:53,581: Results are in /var/lmc DAG: in template kernels: [{'path': 'boot/vmlinuz-5.14.0-427.24.1.el9_4.x86_64', 'version': '5.14.0-427.24.1.el9_4.x86_64', 'arch': 'x86_64', 'flavor': None, 'initrd': {'path': 'boot/initramfs-5.14.0-427.24.1.el9_4.x86_64.img'}}] runtime_img: images/install.img runtime_base: install.img basearch: x86_64 inroot: /var/tmp/lorax.imgutils.z38hfkc5 outroot: /var/tmp/lmc-work-t1zrf150 product: {'name': 'Rocky Linux', 'version': '9', 'release': '', 'variant': '', 'bugurl': '', 'isfinal': False} isolabel: Rocky Linux-9-x86_64 DAG: searching for isolinux inroot: /var/tmp/lorax.imgutils.z38hfkc5 outroot: /var/tmp/lmc-work-t1zrf150 DAG: in 1 runtime_img dir is: /var/tmp/lorax.imgutils.z38hfkc5/images/install.img DAG: in 1 content of runtime_img: /var/tmp/lorax.imgutils.z38hfkc5/images/install.img DAG: out 1.a STAGE2IMG dir is: /var/tmp/lmc-work-t1zrf150/images/install.img DAG: out 1.a content of STAGE2IMG: /var/tmp/lmc-work-t1zrf150/images/install.img DAG: out 1.b out-images/install.img dir is: /var/tmp/lmc-work-t1zrf150/images/ DAG: out 1.b content of out-images/install.img: /var/tmp/lmc-work-t1zrf150/images/install.img DAG: in 2.a isolinux.bin dir is: /var/tmp/lorax.imgutils.z38hfkc5/usr/share/syslinux/isolinux.bin DAG: in 2.a content of isolinux.bin: /var/tmp/lorax.imgutils.z38hfkc5/usr/share/syslinux/isolinux.bin DAG: in 2.a vesamenu.c32 dir is: /var/tmp/lorax.imgutils.z38hfkc5/usr/share/syslinux/vesamenu.c32 DAG: in 2.a content of vesamenu.c32n: /var/tmp/lorax.imgutils.z38hfkc5/usr/share/syslinux/vesamenu.c32 DAG: in 2.a libutil.c32 dir is: /var/tmp/lorax.imgutils.z38hfkc5/usr/share/syslinux/libutil.c32 DAG: in 2.a content of libutil.c32: /var/tmp/lorax.imgutils.z38hfkc5/usr/share/syslinux/libutil.c32 DAG: in 2.b configdir dir is: /var/tmp/lorax.imgutils.z38hfkc5/tmp/config_files/x86/ DAG: in 2.b content of configdir: /var/tmp/lorax.imgutils.z38hfkc5/tmp/config_files/x86/grub2-efi.cfg DAG: in 2.b content of configdir: /var/tmp/lorax.imgutils.z38hfkc5/tmp/config_files/x86/boot.msg DAG: in 2.b content of configdir: /var/tmp/lorax.imgutils.z38hfkc5/tmp/config_files/x86/grub.conf DAG: in 2.b content of configdir: /var/tmp/lorax.imgutils.z38hfkc5/tmp/config_files/x86/isolinux.cfg DAG: out 1 BOOTDIR dir is: /var/tmp/lmc-work-t1zrf150/isolinux/ DAG: find isolinux.bin: [PosixPath('/var/tmp/lorax.imgutils.z38hfkc5/usr/share/syslinux/isolinux.bin'), PosixPath('/usr/share/syslinux/isolinux.bin')] DAG: find isolinux.bin: [PosixPath('/var/tmp/lorax.imgutils.z38hfkc5/usr/share/lorax/templates.d/99-generic/live/config_files/x86/isolinux.cfg'), PosixPath('/var/tmp/lorax.imgutils.z38hfkc5/usr/share/lorax/templates.d/99-generic/config_files/x86/isolinux.cfg'), PosixPath('/var/tmp/lorax.imgutils.z38hfkc5/usr/share/lorax/templates.d/80-rocky/live/config_files/x86/isolinux.cfg'), PosixPath('/var/tmp/lorax.imgutils.z38hfkc5/usr/share/lorax/templates.d/80-rocky/config_files/x86/isolinux.cfg'), PosixPath('/var/tmp/lorax.imgutils.z38hfkc5/tmp/config_files/x86/isolinux.cfg'), PosixPath('/usr/share/lorax/templates.d/99-generic/config_files/x86/isolinux.cfg'), PosixPath('/usr/share/lorax/templates.d/99-generic/live/config_files/x86/isolinux.cfg'), PosixPath('/usr/share/lorax/templates.d/80-rocky/config_files/x86/isolinux.cfg'), PosixPath('/usr/share/lorax/templates.d/80-rocky/live/config_files/x86/isolinux.cfg'), PosixPath('/builddir/80-rocky/live/config_files/x86/isolinux.cfg'), PosixPath('/builddir/80-rocky/config_files/x86/isolinux.cfg'), PosixPath('/iso-graft/resources/eficonfig_x86/isolinux.cfg')] DAG: in 3 kernel.path dir is: /var/tmp/lorax.imgutils.z38hfkc5/boot/vmlinuz-5.14.0-427.24.1.el9_4.x86_64 DAG: in 3 content of kernel.path: /var/tmp/lorax.imgutils.z38hfkc5/boot/vmlinuz-5.14.0-427.24.1.el9_4.x86_64 DAG: out 3.a KERNELDIR dir is: /var/tmp/lmc-work-t1zrf150/images/pxeboot/ DAG: out 3.b KERNELDIR dir is: /var/tmp/lmc-work-t1zrf150/images/pxeboot/ DAG: searching for isolinux in efi - inroot: /var/tmp/lorax.imgutils.z38hfkc5 outroot: /var/tmp/lmc-work-t1zrf150 DAG: out 1 EFIBOOTDIR dir is: /var/tmp/lmc-work-t1zrf150/EFI/BOOT/ DAG: out 2 EFIBOOTDIR dir is: /var/tmp/lmc-work-t1zrf150/EFI/BOOT/*

template segment of x86.tmpl looks like: ` mkdir ${BOOTDIR} install ${SYSLINUXDIR}/isolinux.bin ${BOOTDIR} install ${SYSLINUXDIR}/vesamenu.c32 ${BOOTDIR} install ${SYSLINUXDIR}/ldlinux.c32 ${BOOTDIR} install ${SYSLINUXDIR}/libcom32.c32 ${BOOTDIR} install ${SYSLINUXDIR}/libutil.c32 ${BOOTDIR} install ${configdir}/isolinux.cfg ${BOOTDIR} install ${configdir}/boot.msg ${BOOTDIR} install ${configdir}/grub.conf ${BOOTDIR} install usr/share/anaconda/boot/syslinux-splash.png ${BOOTDIR}/splash.png install boot/memtest* ${BOOTDIR}/memtest

<% print("DAG: out 1 BOOTDIR dir is: ", os.path.join(outroot, BOOTDIR, "")) %> %for fn in glob.glob(os.path.join(outroot, BOOTDIR, "")): <% print("DAG: out 1 content of BOOTDIR: ", fn) %> %endfor

<% from pathlib import Path p = Path('/') print("DAG: find isolinux.bin: ",list(p.glob('/isolinux.bin'))) print("DAG: find isolinux.cfg: ",list(p.glob('/isolinux.cfg'))) %>`

from trace: inroot: /var/tmp/lorax.imgutils.z38hfkc5 outroot: /var/tmp/lmc-work-t1zrf150 and DAG: find isolinux.bin: [PosixPath('/var/tmp/lorax.imgutils.z38hfkc5/usr/share/syslinux/isolinux.bin'), PosixPath('/usr/share/syslinux/isolinux.bin')]

duaneguthrie commented 1 month ago

so i am pursuing the Lorax rout. with a file based repo lorax -p "Rocky Linux" -v 9 -r 9 -s file:///iso-graft/rpm/Latest ./results/

there is no kickstart with Lorax, right? i need to edit or copy and modify the templates. right?

there is no "installpkggroup". right?

duaneguthrie commented 1 month ago

okay i am calling lorax and it is generating iso.

i am really stuck to kickstart and how to do the equivalent of skipx and first boot --disable.

okay i just found mkksiso in your tool box! does it make sense to generate boot.iso with lorax. then pass boot.iso, kickstart file, and file based repo to mkksiso?

bcl commented 1 month ago

Sorry for the delay, if that works for you then yes :) I'll look over this stuff in more detail next week.

duaneguthrie commented 1 month ago

My build now looks like this:

lorax --product="Rocky Linux" --version=${RELEASE} --release=${RELEASE} --source=file:///builddir/rpm/Latest --repo=/etc/dnf/dnf.conf --enablerepo=distribution --noverifyssl --rootfs-size 5 ./results/

mkksiso --ks ${KICKSTART_FILE} --add /builddir/rpm/Latest --debug /results/images/boot.iso /results/images/test.iso

my understanding is that --add /builddir/rpm/Latest \ will build file file based repo into the image. where should my url and repo commands expect it to be?

url --noverifyssl --url=file:///iso-graft/rpm/Latest repo --name=distribution --baseurl=file:///iso-graft/rpm/Latest

bcl commented 1 month ago

https://weldr.io/lorax/mkksiso.html#adding-package-repos-to-a-boot-iso

So it should be: file:///run/install/repo/Latest/

The --add copies the directory to the root of the iso and the iso is mounted on /run/install/repo/

You can also boot the iso in text mode (pass inst.text on the kernel cmdline in grub) and poke around with the shell on tmux pane 2.

duaneguthrie commented 1 month ago

thanks, trying that

bcl commented 4 weeks ago

@duaneguthrie Did you get this working?