Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Problem with dual boot
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
enrico68
Apprentice
Apprentice


Joined: 21 Oct 2016
Posts: 169

PostPosted: Sun Nov 13, 2016 11:27 am    Post subject: Problem with dual boot Reply with quote

Hello,

I spent the last few hours trying to dual boot into Windows 10 and Gentoo. I installed the os-prober, and, in /etc/grub.d/40 I entered the following lines:
Code:
menuentry 'Windows 10' {
    set root='hd0,1)'
    chainloader +1
}



Now, when I boot my PC, the Windows 10 line is there, but I get the message: no hd0, msdos1 found... and /grub/x86_64-efi/part.mod not found...

The two OS are installed on two separate disks, Windows 10 with an msdos partition, and Gentoo with a GPT partition. It is evident my solution is not correct,

I already tried to run

Code:
emerge --ask --newuse sys-boot/os-prober


and, when running:

Code:
grub-mkconfig -o /boot/grub/grub.cfg


I get:

Code:
tux erpino # grub-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.4.26-gentoo
Found linux image: /boot/vmlinuz-4.4.26-gentoo.old
done


with no Windows 10 to show.

I hope someone can shed a light on this, as I am curious to see what the solution is.

enrico
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21630

PostPosted: Sun Nov 13, 2016 3:37 pm    Post subject: Reply with quote

That unbalanced parenthesis looks wrong to me. I have not used grub in a long time, but from what I remember, its syntax should be (hdN,M) where N and M are numbers appropriate to the drive and partition you want to use.
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


Joined: 09 Dec 2006
Posts: 7651
Location: Goose Creek SC

PostPosted: Sun Nov 13, 2016 6:51 pm    Post subject: Reply with quote

agree about parentheses
did you run os-prober after you emerged it?
with the boot partition mounted at /boot, run
Code:
os-prober | wgetpaste -t
post url returned. If that does not produce a reference to a microsoft OS, try
Code:
emerge ntfs3g
mkdir /mnt/win
mount /dev/sda2 /mnt/win
os-prober | wgetpaste -t
grub-mkconfig -o /boot/grub/grub.cfg
wgetpaste -t /boot/grub/grub.cfg
post url's
_________________
Defund the FCC.
Back to top
View user's profile Send private message
enrico68
Apprentice
Apprentice


Joined: 21 Oct 2016
Posts: 169

PostPosted: Sun Nov 13, 2016 10:01 pm    Post subject: Reply with quote

Hi DONAHUE,

Quote:
agree about parentheses


The parentheses is there, I must have missed it while typing.

Quote:
did you run os-prober after you emerged it?


I did run
Code:
grub-mkconfig -o /boot/grub/grub.cfg
after emerging os-prober.

Quote:
with the boot partition mounted at /boot, run
Code:
os-prober | wgetpaste -t
post url returned.


I ran it, but there is nothing to read. I am doing it not from the sysrsccd, but from my Gentoo hard disk.


If that does not produce a reference to a microsoft OS, try

Code:
emerge ntfs3g
mkdir /mnt/win
mount /dev/sda2 /mnt/win
os-prober | wgetpaste -t
grub-mkconfig -o /boot/grub/grub.cfg
wgetpaste -t /boot/grub/grub.cfg
post url's

I did the first part, "emerge ntfs3g, and then I stopped. I have sda with Windows, and sdb with Gentoo. Is the :mount /dev/sda2 /mnt/win correct, given my disk setup?

enrico

edit: I just checked
Code:
grub-mkconfig -o /boot/grub/grub.cfg
, and I get an error:
Code:
 /usr/sbin/grub-mkconfig: line 235: /boot/grub/grub.cfg.new: No such file or directory
.

This is where that line 235 is:

Code:
if test "x${grub_cfg}" != "x"; then
  rm -f "${grub_cfg}.new"
  oldumask=$(umask); umask 077
  exec > "${grub_cfg}.new.


I think this has to be fixed first, before we go any further...

enrico


Last edited by enrico68 on Sun Nov 13, 2016 10:34 pm; edited 2 times in total
Back to top
View user's profile Send private message
enrico68
Apprentice
Apprentice


Joined: 21 Oct 2016
Posts: 169

PostPosted: Sun Nov 13, 2016 10:10 pm    Post subject: Reply with quote

Hu wrote:
That unbalanced parenthesis looks wrong to me. I have not used grub in a long time, but from what I remember, its syntax should be (hdN,M) where N and M are numbers appropriate to the drive and partition you want to use.


I have Windows 10 on sda, and the boot partition is the first one of that disk, that is why I entered (hd0,1).

enrico
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


Joined: 09 Dec 2006
Posts: 7651
Location: Goose Creek SC

PostPosted: Sun Nov 13, 2016 11:01 pm    Post subject: Reply with quote

Good, but Hu is trying to point out that
Quote:
menuentry 'Windows 10' {
set root='hd0,1)'
chainloader +1
}
should likely be
Quote:
menuentry 'Windows 10' {
set root='(hd0,1)'
chainloader +1
}
since most programming languages require an opening ( for every closing )
_________________
Defund the FCC.
Back to top
View user's profile Send private message
enrico68
Apprentice
Apprentice


Joined: 21 Oct 2016
Posts: 169

PostPosted: Mon Nov 14, 2016 6:18 pm    Post subject: Reply with quote

Hi DONAHUE,

I think you are referring to the parenthesis before "hd0,1", where I show "hd0,1)"; but it should be "(hd0,1)". If this is it, it's in there, I just copied and pasted it incorrectly.
Back to top
View user's profile Send private message
keyson
l33t
l33t


Joined: 10 Jun 2003
Posts: 830
Location: Sweden

PostPosted: Mon Nov 14, 2016 7:38 pm    Post subject: Reply with quote

Hi Enrico.

Windows10 use efi boot on a gpt partition.

So you need the part_gpt module to read it. Then You may boot it by running the os prober.
My grub.cfg has this. after probing. Windows on second disk.

Code:

### BEGIN /etc/grub.d/30_os-prober ###
menuentry 'Windows Boot Manager (på /dev/sdb2)' --class windows --class os $menuentry_id_option 'osprober-efi-XXXX-XXXX' {
        savedefault
        insmod part_gpt
        insmod fat
        set root='hd1,gpt2'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd1,gpt2 --hint-efi=hd1,gpt2 --hint-baremetal=ahci1,gpt2  XXXX-XXXX
        else
          search --no-floppy --fs-uuid --set=root XXXX-XXXX
        fi
        chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}
### END /etc/grub.d/30_os-prober ###


(Replaced the efi id by XXXX-XXXX)
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


Joined: 09 Dec 2006
Posts: 7651
Location: Goose Creek SC

PostPosted: Mon Nov 14, 2016 10:56 pm    Post subject: Reply with quote

@ keyson
IIRC, Enrico has Windows 10 on an MSDOS labeled labeled disk, not on a gpt disk.

He may have to use "bios" or legacy grub to achieve dual boot. Grub2 is appearing to be either or.
_________________
Defund the FCC.
Back to top
View user's profile Send private message
enrico68
Apprentice
Apprentice


Joined: 21 Oct 2016
Posts: 169

PostPosted: Tue Nov 15, 2016 12:13 pm    Post subject: Reply with quote

DONAHUE wrote:
@ keyson
IIRC, Enrico has Windows 10 on an MSDOS labeled labeled disk, not on a gpt disk.

He may have to use "bios" or legacy grub to achieve dual boot. Grub2 is appearing to be either or.


Exactly, I have an MSDOS labeled disk for Windows 10. I was actually coming to the same conclusion, to use "Legacy Grub", instead of GRUB 2.0, I can try that out and report back. Just one question before I proceed:

as I have said a few posts back, whenever I run
Code:
grub-mkconfig -o /boot/grub/grub.cfg


I get an error message:
Code:
 /usr/sbin/grub-mkconfig: line 235: /boot/grub/grub.cfg.new: No such file or directory
and here is the part where line 235 seats:

Code:
if test "x${grub_cfg}" != "x"; then
  rm -f "${grub_cfg}.new"
  oldumask=$(umask); umask 077
  exec > "${grub_cfg}.new.


What I did, and that was for sure a mistake, I tried to run a cd called "Boor Repair Disk", to see if that would fix my GRUB issue, but, since running it, it must have created a new "${grub_cfg}.new file, that gives back the error. How can I fix it? I know I should not touch that grub_cfg. file, that is why I want to get someone's help before I mess it up even more...once that is done, I will try and see if I can get around the Grub Legacy thing...that file, I checked, is empty, there is nothing in it...
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


Joined: 09 Dec 2006
Posts: 7651
Location: Goose Creek SC

PostPosted: Tue Nov 15, 2016 2:10 pm    Post subject: Reply with quote

The "don't touch grub.cfg" can be ignored safely. Inspired by the developer's conceit that their work would be universal and perfect.
It is ephemeral, designed to be rerun every time the kernel name changes, works just as well to rerun it every time we screw it up!
_________________
Defund the FCC.
Back to top
View user's profile Send private message
enrico68
Apprentice
Apprentice


Joined: 21 Oct 2016
Posts: 169

PostPosted: Tue Nov 15, 2016 3:12 pm    Post subject: Reply with quote

I see...but then, again, how can I fix that problem? Is there a way to somehow revert it back to "factory conditions", as it was before my "ingenious" decision to run Boot Repair Disk???
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


Joined: 09 Dec 2006
Posts: 7651
Location: Goose Creek SC

PostPosted: Tue Nov 15, 2016 4:44 pm    Post subject: Reply with quote

You can unmerge grub, re-emerge grub, rerun grub-install, rerun grub-mkconfig. Should restore to original condition. I do not know that grub2 for efi is capable of running chainloader to/on an msdos labeled disk. Also I do not know that it won't. You have the good luck to be my first case like this.
_________________
Defund the FCC.
Back to top
View user's profile Send private message
enrico68
Apprentice
Apprentice


Joined: 21 Oct 2016
Posts: 169

PostPosted: Tue Nov 15, 2016 6:11 pm    Post subject: Reply with quote

Quote:
You have the good luck to be my first case like this.


AH ah ah...well, let me first sort the grub configuration out first, then we'll address the dual booting. This is getting interesting. I am actually thinking of installing GRUB Legacy, and give it a try, I can always unmerg it and try with GRUB 2.0, again. I'll let you know when I am done, let's see where this will take me. Will keep you posted!

Enrico
Back to top
View user's profile Send private message
enrico68
Apprentice
Apprentice


Joined: 21 Oct 2016
Posts: 169

PostPosted: Tue Nov 15, 2016 7:07 pm    Post subject: Reply with quote

Just a quick question, as I have never unmerged a package before: is this the correct command to uninstall GRUB?
Code:
emerge --unmerge grub:2


If it is the correct command, do I need to do anything else, before I emerge grub again?

Enrico
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


Joined: 09 Dec 2006
Posts: 7651
Location: Goose Creek SC

PostPosted: Tue Nov 15, 2016 7:57 pm    Post subject: Reply with quote

that's good. or emerge -C grub
_________________
Defund the FCC.
Back to top
View user's profile Send private message
bandreabis
Advocate
Advocate


Joined: 18 Feb 2005
Posts: 2490
Location: イタリアのロディで

PostPosted: Wed Jan 04, 2017 12:11 pm    Post subject: Reply with quote

keyson wrote:
Hi Enrico.

Windows10 use efi boot on a gpt partition.

So you need the part_gpt module to read it. Then You may boot it by running the os prober.
My grub.cfg has this. after probing. Windows on second disk.

Code:

### BEGIN /etc/grub.d/30_os-prober ###
menuentry 'Windows Boot Manager (på /dev/sdb2)' --class windows --class os $menuentry_id_option 'osprober-efi-XXXX-XXXX' {
        savedefault
        insmod part_gpt
        insmod fat
        set root='hd1,gpt2'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd1,gpt2 --hint-efi=hd1,gpt2 --hint-baremetal=ahci1,gpt2  XXXX-XXXX
        else
          search --no-floppy --fs-uuid --set=root XXXX-XXXX
        fi
        chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}
### END /etc/grub.d/30_os-prober ###


(Replaced the efi id by XXXX-XXXX)


Hi keyson,

could you tell me how your Windows HD is partitioned?
Is your PC a notebook or a Desktop?
In my case the problem seems to reside in having a HP notebook, so that windows on the second HD wants some data on the first one, screwing it up.

Many thanks.

Andrea
_________________
Il numero di post non fa di me un esperto! Anzi!
Back to top
View user's profile Send private message
Roman_Gruber
Advocate
Advocate


Joined: 03 Oct 2006
Posts: 3846
Location: Austro Bavaria

PostPosted: Thu Jan 05, 2017 10:40 am    Post subject: Reply with quote

Quote:
set root='hd1,gpt2'


as you can see, the partitino activated is root='hd1,gpt2'

I assume the numbering start at 0, so it is a second drive

you just need to activate your windows responsible partition, check grub documentation how the drives are numbered

The more interesting question is how to keep windows from overwriting the UEFI settings / bootloader
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