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

ktest setup: GRUB submenu fixes #486

Merged
merged 1 commit into from
Mar 28, 2024

Conversation

marc-hb
Copy link
Collaborator

@marc-hb marc-hb commented Feb 24, 2024

The GRUB documentation used to say GRUB_DISABLE_SUBMENU=y, now it says GRUB_DISABLE_SUBMENU=true

Also, the corresponding code is unreliable copy/paste/diverge:

rhboot/grub2@ee4bd79ef28e6fa4a6

This makes GRUB submenus error-prone. As a broken grub.cfg makes the system unbootable, "harden" the corresponding documentation.

The GRUB documentation used to say `GRUB_DISABLE_SUBMENU=y`, now it says
`GRUB_DISABLE_SUBMENU=true`

Also, the corresponding code is unreliable copy/paste/diverge:

rhboot/grub2@ee4bd79ef28e6fa4a6

This makes GRUB submenus error-prone. As a broken grub.cfg makes the
system unbootable, "harden" the corresponding documentation.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>

.. code-block:: console

echo 'GRUB_DISABLE_SUBMENU=y' | sudo tee -a /etc/default/grub.d/disable-submenu.cfg
Copy link
Contributor

Choose a reason for hiding this comment

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

the commit is saying that GRUB_DISABLE_SUBMENU=true is the documented setting and not with y?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

  • The documentation changed from y (unusual) to true (common)
  • The _implementation changed from: "y only" to: "y OR true".

=> To be compatible with ALL grub versions, stick to y.

@@ -84,7 +92,7 @@ Set up a target
# Print your currently booted (and known-safe) option
cat /proc/cmdline
# List the grub entries
awk '/^menuentry/ { print i++, '\t', $0 }' /boot/grub/grub.cfg
awk '/^menuentry|submenu/ { print i++, '\t', $0 }' /boot/grub/grub.cfg
Copy link
Contributor

Choose a reason for hiding this comment

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

there should not be any submenu at this point?

But sudo might be needed to actually read the grub.cfg

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

there should not be any submenu at this point?

Not in theory.

In practice this "magic" command is typically re-used across devices - including devices that still have submenus for whatever reason. And the consequences can be deadly.

But sudo might be needed to actually read the grub.cfg

In my experience it's not; I use this command all the time.

# Better safe than _very_ sorry
sudo cp /boot/grub/grub.cfg /boot/grub/saved_grub.cfg

sudo update-grub
Copy link
Contributor

Choose a reason for hiding this comment

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

Note: this sometimes can cause un-bootable system which can be only recovered by booting to a live env, chrooting to the existing linux install and grub-install --target=x86_64-efi ....

Copy link
Collaborator Author

@marc-hb marc-hb Feb 29, 2024

Choose a reason for hiding this comment

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

I tried to chroot and run update-grub inside the chroot but that did not work, it failed with: can't find device for /, is /dev mounted?
GRUB was still installed fine on my system in that instance, that wasn't my problem.

What worked for me was to find and manually enter grub commands and parameters at boot time. This let me boot. Then I disabled the submenus and ran update-grub from the "real" system.

Different OS and different situations will require different solutions. Rescuing unbootable systems is a very complex topic; we can't provide bullet proof advice in such a limited space here.

Copy link
Contributor

Choose a reason for hiding this comment

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

I tried to chroot and run update-grub inside the chroot but that did not work, it failed with: can't find device for /, is /dev mounted? GRUB was still installed fine on my system in that instance, that wasn't my problem.

Few things should be done to be able to update grub in chroot, something like:
https://wiki.gentoo.org/wiki/Chroot#Configuration

What worked for me was to find and manually enter grub commands and parameters at boot time.

Wow

This let me boot. Then I disabled the submenus and ran update-grub from the "real" system.

Different OS and different situations will require different solutions. Rescuing unbootable systems is a very complex topic; we can't provide bullet proof advice in such a limited space here.

Sure!

Copy link
Collaborator

Choose a reason for hiding this comment

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

@marc-hb Are you ready for this PR to be merged? Thanks.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes please merge.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@marc-hb Thanks!

@deb-intel
Copy link
Collaborator

@ujfalusi Has the issues you raised been resolved to your satisfaction? If so, I will merge this PR.

@deb-intel deb-intel merged commit 424ddf4 into thesofproject:master Mar 28, 2024
4 checks passed
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