Is there a way to force CentOS to do a legacy-style boot install in the UEFI-style installer?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












I've got a strange situation at work, and I have about 700 systems that all are booting to EFI by default.



I have a PXE menu set up, and I can install CentOS - but the units need to swap to Legacy booting mode to continue in our process.



This presents a problem; once CentOS 7.4 is laid down in UEFI installer mode, it will not boot when the BIOS is swapped to Legacy mode.



How can I force CentOS 7.4, in an automated way, to do a Legacy-style bootloader install while running in UEFI mode?







share|improve this question
























    up vote
    1
    down vote

    favorite












    I've got a strange situation at work, and I have about 700 systems that all are booting to EFI by default.



    I have a PXE menu set up, and I can install CentOS - but the units need to swap to Legacy booting mode to continue in our process.



    This presents a problem; once CentOS 7.4 is laid down in UEFI installer mode, it will not boot when the BIOS is swapped to Legacy mode.



    How can I force CentOS 7.4, in an automated way, to do a Legacy-style bootloader install while running in UEFI mode?







    share|improve this question






















      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I've got a strange situation at work, and I have about 700 systems that all are booting to EFI by default.



      I have a PXE menu set up, and I can install CentOS - but the units need to swap to Legacy booting mode to continue in our process.



      This presents a problem; once CentOS 7.4 is laid down in UEFI installer mode, it will not boot when the BIOS is swapped to Legacy mode.



      How can I force CentOS 7.4, in an automated way, to do a Legacy-style bootloader install while running in UEFI mode?







      share|improve this question












      I've got a strange situation at work, and I have about 700 systems that all are booting to EFI by default.



      I have a PXE menu set up, and I can install CentOS - but the units need to swap to Legacy booting mode to continue in our process.



      This presents a problem; once CentOS 7.4 is laid down in UEFI installer mode, it will not boot when the BIOS is swapped to Legacy mode.



      How can I force CentOS 7.4, in an automated way, to do a Legacy-style bootloader install while running in UEFI mode?









      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 13 at 2:56









      Locane

      1155




      1155




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          2
          down vote



          accepted










          Yes. You can set the platform using --target option with grub2-install as follows



          grub2-install --target=i386-pc /dev/sdX


          i386-pc option creates a legacy grub installation even in a UFI booted platform.



          NOTE You must have a small 1Mb unformatted partition with bios-boot flag while installing legacy style grub with gpt partition table.



          You must also have grub create a config file, and then because the installer is in EFI mode, you must replace instances of EFI keywords with Legacy ones. Here is an example using awk:



          #EXAMPLE: Normal grub make config command
          #grub2-mkconfig > /boot/grub2/grub.cfg

          #With awk statement to replace EFI keywords with legacy ones:
          grub2-mkconfig |awk 'gsub("linuxefi /", "linux /");gsub("initrdefi /", "initrd /");print $0' > /boot/grub2/grub.cfg





          share|improve this answer


















          • 1




            +1 without the bios-boot partition the grub installation will fail.
            – GAD3R
            Jan 13 at 16:38










          • I'm having a hell of a time getting this to work. The system reboots to a grub rescue prompt - grub2-install --target=i386-pc /dev/sda also doesn't place a grub.cfg. When I make it manually, it makes it with EFI linux references.
            – Locane
            Jan 14 at 22:25










          • @Locane Use grub2-mkconfig and redirect the output into grub.cfg. It'll auto detect all installed OSs (including Windows, if any) and will generate grub.cfg for you.. grub2-install is not supposed to generate the configuration.
            – Abhik Bose
            Jan 15 at 0:08











          • Thanks @AbhikBose - I actually got that far (in my comment it says "when I make it manually") - it auto-detects EFI style installation, so the terms "linuxefi" and "initrdefi" replace "linux" and "initrd" respectively. I was able to get it to work by awking the output and just gusb()ing the terms; so linuxefi->linux and initrdefi->initrd.
            – Locane
            Jan 15 at 1:53










          • Can you edit your answer to include those two steps? "grub2-mkconfig > /boot/grub2/grub.cfg" and replace all instances of "linuxefi" with "linux" and "initrdefi" with "initrd"?
            – Locane
            Jan 15 at 1:55










          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );








           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f416734%2fis-there-a-way-to-force-centos-to-do-a-legacy-style-boot-install-in-the-uefi-sty%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          2
          down vote



          accepted










          Yes. You can set the platform using --target option with grub2-install as follows



          grub2-install --target=i386-pc /dev/sdX


          i386-pc option creates a legacy grub installation even in a UFI booted platform.



          NOTE You must have a small 1Mb unformatted partition with bios-boot flag while installing legacy style grub with gpt partition table.



          You must also have grub create a config file, and then because the installer is in EFI mode, you must replace instances of EFI keywords with Legacy ones. Here is an example using awk:



          #EXAMPLE: Normal grub make config command
          #grub2-mkconfig > /boot/grub2/grub.cfg

          #With awk statement to replace EFI keywords with legacy ones:
          grub2-mkconfig |awk 'gsub("linuxefi /", "linux /");gsub("initrdefi /", "initrd /");print $0' > /boot/grub2/grub.cfg





          share|improve this answer


















          • 1




            +1 without the bios-boot partition the grub installation will fail.
            – GAD3R
            Jan 13 at 16:38










          • I'm having a hell of a time getting this to work. The system reboots to a grub rescue prompt - grub2-install --target=i386-pc /dev/sda also doesn't place a grub.cfg. When I make it manually, it makes it with EFI linux references.
            – Locane
            Jan 14 at 22:25










          • @Locane Use grub2-mkconfig and redirect the output into grub.cfg. It'll auto detect all installed OSs (including Windows, if any) and will generate grub.cfg for you.. grub2-install is not supposed to generate the configuration.
            – Abhik Bose
            Jan 15 at 0:08











          • Thanks @AbhikBose - I actually got that far (in my comment it says "when I make it manually") - it auto-detects EFI style installation, so the terms "linuxefi" and "initrdefi" replace "linux" and "initrd" respectively. I was able to get it to work by awking the output and just gusb()ing the terms; so linuxefi->linux and initrdefi->initrd.
            – Locane
            Jan 15 at 1:53










          • Can you edit your answer to include those two steps? "grub2-mkconfig > /boot/grub2/grub.cfg" and replace all instances of "linuxefi" with "linux" and "initrdefi" with "initrd"?
            – Locane
            Jan 15 at 1:55














          up vote
          2
          down vote



          accepted










          Yes. You can set the platform using --target option with grub2-install as follows



          grub2-install --target=i386-pc /dev/sdX


          i386-pc option creates a legacy grub installation even in a UFI booted platform.



          NOTE You must have a small 1Mb unformatted partition with bios-boot flag while installing legacy style grub with gpt partition table.



          You must also have grub create a config file, and then because the installer is in EFI mode, you must replace instances of EFI keywords with Legacy ones. Here is an example using awk:



          #EXAMPLE: Normal grub make config command
          #grub2-mkconfig > /boot/grub2/grub.cfg

          #With awk statement to replace EFI keywords with legacy ones:
          grub2-mkconfig |awk 'gsub("linuxefi /", "linux /");gsub("initrdefi /", "initrd /");print $0' > /boot/grub2/grub.cfg





          share|improve this answer


















          • 1




            +1 without the bios-boot partition the grub installation will fail.
            – GAD3R
            Jan 13 at 16:38










          • I'm having a hell of a time getting this to work. The system reboots to a grub rescue prompt - grub2-install --target=i386-pc /dev/sda also doesn't place a grub.cfg. When I make it manually, it makes it with EFI linux references.
            – Locane
            Jan 14 at 22:25










          • @Locane Use grub2-mkconfig and redirect the output into grub.cfg. It'll auto detect all installed OSs (including Windows, if any) and will generate grub.cfg for you.. grub2-install is not supposed to generate the configuration.
            – Abhik Bose
            Jan 15 at 0:08











          • Thanks @AbhikBose - I actually got that far (in my comment it says "when I make it manually") - it auto-detects EFI style installation, so the terms "linuxefi" and "initrdefi" replace "linux" and "initrd" respectively. I was able to get it to work by awking the output and just gusb()ing the terms; so linuxefi->linux and initrdefi->initrd.
            – Locane
            Jan 15 at 1:53










          • Can you edit your answer to include those two steps? "grub2-mkconfig > /boot/grub2/grub.cfg" and replace all instances of "linuxefi" with "linux" and "initrdefi" with "initrd"?
            – Locane
            Jan 15 at 1:55












          up vote
          2
          down vote



          accepted







          up vote
          2
          down vote



          accepted






          Yes. You can set the platform using --target option with grub2-install as follows



          grub2-install --target=i386-pc /dev/sdX


          i386-pc option creates a legacy grub installation even in a UFI booted platform.



          NOTE You must have a small 1Mb unformatted partition with bios-boot flag while installing legacy style grub with gpt partition table.



          You must also have grub create a config file, and then because the installer is in EFI mode, you must replace instances of EFI keywords with Legacy ones. Here is an example using awk:



          #EXAMPLE: Normal grub make config command
          #grub2-mkconfig > /boot/grub2/grub.cfg

          #With awk statement to replace EFI keywords with legacy ones:
          grub2-mkconfig |awk 'gsub("linuxefi /", "linux /");gsub("initrdefi /", "initrd /");print $0' > /boot/grub2/grub.cfg





          share|improve this answer














          Yes. You can set the platform using --target option with grub2-install as follows



          grub2-install --target=i386-pc /dev/sdX


          i386-pc option creates a legacy grub installation even in a UFI booted platform.



          NOTE You must have a small 1Mb unformatted partition with bios-boot flag while installing legacy style grub with gpt partition table.



          You must also have grub create a config file, and then because the installer is in EFI mode, you must replace instances of EFI keywords with Legacy ones. Here is an example using awk:



          #EXAMPLE: Normal grub make config command
          #grub2-mkconfig > /boot/grub2/grub.cfg

          #With awk statement to replace EFI keywords with legacy ones:
          grub2-mkconfig |awk 'gsub("linuxefi /", "linux /");gsub("initrdefi /", "initrd /");print $0' > /boot/grub2/grub.cfg






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Jan 21 at 11:54









          Jeff Schaller

          31.8k848109




          31.8k848109










          answered Jan 13 at 3:09









          Abhik Bose

          1,5341217




          1,5341217







          • 1




            +1 without the bios-boot partition the grub installation will fail.
            – GAD3R
            Jan 13 at 16:38










          • I'm having a hell of a time getting this to work. The system reboots to a grub rescue prompt - grub2-install --target=i386-pc /dev/sda also doesn't place a grub.cfg. When I make it manually, it makes it with EFI linux references.
            – Locane
            Jan 14 at 22:25










          • @Locane Use grub2-mkconfig and redirect the output into grub.cfg. It'll auto detect all installed OSs (including Windows, if any) and will generate grub.cfg for you.. grub2-install is not supposed to generate the configuration.
            – Abhik Bose
            Jan 15 at 0:08











          • Thanks @AbhikBose - I actually got that far (in my comment it says "when I make it manually") - it auto-detects EFI style installation, so the terms "linuxefi" and "initrdefi" replace "linux" and "initrd" respectively. I was able to get it to work by awking the output and just gusb()ing the terms; so linuxefi->linux and initrdefi->initrd.
            – Locane
            Jan 15 at 1:53










          • Can you edit your answer to include those two steps? "grub2-mkconfig > /boot/grub2/grub.cfg" and replace all instances of "linuxefi" with "linux" and "initrdefi" with "initrd"?
            – Locane
            Jan 15 at 1:55












          • 1




            +1 without the bios-boot partition the grub installation will fail.
            – GAD3R
            Jan 13 at 16:38










          • I'm having a hell of a time getting this to work. The system reboots to a grub rescue prompt - grub2-install --target=i386-pc /dev/sda also doesn't place a grub.cfg. When I make it manually, it makes it with EFI linux references.
            – Locane
            Jan 14 at 22:25










          • @Locane Use grub2-mkconfig and redirect the output into grub.cfg. It'll auto detect all installed OSs (including Windows, if any) and will generate grub.cfg for you.. grub2-install is not supposed to generate the configuration.
            – Abhik Bose
            Jan 15 at 0:08











          • Thanks @AbhikBose - I actually got that far (in my comment it says "when I make it manually") - it auto-detects EFI style installation, so the terms "linuxefi" and "initrdefi" replace "linux" and "initrd" respectively. I was able to get it to work by awking the output and just gusb()ing the terms; so linuxefi->linux and initrdefi->initrd.
            – Locane
            Jan 15 at 1:53










          • Can you edit your answer to include those two steps? "grub2-mkconfig > /boot/grub2/grub.cfg" and replace all instances of "linuxefi" with "linux" and "initrdefi" with "initrd"?
            – Locane
            Jan 15 at 1:55







          1




          1




          +1 without the bios-boot partition the grub installation will fail.
          – GAD3R
          Jan 13 at 16:38




          +1 without the bios-boot partition the grub installation will fail.
          – GAD3R
          Jan 13 at 16:38












          I'm having a hell of a time getting this to work. The system reboots to a grub rescue prompt - grub2-install --target=i386-pc /dev/sda also doesn't place a grub.cfg. When I make it manually, it makes it with EFI linux references.
          – Locane
          Jan 14 at 22:25




          I'm having a hell of a time getting this to work. The system reboots to a grub rescue prompt - grub2-install --target=i386-pc /dev/sda also doesn't place a grub.cfg. When I make it manually, it makes it with EFI linux references.
          – Locane
          Jan 14 at 22:25












          @Locane Use grub2-mkconfig and redirect the output into grub.cfg. It'll auto detect all installed OSs (including Windows, if any) and will generate grub.cfg for you.. grub2-install is not supposed to generate the configuration.
          – Abhik Bose
          Jan 15 at 0:08





          @Locane Use grub2-mkconfig and redirect the output into grub.cfg. It'll auto detect all installed OSs (including Windows, if any) and will generate grub.cfg for you.. grub2-install is not supposed to generate the configuration.
          – Abhik Bose
          Jan 15 at 0:08













          Thanks @AbhikBose - I actually got that far (in my comment it says "when I make it manually") - it auto-detects EFI style installation, so the terms "linuxefi" and "initrdefi" replace "linux" and "initrd" respectively. I was able to get it to work by awking the output and just gusb()ing the terms; so linuxefi->linux and initrdefi->initrd.
          – Locane
          Jan 15 at 1:53




          Thanks @AbhikBose - I actually got that far (in my comment it says "when I make it manually") - it auto-detects EFI style installation, so the terms "linuxefi" and "initrdefi" replace "linux" and "initrd" respectively. I was able to get it to work by awking the output and just gusb()ing the terms; so linuxefi->linux and initrdefi->initrd.
          – Locane
          Jan 15 at 1:53












          Can you edit your answer to include those two steps? "grub2-mkconfig > /boot/grub2/grub.cfg" and replace all instances of "linuxefi" with "linux" and "initrdefi" with "initrd"?
          – Locane
          Jan 15 at 1:55




          Can you edit your answer to include those two steps? "grub2-mkconfig > /boot/grub2/grub.cfg" and replace all instances of "linuxefi" with "linux" and "initrdefi" with "initrd"?
          – Locane
          Jan 15 at 1:55












           

          draft saved


          draft discarded


























           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f416734%2fis-there-a-way-to-force-centos-to-do-a-legacy-style-boot-install-in-the-uefi-sty%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

          How to check contact read email or not when send email to Individual?

          Displaying single band from multi-band raster using QGIS

          How many registers does an x86_64 CPU actually have?