* [PATCH v2 0/2] Fix installation issues on ppc64le
@ 2022-08-29 14:36 Ismael Luceno
2022-08-29 14:36 ` [PATCH v2 1/2] grub-install: Add missing points of no return for IEEE1275 on i386/powerpc Ismael Luceno
2022-08-29 14:36 ` [PATCH v2 2/2] grub-install: Ensure a functional /dev/nvram Ismael Luceno
0 siblings, 2 replies; 5+ messages in thread
From: Ismael Luceno @ 2022-08-29 14:36 UTC (permalink / raw)
To: grub-devel; +Cc: Ismael Luceno
If the nvram device is non-functional, e.g. because the nvram module isn't
loaded and it's file been removed from the filesystem, thus can't be
loaded, the installation will be attempted but the system will be left in
an unbootable state.
The boot process shows:
Welcome to GRUB!
error: ../../grub-core/kern/dl.c:380:symbol `grub_disk_get_size' not found.
Entering rescue mode...
grub rescue>
The patches in this series introduce a couple of points of no return
before updating the nvram, and make sure /dev/nvram is functional or
fail early.
Ismael Luceno (2):
grub-install: Add missing points of no return for IEEE1275 on
i386/powerpc
grub-install: Ensure a functional /dev/nvram
util/grub-install.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
--
2.37.1
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH v2 1/2] grub-install: Add missing points of no return for IEEE1275 on i386/powerpc 2022-08-29 14:36 [PATCH v2 0/2] Fix installation issues on ppc64le Ismael Luceno @ 2022-08-29 14:36 ` Ismael Luceno 2022-09-05 9:56 ` Michael Chang 2022-08-29 14:36 ` [PATCH v2 2/2] grub-install: Ensure a functional /dev/nvram Ismael Luceno 1 sibling, 1 reply; 5+ messages in thread From: Ismael Luceno @ 2022-08-29 14:36 UTC (permalink / raw) To: grub-devel; +Cc: Ismael Luceno Signed-off-by: Ismael Luceno <iluceno@suse.de> --- util/grub-install.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/util/grub-install.c b/util/grub-install.c index 7b04bd3c534b..527b85e27aa7 100644 --- a/util/grub-install.c +++ b/util/grub-install.c @@ -1835,6 +1835,7 @@ main (int argc, char *argv[]) { if (write_to_disk (ins_dev, imgfile)) grub_util_error ("%s", _("failed to copy Grub to the PReP partition")); + grub_set_install_backup_ponr (); } else { @@ -1859,6 +1860,7 @@ main (int argc, char *argv[]) partno = grub_dev->disk->partition ? grub_dev->disk->partition->number + 1 : 0; dev = grub_util_get_os_disk (grub_devices[0]); + grub_set_install_backup_ponr (); grub_install_register_ieee1275 (0, dev, partno, relpath); } -- 2.37.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2 1/2] grub-install: Add missing points of no return for IEEE1275 on i386/powerpc 2022-08-29 14:36 ` [PATCH v2 1/2] grub-install: Add missing points of no return for IEEE1275 on i386/powerpc Ismael Luceno @ 2022-09-05 9:56 ` Michael Chang 0 siblings, 0 replies; 5+ messages in thread From: Michael Chang @ 2022-09-05 9:56 UTC (permalink / raw) To: The development of GNU GRUB; +Cc: Ismael Luceno On Mon, Aug 29, 2022 at 04:36:24PM +0200, Ismael Luceno wrote: > Signed-off-by: Ismael Luceno <iluceno@suse.de> > --- > util/grub-install.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/util/grub-install.c b/util/grub-install.c > index 7b04bd3c534b..527b85e27aa7 100644 > --- a/util/grub-install.c > +++ b/util/grub-install.c > @@ -1835,6 +1835,7 @@ main (int argc, char *argv[]) > { > if (write_to_disk (ins_dev, imgfile)) > grub_util_error ("%s", _("failed to copy Grub to the PReP partition")); > + grub_set_install_backup_ponr (); This looks good to me. > } > else > { > @@ -1859,6 +1860,7 @@ main (int argc, char *argv[]) > partno = grub_dev->disk->partition > ? grub_dev->disk->partition->number + 1 : 0; > dev = grub_util_get_os_disk (grub_devices[0]); > + grub_set_install_backup_ponr (); This should be moved way up, given failure may occur at grub_make_system_path_relative_to_its_root or even earlier. But in the first place the attempt may have been wrong, given the image is installed as file in the platform directory, there we should not be botherd to set grub_set_install_backup_ponr as file should be able to be backup and restored thus is covered. On the other hand, the grub_set_install_backup_ponr looked like a workaround to me to deal with raw images embedded in partition that has no good way to restore it. That is for i386-ieee1275, /boot/grub2/i386-ieee1275/grub should be added to the list of backup and restore to get it to work in failure recovery path. Thanks, Michael > grub_install_register_ieee1275 (0, dev, > partno, relpath); > } > -- > 2.37.1 > > > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/grub-devel ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 2/2] grub-install: Ensure a functional /dev/nvram 2022-08-29 14:36 [PATCH v2 0/2] Fix installation issues on ppc64le Ismael Luceno 2022-08-29 14:36 ` [PATCH v2 1/2] grub-install: Add missing points of no return for IEEE1275 on i386/powerpc Ismael Luceno @ 2022-08-29 14:36 ` Ismael Luceno 2022-09-05 10:04 ` Michael Chang 1 sibling, 1 reply; 5+ messages in thread From: Ismael Luceno @ 2022-08-29 14:36 UTC (permalink / raw) To: grub-devel; +Cc: Ismael Luceno This enables an early failure; for i386-ieee1275 and powerpc-ieee1275 on Linux, without /dev/nvram the system may be left in an unbootable state. Signed-off-by: Ismael Luceno <iluceno@suse.de> --- util/grub-install.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/util/grub-install.c b/util/grub-install.c index 527b85e27aa7..c84a2fb0526f 100644 --- a/util/grub-install.c +++ b/util/grub-install.c @@ -827,6 +827,16 @@ fill_core_services (const char *core_services) free (sysv_plist); } +static void +try_open (const char *path) +{ + FILE *f; + f = grub_util_fopen (path, "r+"); + if (!f) + grub_util_error (_("Unable to open %s: %s"), path, strerror(errno)); + fclose (f); +} + int main (int argc, char *argv[]) { @@ -1026,6 +1036,19 @@ main (int argc, char *argv[]) break; } + switch (platform) + { + case GRUB_INSTALL_PLATFORM_I386_IEEE1275: + case GRUB_INSTALL_PLATFORM_POWERPC_IEEE1275: +#ifdef __linux__ + /* On Linux, ensure /dev/nvram is _functional_. */ + try_open ("/dev/nvram"); +#endif + break; + default: + break; + } + /* Find the EFI System Partition. */ if (is_efi) -- 2.37.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2 2/2] grub-install: Ensure a functional /dev/nvram 2022-08-29 14:36 ` [PATCH v2 2/2] grub-install: Ensure a functional /dev/nvram Ismael Luceno @ 2022-09-05 10:04 ` Michael Chang 0 siblings, 0 replies; 5+ messages in thread From: Michael Chang @ 2022-09-05 10:04 UTC (permalink / raw) To: The development of GNU GRUB; +Cc: Ismael Luceno On Mon, Aug 29, 2022 at 04:36:25PM +0200, Ismael Luceno wrote: > This enables an early failure; for i386-ieee1275 and powerpc-ieee1275 on > Linux, without /dev/nvram the system may be left in an unbootable state. > > Signed-off-by: Ismael Luceno <iluceno@suse.de> > --- > util/grub-install.c | 23 +++++++++++++++++++++++ > 1 file changed, 23 insertions(+) > > diff --git a/util/grub-install.c b/util/grub-install.c > index 527b85e27aa7..c84a2fb0526f 100644 > --- a/util/grub-install.c > +++ b/util/grub-install.c > @@ -827,6 +827,16 @@ fill_core_services (const char *core_services) > free (sysv_plist); > } > > +static void > +try_open (const char *path) > +{ > + FILE *f; > + f = grub_util_fopen (path, "r+"); > + if (!f) > + grub_util_error (_("Unable to open %s: %s"), path, strerror(errno)); > + fclose (f); > +} > + > int > main (int argc, char *argv[]) > { > @@ -1026,6 +1036,19 @@ main (int argc, char *argv[]) > break; > } > > + switch (platform) > + { > + case GRUB_INSTALL_PLATFORM_I386_IEEE1275: > + case GRUB_INSTALL_PLATFORM_POWERPC_IEEE1275: > +#ifdef __linux__ > + /* On Linux, ensure /dev/nvram is _functional_. */ > + try_open ("/dev/nvram"); The update_nvram variable should be tested in case user has skipped it. Thanks, Michael > +#endif > + break; > + default: > + break; > + } > + > /* Find the EFI System Partition. */ > > if (is_efi) > -- > 2.37.1 > > > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/grub-devel ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-09-05 10:04 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-08-29 14:36 [PATCH v2 0/2] Fix installation issues on ppc64le Ismael Luceno 2022-08-29 14:36 ` [PATCH v2 1/2] grub-install: Add missing points of no return for IEEE1275 on i386/powerpc Ismael Luceno 2022-09-05 9:56 ` Michael Chang 2022-08-29 14:36 ` [PATCH v2 2/2] grub-install: Ensure a functional /dev/nvram Ismael Luceno 2022-09-05 10:04 ` Michael Chang
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.