Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
GRUB2 wants to boot from sda4 instead of sdd4.
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
Spanik
Guru
Guru


Joined: 12 Dec 2003
Posts: 457
Location: Belgium

PostPosted: Wed Mar 30, 2016 7:21 pm    Post subject: GRUB2 wants to boot from sda4 instead of sdd4. Reply with quote

I did a new install and during the install from the livecd the disks were as follows:
sda: new sdd for OS where everything is installed now
sdb: internal hd where I keep spare copies of important files
sdc: first raid array on the Areca controller
sdd: the second rais array on the controller

As usual after booting the new kernel this one finds the disks as follows:
sda: raid array 1
sdb: raid array 2
sdc: new ssd with the OS
sdd: the copy disk

Now before with Grub this was simple, just edit grub.conf and change to root=/dev/sdc4 and done. But with this Grub2 you cannot change such things in the grub.cfg.

I pressed 'e' on the bootscreen and changed the last line to root=/dev/sdc4 and it booted. But from what I understand from reading on the net, the next time I add a kernel (*) and run the update it will change back. How can I make sure this stays this way and stays this way for each new kernel I add?

I always keep the first kernel that boots as this is often one where I leave out stuff that I rarely use. So I have one that I'm sure of will boot so I don't need a livecd.

Long live plain text config files!
_________________
Expert in non-working solutions
Back to top
View user's profile Send private message
Syl20
Guru
Guru


Joined: 04 Aug 2005
Posts: 564
Location: France

PostPosted: Thu Mar 31, 2016 12:13 pm    Post subject: Re: GRUB2 wants to boot from sda4 instead of sdd4. Reply with quote

Spanik wrote:
But with this Grub2 you cannot change such things in the grub.cfg.

Yes, you can. You just have to omit the grub-update (or update-grub ?) command when installing a new kernel, and change the kernel entries to point to symlinks in grub.cfg (when compiling a new lernel, the "make install" command is able to maintain these symlinks). Then, you use grub 2 as you used grub.

Quote:
But from what I understand from reading on the net, the next time I add a kernel (*) and run the update it will change back. How can I make sure this stays this way and stays this way for each new kernel I add?

I suppose the grub update script reads /etc/fstab, doesn't it ? So, if the "/" entry is correct, grub should update grub.cfg correctly.
Back to top
View user's profile Send private message
Spanik
Guru
Guru


Joined: 12 Dec 2003
Posts: 457
Location: Belgium

PostPosted: Fri Apr 01, 2016 8:40 pm    Post subject: Reply with quote

Well, right now I edited grub.cfg as I don't know the "correct" procedure to do this. So yes, it can be done. But I'm not very sure it should be done on a file that starts with "DO NOT EDIT THIS FILE"...

Could be that it reads from /etc/fstab, don't know. (but I did had to change fstab as well of course) I read somewhere it reads from /etc/conf.d/default but I couldn't find anything there that makes sense to this issue.
_________________
Expert in non-working solutions
Back to top
View user's profile Send private message
C5ace
Apprentice
Apprentice


Joined: 23 Dec 2013
Posts: 286
Location: Brisbane, Australia

PostPosted: Sat Apr 02, 2016 10:47 am    Post subject: Reply with quote

Spanik wrote:
Well, right now I edited grub.cfg as I don't know the "correct" procedure to do this. So yes, it can be done. But I'm not very sure it should be done on a file that starts with "DO NOT EDIT THIS FILE"...

Could be that it reads from /etc/fstab, don't know. (but I did had to change fstab as well of course) I read somewhere it reads from /etc/conf.d/default but I couldn't find anything there that makes sense to this issue.


Why do you use Grub2 insted of grub-static?
Back to top
View user's profile Send private message
Syl20
Guru
Guru


Joined: 04 Aug 2005
Posts: 564
Location: France

PostPosted: Mon Apr 04, 2016 9:26 am    Post subject: Reply with quote

Spanik wrote:
Well, right now I edited grub.cfg as I don't know the "correct" procedure to do this. So yes, it can be done. But I'm not very sure it should be done on a file that starts with "DO NOT EDIT THIS FILE"...

The "DO NOT EDIT" sentence is there to warn you that, if you use the update command, the grub.cfg file will be erased. But, if you don't use it, no problem.
For example, this is the file I use on my systems (with a custom theme) :
Code:
# cat /boot/grub/grub.cfg
set timeout=10
set default=0
set root='hd0,5'

insmod gfxmenu
insmod vbe
insmod png
terminal_output gfxterm
loadfont ($root)/boot/grub/themes/perso/dejavu_10.pf2
loadfont ($root)/boot/grub/themes/perso/dejavu_12.pf2
loadfont ($root)/boot/grub/themes/perso/dejavu_14.pf2
loadfont ($root)/boot/grub/themes/perso/dejavu_16.pf2
loadfont ($root)/boot/grub/themes/perso/dejavu_bold_14.pf2
set theme=($root)/boot/grub/themes/perso/theme.txt
export theme

menuentry 'Gentoo' {
        echo    'Chargement de vmlinuz...'
        linux   /boot/vmlinuz root=/dev/sda5 ro
}
menuentry 'Gentoo single' {
        echo    'Chargement de vmlinuz...'
        linux   /boot/vmlinuz root=/dev/sda5 ro single
}
menuentry 'Gentoo version precedente' {
        echo    'Chargement de vmlinuz.old...'
        linux   /boot/vmlinuz.old root=/dev/sda5 ro
}

menuentry "Memtest86+" {
        linux16 /boot/memtest86plus/memtest
}

And the symlinks (as I already said, one created once, they're updated by the "make install" command) :
Code:
# ll /boot
total 21M                                                                                                                             
drwxr-xr-x  3 root root 4,0K  1 mars  14:48 .
drwxr-xr-x 21 root root 4,0K  3 mars  16:36 ..
-rw-r--r--  1 root root    0 22 mars  19:56 .keep                                                                                     
lrwxrwxrwx  1 root root   29  1 mars  14:48 System.map -> System.map-4.4.2-hardened-gnu
lrwxrwxrwx  1 root root   32 19 févr. 14:26 System.map.old -> System.map-4.3.3-hardened-r4-gnu
-rw-------  1 root root 2,2M 19 févr. 14:26 System.map-4.3.3-hardened-r4-gnu
-rw-------  1 root root 2,2M  1 mars  14:48 System.map-4.4.2-hardened-gnu
-rw-------  1 root root  72K 19 févr. 14:26 config-4.3.3-hardened-r4-gnu
-rw-------  1 root root  72K  1 mars  14:48 config-4.4.2-hardened-gnu
drwxr-xr-x  6 root root 4,0K  7 févr. 18:25 grub
lrwxrwxrwx  1 root root   26  1 mars  14:48 vmlinuz -> vmlinuz-4.4.2-hardened-gnu
lrwxrwxrwx  1 root root   29 19 févr. 14:26 vmlinuz.old -> vmlinuz-4.3.3-hardened-r4-gnu
-rw-------  1 root root 4,5M 19 févr. 14:26 vmlinuz-4.3.3-hardened-r4-gnu
-rw-------  1 root root 4,5M  1 mars  14:48 vmlinuz-4.4.2-hardened-gnu

Sometimes I need to add a "menuentry" block to load a specific kernel, but, most of the time, I don't have to edit it.

C5ace wrote:
Why do you use Grub2 insted of grub-static?

Maybe because grub-static (or grub-legacy) is EOL ?
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