Is there a way to load the GRUB command line from within Linux?












0















This is primarily for educational purposes, so I don't have to keep turning my computer on and off again.










share|improve this question

























  • Take a look at grub-emu, perhaps it's what you look for.

    – ctac_
    Sep 29 '18 at 10:24
















0















This is primarily for educational purposes, so I don't have to keep turning my computer on and off again.










share|improve this question

























  • Take a look at grub-emu, perhaps it's what you look for.

    – ctac_
    Sep 29 '18 at 10:24














0












0








0








This is primarily for educational purposes, so I don't have to keep turning my computer on and off again.










share|improve this question
















This is primarily for educational purposes, so I don't have to keep turning my computer on and off again.







linux grub2






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 9 at 0:40









Rui F Ribeiro

40.4k1479137




40.4k1479137










asked Sep 29 '18 at 4:12









extremeaxe5extremeaxe5

23916




23916













  • Take a look at grub-emu, perhaps it's what you look for.

    – ctac_
    Sep 29 '18 at 10:24



















  • Take a look at grub-emu, perhaps it's what you look for.

    – ctac_
    Sep 29 '18 at 10:24

















Take a look at grub-emu, perhaps it's what you look for.

– ctac_
Sep 29 '18 at 10:24





Take a look at grub-emu, perhaps it's what you look for.

– ctac_
Sep 29 '18 at 10:24










1 Answer
1






active

oldest

votes


















0














I assume your question is about how to debug the boot process, i.e. testing whether a new grub configuration would work as expected, before rebooting for real:



It's possible with virtualization.



However, there are many corner cases if you just boot up your physical disk that's currently running your system again in a VM. You have to sync any outstanding writes to disk, flush caches, then start the VM with a strictly read-only view of the drive(s) (perhaps on a copy-on-write layer). You also have to disable network entirely - or it will download your emails and delete them from your server inside the VM where this data is then lost on shutdown.



And even then, the VM might just crash if it uses a filesystem that is already in use and being modified by the host. You could work around this problem using a proper snapshot but you usually can't just snapshot an entire drive and snapshotting a single LV won't help at all, as the VM will just see the same snapshot structure when it boots.



So it's best if the host stays idle and doesn't have filesystem activity while the VM is running, or simply stop the VM after the critical boot phase. Since the VM is read only you can just close it / kill it / no need for a proper shutdown inside the VM. So even if the VM crashes it doesn't really matter other than that it makes debugging difficult of course.



As long as you are aware of the ramifications, it comes down to a simple qemu, basically:



sync
echo 3 > /proc/sys/vm/drop_caches
qemu -net none -drive file=/dev/disk,readonly
# leave out readonly for a copy-on-write device:
qemu -net none -drive file=/dev/mapper/copy-on-write-disk


(qemu needs more options to run properly, check any qemu guide for more details - for example if you're using a distro like Gentoo that's strictly optimized for one type of CPU you also need -cpu host - but that's more or less the gist of it.)






share|improve this answer























    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',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    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
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f472216%2fis-there-a-way-to-load-the-grub-command-line-from-within-linux%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














    I assume your question is about how to debug the boot process, i.e. testing whether a new grub configuration would work as expected, before rebooting for real:



    It's possible with virtualization.



    However, there are many corner cases if you just boot up your physical disk that's currently running your system again in a VM. You have to sync any outstanding writes to disk, flush caches, then start the VM with a strictly read-only view of the drive(s) (perhaps on a copy-on-write layer). You also have to disable network entirely - or it will download your emails and delete them from your server inside the VM where this data is then lost on shutdown.



    And even then, the VM might just crash if it uses a filesystem that is already in use and being modified by the host. You could work around this problem using a proper snapshot but you usually can't just snapshot an entire drive and snapshotting a single LV won't help at all, as the VM will just see the same snapshot structure when it boots.



    So it's best if the host stays idle and doesn't have filesystem activity while the VM is running, or simply stop the VM after the critical boot phase. Since the VM is read only you can just close it / kill it / no need for a proper shutdown inside the VM. So even if the VM crashes it doesn't really matter other than that it makes debugging difficult of course.



    As long as you are aware of the ramifications, it comes down to a simple qemu, basically:



    sync
    echo 3 > /proc/sys/vm/drop_caches
    qemu -net none -drive file=/dev/disk,readonly
    # leave out readonly for a copy-on-write device:
    qemu -net none -drive file=/dev/mapper/copy-on-write-disk


    (qemu needs more options to run properly, check any qemu guide for more details - for example if you're using a distro like Gentoo that's strictly optimized for one type of CPU you also need -cpu host - but that's more or less the gist of it.)






    share|improve this answer




























      0














      I assume your question is about how to debug the boot process, i.e. testing whether a new grub configuration would work as expected, before rebooting for real:



      It's possible with virtualization.



      However, there are many corner cases if you just boot up your physical disk that's currently running your system again in a VM. You have to sync any outstanding writes to disk, flush caches, then start the VM with a strictly read-only view of the drive(s) (perhaps on a copy-on-write layer). You also have to disable network entirely - or it will download your emails and delete them from your server inside the VM where this data is then lost on shutdown.



      And even then, the VM might just crash if it uses a filesystem that is already in use and being modified by the host. You could work around this problem using a proper snapshot but you usually can't just snapshot an entire drive and snapshotting a single LV won't help at all, as the VM will just see the same snapshot structure when it boots.



      So it's best if the host stays idle and doesn't have filesystem activity while the VM is running, or simply stop the VM after the critical boot phase. Since the VM is read only you can just close it / kill it / no need for a proper shutdown inside the VM. So even if the VM crashes it doesn't really matter other than that it makes debugging difficult of course.



      As long as you are aware of the ramifications, it comes down to a simple qemu, basically:



      sync
      echo 3 > /proc/sys/vm/drop_caches
      qemu -net none -drive file=/dev/disk,readonly
      # leave out readonly for a copy-on-write device:
      qemu -net none -drive file=/dev/mapper/copy-on-write-disk


      (qemu needs more options to run properly, check any qemu guide for more details - for example if you're using a distro like Gentoo that's strictly optimized for one type of CPU you also need -cpu host - but that's more or less the gist of it.)






      share|improve this answer


























        0












        0








        0







        I assume your question is about how to debug the boot process, i.e. testing whether a new grub configuration would work as expected, before rebooting for real:



        It's possible with virtualization.



        However, there are many corner cases if you just boot up your physical disk that's currently running your system again in a VM. You have to sync any outstanding writes to disk, flush caches, then start the VM with a strictly read-only view of the drive(s) (perhaps on a copy-on-write layer). You also have to disable network entirely - or it will download your emails and delete them from your server inside the VM where this data is then lost on shutdown.



        And even then, the VM might just crash if it uses a filesystem that is already in use and being modified by the host. You could work around this problem using a proper snapshot but you usually can't just snapshot an entire drive and snapshotting a single LV won't help at all, as the VM will just see the same snapshot structure when it boots.



        So it's best if the host stays idle and doesn't have filesystem activity while the VM is running, or simply stop the VM after the critical boot phase. Since the VM is read only you can just close it / kill it / no need for a proper shutdown inside the VM. So even if the VM crashes it doesn't really matter other than that it makes debugging difficult of course.



        As long as you are aware of the ramifications, it comes down to a simple qemu, basically:



        sync
        echo 3 > /proc/sys/vm/drop_caches
        qemu -net none -drive file=/dev/disk,readonly
        # leave out readonly for a copy-on-write device:
        qemu -net none -drive file=/dev/mapper/copy-on-write-disk


        (qemu needs more options to run properly, check any qemu guide for more details - for example if you're using a distro like Gentoo that's strictly optimized for one type of CPU you also need -cpu host - but that's more or less the gist of it.)






        share|improve this answer













        I assume your question is about how to debug the boot process, i.e. testing whether a new grub configuration would work as expected, before rebooting for real:



        It's possible with virtualization.



        However, there are many corner cases if you just boot up your physical disk that's currently running your system again in a VM. You have to sync any outstanding writes to disk, flush caches, then start the VM with a strictly read-only view of the drive(s) (perhaps on a copy-on-write layer). You also have to disable network entirely - or it will download your emails and delete them from your server inside the VM where this data is then lost on shutdown.



        And even then, the VM might just crash if it uses a filesystem that is already in use and being modified by the host. You could work around this problem using a proper snapshot but you usually can't just snapshot an entire drive and snapshotting a single LV won't help at all, as the VM will just see the same snapshot structure when it boots.



        So it's best if the host stays idle and doesn't have filesystem activity while the VM is running, or simply stop the VM after the critical boot phase. Since the VM is read only you can just close it / kill it / no need for a proper shutdown inside the VM. So even if the VM crashes it doesn't really matter other than that it makes debugging difficult of course.



        As long as you are aware of the ramifications, it comes down to a simple qemu, basically:



        sync
        echo 3 > /proc/sys/vm/drop_caches
        qemu -net none -drive file=/dev/disk,readonly
        # leave out readonly for a copy-on-write device:
        qemu -net none -drive file=/dev/mapper/copy-on-write-disk


        (qemu needs more options to run properly, check any qemu guide for more details - for example if you're using a distro like Gentoo that's strictly optimized for one type of CPU you also need -cpu host - but that's more or less the gist of it.)







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Sep 29 '18 at 7:17









        frostschutzfrostschutz

        27.1k15584




        27.1k15584






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • 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%2funix.stackexchange.com%2fquestions%2f472216%2fis-there-a-way-to-load-the-grub-command-line-from-within-linux%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

            How to make a Squid Proxy server?

            Is this a new Fibonacci Identity?

            19世紀