#1446 PR merged: Migrate lilo and yaboot before mkinitrd

Labels: bug, fixed / solved / done

schabrolles opened issue at 2017-08-16 12:07:

I currently facing a BUG with mkinitrd re-creation when :

  • restoration is made to a different system (migration)
  • running with ppc64 with lilo or yaboot boot loader
  • boot device is multipathed.
  • and boot partition is defined with /dev/disk/by-id in lilo.conf or yaboot.conf

mkinitrd gets the boot device from /etc/lilo.conf or /etc/yaboot.conf when they exists.
This means those one need to be migrated BEFORE running mkinitrd.

/etc/lilo.conf and /etc/yaboot.conf are with migrated with (250_migrate_disk_devices_layout.sh) for non-diskbyid device (/dev/vda, /dev/sda, /dev/mapper/vg-lv) which is before 550_rebuild_initramfs.sh.

But diskbyid devices which are multipathed are not migrated (260_rename_diskbyid.sh).

while read ID DEV_NAME; do
  ID_NEW=""
  if [[ $DEV_NAME =~ ^dm- ]]; then
    # probably a multipath device
    # we cannot migrate device mapper targets
    # we delete DEV_NAME to make sure it won't get used
    DEV_NAME=""
  else
...

The script 610_install_yaboot.sh or 610_install_lilo.sh contain a verification and replace part= with the good Power PReP partition. (but it runs after 550_rebuild_initramfs.sh)
(@jsmeix, this explain why mkinitrd part was running originally after bootloader for ppc64. cf #1323)

====
Solutions:

  1. The best would be to update 260_rename_diskbyid.sh in order to also migrate multipathed...
    but it looks complex

  2. Another way would be to move the part= renaming of lilo.conf and yaboot.conf from bootloader installation script to run it before mkinitrd. This solution is quick & easy and reduce the potential side-effect because we can apply this change to only ppc64 arch.

This pull-request implements the solution 2), but I ask advice/feedback from the team (@gdha @jsmeix @schlomo @gozora).

tested on ppc64 with SLES11 SP4

schabrolles commented at 2017-08-18 08:02:

@gdha, sure. I will wait for next week. it will let time for other to also provide feedback.

jsmeix commented at 2017-08-23 14:10:

@schabrolles
perhaps a stupid question:
I do not understand why you need to

export PREP_BOOT_PART

in finalize/Linux-ppc64/540_check_yaboot_path.sh

Nothing goes wrong with the export.
I only like to understand why it is needed.

I think all ReaR scripts get sourced
(via the Source function in lib/framework-functions.sh)
so that all the scripts are run by one same bash process
so that usually no export to child processes should be needed.

Or in other words my question is:
What child process needs PREP_BOOT_PART?

schabrolles commented at 2017-08-23 14:43:

@jsmeix, thanks for the clarification.

$PREP_BOOT_PART is only needed in 600_install_yaboot.sh. So If I've well understood, it is the same process and the variable should be available without export. So I will remove it.


[Export of Github issue for rear/rear.]