Skip to content

[14.5-stable] netboot: stop transferring the installer ISO twice - #6878

Closed
milan-zededa wants to merge 2 commits into
lf-edge:14.5-stablefrom
milan-zededa:14.5-backport-6380-netboot-iso
Closed

milan-zededa wants to merge 2 commits into
lf-edge:14.5-stablefrom
milan-zededa:14.5-backport-6380-netboot-iso

Conversation

@milan-zededa

Copy link
Copy Markdown
Contributor

Description

Backport of #6380 to 14.5-stable.

Both commits of the PR are cherry-picked with -x from 7116d64533 and fc25cab6af. The cherry-picks are clean, no conflicts.

Without this fix TestBootstrapWithNetworkBoot fails: the installer image is transferred twice over TFTP and the installer does not finish.

PR dependencies

None.

How to test and validate this PR

Covered by the evetest test TestBootstrapWithNetworkBoot (added to 14.5-stable by #6873):

EVETEST_EVE_VERSION=<14.5-stable build with this PR> make evetest NAME=TestBootstrapWithNetworkBoot

Changelog notes

Network boot of the installer no longer transfers the installer ISO twice.

Checklist

  • I've provided a proper description
  • I've added the proper documentation
  • I've tested my PR on amd64 device
  • I've tested my PR on arm64 device
  • I've written the test verification instructions
  • I've set the proper labels to this PR

For backport PRs (remove it if it's not a backport):

  • I've added a reference link to the original PR
  • PR's title follows the template

And the last but not least:

  • I've checked the boxes above, or I've provided a good reason why I didn't
    check them.

rene and others added 2 commits October 20, 2026 09:30
The netboot grub.cfg loopback mounts installer.iso over the network so
that grub can read the kernel, initrd and configs out of it, and
grub_installer.cfg then named ($install_part)/installer.iso as the
initrd source. That is a second URL, so the whole ~500MB image crossed
the network again just to end up in the initramfs.

Read the payload out of the ISO grub already has open instead: the
installer rootfs image, plus the top-level config.img when the ISO
carries one. The kernel now gets root=/rootfs_installer.img and mounts
it directly, which also drops the nested iso9660 loop mount.

config.img has to be conditional because the two ISO builders disagree.
tools/makeiso.sh builds from installer.tar and leaves only EFI/, boot/,
etc/ and rootfs_installer.img at the ISO root, while create_installer_iso
in runme.sh copies /bits/config.img there so that config overrides passed
as "docker run -v ...:/in lfedge/eve" reach the installer. The
unconditional rootaddmount=/config.img was silently skipped on the
former.

initrd.sh gains an add_mounts helper so both layouts can resolve
rootaddmount sources: under root= when rootimg= is set, in the initramfs
otherwise. It also skips the blkid device hunt when root= names a file,
which has nothing to find there and relied on blkid printing at least
one line to finish early.

A source taken from the initramfs cannot be bind mounted straight from
there. switch_root unlinks the whole initramfs, and while the bind mount
keeps working for reads afterwards, its source dentry is deleted and the
kernel refuses a deleted dentry as the source of a further bind mount.
The onboot containers do exactly that with /config.img, so they failed
with "move_mount() failed: No such file or directory". Such sources are
therefore moved onto a tmpfs first, which switch_root skips, keeping them
linked.

The installer.net tarball itself is unchanged, files and layout alike.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: Renê de Souza Pinto <rene@renesp.com.br>
(cherry picked from commit 7116d64)
Update the PXE boot sequence in BOOT-INSTALLER.md for the payload being
read out of the loop mounted ISO, and explain why naming the ISO as a
second URL is what makes the image cross the network twice.

Note that the netboot directory is far better served over HTTP than over
TFTP. Grub's HTTP transport implements seek with a Range request, so it
only transfers the ISO extents it actually reads, while its TFTP
transport has no seek at all and restarts from byte 0 on every backward
seek. Document how to get that: overriding $cmddevice in the
EFI/BOOT/grub.cfg of the served directory, that its path is resolved from
the root of that device rather than relative to where grub was loaded
from, and that no explicit export is needed because grub exports
cmddevice itself at startup.

Also document rootimg= and rootaddmount= in the mkimage-iso-efi README.
The rootaddmount source is resolved under root= when rootimg= is set and
in the initramfs otherwise, which was not written down anywhere.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: Renê de Souza Pinto <rene@renesp.com.br>
(cherry picked from commit fc25cab)
@milan-zededa

Copy link
Copy Markdown
Contributor Author

Closing: the original PR (#6380) was not backported to 16.0-stable or 17.0-stable either, and TestBootstrapWithNetworkBoot passes on those branches without it, so this change is not the reason the test fails on 14.5. The real cause is being investigated separately.

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.

2 participants