netbootxyz / docker-netbootxyz

netboot.xyz docker container
https://netboot.xyz/docs/docker
179 stars 52 forks source link

Unable to chain custom.ipxe using just boot.cfg and custom.ipxe #13

Open Kipjr opened 2 years ago

Kipjr commented 2 years ago

I want to minimize the amount of modified iPXE files so I only created custom.ipxe and modified boot.cfg. However I cannot seem to get the menu item custom-user in menu.ipxe. It looks like it is has two issues:


  1. Misconfigured setting for the Docker version which does not generate custom-user menu item

netbootxyz/netboot.xyz/blob/development/roles/netbootxyz/defaults/main.yml custom_generate_menus: false

and this results in not creating a line in netbootxyz/netboot.xyz/blob/development/roles/netbootxyz/templates/menu/menu.ipxe

{% if custom_generate_menus | bool %}
item --gap Custom User Menus: ||
item custom-user ${space} Custom User Menus
{% endif %}

with the resulting menu.ipxe file

:main_menu
clear menu
set space:hex 20:20
set space ${space:string}
isset ${next-server} && menu ${site_name} v${version} - next-server: ${next-server} || menu ${site_name}
item --gap Default:
item local ${space} Boot from local hdd
(...)
isset ${github_user} && item --gap Custom Github Menu: ||
isset ${github_user} && item custom-github ${space} ${github_user}'s Custom Menu ||
isset ${custom_url} && item --gap Custom URL Menu: ||
isset ${custom_url} && item custom-url ${space} Custom URL Menu ||
isset ${menu} && set timeout 0 || set timeout ${boot_timeout}
choose --timeout ${timeout} --default ${menu} menu || goto local
(...)

  1. When you create custom.ipxe in the web environment, shouldn't line 137 in

netbootxyz/netboot.xyz/blob/development/roles/netbootxyz/templates/menu/menu.ipxe.j2 be changed from

:custom-user
chain custom/custom.ipxe
goto main_menu

to

:custom-user
chain custom.ipxe
goto main_menu
ikkemaniac commented 2 years ago

Just ran into this myself. On the build flag custom_generate_menus: false, yes you are RIGHT about the workings. But it is explained in the documentation that you need to build your own to use custom as this is disabled by default: https://github.com/netbootxyz/netboot.xyz/blob/43e2f303def858974f47160e1b657385477e7a9f/etc/netbootxyz/custom/README.md

On the custom/custom.ipxe, you are "wrong", you can set this dir by var custom_templates_dir. The default is xxx/custom, this is explained in the documentation: https://github.com/netbootxyz/netboot.xyz/blob/43e2f303def858974f47160e1b657385477e7a9f/etc/netbootxyz/custom/README.md

You can set that location to whatever you want. just keep in mind that this is NOT the same as going to the web interface and creating a new ipxe file that you name custom.ipxe

A simple cheat for all this is to set the custom_url var in boot.cfg (note that you need to include the filename if it's not custom.ipxe) set custom_url http://${boot_domain} or set custom_url http://${boot_domain}/fancy_name.ipxe

Kipjr commented 2 years ago

you need to build your own to use custom as this is disabled by default

@ikkemaniac Is there a specific reason why it is disabled while custom_github_menus is enabled?

I would like to use this tool in a local environment (without permanent available network access) where building images or direct filesystem access is not possible.

ikkemaniac commented 2 years ago

you need to build your own to use custom as this is disabled by default

@ikkemaniac Is there a specific reason why it is disabled while custom_github_menus is enabled?

I would like to use this tool in a local environment (without permanent available network access) where building images or direct filesystem access is not possible.

No freaking clue. Note that i'm not affiliated with this project.

I'd just build a custom ipxe to your liking on your favorite machine and copy that to your environment. Or use the custom_url.

antonym commented 2 years ago

you need to build your own to use custom as this is disabled by default

@ikkemaniac Is there a specific reason why it is disabled while custom_github_menus is enabled?

I would like to use this tool in a local environment (without permanent available network access) where building images or direct filesystem access is not possible.

custom_github_menus is used when a GitHub user is set from the Utility menu or at local-vars.ipxe so that a menu can be loaded from GitHub directly:

https://github.com/netbootxyz/netboot.xyz/blob/development/roles/netbootxyz/templates/menu/utils-pcbios-64.ipxe.j2#L78