Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Why change in GRUB 2 directory, & what should I do? [Solved]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
Fitzcarraldo
Guru
Guru


Joined: 30 Aug 2008
Posts: 499
Location: United Kingdom

PostPosted: Thu Oct 24, 2013 9:05 pm    Post subject: Why change in GRUB 2 directory, & what should I do? [Sol Reply with quote

I happened to notice an OT comment in a thread that mentioned the GRUB 2 directory was changed from /boot/grub2/ to /boot/grub/ in a recent sys-boot/grub ebuild (2.00_p5107-r1, if I'm not mistaken).

I was just wondering the reason for the change? (I'm not complaining, just curious.)

I also noticed that the ebuild of grub-2.00_p5107-r2 to which I upgraded today appears to have created a directory /boot/grub/ and put a symlink in it:

Code:
# mount /dev/sda3 /boot
# cd /boot
# ls -1
boot
grub
grub2
initramfs-genkernel-x86_64-3.9.4-gentoo
kernel-genkernel-x86_64-3.9.4-gentoo
lost+found
System.map-genkernel-x86_64-3.9.4-gentoo
# cd grub
# ls -la
total 2
drwxr-xr-x 2 root root 1024 Oct 24 16:06 .
drwxr-xr-x 6 root root 1024 Oct 24 16:06 ..
lrwxrwxrwx 1 root root   17 Oct 24 16:06 grub.cfg -> ../grub2/grub.cfg
#


Up until today I have been using the following commands to install GRUB 2 to my boot partition (sda3) and to generate the grub.cfg file:

Code:
mount /dev/sda3 /boot
grub2-install --force /dev/sda3
grub2-mkconfig -o /boot/grub2/grub.cfg

But, given the new version of GRUB 2, I'm wondering what should I do from now on? Should I change the last command to the following?:

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

and delete the directory /boot/grub2/, or should I continue to specify /boot/grub2/grub.cfg as the target file?



EDIT: I can see already that, whether or not I change the path of the target file in the grub2-mkconfig command, I will need to edit /etc/default/grub. Below is a comparison of /etc/default/grub installed by version sys-boot/grub-2.00_p5107-r2 and the /etc/default/grub I was using with sys-boot/grub-2.00-r3:

Code:
# diff -y -W 200 /etc/default/grub /etc/default/grub.bak
# Copyright 1999-2013 Gentoo Foundation                                                            |    # Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2                                      # Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-boot/grub/files/grub.default-2,v 1.4 2013/09/21 18:10:55    |    # $Header: /var/cvsroot/gentoo-x86/sys-boot/grub/files/grub.default-2,v 1.1 2012/06/28 10:10:04
#                                                                                                       #
# To populate all changes in this file you need to regenerate your                                      # To populate all changes in this file you need to regenerate your
# grub configuration file afterwards:                                                                   # grub configuration file afterwards:
#     'grub2-mkconfig -o /boot/grub/grub.cfg'                                                      |    #     'grub2-mkconfig -o /boot/grub2/grub.cfg'
#                                                                                                       #
# See the grub info page for documentation on possible variables and                                    # See the grub info page for documentation on possible variables and
# their associated values.                                                                              # their associated values.

GRUB_DISTRIBUTOR="Gentoo"                                                                               GRUB_DISTRIBUTOR="Gentoo"

GRUB_DEFAULT=0                                                                                          GRUB_DEFAULT=0
GRUB_HIDDEN_TIMEOUT=0                                                                                   GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true                                                                          GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=10                                                                                         GRUB_TIMEOUT=10

# Append parameters to the linux kernel command line                                               |    GRUB_CMDLINE_LINUX_DEFAULT=""
# GRUB_CMDLINE_LINUX=""                                                                            |    GRUB_CMDLINE_LINUX="`cat /proc/cmdline | sed -e 's#BOOT_IMAGE=.* ro ##g'`"
                                                                                                   <
# Append parameters to the linux kernel command line for non-recovery entries                      <
#GRUB_CMDLINE_LINUX_DEFAULT=""                                                                     <

# Uncomment to disable graphical terminal (grub-pc only)                                                # Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console                                                                                  #GRUB_TERMINAL=console

                                                                                                   >    ####################################
                                                                                                   >    # Inserted by me 18.06.12:
                                                                                                   >    GRUB_VIDEO_BACKEND=vbe
                                                                                                   >    GRUB_GFXPAYLOAD_LINUX=1024x768
                                                                                                   >    GRUB_COLOR_HIGHLIGHT="magenta/black"
                                                                                                   >    GRUB_COLOR_NORMAL="white/black"
                                                                                                   >    ####################################
                                                                                                   >
# The resolution used on graphical terminal.                                                            # The resolution used on graphical terminal.
# Note that you can use only modes which your graphic card supports via VBE.                            # Note that you can use only modes which your graphic card supports via VBE.
# You can see them in real GRUB with the command `vbeinfo'.                                             # You can see them in real GRUB with the command `vbeinfo'.
#GRUB_GFXMODE=640x480                                                                              |    GRUB_GFXMODE=1024x768

# Path to theme spec txt file.                                                                          # Path to theme spec txt file.
# The starfield is by default provided with use truetype.                                          |    # The starfiled is by default provided with use truetype.
# NOTE: when enabling custom theme, ensure you have required font/etc.                                  # NOTE: when enabling custom theme, ensure you have required font/etc.
#GRUB_THEME="/boot/grub/themes/starfield/theme.txt"                                                     #GRUB_THEME="/boot/grub/themes/starfield/theme.txt"

# Background image used on graphical terminal.                                                          # Background image used on graphical terminal.
# Can be in various bitmap formats.                                                                     # Can be in various bitmap formats.
#GRUB_BACKGROUND="/boot/grub/mybackground.png"                                                     |    GRUB_BACKGROUND="/boot/grub2/mybackground.png"

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to kernel                          # Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to kernel
#GRUB_DISABLE_LINUX_UUID=true                                                                      |    GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries                                         # Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY=true                                                                             #GRUB_DISABLE_RECOVERY=true

_________________
Fitzcarraldo's blog


Last edited by Fitzcarraldo on Fri Nov 01, 2013 11:02 pm; edited 1 time in total
Back to top
View user's profile Send private message
fturco
Apprentice
Apprentice


Joined: 08 Dec 2010
Posts: 273
Location: Italy

PostPosted: Fri Oct 25, 2013 12:46 pm    Post subject: Reply with quote

I don't know why /boot/grub2 was changed to /boot/grub, but I noticed that the commands still have the grub2 prefix, as in grub2-install.

Anyway I would try with:
Code:
rm /boot/grub -r
rm /boot/grub2 -r
grub2-install /dev/sda
grub2-mkconfig -o /boot/grub/grub.cfg
Back to top
View user's profile Send private message
swimmer
Veteran
Veteran


Joined: 15 Jul 2002
Posts: 1289
Location: Netherlands

PostPosted: Sat Oct 26, 2013 8:58 am    Post subject: Reply with quote

fturco wrote:
I don't know why /boot/grub2 was changed to /boot/grub, but I noticed that the commands still have the grub2 prefix, as in grub2-install.

Anyway I would try with:
Code:
rm /boot/grub -r
rm /boot/grub2 -r
grub2-install /dev/sda
grub2-mkconfig -o /boot/grub/grub.cfg

Not sure if that's the way to go .... I did that last week and ended up at the grub rescue mode :-/

And yes I *had* reconfigured /etc/defaults/grub ;-)
Back to top
View user's profile Send private message
Fitzcarraldo
Guru
Guru


Joined: 30 Aug 2008
Posts: 499
Location: United Kingdom

PostPosted: Sat Oct 26, 2013 12:13 pm    Post subject: Reply with quote

swimmer, what did you then do to rectify the situation? What is the correct procedure to follow?

I had been thinking of using the procedure listed below to switch to the new way of doing things (/boot/grub/ instead of /boot/grub2/). You can ignore my Step 8, as that is only because I dual boot with Windows 7 and chainload from the Windows Boot Manager.

1. Mount my boot partition:

Code:
mount /dev/sda3 /boot

2. Edit /etc/default/grub as shown below, leaving the references to the new directory /boot/grub/ but adding back the changes I had made to the /etc/default/grub file of an earlier version of GRUB 2:

Code:
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-boot/grub/files/grub.default-2,v 1.4 2013/09/21 18:10:55
#
# To populate all changes in this file you need to regenerate your
# grub configuration file afterwards:
#     'grub2-mkconfig -o /boot/grub/grub.cfg'
#
# See the grub info page for documentation on possible variables and
# their associated values.

GRUB_DISTRIBUTOR="Gentoo"

GRUB_DEFAULT=0
GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=10

# Append parameters to the linux kernel command line
GRUB_CMDLINE_LINUX="`cat /proc/cmdline | sed -e 's#BOOT_IMAGE=.* ro ##g'`"

# Append parameters to the linux kernel command line for non-recovery entries             
#GRUB_CMDLINE_LINUX_DEFAULT=""

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

####################################
# Inserted by me 18.06.12:
GRUB_VIDEO_BACKEND=vbe
GRUB_GFXPAYLOAD_LINUX=1024x768
GRUB_COLOR_HIGHLIGHT="magenta/black"
GRUB_COLOR_NORMAL="white/black"
####################################

# The resolution used on graphical terminal.
# Note that you can use only modes which your graphic card supports via VBE.               
# You can see them in real GRUB with the command `vbeinfo'.
GRUB_GFXMODE=1024x768

# Path to theme spec txt file.
# The starfield is by default provided with use truetype.
# NOTE: when enabling custom theme, ensure you have required font/etc.
#GRUB_THEME="/boot/grub/themes/starfield/theme.txt"

# Background image used on graphical terminal.
# Can be in various bitmap formats.
GRUB_BACKGROUND="/boot/grub/mybackground.png"

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to kernel
GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY=true

3. Delete the new directory (which only contains a symlink to /boot/grub2/grub.cfg):
Code:
rm -rf /boot/grub

4. Back up /boot/grub2:

Code:
cp -pr /boot/grub2 /home/fitzcarraldo/boot/grub2.bak

5. Rename /boot/grub2/ directory to the new format:

Code:
mv /boot/grub2/ /boot/grub/

6. Install the latest version of GRUB 2 in my boot partition (sda3), as I have always done:

Code:
grub2-install --force /dev/sda3

7. Generate the latest version of grub.cfg in the new /boot/grub/ directory:

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

8. As I dual-boot with Windows 7 and use the Windows Boot Manager to chainload GRUB 2: a) reboot and select Windows 7 from the Windows Boot Manager; b) launch EasyBCD (I still have EasyBCD version 2.2 Beta - Build 179.exe installed); c) delete the Linux menu entry; d) select 'GRUB Legacy' (see Note 1 below) and specify sda3 as the partition on which GRUB is located; e) save this to the BCD; f) reboot.

Note 1: I would specify GRUB Legacy to EasyBCD so that Windows Boot Manager vectors to the sda3 boot sector instead of to (in theory) /boot/grub/i386-pc/core.img (see the thread GRUB 2 wrongly using /boot/grub/ instead of /boot/grub2/ for the reason).
_________________
Fitzcarraldo's blog
Back to top
View user's profile Send private message
swimmer
Veteran
Veteran


Joined: 15 Jul 2002
Posts: 1289
Location: Netherlands

PostPosted: Sat Oct 26, 2013 12:48 pm    Post subject: Reply with quote

Quote:
swimmer, what did you then do to rectify the situation? What is the correct procedure to follow?

I had to boot with an usb-stick and rename /boot/grub/ to /boot/grub2/ again :-/
But if I look at your steps I think I missed out step #6 ... that might have changed things ;-)
Could you let me know how you proceeded at the end? I'm willing to give it another shot if I know it might work ...

Kindly yours
swimmer
Back to top
View user's profile Send private message
Fitzcarraldo
Guru
Guru


Joined: 30 Aug 2008
Posts: 499
Location: United Kingdom

PostPosted: Fri Nov 01, 2013 10:58 pm    Post subject: Reply with quote

swimmer, I followed the procedure I gave in my previous post, and it worked perfectly. I am now using GRUB 2 Version 2.00_p5107-r2 and have it installed in the boot sector of my boot partition sda3 and in the /boot/grub/ directory instead of the /boot/grub2/ directory used by earlier Gentoo versions of GRUB 2. As was the case before I did this, the Windows Boot Manager vectors correctly to the boot sector of /dev/sda3 which in turn vectors to /boot/grub/i386-pc/core.img and uses the /boot/grub/grub.cfg file.

I suppose the only thing I could have added to my procedure above would be to back-up the new /etc/default/grub configuration file:

Code:
cp /etc/default/grub /etc/default/grub.bak

_________________
Fitzcarraldo's blog
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things 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