Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Trouble dual booting with factory-installed Ubuntu
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
Punchcutter
Guru
Guru


Joined: 11 Feb 2007
Posts: 329

PostPosted: Fri Nov 18, 2016 3:22 am    Post subject: Trouble dual booting with factory-installed Ubuntu Reply with quote

I have a sorta complicated tale, and don't know how to relay all details, but will start out and hope that someone can point the way toward a solution.

I have taken a Dell Precision 3510 with factory installed Ubuntu 14.04, resized and repartitioned on the SSD, and done a Gentoo install into it. The partition table looks like this:
Code:
(parted) p                                                               
Model: Unknown (unknown)
Disk /dev/nvme0n1: 512GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system     Name                  Flags
 1      1049kB  525MB   524MB   fat32           EFI system partition  boot
 2      525MB   3747MB  3221MB  fat32           Recovery              msftdata
 3      3747MB  45.7GB  41.9GB  ext4            Factory Ubuntu 14.04
 5      45.7GB  45.8GB  105MB   ext2            Main Linux Boot       boot
 7      45.8GB  477GB   431GB   ext4            Main Linux Root
 6      477GB   494GB   17.2GB  linux-swap(v1)  Main Linux Swap
 4      494GB   512GB   17.8GB  linux-swap(v1)  Hibernate Store


I have followed the usual handbook instructions for installing. I mounted the above partition 1 (EFI system partition) temporarily as /efiboot, and installed grub (according to handbook) with
Code:
grub-install --target=x86_64-efi --efi-directory=/efiboot
I recall it succeeded, but don't remember what the output was :( Of course I did grub-mkconfig, and it behaved as expected.

Now when I try to boot, this is what happens: With UEFI boot mode active in the BIOS settings (but "secure boot" off), if I just cold start, it goes right into Ubuntu, with no grub menu or anything.
So I think... maybe I need to try to start by booting first off a USB stick, so I get a System Rescue CD stick, and boot from that (after changing BIOS boot mode to "legacy").

From the Sysresccd main menu, I choose Boot an existing Linux system installed on the disk. Now, it looks like it's booting my Gentoo, with the usual sort of console gunk that I have no idea what it means, stops and asks me to choose a keymap (odd?), but then dies with this:
Code:
>> Searching a root filesystem having /sbin/init
>> File /sbin/init found on already mounted filesystem, link created in /newroot
>> Checking /sbin/init can be executed by the current kernel...
readelf: Error: '/newroot/sbin/init': No such file
   /sbin/init on the root filesystem is an  binary
   The current running kernel architecture is x86_64
mount: mounting /dev on /newroot/dev failed: No such file or directory
!! /sbin/init not found on root filesystem
!! Running a mini shell (cannot complete the boot process)

(EDIT: I think the above paragraph might actually be describing Sysresccd trying to reboot itself, rather than something on the main SSD. Not sure about that - just a hunch).

Another thing I tried, from Sysresccd, is hitting TAB to edit the boot command, and going into grubdisk. This gives me a Grub2 menu. If I choose Detect any operating system, it seems to find only the Ubuntu (going by kernel version numbers-I didn't bother actually booting). If I do Detect any GRUB2 installation (even if mbr is overwritten), I get just a bare console error saying "Error: Could not find any grub2 installation files".

If anyone can help me fix this, I'll be very grateful. I'm even willing to always boot the thing off the Sysresccd USB stick if that's what it takes :)


Last edited by Punchcutter on Fri Nov 18, 2016 10:17 pm; edited 1 time in total
Back to top
View user's profile Send private message
Lokesh
Tux's lil' helper
Tux's lil' helper


Joined: 01 Apr 2012
Posts: 131

PostPosted: Fri Nov 18, 2016 10:42 am    Post subject: Reply with quote

Hello Punchcutter,

0. [an EDIT] if Ubuntu was pre-installed, why did you make another grub install? There is no need. Mount the existing ESP to the /boot/efi directory only. This is my /boot directory of the 2nd Linux:
Code:
ls /boot
config-4.4.26-gentoo  efi  initramfs-genkernel-x86_64-4.4.26-gentoo  System.map-4.4.26-gentoo  vmlinuz-4.4.26-gentoo
And this from my first Linux:
Code:
ls /boot
efi  config-4.8.0-1-amd64  grub  initrd.img-4.8.0-1-amd64  System.map-4.8.0-1-amd64  vmlinuz-4.8.0-1-amd64
Grub was installed once only for the first Linux

1. the flag for the EFI system partion in my case is "boot, esp", yours is "boot" only. You should check whether your booted System did so in EFI mode, e.g.
ls /sys/firmware/efi/efivars (if empty--> no efi boot).

2. ESP should be mounted to /boot or /boot/efi. I am not sure whether /efiboot will work. Grub-install will not moan about a wrong ESP.

3. you have the boot flag set for two partitions on the same disk. Never tried that myself but I would anticipate problems.

4. I believe you mix up /boot, which is a directory, and the boot flag. The minimum requirement for a system are 2 partitions only, the EFI system partition and the root partition. This is my partition table for a dual boot with 2 Linuxes:
Code:
Nummer  Anfang  Ende    Größe   Dateisystem  Name    Flags
 1      1049kB  250MB   249MB   fat32        boot    boot, esp
 2      250MB   40,2GB  40,0GB  ext4         Debian
 3      40,2GB  61,2GB  21,0GB  ext4         Gentoo
I am having each a /boot directory on /dev/sda2 and another in /dev/sda3. There is only one single ESP on /dev/sda1 which is mounted to /boot/efi respectively (as per /etc/fstab).

5. In order to get this work, you should create a initramfs, without it the OS were unable to mount the ESP and would not start.

6. Finally, if all is set correctly, an "update-grub" should do the trick with adding the 2nd OS to the grub menu.

Hope this helps.
Lokesh
_________________
Sometimes frustrated Linux User
Back to top
View user's profile Send private message
Punchcutter
Guru
Guru


Joined: 11 Feb 2007
Posts: 329

PostPosted: Fri Nov 18, 2016 10:14 pm    Post subject: Reply with quote

Hi Lokesh... thanks for the helpful response.

Lokesh wrote:
0. [an EDIT] if Ubuntu was pre-installed, why did you make another grub install? There is no need.
Uhhhh, I'm not sure :oops: except that I am in the habit of following the handbook instructions and have always needed to install a bootloader before :lol: Well.... the real reason is probably that when I boot the machine without doing anything out of the ordinary, it goes straight into Ubuntu. There's no grub menu. It did that originally, before Gentoo install, and still doing it now. I don't know how to get grub into a position so that I will get a grub menu when I cold boot!

Quote:
1. the flag for the EFI system partion in my case is "boot, esp", yours is "boot" only.
I double checked this with Sysresccd and fixed it. Now my ESP has boot, esp, and those flags are removed from my Gentoo boot partition.

Quote:
You should check whether your booted System did so in EFI mode, e.g. ls /sys/firmware/efi/efivars (if empty--> no efi boot).
When I tried this within the Ubuntu system, it gave lots of output, therefore I guess it booted in EFI mode. Which is as I expect, because my "BIOS" settings are set to "UEFI boot mode; non secure".

Quote:
2. ESP should be mounted to /boot or /boot/efi. I am not sure whether /efiboot will work. Grub-install will not moan about a wrong ESP.
But the ESP should never need to be mounted during normal operations, should it? Since /boot doesn't need to be mounted while running, I can't imagine the ESP needs to be mounted. Is that correct?

Quote:
5. In order to get this work, you should create a initramfs, without it the OS were unable to mount the ESP and would not start.
Originally when doing genkernel, I avoided the initramfs, because I usually think I don't need it, but when I started having troubles, I went back into the install procedure and reran "genkernel all" to get the initramfs, but it didn't solve any of the problems I've reported.

Quote:
6. Finally, if all is set correctly, an "update-grub" should do the trick with adding the 2nd OS to the grub menu.
Hmmmm... should I try this, just to grasp at straws?? :)

Thanks again. At this point, I guess my main problem is: How do I get grub to give me its menu when I boot up? If I can get that to happen, I think any other problems can be solved fairly straightforwardly. I wonder if Dell is doing some kind of "magic" to avoid having the grub menu be shown to the user?
Back to top
View user's profile Send private message
Punchcutter
Guru
Guru


Joined: 11 Feb 2007
Posts: 329

PostPosted: Sat Nov 19, 2016 4:45 am    Post subject: Reply with quote

OK, my problem is not quite solved yet, but I am now booting my Gentoo install. I found the way to boot off of Sysresccd, by going into grubdisk, then choosing "Detect any Grub2 configuration files". It finds the one on my Gentoo /boot partition, and now I'm running (after fixing my kernel to include drivers for my SSD, which genkernel, in its wisdom, somehow managed to set as M rather than Y). However, I'd still like to know how I can get a Grub2 menu to appear when I boot up, so I can choose Gentoo or Ubuntu, and not have to boot off a stick all the time.
Back to top
View user's profile Send private message
cwr
Veteran
Veteran


Joined: 17 Dec 2005
Posts: 1969

PostPosted: Sun Nov 20, 2016 4:07 pm    Post subject: Reply with quote

You might try:

http://askubuntu.com/questions/16042/how-to-get-to-the-grub-menu-at-boot-time

Hope this helps - Will
Back to top
View user's profile Send private message
Lokesh
Tux's lil' helper
Tux's lil' helper


Joined: 01 Apr 2012
Posts: 131

PostPosted: Mon Nov 21, 2016 10:56 am    Post subject: Reply with quote

..
_________________
Sometimes frustrated Linux User


Last edited by Lokesh on Mon Nov 21, 2016 11:47 am; edited 2 times in total
Back to top
View user's profile Send private message
Lokesh
Tux's lil' helper
Tux's lil' helper


Joined: 01 Apr 2012
Posts: 131

PostPosted: Mon Nov 21, 2016 11:45 am    Post subject: Reply with quote

Punchcutter wrote:
Now my ESP has boot, esp, and those flags are removed from my Gentoo boot partition.
In your first post the boot flag was set to the Main Linux Boot, supposedly Ubuntu? Only one partion shoud carry the "boot,esp" flag, which is the $ESP (/dev/sda1 in your case). Again, there is no need for a separate /boot partition in your setting. Keep /boot as a directories on each of your "/" (root) partitions. Please post your fstab and I can tell you how it should be changed.

Punchcutter wrote:
But the ESP should never need to be mounted during normal operations, should it?
Who said that?
Punchcutter wrote:
Since /boot doesn't need to be mounted while running, I can't imagine the ESP needs to be mounted. Is that correct?
Don't know for sure, but during boot, both ESP and /boot need to be mounted. I always put this info into the corresponding fstab(s). Genkernel picks its information from this file, so any change to the fstab may require 1) create the initramfs again, 2) run update-grub. It is a good habit if you do not yet understand all details, and they are of no harm.

Punchcutter wrote:
Originally when doing genkernel, I avoided the initramfs, because I usually think I don't need it, but when I started having troubles, I went back into the install procedure and reran "genkernel all" to get the initramfs, but it didn't solve any of the problems I've reported.
Did you run update-grub from your Ubuntu installation afterwards?

Punchcutter wrote:
Hmmmm... should I try this, just to grasp at straws?? :)
Whenever you change something on your boot partition or grub setting, you must run update-grub.

Punchcutter wrote:
Thanks again. At this point, I guess my main problem is: How do I get grub to give me its menu when I boot up?
What is listed in your /etc/default/grub for "GRUB_TIMEOUT= " ? Is "GRUB_HIDDEN_TIMEOUT" commented out (line should begin with a hash)? Don't forget update-grup afterwards! Try this setting:
Code:
sudo nano -w /etc/default/grub
GRUB_DEFAULT=0
# GRUB_HIDDEN_TIMEOUT=0
# GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=3


Alternatively, keep ticking on the arrow down button at start up, this will bring up the boot menu.
Punchcutter wrote:
I wonder if Dell is doing some kind of "magic" to avoid having the grub menu be shown to the user?
sigh...better read the excellent Ubuntu documentation on Grub2.

Lokesh
_________________
Sometimes frustrated Linux User
Back to top
View user's profile Send private message
Punchcutter
Guru
Guru


Joined: 11 Feb 2007
Posts: 329

PostPosted: Tue Dec 06, 2016 12:14 am    Post subject: Reply with quote

Lokesh (and others)..... I am getting back to looking at this stuff... specifically installing my first new kernel since that time... and I am looking for the "update-grub" command, and not finding it! I cannot find it in /usr/sbin along with all the other grub commands... or anywhere else for that matter (did a find / , but nothing). How can I not have this?? Thanks.

FWIW, I note that the wiki page doesn't mention it....
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum