edit-icon download-icon

Update GRUB 1.99 for a Linux server

Last Updated: Aug 10, 2018

If you fail to migrate your servers, virtual machines, or cloud hosts to Alibaba Cloud by using the Cloud Migration tool, and you get Do Grub Failed message in the log file, perhaps the version of GRUB (GRand Unified Bootloader) is earlier than 0.97.

In this case, you can update the boot loader GRUB to the 1.99 version. Follow these steps to update boot loader GRUB for a Linux server. For newer version, such as 2.02, you can navigate to https://alpha.gnu.org/gnu/grub/ and find the related source code package.

Update to GRUB 1.99

  1. Log on to the target on-premises server.

  2. Run the following commands to view the directories of the original grub, grub-install, and grub-mkconfig:

    1. which grub
    2. which grub-install
    3. which grub-mkconfig
  3. Use the command mv to rename and make a copy of the grub, grub-install, and grub-mkconfig.

    Note: After you migrate your server by using the Cloud Migration tool, you can reinstate the original files by changing their names back to the original ones.

    1. mv /sbin/grub /sbin/grub-old
    2. mv /sbin/grub-install /sbin/grub-install-old
    3. mv /sbin/grub-mkconfig /sbin/grub-mkconfig-old
  4. Run yum install -y bison gcc make to install the dependencies of boot loader GRUB, which includes bison, gcc, and make.

  5. Run the following commands to install flex.

    1. test -d /root/tools || mkdir -p /root/tools
    2. cd /root/tools
    3. wget https://github.com/westes/flex/releases/download/v2.6.4/flex-2.6.4.tar.gz
    4. tar xzf flex-2.6.4.tar.gz
    5. cd flex-2.6.4
    6. mkdir -p build
    7. cd build
    8. ../configure
    9. make && make install
    10. ln -s /usr/local/bin/flex /usr/bin/flex
  6. Run the following commands to install the dependencies of GRUB 1.99.

    1. test -d /root/tools || mkdir -p /root/tools
    2. cd /root/tools
    3. wget https://alpha.gnu.org/gnu/grub/grub-1.99~rc1.tar.gz
    4. tar xzf grub-1.99~rc1.tar.gz
    5. cd grub-1.99~rc1
    6. mkdir -p build
    7. cd build
    8. ../configure
    9. sed -i -e "s/-Werror//" ./grub-core/Makefile
    10. make && make install
    11. ln -s /usr/local/sbin/grub-install /sbin/grub-install
    12. ln -s /usr/local/sbin/grub-mkconfig /sbin/grub-mkconfig

    Note: If an error -werror prompts, you can locate the error in the makefile and remove the -werror, and then try again.

  7. Run grub-install --version to verify the GRUB is updated to 1.99 version.

Next steps

  1. After you update the boot loader GRUB, you can migrate your servers to Alibaba Cloud.

  2. Optional. When your servers are successfully migrated to Alibaba Cloud, run the following commands to use the former version of GRUB.

    1. rm /sbin/grub-install
    2. rm /sbin/grub-mkconfig
    3. rm /boot/grub/grub.cfg
    4. mv /sbin/grub-old /sbin/grub
    5. mv /sbin/grub-install-old /sbin/grub-install
Thank you! We've received your feedback.