How to make grub-mkconfig work on a usb device?











up vote
2
down vote

favorite












AFAIK grub-mkconfig and grub-update/update-grub commands only run on the device that they are installed on.



I want to run the commands on a usb drive, but




  • I don't know how to install them on the usb

  • I can't make the ones that are installed on my computer to run on usb(i.e they should update the usb's grub.cfg file)


How can I do either of them?



BTW I am using manjaro KDE










share|improve this question






















  • What is it exactly what you are trying to acomplish?
    – YoMismo
    Sep 8 '15 at 13:44










  • @YoMismo unix.stackexchange.com/q/224695/55673
    – Registered User
    Sep 8 '15 at 14:02










  • Then mount your usb in /mnt, mount --bind /dev /sys /proc under mnt's respctive ones and chroot to your /mnt, modify any needed file and run grub-mkconfig
    – YoMismo
    Sep 8 '15 at 14:11










  • @YoMismo Can you write an answer? I didn't get your comment properly.
    – Registered User
    Sep 8 '15 at 14:33















up vote
2
down vote

favorite












AFAIK grub-mkconfig and grub-update/update-grub commands only run on the device that they are installed on.



I want to run the commands on a usb drive, but




  • I don't know how to install them on the usb

  • I can't make the ones that are installed on my computer to run on usb(i.e they should update the usb's grub.cfg file)


How can I do either of them?



BTW I am using manjaro KDE










share|improve this question






















  • What is it exactly what you are trying to acomplish?
    – YoMismo
    Sep 8 '15 at 13:44










  • @YoMismo unix.stackexchange.com/q/224695/55673
    – Registered User
    Sep 8 '15 at 14:02










  • Then mount your usb in /mnt, mount --bind /dev /sys /proc under mnt's respctive ones and chroot to your /mnt, modify any needed file and run grub-mkconfig
    – YoMismo
    Sep 8 '15 at 14:11










  • @YoMismo Can you write an answer? I didn't get your comment properly.
    – Registered User
    Sep 8 '15 at 14:33













up vote
2
down vote

favorite









up vote
2
down vote

favorite











AFAIK grub-mkconfig and grub-update/update-grub commands only run on the device that they are installed on.



I want to run the commands on a usb drive, but




  • I don't know how to install them on the usb

  • I can't make the ones that are installed on my computer to run on usb(i.e they should update the usb's grub.cfg file)


How can I do either of them?



BTW I am using manjaro KDE










share|improve this question













AFAIK grub-mkconfig and grub-update/update-grub commands only run on the device that they are installed on.



I want to run the commands on a usb drive, but




  • I don't know how to install them on the usb

  • I can't make the ones that are installed on my computer to run on usb(i.e they should update the usb's grub.cfg file)


How can I do either of them?



BTW I am using manjaro KDE







grub2 live-usb






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Sep 8 '15 at 13:19









Registered User

1662722




1662722












  • What is it exactly what you are trying to acomplish?
    – YoMismo
    Sep 8 '15 at 13:44










  • @YoMismo unix.stackexchange.com/q/224695/55673
    – Registered User
    Sep 8 '15 at 14:02










  • Then mount your usb in /mnt, mount --bind /dev /sys /proc under mnt's respctive ones and chroot to your /mnt, modify any needed file and run grub-mkconfig
    – YoMismo
    Sep 8 '15 at 14:11










  • @YoMismo Can you write an answer? I didn't get your comment properly.
    – Registered User
    Sep 8 '15 at 14:33


















  • What is it exactly what you are trying to acomplish?
    – YoMismo
    Sep 8 '15 at 13:44










  • @YoMismo unix.stackexchange.com/q/224695/55673
    – Registered User
    Sep 8 '15 at 14:02










  • Then mount your usb in /mnt, mount --bind /dev /sys /proc under mnt's respctive ones and chroot to your /mnt, modify any needed file and run grub-mkconfig
    – YoMismo
    Sep 8 '15 at 14:11










  • @YoMismo Can you write an answer? I didn't get your comment properly.
    – Registered User
    Sep 8 '15 at 14:33
















What is it exactly what you are trying to acomplish?
– YoMismo
Sep 8 '15 at 13:44




What is it exactly what you are trying to acomplish?
– YoMismo
Sep 8 '15 at 13:44












@YoMismo unix.stackexchange.com/q/224695/55673
– Registered User
Sep 8 '15 at 14:02




@YoMismo unix.stackexchange.com/q/224695/55673
– Registered User
Sep 8 '15 at 14:02












Then mount your usb in /mnt, mount --bind /dev /sys /proc under mnt's respctive ones and chroot to your /mnt, modify any needed file and run grub-mkconfig
– YoMismo
Sep 8 '15 at 14:11




Then mount your usb in /mnt, mount --bind /dev /sys /proc under mnt's respctive ones and chroot to your /mnt, modify any needed file and run grub-mkconfig
– YoMismo
Sep 8 '15 at 14:11












@YoMismo Can you write an answer? I didn't get your comment properly.
– Registered User
Sep 8 '15 at 14:33




@YoMismo Can you write an answer? I didn't get your comment properly.
– Registered User
Sep 8 '15 at 14:33










1 Answer
1






active

oldest

votes

















up vote
0
down vote














  1. Mount your USB in /mnt: mount /dev/your_USB /mnt

  2. mount --bind /dev /mnt/dev

  3. mount --bind /proc /mnt/proc

  4. mount --bind /sys /mnt/sys

  5. chroot /mnt

  6. Modify GRUB config files.

  7. grub-mkconfig






share|improve this answer























  • Beware - I find that it puts incorrect 'search hints' in the grub.cfg that can stop the target machine from finding kernel and initrd. You may need to clean it up (sed helps).
    – Toby Speight
    Sep 8 '15 at 16:33










  • I get this error chroot: failed to run command ‘/bin/bash’: No such file or directory
    – Registered User
    Sep 8 '15 at 16:50










  • Try chroot /mnt /path/to/your/shell
    – YoMismo
    Sep 9 '15 at 7:39










  • @YoMismo I tried sudo chroot /mnt /usr/bin/bash it gives chroot: failed to run command ‘/usr/bin/bash’: No such file or directory
    – Registered User
    Sep 19 '15 at 9:46










  • Does /usr/bin/bash exist?
    – YoMismo
    Sep 19 '15 at 21:21











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: 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%2f228267%2fhow-to-make-grub-mkconfig-work-on-a-usb-device%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








up vote
0
down vote














  1. Mount your USB in /mnt: mount /dev/your_USB /mnt

  2. mount --bind /dev /mnt/dev

  3. mount --bind /proc /mnt/proc

  4. mount --bind /sys /mnt/sys

  5. chroot /mnt

  6. Modify GRUB config files.

  7. grub-mkconfig






share|improve this answer























  • Beware - I find that it puts incorrect 'search hints' in the grub.cfg that can stop the target machine from finding kernel and initrd. You may need to clean it up (sed helps).
    – Toby Speight
    Sep 8 '15 at 16:33










  • I get this error chroot: failed to run command ‘/bin/bash’: No such file or directory
    – Registered User
    Sep 8 '15 at 16:50










  • Try chroot /mnt /path/to/your/shell
    – YoMismo
    Sep 9 '15 at 7:39










  • @YoMismo I tried sudo chroot /mnt /usr/bin/bash it gives chroot: failed to run command ‘/usr/bin/bash’: No such file or directory
    – Registered User
    Sep 19 '15 at 9:46










  • Does /usr/bin/bash exist?
    – YoMismo
    Sep 19 '15 at 21:21















up vote
0
down vote














  1. Mount your USB in /mnt: mount /dev/your_USB /mnt

  2. mount --bind /dev /mnt/dev

  3. mount --bind /proc /mnt/proc

  4. mount --bind /sys /mnt/sys

  5. chroot /mnt

  6. Modify GRUB config files.

  7. grub-mkconfig






share|improve this answer























  • Beware - I find that it puts incorrect 'search hints' in the grub.cfg that can stop the target machine from finding kernel and initrd. You may need to clean it up (sed helps).
    – Toby Speight
    Sep 8 '15 at 16:33










  • I get this error chroot: failed to run command ‘/bin/bash’: No such file or directory
    – Registered User
    Sep 8 '15 at 16:50










  • Try chroot /mnt /path/to/your/shell
    – YoMismo
    Sep 9 '15 at 7:39










  • @YoMismo I tried sudo chroot /mnt /usr/bin/bash it gives chroot: failed to run command ‘/usr/bin/bash’: No such file or directory
    – Registered User
    Sep 19 '15 at 9:46










  • Does /usr/bin/bash exist?
    – YoMismo
    Sep 19 '15 at 21:21













up vote
0
down vote










up vote
0
down vote










  1. Mount your USB in /mnt: mount /dev/your_USB /mnt

  2. mount --bind /dev /mnt/dev

  3. mount --bind /proc /mnt/proc

  4. mount --bind /sys /mnt/sys

  5. chroot /mnt

  6. Modify GRUB config files.

  7. grub-mkconfig






share|improve this answer















  1. Mount your USB in /mnt: mount /dev/your_USB /mnt

  2. mount --bind /dev /mnt/dev

  3. mount --bind /proc /mnt/proc

  4. mount --bind /sys /mnt/sys

  5. chroot /mnt

  6. Modify GRUB config files.

  7. grub-mkconfig







share|improve this answer














share|improve this answer



share|improve this answer








edited Jan 29 at 12:16

























answered Sep 8 '15 at 14:57









YoMismo

3,0561724




3,0561724












  • Beware - I find that it puts incorrect 'search hints' in the grub.cfg that can stop the target machine from finding kernel and initrd. You may need to clean it up (sed helps).
    – Toby Speight
    Sep 8 '15 at 16:33










  • I get this error chroot: failed to run command ‘/bin/bash’: No such file or directory
    – Registered User
    Sep 8 '15 at 16:50










  • Try chroot /mnt /path/to/your/shell
    – YoMismo
    Sep 9 '15 at 7:39










  • @YoMismo I tried sudo chroot /mnt /usr/bin/bash it gives chroot: failed to run command ‘/usr/bin/bash’: No such file or directory
    – Registered User
    Sep 19 '15 at 9:46










  • Does /usr/bin/bash exist?
    – YoMismo
    Sep 19 '15 at 21:21


















  • Beware - I find that it puts incorrect 'search hints' in the grub.cfg that can stop the target machine from finding kernel and initrd. You may need to clean it up (sed helps).
    – Toby Speight
    Sep 8 '15 at 16:33










  • I get this error chroot: failed to run command ‘/bin/bash’: No such file or directory
    – Registered User
    Sep 8 '15 at 16:50










  • Try chroot /mnt /path/to/your/shell
    – YoMismo
    Sep 9 '15 at 7:39










  • @YoMismo I tried sudo chroot /mnt /usr/bin/bash it gives chroot: failed to run command ‘/usr/bin/bash’: No such file or directory
    – Registered User
    Sep 19 '15 at 9:46










  • Does /usr/bin/bash exist?
    – YoMismo
    Sep 19 '15 at 21:21
















Beware - I find that it puts incorrect 'search hints' in the grub.cfg that can stop the target machine from finding kernel and initrd. You may need to clean it up (sed helps).
– Toby Speight
Sep 8 '15 at 16:33




Beware - I find that it puts incorrect 'search hints' in the grub.cfg that can stop the target machine from finding kernel and initrd. You may need to clean it up (sed helps).
– Toby Speight
Sep 8 '15 at 16:33












I get this error chroot: failed to run command ‘/bin/bash’: No such file or directory
– Registered User
Sep 8 '15 at 16:50




I get this error chroot: failed to run command ‘/bin/bash’: No such file or directory
– Registered User
Sep 8 '15 at 16:50












Try chroot /mnt /path/to/your/shell
– YoMismo
Sep 9 '15 at 7:39




Try chroot /mnt /path/to/your/shell
– YoMismo
Sep 9 '15 at 7:39












@YoMismo I tried sudo chroot /mnt /usr/bin/bash it gives chroot: failed to run command ‘/usr/bin/bash’: No such file or directory
– Registered User
Sep 19 '15 at 9:46




@YoMismo I tried sudo chroot /mnt /usr/bin/bash it gives chroot: failed to run command ‘/usr/bin/bash’: No such file or directory
– Registered User
Sep 19 '15 at 9:46












Does /usr/bin/bash exist?
– YoMismo
Sep 19 '15 at 21:21




Does /usr/bin/bash exist?
– YoMismo
Sep 19 '15 at 21:21


















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.





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%2funix.stackexchange.com%2fquestions%2f228267%2fhow-to-make-grub-mkconfig-work-on-a-usb-device%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

List directoties down one level, excluding some named directories and files

list processes belonging to a network namespace

list systemd RuntimeDirectory mounts