LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This 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


Reply
  Search this Thread
Old 06-15-2016, 12:12 PM   #1
id2205
LQ Newbie
 
Registered: Jun 2016
Posts: 7

Rep: Reputation: Disabled
GRUB2 New menu entry pointing to USB drive


Hey guys,

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...

Thanks a lot

Last edited by id2205; 06-21-2016 at 12:52 PM.
 
Old 06-15-2016, 01:58 PM   #2
Tonus
Senior Member
 
Registered: Jan 2007
Location: Paris, France
Distribution: Slackware-15.0
Posts: 1,405
Blog Entries: 3

Rep: Reputation: 514Reputation: 514Reputation: 514Reputation: 514Reputation: 514Reputation: 514
GRUB2 New menu entry pointing to USB drive

What files are you trying to edit ?

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

Last edited by Tonus; 06-15-2016 at 02:00 PM.
 
Old 06-15-2016, 02:46 PM   #3
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,502

Rep: Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489
Quote:
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.
 
Old 06-16-2016, 04:18 AM   #4
id2205
LQ Newbie
 
Registered: Jun 2016
Posts: 7

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Tonus View Post
What files are you trying to edit ?

Basically I'd try something like this : http://askubuntu.com/questions/34412...on-a-usb-drive
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

Thank you for your answers guys
 
Old 06-16-2016, 07:28 AM   #5
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,502

Rep: Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489
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.

Quote:
menuentry 'CHAINLOAD Kali' {
insmod ext2
set root=(hd2,1)
chainloader +1
}
 
Old 06-16-2016, 09:14 AM   #6
id2205
LQ Newbie
 
Registered: Jun 2016
Posts: 7

Original Poster
Rep: Reputation: Disabled
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 ?

Last edited by id2205; 06-16-2016 at 09:28 AM.
 
Old 06-16-2016, 12:25 PM   #7
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,502

Rep: Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489
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.

http://www.rodsbooks.com/efi-bootloaders/grub2.html
 
Old 06-17-2016, 12:12 PM   #8
tnut
NuTyX Founder
 
Registered: May 2016
Location: Switzerland
Distribution: NuTyX
Posts: 136

Rep: Reputation: Disabled
I think this cannot work because the kernel needs a few seconds to find the USB stick port. We use to put:

Code:
rootdelay=5
at the end of the kernel line. But in your example, I don't see any
 
Old 06-18-2016, 02:11 PM   #9
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137
Blog Entries: 1

Rep: Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874
From the OS with grub on it.

# update-grub2

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.
 
Old 06-21-2016, 06:34 AM   #10
id2205
LQ Newbie
 
Registered: Jun 2016
Posts: 7

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Shadow_7 View Post
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

Last edited by id2205; 06-21-2016 at 06:44 AM.
 
Old 06-21-2016, 06:44 AM   #11
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,346

Rep: Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589
did you try setting the path like this?
Code:
(hd2,1)/EFI/BOOT/BOOTX64.efi
 
Old 06-21-2016, 06:55 AM   #12
id2205
LQ Newbie
 
Registered: Jun 2016
Posts: 7

Original Poster
Rep: Reputation: Disabled
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 !
 
Old 06-21-2016, 07:55 AM   #13
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,502

Rep: Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489
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.
 
Old 06-21-2016, 12:52 PM   #14
id2205
LQ Newbie
 
Registered: Jun 2016
Posts: 7

Original Poster
Rep: Reputation: Disabled
Ok I managed to do it, here is how I did:

My menu entry in 40_custom

Code:
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...

Thank you to all who helped me
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Install Linux to SATA drive but GRUB2 on to USB thumb drive Quija Linux - General 2 11-22-2011 06:40 PM
LXer: Windows entry disappeared in Grub2 menu LXer Syndicated Linux News 0 10-19-2011 01:01 AM
Cannot access bios or Grub2 menu with usb keyboard the trooper Linux - Hardware 11 09-01-2010 03:01 AM
[SOLVED] Create independent Grub2 boot loader menu in USB stick. cr4321 Linux - General 27 07-18-2010 12:48 PM
Adding a menu entry to grub2 Jeff91 Linux - General 1 08-28-2009 06:12 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:13 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration