Child pages
  • MBR reinstall after illumos loader update
Skip to end of metadata
Go to start of metadata

A bug was found in the illumos bootloader that resulted in the inability to boot after updating Openindiana hipster on MBR disk installs.
The problem with booting is solved by updating to OI hipster osnet-incorporation 0.5.11-2017.0.0.16205 (2017-02-25_1202) with system/boot/loader 1.1-2017.0.0.16205 (2017-02-25_1228) and upwards.
Here are some additional notes and technical information on the issue:

  • The boot programs written into disk boot block areas are read into memory based on recorded boot program sizes, since the MBR boot record is not updated by "pkg update" in case of MBR setups, the boot process will not read the  gptzfsboot fully into the memory. This is problem with installboot command.
  •  The loader partition reading code was built using optimized data sharing, assuming only one partition is "open" at the time. Unfortunately, in case of ZFS, this assumption is not true and results in the disk read validation checks invalidating the IO requests.
Updated packages are available in Openindiana hipster package repository. Instructions below are provided to perform the necessary updates to avoid these issues.

The second issue is about the implementation of specific details inside the loader and updated binaries. Once updated binaries are installed, no other special activities are needed.

The installboot problem is more complicated. The installboot command update implements the MBR update to make MBR boot code readable and load the partition boot record, and only record gptzfsboot locations and size in partition boot record. As "pkg update" will always cause partition boot record to be updated, this change means that gptzfsboot will always be read using correct size. The complication is that we can not force the MBR update automatically, and the MBR update has to be performed by the operator. The second complication that the patched installboot command is available only in the updated BE, meaning that bootblock update has to be performed twice.

Who is affected:
Fresh installs with 20161030 OI hipster snapshot usb/ISO using MBR partition/slice install, using illumos loader

Who is not affected:
 Older 20160421 usb/ISO and earlier installs still using GRUB1
 Full-disk installs and GPT installs for rpool.

How problem appears:
Problem appears by issuing the regular 'pkg update ' procedure which results in having an unbootable system after update and restart.
Workaround 1 is done right after update, before reboot, so you don't experience any boot failures. Nothing happens if you reinstall loader upon update and BEFORE restart.
Workaround 2 is there if you already restarted after update and you have an unbootable system.

Workaround 1:

Bootblock update has to be performed twice, after regular pkg update and before reboot and after reboot again.
Find the name of your new active updated BE:
$ beadm list
oi-hipster-87                    R     /          36.8G static 2017-02-25 19:07

 Mount new BE into /mnt dir, so we can install new loader into MBR:  (assume root privileges by su, sudo or pfexec)

$ pfexec bash
# beadm mount oi-hipster-87 /mnt
   Install new illumos loader from new BE into MBR to be able to boot from HD again:
# bootadm install-bootloader -MfvR  /mnt

The bootadm command above will reinstall boot code, using boot programs from /mnt/boot, using verbose mode, so you can see the MBR code is also updated.

Unmount new BE from /mnt dir:
# beadm unmount oi-hipster-87
# shutdown -y -g 0 -i 6
 After reboot, again re-install boot code as priviledged user: (assume root privileges by su, sudo or pfexec)
$ pfexec bash
# bootadm install-bootloader -Mfv
Because this bootadm command is run from updated BE and the patched installboot command is used, MBR is updated to read partition boot record, and future "pkg update" command does not need any special workarounds.

Workaround 2:

If you already experienced the boot failure after update, you need to boot from live USB/DVD media into your new updated BE and reinstall loader:
Use bootable USB/ISO disk to boot from media other then HD (by selecting it to be first bootable media in motherboard settings):
Hit 'ESC' key to get loader "ok" prompt and list Boot Environments(BE) (rpool is name of boot pool):

ok beadm list zfs:rpool
BE               bootfs
oi-hipster-87    rpool/ROOT/oi-hipster-87
Activate new BE to boot from (where beadm_name is the new BE created after update):
ok beadm activate oi-hipster-87 zfs:rpool
Boot into new BE:
ok boot

After booting into updated BE, you would need to issue this command to reinstall loader on HD MBR (so that problem is resolved for the next reboot):

Install the new illumos loader from new BE into MBR to be able to boot from HD again (as the privileged user):
$ pfexec bash
# bootadm install-bootloader -Mfv
 After that you can safely update and restart.

Thank you for your patience and understanding. The loader is part of the illumos and is a work in progress. While MBR booting problems occasionally slip into testing, we try our best to find and fix the bugs before things like this happen.
Send your appreciation to Toomas Soome (tsoome) for both creating and fixing the illumos loader and for providing a large part of this article.

Post on this topic to discuss, it is on this thread of Openindiana-discuss mailing list:
  • No labels