Skip to content

Conversation

@stejskalleos
Copy link
Contributor

@stejskalleos stejskalleos commented Oct 9, 2025

Before

/var/lib/tftpboot
├── grub2
│   ├── grub.cfg
│   ├── grub.cfg-00:aa:aa:10:10:ee
│   ├── grub.cfg-01-00-aa-aa-10-10-ee
├── host-config
│   └── 00-aa-aa-10-10-ee
│       ├── grub2
│       │   ├── grub.cfg
│       │   ├── grub.cfg-00:aa:aa:10:10:ee
│       │   ├── grub.cfg-01-00-aa-aa-10-10-ee
└── pxelinux.cfg
    ├── 01-00-aa-aa-10-10-ee
    └── 01-00-aa-aa-10-10-ee.ipxe

After

/var/lib/tftpboot
├── grub2
│   ├── ...
├── host-config
│   └── 00-aa-aa-10-10-ee
│       ├── grub2
│       │   ├── ...
│       ├── ipxe
│       │   └── 01-00-aa-aa-10-10-ee -> ../../../pxelinux.cfg/01-00-aa-aa-10-10-ee.ipxe
│       └── pxe
│           └── 01-00-aa-aa-10-10-ee -> ../../../pxelinux.cfg/01-00-aa-aa-10-10-ee
└── pxelinux.cfg
    ├── 01-00-aa-aa-10-10-ee
    └── 01-00-aa-aa-10-10-ee.ipxe

@stejskalleos
Copy link
Contributor Author

@evgeni

With the current implementation, the config files are duplicated. Thinking about changing it into symlinks pointing to the default directories (grub2 and pxelinux.cfg)

@stejskalleos
Copy link
Contributor Author

Test failures are related to changes; I will address them once the decision on unifying the approach is made.

@evgeni
Copy link
Member

evgeni commented Oct 9, 2025

cc @jloeser -- this structure was influenced by you in 1345bb4 and I think you're the most knowledgeable here to have an opinion :)

@evgeni
Copy link
Member

evgeni commented Oct 9, 2025

Also @goarsna

@jloeser
Copy link

jloeser commented Oct 13, 2025

Why are we doing this?

So technically it's unnecessary to store them in the host specific locations. AFAIK GRUB2 is the only bootloader reading it's origin from EFI firmware in order to use it for fetching its configuration files.

For iPXE I would need to have a look, PXE is legacy BIOS so it must be hardcoded.

However, from the user's point of view and consistency may make sense to have all bootloader configurations together in one place for one specific host. But then it should be definitely symlinks so that there is only one source of truth.

@stejskalleos
Copy link
Contributor Author

Why are we doing this?

To centralize configs in one place for each host.

But then it should be definitely symlinks so that there is only one source of truth.

Yeah, I was thinking about it during the weekend, and I also think it should be done via symlinks.
Will update the PR.

@stejskalleos stejskalleos force-pushed the ls/pxe_and_ipxe_host_config branch from f32346f to ebf7e71 Compare October 14, 2025 14:00
@stejskalleos
Copy link
Contributor Author

Updated, now it creates symlinks (relative paths) to the configs.

@stejskalleos
Copy link
Contributor Author

@evgeni the CI is 🍏

  • Added tests
  • Now only symlinks are created, no duplicate conf files

@ShimShtein
Copy link
Member

Maybe I am a bit late to the party, but creating symlinks that are not really used by the bootloaders feels a bit overwhelming. I would prefer leaving only "functional" files. The only links that make sense for me are those that link synonyms - for example if we want the same file to be served for grub.cfg-00:aa:aa:10:10:ee and grub.cfg-01-00-aa-aa-10-10-ee. This will make a single source of truth scenario, which is a good thing.
I think having the files linked/copied to an exotic directory will cause confusion when trying to reverse engineer the boot flows.

@stejskalleos
Copy link
Contributor Author

I think having the files linked/copied to an exotic directory will cause confusion when trying to reverse engineer the boot flows.

This was the exact issue for me when I came back to the feature, but the opposite direction. I was "annoyed" that some configs are in the host_config directory, and some are not.

@jloeser
Copy link

jloeser commented Oct 21, 2025

I think having the files linked/copied to an exotic directory will cause confusion when trying to reverse engineer the boot flows.

Understood. But I agree with @stejskalleos and I also like the idea of having one place for all.

Depending on how you work/debug there is also the minimal benefit of choosing the correct host by MAC once (cd into it) and then you can simply edit the loader configuration you are interested in. ATM you always need to provide/know the MAC address for every single file you want to edit.

If a user wants to explicitly modify something he can do so and it will always be applied due to sym-linking - independently of the location (that's currently not true for GRUB2 and need to be fixed!).

If a user is interested in the boot flow we maybe should explain in one two sentences how its actually working (=which paths are involved) and why we do this.

@ShimShtein
Copy link
Member

If a user is interested in the boot flow we maybe should explain in one two sentences how its actually working (=which paths are involved) and why we do this.

Well, the general answer here is that we depend on the bootloader and configuration (e.g. DHCP bootfileurl option) here. If the bootloader expects a specific folder structure, we will have to have it in our TFTP folder.

If a user wants to explicitly modify something he can do so and it will always be applied due to sym-linking - independently of the location (that's currently not true for GRUB2 and need to be fixed!).

Since this PR fixes the functional part of the requirement (as you have mentioned) I have no objections to merging it. Having an extra symling doesn't feel as too much, especially if it helps even a smalll group of sysadmins.

@ShimShtein
Copy link
Member

@stejskalleos One question: why don't you also link the grub.cfg* files?
Now we have two copies of the same file: one in the ./grub2 folder and one in the ./host_config/*/grub2 one:
image
image

Create symlinks to PXE & iPXE configs in the host_config directory,
the same way as it is done for Grub2.
@stejskalleos stejskalleos force-pushed the ls/pxe_and_ipxe_host_config branch from bc06df2 to 319b615 Compare November 5, 2025 09:14
@stejskalleos
Copy link
Contributor Author

Updated, now every config is linked to the original one.
Tested Grub2 provisioning and it worked.

@ShimShtein ShimShtein merged commit ab88ce4 into theforeman:develop Nov 5, 2025
10 checks passed
@ShimShtein
Copy link
Member

Merged, thanks @stejskalleos !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants