bjorn's picture

Is there an easy way to provide static ip configuration to a headless machine using pxe installing, without rebuiding the .iso or .squashfs files for every configuration?

I've recently messed about with pxe booting the installer, and out of curiosity looked briefly at providing preseeding without rebuilding the .iso file. A little research tells me turnkey common and appliance spesific preseed files are overlaid into the filesystem during build; that would suggest it should be possible to download inithooks.conf or another .gz or .squashfs file and overlay this at some point during initrd/boot as well.

https://www.turnkeylinux.org/docs/inithooks mentions a "pre-deployment script" but I cannot find any refrences to it, and it may not apply to the live/iso images?

If I have inithooks.conf downloaded and overlaid on the root to /etc/inithooks.conf I get a preseeded live system running without a installer, when passing di-live noinithooks to the kernel.

If I add auto url=http....preseed.cfg nothing happens either.

Sneaking files into the root filesystem mounted by the initrd doesn't get copied to the final install as the files that get copied are taken fom a fresh mount of the squashfs. So downloading and overlaying /usr/lib/inithooks/firstboot.d/29preseed didn't do much.

If nothing else I'm learning all sorts of interesting things by digging around in this :)

Forum: 
Jeremy Davis's picture

Most other (non ISO) builds support you adding/editing files within the filesystem. Although there is not any mechanism that currently supports pre-seeding a static IP. Although IMO it could be really handy!

TBH I'm not quite sure how you would be able to do it, but I'm sure you could. It may still require you patching the ISO though. FWIW tklpatch is a tool that we used to use a fair bit for patching ISOs. It unpacks the ISO, runs a conf script and/or overlays files then repacks the ISO. It's not quite what you were after but may assist you to reach your goal. It's in the TurnKey repo (so install with 'apt-get install tklpatch'). Docs here: https://www.turnkeylinux.org/docs/tklpatch

bjorn's picture

Intersting, I'll have a look and see what I can do with that. Should be possible to have some part of the install process download and aply a tklpatch to the installed system before rebooting (while network is still configured through the initrd stuff). I'll play with it a bit and report back if I find a somewhat suitable solution, won't be a high priority though.

Add new comment