LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-13-2018, 12:59 PM   #1
PrvSAT
LQ Newbie
 
Registered: Jun 2012
Posts: 6

Rep: Reputation: Disabled
Grub dual boot problem with the nvme


My problem is related to installation to an SSD rather that normal HD. It results instead os SDA to "nvme".
I have read and read and tried different setups but have no clue how to fix it.
I have done in the past dual boot of Ubuntu and Kodi (OpenELEC and LibreELEC) but now since I have a new system that has a M2 SSD Samsung EVO960 I have a hell of the problems.
I have done the Ubuntu 16 installation from a USB stick with no problems. I have repartitioned the drive accordingly and set the proper boot flag.
I have installed grub customizer and my problem is to properly boot from grub menu in Kodi

In the past, or on a normal drive, it was SDA, SDB, and so on but with the SSD there "nvme0n1, nvme0n1p1, nvme0n1p2, etc. This screws things up for me in custom40 file. Here is what I did and what I got:

Code:
htpc@htpc:~$ sudo blkid -c /dev/null -o list
device                        fs_type     label        mount point                       UUID
------------
/dev/loop0                    squashfs                 /snap/core/4571                   
/dev/nvme0n1                                           (in use)                          
/dev/nvme0n1p1                vfat                     /boot/efi                         633C-3EBA
/dev/nvme0n1p2                ext4                     /                                 85fb1049-5c04-4c50-ac8b-3c552dcda936
/dev/nvme0n1p3                ext4        LibreELEC    (not mounted)                     c532fde5-0eeb-454c-8459-008f9fb64253
/dev/nvme0n1p4                ext4        LibreSYS     (not mounted)                     8449179d-34df-4d19-b63d-1247b4bef996
and

Code:
htpc@htpc:~$ lsblk -o name,label,partlabel,size,uuid,mountpoint
NAME        LABEL     PARTLABEL              SIZE UUID                                 MOUNTPOINT
loop0                                       86.6M                                      /snap/core/4571
nvme0n1                                    232.9G                                      
├─nvme0n1p3 LibreELEC LibreELEC            207.6G c532fde5-0eeb-454c-8459-008f9fb64253 
├─nvme0n1p1           EFI System Partition   512M 633C-3EBA                            /boot/efi
├─nvme0n1p4 LibreSYS  LibreSYS                 3G 8449179d-34df-4d19-b63d-1247b4bef996 
└─nvme0n1p2                                 21.9G 85fb1049-5c04-4c50-ac8b-3c552dcda936 /
My custom40 file it looks like this but it was much longer since I have tried a lot of things. Something is wrong and someone knowledgeable probably will see my mistake immediately. Sometime in first variant1 it boots but most of the times it says "hd0,4 not found". Based on the info above what should I write in the custom40 file please?

Code:
#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.


menuentry "Entertainment System1" {
  set root=(hd0,4)
  linux /KERNEL boot=/dev/nvme0n1p4 disk=/dev/nvme0n1p3 quiet
}


menuentry "Entertainment System6" {
    search --file --no-floppy --set root=633C-3EBA
    chainloader (${root})/efi/bootx64.efi
    linux /KERNEL boot=/dev/nvme0n1p4 disk=/dev/nvme0n1p3 quiet
}


menuentry "Entertainment System7" {
    search --file --no-floppy --set root=633C-3EBA
    chainloader (${root})/boot/efi/bootx64.efi
    linux /KERNEL boot=/dev/nvme0n1p4 disk=/dev/nvme0n1p3 quiet
}


menuentry "Entertainment System8" {
    set root=UUID=633C-3EBA
    chainloader (${root})/boot/efi/bootx64.efi
    linux /KERNEL boot=/dev/nvme0n1p4 disk=/dev/nvme0n1p3 quiet
}


menuentry "Entertainment System9" {
    search --set=root --LABEL LibreSYS --hint hd0,4
    linux /KERNEL boot=LABEL=LibreSYS disk=LABEL=LibreELEC
}


menuentry "Entertainment System10" {
    search --set=root --LABEL=LibreSYS --hint hd0,4
    linux /KERNEL boot=LABEL=LibreSYS disk=LABEL=LibreELEC
}


menuentry "Entertainment System12" {
    set root=633C-3EBA
    linux /KERNEL boot=UUID=8449179d-34df-4d19-b63d-1247b4bef996 disk=UUID=c532fde5-0eeb-454c-8459-008f9fb64253
}


menuentry "Entertainment System21" {
  set root=(nvme0n1,nvme0n1p3)
  linux /KERNEL boot=UUID=8449179d-34df-4d19-b63d-1247b4bef996 disk=UUID=c532fde5-0eeb-454c-8459-008f9fb64253
}


menuentry "Entertainment System22" {
  set root=(nvme0n1,nvme0n1p3)
  linux /KERNEL boot=/dev/nvme0n1p4 disk=/dev/nvme0n1p3 quiet
}


menuentry "Entertainment System23" {
  set root=(nvme0n1p1,nvme0n1p3)
  linux /KERNEL boot=/dev/nvme0n1p4 disk=/dev/nvme0n1p3 quiet
}

Last edited by PrvSAT; 05-13-2018 at 01:03 PM.
 
Old 05-13-2018, 01:19 PM   #2
Keruskerfuerst
Senior Member
 
Registered: Oct 2005
Location: Horgau, Germany
Distribution: Manjaro KDE, Win 10
Posts: 2,199

Rep: Reputation: 164Reputation: 164
You need a new kernel.
Ubuntu 18.04.0......
 
Old 05-13-2018, 01:29 PM   #3
PrvSAT
LQ Newbie
 
Registered: Jun 2012
Posts: 6

Original Poster
Rep: Reputation: Disabled
Are you sure? how it could be from kernel?
Will I have SDA terminology instead of "nvme"?
 
Old 05-13-2018, 02:05 PM   #4
Keruskerfuerst
Senior Member
 
Registered: Oct 2005
Location: Horgau, Germany
Distribution: Manjaro KDE, Win 10
Posts: 2,199

Rep: Reputation: 164Reputation: 164
It is /dev/nvmexx instead of /dev/sdax.
 
Old 05-13-2018, 03:34 PM   #5
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,573

Rep: Reputation: 2499Reputation: 2499Reputation: 2499Reputation: 2499Reputation: 2499Reputation: 2499Reputation: 2499Reputation: 2499Reputation: 2499Reputation: 2499Reputation: 2499
Quote:
/dev/nvme0n1p2 ext4 /
The above from your initial post shows your / filesysttem partition which would be equivalent to sda2, n1 (drive one) p2 (partition two).
You don't seem to be using the Ubuntu grub.cfg, what are you using? Why do you not just use UUIDs. A standard Ubuntu entry will have a kernel line beginning with: linux /boot/vmlinuz?? and then the parameters Your set root line should be pointing to (hd0,gpt2). Not sure where you are getting the below from although some Linux systems use similar entries, not Ubuntu. Where do you get the /KERNEL in the entry from?

Quote:
linux /KERNEL boot=/dev/...
 
Old 05-13-2018, 07:26 PM   #6
PrvSAT
LQ Newbie
 
Registered: Jun 2012
Posts: 6

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Keruskerfuerst View Post
It is /dev/nvmexx instead of /dev/sdax.
Thanks Keruskerfuerst! Yes, that's what I have now in Ubuntu 16.04, exactly what you are de describing. So it appears that Ubuntu 18 will do the same.
My problem is to use the correct syntax in "40_custom" file and that's what don't know how to do it.

Quote:
The above from your initial post shows your / filesysttem partition which would be equivalent to sda2, n1 (drive one) p2 (partition two).
You don't seem to be using the Ubuntu grub.cfg, what are you using? Why do you not just use UUIDs. A standard Ubuntu entry will have a kernel line beginning with: linux /boot/vmlinuz?? and then the parameters Your set root line should be pointing to (hd0,gpt2). Not sure where you are getting the below from although some Linux systems use similar entries, not Ubuntu. Where do you get the /KERNEL in the entry from?
Thank you yancek! I use Ubuntu 16.04 and I have also installed Grub customizer. The last of my quote is the content of "40_custom" file found in /etc/grub.d/ so I edited it and added the menuentries in different variants, many of them I have erased. /KERNEL as I understand is still used in Ubuntu and based on older files that worked, I have built the "40_custom" file as I thought, obviously wrong.
I would use anything to make this thing work so I tried with UUID's too as it is in one of the menuentry. Using the correct syntax is the problem with me.

Last edited by PrvSAT; 05-13-2018 at 07:28 PM.
 
Old 05-13-2018, 10:52 PM   #7
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,573

Rep: Reputation: 2499Reputation: 2499Reputation: 2499Reputation: 2499Reputation: 2499Reputation: 2499Reputation: 2499Reputation: 2499Reputation: 2499Reputation: 2499Reputation: 2499
Below is a basic Ubuntu 16.04 menuentry which works.

Quote:
menuentry 'Ubuntu 16.04' {
insmod part_gpt
insmod ext2
set root='hd0,gpt6'
linux /boot/vmlinuz-4.4.0-124-generic.efi.signed root=UUID=f98155d5-9c89-48ea-9118-bf686c346caa ro quiet splash $vt_handoff
initrd /boot/initrd.img-4.4.0-124-generic
}
If you are using a Legacy or non-gpt system, replace the line: insmod part_gpt with insmod part_msdos but since you are using EFI, it is most likely a GPT partitioned drive. Your set root line needs to be similar to the above as Grub will not understand entries such as some you have in your first post: set root=(nvme0n1,nvme0n1p3)
Yours should be: set root='hd0,gpt2' or msdos2 as that is where your / (root) filesystem is and hopefully the kernel. Older versions of Linux used 'kernel' to point to the kernel file (vmlinuz in most cases) and newer versions use 'linux' so the line beginning with linux should point to the location where the kernel actually exists which on Ubuntu, should be in the boot directory. You would have to have the correct absolute path and the correct absolute name of the kernel (vmlinuz file). Ubuntu 16.04 should have the '.efi' extension.

If you installed Ubuntu last, this should all have been taken care of during the installation. Are the other two partitions different operating system or just media data? I would not expect any of the menuentries you have in your first post to boot Ubuntu. Some info on using Grub2 with Ubuntu including sample menuentries at the link below.

https://help.ubuntu.com/community/Grub2/CustomMenus

If you can't resolve this you should go to the site below from the Ubuntu install media if you can't boot the insttalled system and use the 2nd option to get boot repair. After downloading and running per the instructions, make sure you only select the option to Create BootInfo Summary and post the link to the output here. That should give more detailed information on your system and efi and other boot files.

https://help.ubuntu.com/community/Boot-Repair
 
Old 05-14-2018, 05:18 AM   #8
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,396

Rep: Reputation: 1594Reputation: 1594Reputation: 1594Reputation: 1594Reputation: 1594Reputation: 1594Reputation: 1594Reputation: 1594Reputation: 1594Reputation: 1594Reputation: 1594
for a chainloader entry it will be something like this:

menuentry "Entertainment System7" {
set root='hd0,gpt1'
chainloader /EFI/<kodi boot directory>/bootx64.efi
}

from a ubuntu terminal: sudo ls /boot/efi/EFI to see what the different boot directories are on the efi partition. bootx64.efi maybe named something else and will have to change accordingly.

Last edited by colorpurple21859; 05-14-2018 at 05:27 AM.
 
Old 05-15-2018, 06:14 AM   #9
PrvSAT
LQ Newbie
 
Registered: Jun 2012
Posts: 6

Original Poster
Rep: Reputation: Disabled
Hi guys and thank you very much for the help!

The truth is I am all over the place and I cannot get a proper config to work reliably. I am running around like a chicken without head and it seem that is beyond my capability.
Here is an overview of what I have and what I did.
- The computer is a Intel NUC Skull Canyon NUC6i7KYK Kit with 6th Gen. Intel Core i7 Processor, 8Gb ram and 256 M2.SSD. This M2.SSD gave me the headaches since Ubuntu recognize it as "nvme0n1" instead of SDA.
- I have installed with no problems Ubuntu 16.04/64bit from a USB stick, it is formatted as GPT. As few times before on other PC configs, with GParted I have created another two partitions, so there is 1st partition EFI auto created by Ubuntu, the 2nd is with Ubuntu and two others formated in EXT4: "nvme0n1p4" called LibreSYS that is bootable (this is the 4th partition) and "nvme0n1p3" called LibreELEC that holds the data (3rd partition). As known by media community, Kodi (LibreELEC) requires two partitions, one for boot and one where the actual app resides.
- I have installed Kodi (LibresELEC) same as many times before and I was supposed to go back in Ubuntu, install the grub customizer, create the menuentry for Kodi and done so that at grub menu, I could choose to go into Ubuntu or Kodi.
I ran into problems at this point because what I knew and my old config of "40_custom" file did not work anymore.

Now here is the strangest thing... With this config,
Code:
menuentry "Entertainment System1" {
  set root=(hd0,4)
  linux /KERNEL boot=/dev/nvme0n1p4 disk=/dev/nvme0n1p3 quiet
}
sometimes it boots in Kodi when selected in menu but other times it shows "cannot find hd0,4) or /KERNEL not found. If I take out "/Kernel" doesn't work at all and this is weird!
Ever since I have tried a lot of combinations but none of them worked.

"yancek": I have wrote "set root='hd0,gpt2'" and in Ubuntu root I do have the vmlinuz file. I have tried various combinations based on your suggestions without luck. I am tempted to try boot repair app as suggested but I do not want to screwup the whole installation since I believe it is correct, it is just this damned menu to have correct pointing.

"colorpurple21859": the chainloader is something new for me and have no clue how to use it.

Last edited by PrvSAT; 05-15-2018 at 06:18 AM.
 
Old 05-15-2018, 07:18 AM   #10
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,396

Rep: Reputation: 1594Reputation: 1594Reputation: 1594Reputation: 1594Reputation: 1594Reputation: 1594Reputation: 1594Reputation: 1594Reputation: 1594Reputation: 1594Reputation: 1594
If LibreELEC was installed in efi mode then there should be a folder that was created by LibreELEC on the efi partition with a boot file in it. This boot file is what you chainload. I don't use LibreELEC but did download the install file to see what was on it. It looks like LibreELEC uses syslinux for booting and /kernel is the kernel that runs the system. similar to /vmlinuz on the Ubuntu partition. If your booting the system with a usb stick inserted maybe causing the grub confusion. See if it makes a difference if the usb stick is inserted or not when first turned on.

Last edited by colorpurple21859; 05-15-2018 at 07:47 AM.
 
Old 02-25-2019, 06:12 PM   #11
catmandew
LQ Newbie
 
Registered: Feb 2019
Posts: 1

Rep: Reputation: Disabled
Talking grub hack to dual boot with Windows on an NVMe drive

I had a similar problem & found an odd solution that might work for some.

Windows 10 Pro was installed on an NVMe M.2 drive.
Wanted to install CentOS 7 and had a spare NVMe M.2 drive, so installed CentOS 7 on it.
Could boot into CentOS 7 but needed to add menu item & commands in grub to boot Windows.
Couldn't figure out how to reference NVMe M.2 drive & partition with Windows on it to get commands right.
In boot loader, happened to enter "c" to get to command line, still couldn't figure it out, so entered "exit" & hit return.
.... and the system then booted Windows. Aha moment followed. Hack implemented & tested & works for me (YMMV).

Solution:
1. Set boot order in UEFI/BIOS to boot CentOS drive first & Windows drive second (well, not first).
2. Edit /etc/grub.d/40_custom & add the following (obviously, use the menuentry label of your choice):
menuentry "Windows 10" {
exit
}
3. Run grub2-mkconfig --output=/boot/efi/EFI/centos/grub.cfg
4. Reboot.
5. Laugh.
 
Old 02-12-2021, 01:18 AM   #12
N8ZF
LQ Newbie
 
Registered: Feb 2021
Posts: 1

Rep: Reputation: Disabled
Thumbs up catmandew = genius (dual nvme grub boot) (dual PCIe grub boot)

Quote:
Originally Posted by catmandew View Post
Solution:
1. Set boot order in UEFI/BIOS to boot CentOS drive first & Windows drive second (well, not first).
2. Edit /etc/grub.d/40_custom & add the following (obviously, use the menuentry label of your choice):
menuentry "Windows 10" {
exit
}
3. Run grub2-mkconfig --output=/boot/efi/EFI/centos/grub.cfg
4. Reboot.
5. Laugh.
THIS IS AWSOME!! Works on Ubuntu20.04-LTS with M.2 SSD for windows.
I had the same problem and tried several solutions (which wasted hours). This really works. I have always been a little intimidated by GRUB. I used the GUI grub-customizer. The menuentry you create makes another one at runtime. This second entry only has
Code:
setparams "Windows 10" exit
. Nice solution but you still needed to select the new entry at runtime/grub boot. I wanted to default to my windows partition if I let the timer expire so I added this to grub-customizer and set it as the default. It works. I am impressed with this and had to give catmandew a big high 5. Sorry to bump an old thread, but this is clearly a somewhat common issue with dual booting and this is the first workaround I've seen work.
 
  


Reply

Tags
dual boot, grub2, nvme



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How to Dual Boot Windows 10 and Slackware on NVME SSD ALVAN Slackware 8 05-30-2017 04:39 AM
Can't select XP OS in a dual boot at boot screen (grub problem i think) incz Linux Mint 1 06-08-2011 05:52 AM
[SOLVED] Can't select XP OS in a dual boot with Isadora at boot screen (grub problem) faby1321 Linux Mint 10 08-10-2010 06:07 PM
grub problem with dual-boot maiden2 Ubuntu 5 08-02-2008 05:04 AM
GRUB dual boot problem: Boot "other" (windows) just restarts GRUB! stevod333 Linux - Software 13 04-06-2006 05:26 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:52 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