Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wait for root device inside the initrd script for ISO images #4605

Merged
merged 1 commit into from
Feb 11, 2025

Conversation

rene
Copy link
Contributor

@rene rene commented Feb 10, 2025

Description

When installing EVE on devices with Virtual Media CD/DVD-ROM emulation it can take a few seconds to kernel to detect the installer media device. This is an issue when booting from an ISO because GRUB will boot kernel + initrd, but when initrd script tries to find the installer media's filesystem, the Virtual CD/DVD-ROM can be not yet available. This PR implements a retry mechanism inside the initrd script in order to wait for the root device.

@rene rene added the stable Should be backported to stable release(s) label Feb 10, 2025
@rene rene requested a review from eriknordmark as a code owner February 10, 2025 18:30
@rene rene marked this pull request as draft February 10, 2025 18:30
@rene
Copy link
Contributor Author

rene commented Feb 10, 2025

Marked as Draft for now because it needs more test...

Copy link
Contributor

@deitch deitch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So basically, rootdelay=10 really means, "if you could not find the root filesystem, wait 1 second, try again, repeat up to 10 (i.e. rootdelay) times.

That looks like it should work.

Small cleanliness nit. Would it work if, instead of the heredoc and EOF, we did:

blkid | while read -r line; do

?

pkg/eve/installer/grub_installer.cfg Outdated Show resolved Hide resolved
@rene
Copy link
Contributor Author

rene commented Feb 11, 2025

So basically, rootdelay=10 really means, "if you could not find the root filesystem, wait 1 second, try again, repeat up to 10 (i.e. rootdelay) times.

That looks like it should work.

Small cleanliness nit. Would it work if, instead of the heredoc and EOF, we did:

blkid | while read -r line; do

?

@deitch , I agree this form is cleaner but then rootdev variable will be only in the scope of the subshell executed in the pipe, so we won't get its value after the blkid | while... command, that's why the heredoc approach is used... I would also prefer the bashism form while ... done < <(blkid) but then Yetus will scream about it...

@rene rene force-pushed the imp-rootdelay-iso branch from ae7e60e to 3b8fd07 Compare February 11, 2025 11:11
When installing EVE on devices with Virtual Media CD/DVD-ROM emulation it
can take a few seconds to kernel to detect the installer media device. This
is an issue when booting from an ISO because GRUB will boot kernel +
initrd, but when initrd script tries to find the installer media's
filesystem, the Virtual CD/DVD-ROM can be not yet available. This commit
implements a retry mechanism in order to wait for the root device for up to
10 seconds.

Signed-off-by: Renê de Souza Pinto <[email protected]>
@rene rene force-pushed the imp-rootdelay-iso branch from 3b8fd07 to 14d202e Compare February 11, 2025 11:22
@rene rene changed the title Implement rootdelay in the initrd for ISO images Wait for root device inside the initrd script for ISO images Feb 11, 2025
@rene
Copy link
Contributor Author

rene commented Feb 11, 2025

Reworked this PR:

  • No additional kernel parameters are added
  • A retry mechanism is implemented inside the initrd script in order to wait for the root device. It gives up if device doesn't show up after 10 retries (one per second)

Tested with QEMU + HP device (through iLO5)

Copy link
Member

@OhmSpectator OhmSpectator left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine to merge if tested =)
And I'm still curious, why rootdelay did not work on the Kernel level...

@rene
Copy link
Contributor Author

rene commented Feb 11, 2025

Fine to merge if tested =) And I'm still curious, why rootdelay did not work on the Kernel level...

Because we are using ramdisk in this case (ramdisk is the initial root device), which is already available in memory (so we don't need to wait), that's what was trying to explain... the issue was happening inside the initrd script, when we try to switch root to the installer root device, that cannot be available at the moment (doesn't exist), that's why we need to wait...

@OhmSpectator
Copy link
Member

Fine to merge if tested =) And I'm still curious, why rootdelay did not work on the Kernel level...

Because we are using ramdisk in this case (ramdisk is the initial root device), which is already available in memory (so we don't need to wait), that's what was trying to explain... the issue was happening inside the initrd script, when we try to switch root to the installer root device, that cannot be available at the moment (doesn't exist), that's why we need to wait...

Ah, got it! Thanks!

Copy link
Contributor

@rucoder rucoder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@OhmSpectator
Copy link
Member

@rene, do we have any Tests that can check it? Or may we skip the tests?

@rene
Copy link
Contributor Author

rene commented Feb 11, 2025

@rene, do we have any Tests that can check it? Or may we skip the tests?

@rene, do we have any Tests that can check it? Or may we skip the tests?

No, so we don't need to wait for Eden tests...

@rene rene merged commit e1d09ca into lf-edge:master Feb 11, 2025
53 of 66 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stable Should be backported to stable release(s)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants