[SOLVED] GRUB2 New menu entry pointing to USB drive
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I'm currently trying to add a new menu entry to Grub2 menu which should point to USB drive with Kali Linux installed on it.
I have edited the configuration files but for now, every method that I tried failed.
I've tried setting root to UUID, ID, path (/dev/sdc0).
This is the last configuration I tested:
Code:
menuentry "Boot Kali Live from USB Drive" {
set root='hd2,1'
search --no-floppy --fs-uuid --set=root 2016-01-20-18-16-32-00
chainloader Kali Live/EFI/BOOT/BOOTX64.efi
}
But still, when running
Code:
grub2-mkconfig -o /boot/grub2/grub.cfg
it does not seem to work...
Any idea ? I've searched the web for some time now and found nothing regarding USB menu entry...
Basically I'd try something like this : http://askubuntu.com/questions/344125/how-to-add-a-grub2-menu-entry-for-booting-installed-ubuntu-on-a-usb-drive
I've tried setting root to UUID, ID, path (/dev/sdc0).
There is no 'sdc0'. The numbering you show as (hd2,1) would be sdc1. Grub2 counts drives from zero and partitions from one.
The line beginning with 'search' should have the actual UUID of sdc1 after the set root. Doubt having a date there will do anything?
I also don't think having spaces in "Kali Live" will work.
More detail about what 'does not seem to work" means. More detail on what actually happens.
Can you boot the usb directly from BIOS without the Grub menu on the hard drive?
Take a look at the link below. Scroll down a little and you will see an example of chainloading an EFI entry for windows. You'll need to modify it to suit Kali. Also check the case of the entry by mounting the Kali usb from another Linux to verify that it is actually "EFI/BOOT/BOOTX64.efi". If the EFI/BOOT/BOOTX64 are not actually uppercase as you have shown, it won't work.
I already visited this page but unfortunately, not a solution to my problem
Quote:
There is no 'sdc0'. The numbering you show as (hd2,1) would be sdc1. Grub2 counts drives from zero and partitions from one.
You're right, rocky mistake
Quote:
More detail about what 'does not seem to work" means. More detail on what actually happens.
Can you boot the usb directly from BIOS without the Grub menu on the hard drive?
Take a look at the link below. Scroll down a little and you will see an example of chainloading an EFI entry for windows. You'll need to modify it to suit Kali. Also check the case of the entry by mounting the Kali usb from another Linux to verify that it is actually "EFI/BOOT/BOOTX64.efi". If the EFI/BOOT/BOOTX64 are not actually uppercase as you have shown, it won't work.
"What does not seem to work" means that the entry point does not seem to be recognised when I update the config files. I get the output below, but there should be something related to Kali too...
Code:
Generating grub configuration file ...
Found theme: /boot/grub2/themes/openSUSE/theme.txt
Found linux image: /boot/vmlinuz-4.1.21-14-default
Found initrd image: /boot/initrd-4.1.21-14-default
Found linux image: /boot/vmlinuz-4.1.12-1-default
Found initrd image: /boot/initrd-4.1.12-1-default
Found Windows Boot Manager on /dev/sda1@/efi/Microsoft/Boot/bootmgfw.efi
done
From Windows, I can boot directly on my USB, but I have no freaking idea how to do this with linux, so I guess there is something wrong in what I'm doing.
BTW, what seems to be a date is in fact the real UUID (no kidding, I couldn't believe it either so I rechecked it with different methods, always the same UUID).
I will boot from Windows to Kali bootloader then I will try to investigate to see exactly where it is located and how it is called, and I probably will be back with more questions
I'm not sure what you are trying to accomplish. Why are you booting your usb from inside windows? Are you planning to run it in some virtual software? Normally one would set the BIOS boot priority to the flash/usb drive and boot it. If you boot it from windows, does that mean you modified the windows boot file with bcdedit to create an entry for it? You have a Live CD of Kali on a usb, are you planning to use it that way or were you going to use it to try to install Kali? If you want to try Kali, just use the usb and boot it from the BIOS.
You can get the UUID if you can boot Kali or some other Linux by using the 'blkid' command from a terminal. What system's Grub 2 are you using to try to boot Kali? The entry below should boot Kali on sdc1 if that's what your usb shows as so just try putting it in the grub.cfg file of whichevery Linux you are using to boot to try it. No need to update grub.
I have Windows installed on a SSD on my laptop (sda), OpenSUSE on my secondary drive (sdb).
To manage the dual boot, I've given the priority to Grub over Windows bootloader in BIOS... All that works and has worked for quite some time now so no problem on this side
Now, I'm trying to add to Grub menu an entry pointing to Kali Linux on a USB drive (sdc).
I know the UUID of my USB (even if it looks weird) and I'm guessing that the location of the USB drive is (hd2,1).
I've just tried what you proposed but it returned an "Error: invalid EFI file path".
I know that somehow I have to indicate the path to the efi file by doing something like
Code:
chainloader PATH_TO_BOOTLOADER
but for now I cannot find the good solution to my problem, or the good way of doing that...
Actually, I guess that if I learn to boot on my usb directly from grub console, I will find my way around the custom menu entry. Can anyone please explain me how to do that ?
Take a look at the example entry at the link below, about half way down the page under the heading "Configuring Grub". You will need to modify it to suit your drive/partition and the correct efi file, wherever that is. I don't use EFI so that's about all I can offer.
With the usb to be booted plugged in. With quirks, some bioses (uefi) cannot boot GPT partitions. The resulting grub.cfg should be using UUID or LABELs and not /dev/ names (root=UUID= vs. root=/dev/ on the linux line). If you edit grub.cfg directly, then next time update-grub runs (every update to the kernel) your changes will get deleted. In debian you're supposed to change /etc/grub.d/40_custom to have your entries inserted from there when update-grub runs. YMMV depending on distro.
With quirks, some bioses (uefi) cannot boot GPT partitions.
Could you be a bit more specific about this ? I added a menu entry in 40_custom and tried specifying different identifiers to set the root (UUID, dev/sdc, (hd2,1)) but never received anything else than an error.
I tried to use chainloader option to redirect to next bootloader located on my USB first by using "+1" option but grub could not follow up ("Error: Not found" or smtg like that)
Then I replace "+1" with the path to EFI File (EFI/BOOT/BOOTX64.efi) and received an error
Code:
Invalid EFI file path
though I'm quite sure that the path is correct...
I'm not sure if I made a mistake with root definition, if the path to EFI file should be specified on another way or if it's only because of UEFI.
If I wanted to manually boot on a USB from grub 2, what would be the "correct" method?
BTW, I'm not sure that this is related but when I use "ls" in CLI of grub2, I receive an "error: out of disk" for hd1 (which is normal because I don't have any hd1).
When USB is plugged, I have hd0 (USB), hd1 (error), hd2 (SSD) and hd3 (HDD) and when it is not, I have hd0 (error), hd1 (SSD) and hd2 (HDD).
Thanks a lot for your help
EDIT: I will try this later on (when I've access to my private computer) and give you the feedback so that you have some more concrete information to help me
I did not, I looked in grub.cfg for the windows entry (because it almost is what I want to do) and it was just specified the path to bootmgr.efi file without specifying the drive.
I will definitely do that and keep you informed then !
One point you have not clarified, you indicate in your initial post that you have "installed" Kali to a usb and then show in your menuentry for Grub "Kali Live" which is what you would see booting from a flash drive or DVD. Which is it? If it is a Live system, does it boot directly from the BIOS? If it is a Live system, I don't think an efi entry is going to work. With the Kali usb plugged in, you should easily be able to determine which drive it is seen as with fdisk.
menuentry "Boot Kali Live from USB Drive"{
insmod chain
search --no-floppy --fs-uuid --set=root EDCE-911D
chainloader ($root)/efi/boot/bootx64.efi
}
The problem was that
1) even if the path of the EFI file is all in upper case, I don't know why but grub consider it's lower case. I checked that by using ls and navigating through my drive in grub2 CLI
2) I set the root to sdc2 whereas at first I had set it to sdc1 --> as you can see, the UUID has changed and is now pointing to second partition of sdc. I checked that by comparing the output of ls (hd0,msdos2) in grub CLI and ls /dev/disks/by-uuid. Actually, that make sense because my first partition is a hidden ntfs, while the other is formatted in FAT16...
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.