Change default GRUB bootorder from windows












0














I successfully installed a dual-boot (Ubuntu 18.04 and win10) on my notebook.



Unfortunately I'm still new to the Linux world and my terminal skills and Linux knowledge are close to bad. But I'm willing to learn.



My concern: Every time my machine restarts or I want to switch the OS I have to wait for the grub bootloader and then choose the OS. Normally I will not change my running OS for example if I worked in Ubuntu, I would like to boot back into it or the other way.



Now I want to write a little program that automatically changes the default boot entry to the other OS and then reboots the system.

I guess the problem is not writing this little script for Ubuntu. But how should I realize this for windows?



My To do list based on my knowledge.




  • Somehow move the /etc/default/grub file to a small fat32 partition so windows is able to read it and make changes.
    ~probably easy

  • Run the sudo update-grub equivalent command in windows? ~this one is way beyond my knowledge and maybe totally stupid - like running an file.exe on Ubuntu.


I already searched for similar question but without finding a reasonable good solution for me.




  • Some recommended to teach windows to read/write on the Ubuntu drive. I think that my precious Ubuntu drive should not be violated by windows.

  • Or to install another bootloader. I would like to stay with GRUB, because its working and the default?

  • Make changes to the /boot/grub/grub.cfg or /boot/grub/grubenv I'm not 100% sure about it, but most users don't recommend messing with the grub.cfg file because its generated from other files?


I know that I can probably just use a function in GRUB to run the last booted OS as default. But when I want to switch from one OS to the other I like the idea of just running a little own program instead of waiting for the reboot then hitting a key before the timer runs out... and if you miss this opportunity - reboot again -



Thanks for your help










share|improve this question







New contributor




Hysteria is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 1




    If you have UEFI installs, you can just choose what system to boot from UEFI boot menu. Often f12 but varies by vendor.
    – oldfred
    yesterday










  • @Hysteria when you are in windows you want to tell the system that next boot should be Ubuntu or Windows...this is what are you trying to achieve?? suppose if you achieve this and next boot is Ubuntu..means now you are in Ubuntu.. after restart are you expecting Windows or Ubuntu?
    – PRATAP
    yesterday










  • @PRATAP this depends. I have to set a default OS and a short timer (that's not the problem). At this point If I set Win10 as default and run an update I easily came back to Win10. But when I'm done in win10 and want to go back to Ubuntu my Idea takes place: I'm still in win10 and want to tell Grub that now the default boot OS is Ubuntu and reboot the system. So I don't need to sit in front of my system to tell GRUB during startup I want to change the OS.
    – Hysteria
    20 hours ago












  • i have tried since morning.. from windows 10..seems its not possible.. bcoz any changes we make.. update-grub is the task which is not possible.. i have seen a similar question.. little different.. OP added USB to achieve what you are looking for..
    – PRATAP
    20 hours ago












  • askubuntu.com/a/1075943/739431
    – PRATAP
    20 hours ago
















0














I successfully installed a dual-boot (Ubuntu 18.04 and win10) on my notebook.



Unfortunately I'm still new to the Linux world and my terminal skills and Linux knowledge are close to bad. But I'm willing to learn.



My concern: Every time my machine restarts or I want to switch the OS I have to wait for the grub bootloader and then choose the OS. Normally I will not change my running OS for example if I worked in Ubuntu, I would like to boot back into it or the other way.



Now I want to write a little program that automatically changes the default boot entry to the other OS and then reboots the system.

I guess the problem is not writing this little script for Ubuntu. But how should I realize this for windows?



My To do list based on my knowledge.




  • Somehow move the /etc/default/grub file to a small fat32 partition so windows is able to read it and make changes.
    ~probably easy

  • Run the sudo update-grub equivalent command in windows? ~this one is way beyond my knowledge and maybe totally stupid - like running an file.exe on Ubuntu.


I already searched for similar question but without finding a reasonable good solution for me.




  • Some recommended to teach windows to read/write on the Ubuntu drive. I think that my precious Ubuntu drive should not be violated by windows.

  • Or to install another bootloader. I would like to stay with GRUB, because its working and the default?

  • Make changes to the /boot/grub/grub.cfg or /boot/grub/grubenv I'm not 100% sure about it, but most users don't recommend messing with the grub.cfg file because its generated from other files?


I know that I can probably just use a function in GRUB to run the last booted OS as default. But when I want to switch from one OS to the other I like the idea of just running a little own program instead of waiting for the reboot then hitting a key before the timer runs out... and if you miss this opportunity - reboot again -



Thanks for your help










share|improve this question







New contributor




Hysteria is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 1




    If you have UEFI installs, you can just choose what system to boot from UEFI boot menu. Often f12 but varies by vendor.
    – oldfred
    yesterday










  • @Hysteria when you are in windows you want to tell the system that next boot should be Ubuntu or Windows...this is what are you trying to achieve?? suppose if you achieve this and next boot is Ubuntu..means now you are in Ubuntu.. after restart are you expecting Windows or Ubuntu?
    – PRATAP
    yesterday










  • @PRATAP this depends. I have to set a default OS and a short timer (that's not the problem). At this point If I set Win10 as default and run an update I easily came back to Win10. But when I'm done in win10 and want to go back to Ubuntu my Idea takes place: I'm still in win10 and want to tell Grub that now the default boot OS is Ubuntu and reboot the system. So I don't need to sit in front of my system to tell GRUB during startup I want to change the OS.
    – Hysteria
    20 hours ago












  • i have tried since morning.. from windows 10..seems its not possible.. bcoz any changes we make.. update-grub is the task which is not possible.. i have seen a similar question.. little different.. OP added USB to achieve what you are looking for..
    – PRATAP
    20 hours ago












  • askubuntu.com/a/1075943/739431
    – PRATAP
    20 hours ago














0












0








0







I successfully installed a dual-boot (Ubuntu 18.04 and win10) on my notebook.



Unfortunately I'm still new to the Linux world and my terminal skills and Linux knowledge are close to bad. But I'm willing to learn.



My concern: Every time my machine restarts or I want to switch the OS I have to wait for the grub bootloader and then choose the OS. Normally I will not change my running OS for example if I worked in Ubuntu, I would like to boot back into it or the other way.



Now I want to write a little program that automatically changes the default boot entry to the other OS and then reboots the system.

I guess the problem is not writing this little script for Ubuntu. But how should I realize this for windows?



My To do list based on my knowledge.




  • Somehow move the /etc/default/grub file to a small fat32 partition so windows is able to read it and make changes.
    ~probably easy

  • Run the sudo update-grub equivalent command in windows? ~this one is way beyond my knowledge and maybe totally stupid - like running an file.exe on Ubuntu.


I already searched for similar question but without finding a reasonable good solution for me.




  • Some recommended to teach windows to read/write on the Ubuntu drive. I think that my precious Ubuntu drive should not be violated by windows.

  • Or to install another bootloader. I would like to stay with GRUB, because its working and the default?

  • Make changes to the /boot/grub/grub.cfg or /boot/grub/grubenv I'm not 100% sure about it, but most users don't recommend messing with the grub.cfg file because its generated from other files?


I know that I can probably just use a function in GRUB to run the last booted OS as default. But when I want to switch from one OS to the other I like the idea of just running a little own program instead of waiting for the reboot then hitting a key before the timer runs out... and if you miss this opportunity - reboot again -



Thanks for your help










share|improve this question







New contributor




Hysteria is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I successfully installed a dual-boot (Ubuntu 18.04 and win10) on my notebook.



Unfortunately I'm still new to the Linux world and my terminal skills and Linux knowledge are close to bad. But I'm willing to learn.



My concern: Every time my machine restarts or I want to switch the OS I have to wait for the grub bootloader and then choose the OS. Normally I will not change my running OS for example if I worked in Ubuntu, I would like to boot back into it or the other way.



Now I want to write a little program that automatically changes the default boot entry to the other OS and then reboots the system.

I guess the problem is not writing this little script for Ubuntu. But how should I realize this for windows?



My To do list based on my knowledge.




  • Somehow move the /etc/default/grub file to a small fat32 partition so windows is able to read it and make changes.
    ~probably easy

  • Run the sudo update-grub equivalent command in windows? ~this one is way beyond my knowledge and maybe totally stupid - like running an file.exe on Ubuntu.


I already searched for similar question but without finding a reasonable good solution for me.




  • Some recommended to teach windows to read/write on the Ubuntu drive. I think that my precious Ubuntu drive should not be violated by windows.

  • Or to install another bootloader. I would like to stay with GRUB, because its working and the default?

  • Make changes to the /boot/grub/grub.cfg or /boot/grub/grubenv I'm not 100% sure about it, but most users don't recommend messing with the grub.cfg file because its generated from other files?


I know that I can probably just use a function in GRUB to run the last booted OS as default. But when I want to switch from one OS to the other I like the idea of just running a little own program instead of waiting for the reboot then hitting a key before the timer runs out... and if you miss this opportunity - reboot again -



Thanks for your help







dual-boot grub2 18.04 bootloader boot-order






share|improve this question







New contributor




Hysteria is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




Hysteria is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




Hysteria is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked yesterday









Hysteria

11




11




New contributor




Hysteria is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Hysteria is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Hysteria is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








  • 1




    If you have UEFI installs, you can just choose what system to boot from UEFI boot menu. Often f12 but varies by vendor.
    – oldfred
    yesterday










  • @Hysteria when you are in windows you want to tell the system that next boot should be Ubuntu or Windows...this is what are you trying to achieve?? suppose if you achieve this and next boot is Ubuntu..means now you are in Ubuntu.. after restart are you expecting Windows or Ubuntu?
    – PRATAP
    yesterday










  • @PRATAP this depends. I have to set a default OS and a short timer (that's not the problem). At this point If I set Win10 as default and run an update I easily came back to Win10. But when I'm done in win10 and want to go back to Ubuntu my Idea takes place: I'm still in win10 and want to tell Grub that now the default boot OS is Ubuntu and reboot the system. So I don't need to sit in front of my system to tell GRUB during startup I want to change the OS.
    – Hysteria
    20 hours ago












  • i have tried since morning.. from windows 10..seems its not possible.. bcoz any changes we make.. update-grub is the task which is not possible.. i have seen a similar question.. little different.. OP added USB to achieve what you are looking for..
    – PRATAP
    20 hours ago












  • askubuntu.com/a/1075943/739431
    – PRATAP
    20 hours ago














  • 1




    If you have UEFI installs, you can just choose what system to boot from UEFI boot menu. Often f12 but varies by vendor.
    – oldfred
    yesterday










  • @Hysteria when you are in windows you want to tell the system that next boot should be Ubuntu or Windows...this is what are you trying to achieve?? suppose if you achieve this and next boot is Ubuntu..means now you are in Ubuntu.. after restart are you expecting Windows or Ubuntu?
    – PRATAP
    yesterday










  • @PRATAP this depends. I have to set a default OS and a short timer (that's not the problem). At this point If I set Win10 as default and run an update I easily came back to Win10. But when I'm done in win10 and want to go back to Ubuntu my Idea takes place: I'm still in win10 and want to tell Grub that now the default boot OS is Ubuntu and reboot the system. So I don't need to sit in front of my system to tell GRUB during startup I want to change the OS.
    – Hysteria
    20 hours ago












  • i have tried since morning.. from windows 10..seems its not possible.. bcoz any changes we make.. update-grub is the task which is not possible.. i have seen a similar question.. little different.. OP added USB to achieve what you are looking for..
    – PRATAP
    20 hours ago












  • askubuntu.com/a/1075943/739431
    – PRATAP
    20 hours ago








1




1




If you have UEFI installs, you can just choose what system to boot from UEFI boot menu. Often f12 but varies by vendor.
– oldfred
yesterday




If you have UEFI installs, you can just choose what system to boot from UEFI boot menu. Often f12 but varies by vendor.
– oldfred
yesterday












@Hysteria when you are in windows you want to tell the system that next boot should be Ubuntu or Windows...this is what are you trying to achieve?? suppose if you achieve this and next boot is Ubuntu..means now you are in Ubuntu.. after restart are you expecting Windows or Ubuntu?
– PRATAP
yesterday




@Hysteria when you are in windows you want to tell the system that next boot should be Ubuntu or Windows...this is what are you trying to achieve?? suppose if you achieve this and next boot is Ubuntu..means now you are in Ubuntu.. after restart are you expecting Windows or Ubuntu?
– PRATAP
yesterday












@PRATAP this depends. I have to set a default OS and a short timer (that's not the problem). At this point If I set Win10 as default and run an update I easily came back to Win10. But when I'm done in win10 and want to go back to Ubuntu my Idea takes place: I'm still in win10 and want to tell Grub that now the default boot OS is Ubuntu and reboot the system. So I don't need to sit in front of my system to tell GRUB during startup I want to change the OS.
– Hysteria
20 hours ago






@PRATAP this depends. I have to set a default OS and a short timer (that's not the problem). At this point If I set Win10 as default and run an update I easily came back to Win10. But when I'm done in win10 and want to go back to Ubuntu my Idea takes place: I'm still in win10 and want to tell Grub that now the default boot OS is Ubuntu and reboot the system. So I don't need to sit in front of my system to tell GRUB during startup I want to change the OS.
– Hysteria
20 hours ago














i have tried since morning.. from windows 10..seems its not possible.. bcoz any changes we make.. update-grub is the task which is not possible.. i have seen a similar question.. little different.. OP added USB to achieve what you are looking for..
– PRATAP
20 hours ago






i have tried since morning.. from windows 10..seems its not possible.. bcoz any changes we make.. update-grub is the task which is not possible.. i have seen a similar question.. little different.. OP added USB to achieve what you are looking for..
– PRATAP
20 hours ago














askubuntu.com/a/1075943/739431
– PRATAP
20 hours ago




askubuntu.com/a/1075943/739431
– PRATAP
20 hours ago










1 Answer
1






active

oldest

votes


















0














This will do almost what you want...



Making this change will allow you to choose which OS to boot, and it'll reboot to that same OS until you make a different selection.



Edit /etc/default/grub and change/add this:



sudo -H gedit /etc/default/grub # edit the file





GRUB_DEFAULT=saved # change this line



GRUB_SAVEDEFAULT=true # add this line





Then:



sudo update-grub






share|improve this answer





















    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "89"
    };
    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',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });






    Hysteria is a new contributor. Be nice, and check out our Code of Conduct.










    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1104525%2fchange-default-grub-bootorder-from-windows%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    This will do almost what you want...



    Making this change will allow you to choose which OS to boot, and it'll reboot to that same OS until you make a different selection.



    Edit /etc/default/grub and change/add this:



    sudo -H gedit /etc/default/grub # edit the file





    GRUB_DEFAULT=saved # change this line



    GRUB_SAVEDEFAULT=true # add this line





    Then:



    sudo update-grub






    share|improve this answer


























      0














      This will do almost what you want...



      Making this change will allow you to choose which OS to boot, and it'll reboot to that same OS until you make a different selection.



      Edit /etc/default/grub and change/add this:



      sudo -H gedit /etc/default/grub # edit the file





      GRUB_DEFAULT=saved # change this line



      GRUB_SAVEDEFAULT=true # add this line





      Then:



      sudo update-grub






      share|improve this answer
























        0












        0








        0






        This will do almost what you want...



        Making this change will allow you to choose which OS to boot, and it'll reboot to that same OS until you make a different selection.



        Edit /etc/default/grub and change/add this:



        sudo -H gedit /etc/default/grub # edit the file





        GRUB_DEFAULT=saved # change this line



        GRUB_SAVEDEFAULT=true # add this line





        Then:



        sudo update-grub






        share|improve this answer












        This will do almost what you want...



        Making this change will allow you to choose which OS to boot, and it'll reboot to that same OS until you make a different selection.



        Edit /etc/default/grub and change/add this:



        sudo -H gedit /etc/default/grub # edit the file





        GRUB_DEFAULT=saved # change this line



        GRUB_SAVEDEFAULT=true # add this line





        Then:



        sudo update-grub







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 12 hours ago









        heynnema

        18k22054




        18k22054






















            Hysteria is a new contributor. Be nice, and check out our Code of Conduct.










            draft saved

            draft discarded


















            Hysteria is a new contributor. Be nice, and check out our Code of Conduct.













            Hysteria is a new contributor. Be nice, and check out our Code of Conduct.












            Hysteria is a new contributor. Be nice, and check out our Code of Conduct.
















            Thanks for contributing an answer to Ask Ubuntu!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1104525%2fchange-default-grub-bootorder-from-windows%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Human spaceflight

            Can not write log (Is /dev/pts mounted?) - openpty in Ubuntu-on-Windows?

            張江高科駅