FedoraForum.org - Fedora Support Forums and Community
Results 1 to 9 of 9
  1. #1
    Join Date
    Nov 2013
    Location
    Largo, FL
    Posts
    72

    How can I edit the Windows menu entry in grub2?

    I just installed Fedora 25 on a laptop dual booting with Windows 8.1 using uefi. Unfortunately out of the box it will not allow Windows to boot, and I need to edit the last line in the boot menu from:

    Code:
    chainloader /EFI/Microsoft/Boot/bootmgfw.efi
    to be

    Code:
    chainloader (hd0,2)/EFI/Microsoft/Boot/bootmgfw.efi
    However, I cannot for the life of me figure out how to do that. From what I read I need to either use grubby, which looks like it is just for editing linux entries, or edit /etc/grub.d/30_os-prober, which is a script and not a config file. Anyone know how to accomplish this? Thanks.

    -Michael

  2. #2
    PabloTwo's Avatar
    PabloTwo is offline "Registered User" T-Shirt Winner
    Join Date
    Mar 2007
    Location
    Seville, FL
    Posts
    7,566

    Re: How can I edit the Windows menu entry in grub2?

    I would ask first, have you done a "# dnf upgrade" on your new F25 install. If not, do so now.

    After that, do:
    Code:
    # grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
    That will generate a new grub.cfg file. It could potentially alter the Windows 8.1 entry, making it functional.

    FYI: The grub2-mkconfig command will parse information from the /etc/default/grub file, and also run all the scripts in /etc/grub.d/, including the 30_os-prober script which is the one responsible for detecting other OS's within the system.

    Report results and we can work from there if things are still not fixed.
    Last edited by PabloTwo; 15th March 2017 at 07:28 PM. Reason: Ooops! No "dnf" in front of that command.

  3. #3
    PabloTwo's Avatar
    PabloTwo is offline "Registered User" T-Shirt Winner
    Join Date
    Mar 2007
    Location
    Seville, FL
    Posts
    7,566

    Re: How can I edit the Windows menu entry in grub2?

    I have a working F25/W8 dual-boot in UEFI. The working grub.cfg menu entry for W8 has:

    chainloader /EFI/Microsoft/Boot/bootmgfw.efi

    But what directs it to the correct ESP partition is this line in the menu:

    set root='hd0,gpt2'

    So adding the "(hd0,2)" part would be incorrect, as it's not proper gpt partitioning format.

    Edit: DO NOT edit the 30_os-prober file.
    Last edited by PabloTwo; 15th March 2017 at 07:27 PM.

  4. #4
    PabloTwo's Avatar
    PabloTwo is offline "Registered User" T-Shirt Winner
    Join Date
    Mar 2007
    Location
    Seville, FL
    Posts
    7,566

    Re: How can I edit the Windows menu entry in grub2?

    Just a FYI: The grub2-mkconfig command will parse info from the /etc/default/grub file and also run all the script files in /etc/grub.d/ directory, including the 30_os-prober script, which is responsible for detecting other OS's on the system.

    It's possible to disable os-prober with an entry in the /etc/default/grub file and also to manually create a new menu entry by adding the proper menu items into the 40_custom script file. I don't believe you will need to do either of the above, but say this just so you'll know.

  5. #5
    Join Date
    Nov 2013
    Location
    Largo, FL
    Posts
    72

    Re: How can I edit the Windows menu entry in grub2?

    Quote Originally Posted by PabloTwo
    I would ask first, have you done a "# dnf upgrade" on your new F25 install. If not, do so now.
    Technically it was an F24 install, since I was trial and erroring things, and that was what was installed when I thought to edit the menu item manually. This was after 6 or so from scratch restoring the laptop and then installing Fedora attempts. F22 worked out of the box, but then it wouldn't let me upgrade to F25.

    Quote Originally Posted by PabloTwo
    Edit: DO NOT edit the 30_os-prober file.
    Too late. I did edit that, adding the (hd0,2) inside the first conditional that echo'd out "chainloader", then re-ran grub2-mkconfig, and this did add the entry in the correct location, and now the machine does dual boot. However, I know this is a hack and the wrong way to do it, because now if there ever were another os to detect it would (incorrectly) add the same parameter to that as well. While I know this is highly unlikely, I would like to get it working the way it is supposed to at some point. However, it's my assistant's laptop, and she has left for the day, so I won't be able to try anything else until tomorrow.

    Quote Originally Posted by PabloTwo
    I have a working F25/W8 dual-boot in UEFI. The working grub.cfg menu entry for W8 has:

    chainloader /EFI/Microsoft/Boot/bootmgfw.efi

    But what directs it to the correct ESP partition is this line in the menu:

    set root='hd0,gpt2'

    So adding the "(hd0,2)" part would be incorrect, as it's not proper gpt partitioning format.
    I believe that root= line was in there already, but again I can't check until tomorrow. My biggest issue, I think, is that I couldn't figure out how to target the Windows menu item with grubby, which is supposedly the official way to make those changes. The docs show how to target specific kernels, but they all assume that they are linux and I didn't see anything about how to edit the Windows launch options.

    -Michael

  6. #6
    Join Date
    Nov 2013
    Location
    Largo, FL
    Posts
    72

    Re: How can I edit the Windows menu entry in grub2?

    So, we just upgraded Fedora to 25 from 24, and it looks like it overwrote the customization I put in there, but it also looks like now it is working without it. My guess is that your suggestion that running the updates might fix the issue could have been correct, since we updated everything before running the upgrade. I can't know for sure without starting over though, and there's no way I am doing that all again just for a test.

    Thank you again for your help.

    -Michael

  7. #7
    PabloTwo's Avatar
    PabloTwo is offline "Registered User" T-Shirt Winner
    Join Date
    Mar 2007
    Location
    Seville, FL
    Posts
    7,566

    Re: How can I edit the Windows menu entry in grub2?

    Quote Originally Posted by mvandemar
    I just installed Fedora 25 on a laptop dual booting with Windows 8.1 using uefi. Unfortunately out of the box it will not allow Windows to boot
    Quote Originally Posted by PabloTwo
    have you done a "# dnf upgrade" on your new F25 install.
    Quote Originally Posted by mvandemar
    Technically it was an F24 install, since I was trial and erroring things, and that was what was installed when I thought to edit the menu item manually.
    Yeah, so your asking for help here on F25 which in reality is actually F24. Is that right?
    Quote Originally Posted by mvandemar
    So, we just upgraded Fedora to 25 from 24, and it looks like it overwrote the customization I put in there, but it also looks like now it is working without it.
    Had I known that from the start, I probably would have mentioned to you that I had no luck at getting my HP laptop grub2 menu entry for W8 to work (actually boot Windows) until I upgraded to F25. It's also why I suggested to be sure your F25 system was fully updated at the time.

    In any event, I'm glad it's working for you now.

  8. #8
    Join Date
    Nov 2013
    Location
    Largo, FL
    Posts
    72

    Re: How can I edit the Windows menu entry in grub2?

    Quote Originally Posted by PabloTwo
    Yeah, so your asking for help here on F25 which in reality is actually F24. Is that right?
    I was asking about an issue that happened regardless of whether or not it was 24 or 25. I installed 25 I think 3 times trying to fix it, because at first I thought it might be due to the way I was burning the usb, or because I resized the Windows partition, but then didn't fully log out and then back into Windows again before installing Fedora. I know now it wasn't either of those, but like I said, it was trial and error. I happened to be in 24 when I finally thought to edit the menu entry.

    Quote Originally Posted by PabloTwo
    Had I known that from the start, I probably would have mentioned to you that I had no luck at getting my HP laptop grub2 menu entry for W8 to work (actually boot Windows) until I upgraded to F25. It's also why I suggested to be sure your F25 system was fully updated at the time.

    In any event, I'm glad it's working for you now.
    Yeah, I don't know what exactly fixed it, but now it's working without any edits thankfully.

    -Michael

  9. #9
    PabloTwo's Avatar
    PabloTwo is offline "Registered User" T-Shirt Winner
    Join Date
    Mar 2007
    Location
    Seville, FL
    Posts
    7,566

    Re: How can I edit the Windows menu entry in grub2?

    Quote Originally Posted by mvandemar
    Yeah, I don't know what exactly fixed it, but now it's working without any edits thankfully.
    My first thought would be that F25 had a newer version of grub2 than what was available in F24. But after checking on the koji build server, that suspicion was quickly dispelled, as the most recent release (grub2-2.02-0.38.fc25.x86_64} was built for and pushed to F24 at the same time. The build includes, among others, the grub2-tools sub-package, which provides the /etc/grub.d/ scripts.

    So what the difference was will probably remain a mystery.

Similar Threads

  1. [SOLVED] Hide MS-Windows Recovery partition in Grub2 boot menu
    By samster in forum Installation, Upgrades and Live Media
    Replies: 4
    Last Post: 11th March 2015, 04:53 PM
  2. Replies: 0
    Last Post: 11th October 2013, 03:17 PM
  3. [SOLVED] Windows 8 not in grub2 menu
    By icee3x3 in forum Installation, Upgrades and Live Media
    Replies: 23
    Last Post: 6th January 2013, 04:38 AM
  4. Windows 7 not in Grub2 menu
    By JuliusV in forum Installation, Upgrades and Live Media
    Replies: 6
    Last Post: 5th January 2013, 07:34 PM
  5. Replies: 3
    Last Post: 21st March 2012, 09:32 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •