Skip to contentSkip to conversation

LVM on debian

PATCH In review Martin Braure de Calignon 6 participants 62 messages Jan 7, 2008 – Jan 15, 2008

lore
Share & tools
lore
#0 lore raw

I've just try for the first time grub2.

I'm on debian/unstable (grub2 version 1.95+20080105)
I have only one thing to say. It's simply amazing !
I love it !
I have an lvm /usr partition. And everything works great.
I only have to look on /etc/grub.d/10_linux to see what was the variable for command line option of the kernel.
So I had to had GRUB_CMDLINE_LINUX on /etc/default/grub. I also have to edit /etc/grub.d/00_header because grub does not work if he cannot access to the font (that are on my /usr partition). So I added "insmod lvm" before font loading.
But it work and it looks very promising.

Thanks all for your work. Now I'm looking forward to the next upload of grub2 on debian to have TGA image support :-)

Signature · 1 line
Martin Braure de Calignon
#1 lore raw

Hi Martin!

Quoted 5 lines · Martin Braure de Calignon

I've just try for the first time grub2.

I'm on debian/unstable (grub2 version 1.95+20080105) I have only one thing to say. It's simply amazing ! I love it !

Glad to hear that.

Quoted 3 lines

I have an lvm /usr partition. And everything works great.
I only have to look on /etc/grub.d/10_linux to see what was the variable for command line option of the kernel.

Yeah I'm afraid we lack documentation. We could use some help on that ;-)

Quoted 3 lines

So I had to had GRUB_CMDLINE_LINUX on /etc/default/grub. I also have to edit /etc/grub.d/00_header because grub does not work if he cannot access to the font (that are on my /usr partition).

There's something wrong here. update-grub is supposed to detect when your /usr is inaccessible and disable font automaticaly. You mean that it falls back to text mode, or that it won't install/boot at all?

Quoted 2 lines

So I added "insmod
lvm" before font loading.

Ah yes, this is a long-standing issue..

Quoted 2 lines

Thanks all for your work. Now I'm looking forward to the next upload of grub2 on debian to have TGA image support :-)

I can't yet! I'm waiting for #459352

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)
#2 lore raw
Quoted 9 lines · Robert Millan

Hi Martin!

Quoted 5 lines · Martin Braure de Calignon

I've just try for the first time grub2.

I'm on debian/unstable (grub2 version 1.95+20080105) I have only one thing to say. It's simply amazing ! I love it !

Quoted 7 lines

Glad to hear that.

Quoted 3 lines

I have an lvm /usr partition. And everything works great.
I only have to look on /etc/grub.d/10_linux to see what was the variable for command line option of the kernel.

Yeah I'm afraid we lack documentation. We could use some help on that ;-)

Of course. One possible temporary solution would be to insert all customization variables in 10_linux and other files in /etc/default/grub with no value no and a simple comment over it (all the common used variables). I can try to do it if you want, but I've just discovered grub2 so it's quite risky.
Is it complicated to convert kopt= options in grub menu.lst to the GRUB_CMDLINE_LINUX ? in postinst ?

Quoted 7 lines
Quoted 3 lines

So I had to had GRUB_CMDLINE_LINUX on /etc/default/grub. I also have to edit /etc/grub.d/00_header because grub does not work if he cannot access to the font (that are on my /usr partition).

There's something wrong here. update-grub is supposed to detect when your /usr is inaccessible and disable font automaticaly. You mean that it falls back to text mode, or that it won't install/boot at all?

Well, when I tried, I had a graphical menu with no entry. I had to type 'ESC' and try to find what was wrong (that's where I discover insert lvm). If you wan't me to try again somes things, I can. I think it disable font but try to load graphic mode without font. Is it possible ?

Quoted 4 lines
Quoted 2 lines

Thanks all for your work. Now I'm looking forward to the next upload of grub2 on debian to have TGA image support :-)

I can't yet! I'm waiting for #459352

So I just need to wait until the next upload of debian-desktop that's it no ? black color is better for text of course :-). But I'm not debian-desktop developper. I'm not DD, so I can't upload it :-/

Cheers,

Signature · 1 line
Martin Braure de Calignon
#3 lore raw

Hi all!

Maybe a bit too Debian-specific :-)

Quoted 6 lines · Martin Braure de Calignon
Quoted 5 lines · Robert Millan
Quoted 3 lines · Martin Braure de Calignon

I have an lvm /usr partition. And everything works great.
I only have to look on /etc/grub.d/10_linux to see what was the variable for command line option of the kernel.

Quoted 7 lines
Quoted 1 line

Yeah I'm afraid we lack documentation. We could use some help on that ;-)

Of course. One possible temporary solution would be to insert all customization variables in 10_linux and other files in /etc/default/grub with no value no and a simple comment over it (all the common used variables). I can try to do it if you want, but I've just discovered grub2 so it's quite risky.

Filling /etc/default/grub with all the variables empty by default (or commented, as other files in the same dir, e.g. ifupdown) is for sure an improvement over the current situation.

Quoted 2 lines

Is it complicated to convert kopt= options in grub menu.lst to the GRUB_CMDLINE_LINUX ? in postinst ?

This would work for upgrades grub -> grub2, but not for existing installations (see Debian bug #459247 [1]). So, yes, this can be done, but having proper documentation (hint, man update-grub) would be the best thing to do. What's funny is that I had on my ToDo list a note to submit a Debian bug about the same issue ;-)

Thx, bye,
Gismo / Luca

Footnotes:
[1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=459247

#4 lore raw
In reply to Martin Braure de Calignon
Quoted 5 lines · Martin Braure de Calignon

Of course. One possible temporary solution would be to insert all customization variables in 10_linux and other files in /etc/default/grub with no value no and a simple comment over it (all the common used variables).

I don't like it. 10_linux is technicaly a config file, but it's also a script, which means it's much more likely to be updated (causing upgrade conflicts for those who modify it) than /etc/default/grub.

Also, /etc/default/grub is provided by debian, while 10_linux is not. We wouldn't want to put "GRUB_DISTRIBUTOR=Debian" in 10_linux would we ?

And not all variables in /etc/default/grub are meant for 10_linux. Some are there for 00_header. And even GRUB_DISTRIBUTOR is also used by 10_hurd.

Quoted 2 lines

Is it complicated to convert kopt= options in grub menu.lst to the GRUB_CMDLINE_LINUX ? in postinst ?

Maybe. It's basicaly just some sedding, but you have to be careful to get all the corner cases right. I didn't do it because I didn't consider it important, but feel free to send a patch.

Quoted 8 lines
Quoted 3 lines

There's something wrong here. update-grub is supposed to detect when your /usr is inaccessible and disable font automaticaly. You mean that it falls back to text mode, or that it won't install/boot at all?

Well, when I tried, I had a graphical menu with no entry. I had to type 'ESC' and try to find what was wrong (that's where I discover insert lvm). If you wan't me to try again somes things, I can. I think it disable font but try to load graphic mode without font. Is it possible ?

Yes, but first I need to understand better what you saw. Does "graphical" mean it was in VESA mode? You can tell that because "terminal" command would return "gfxterm" rather than "console". Or does it simply mean you had a menu?

When you say "with no entry", does this mean you didn't see any text at all (including the messages at the top and bottom)? Or just that there were no options in the menu?

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)
#5 lore raw
Quoted 10 lines · Robert Millan
Quoted 4 lines · Martin Braure de Calignon

Of course. One possible temporary solution would be to insert all customization variables in 10_linux and other files in /etc/default/grub with no value no and a simple comment over it (all the common used variables).

I don't like it. 10_linux is technicaly a config file, but it's also a script, which means it's much more likely to be updated (causing upgrade conflicts for those who modify it) than /etc/default/grub.

Quoted 5 lines

Also, /etc/default/grub is provided by debian, while 10_linux is not. We wouldn't want to put "GRUB_DISTRIBUTOR=Debian" in 10_linux would we ?

And not all variables in /etc/default/grub are meant for 10_linux. Some are there for 00_header. And even GRUB_DISTRIBUTOR is also used by 10_hurd.

Ok it makes sense to not include all the variables in /etc/default/grub because of course, /etc/default/grub should only contains variable that do not really depends on script. But a kernel command line personalization should be in there. If there's no default in there with non-valued variables, it should be documented.

Quoted 6 lines
Quoted 2 lines

Is it complicated to convert kopt= options in grub menu.lst to the GRUB_CMDLINE_LINUX ? in postinst ?

Maybe. It's basicaly just some sedding, but you have to be careful to get all the corner cases right. I didn't do it because I didn't consider it important, but feel free to send a patch.

Well, I think it can be important when you want grub2 to replace grub because people don't want their computer do not boot any longer (some options (noapictimer) missing can make my system unbootable). For now, it's probably not urgent.
A simple

	sed '/^# kopt=/!d;s/^# kopt=//g' /boot/grub/menu.lst

gives the kernel command line
Then one could use a "echo GRUB_CMD_LINE_LINUX=$(sed '/^# kopt=/!d;s/^# kopt=//g' /boot/grub/menu.lst) >> /etc/default/grub

It's probably not very robust, so a better transitional solution could be to ask in debconf for experimental importing of grub1 configuration. If not, one could also add these informations to README.Debian I can try to do a patch for this, but I need some advices do not make common and obvious mistakes on how manage this conversion.

Quoted 5 lines

Yes, but first I need to understand better what you saw. Does "graphical" mean it was in VESA mode? You can tell that because "terminal" command would return "gfxterm" rather than "console". Or does it simply mean you had a menu?
When you say "with no entry", does this mean you didn't see any text

at all

Quoted 3 lines

(including the messages at the top and bottom)? Or just that there were no options in the menu?

I've just reinstall the default configuration files of grub2 and reboot. What I have is a black and white screen with "GNU GRub Version 1.95", then a menu without any entry and then the message on the bottom saying me that I can do some commands.
Then I go in 'command mode', do a insmod lvm, then configFile /boot/grub/grub.cfg and it works perfectly.

Cheers,

Signature · 1 line
Martin Braure de Calignon
#6 lore raw

debian upgrades and extracting kopt from menu.lst (Re: LVM on debian)

Quoted 6 lines · Martin Braure de Calignon

Ok it makes sense to not include all the variables in /etc/default/grub because of course, /etc/default/grub should only contains variable that do not really depends on script. But a kernel command line personalization should be in there. If there's no default in there with non-valued variables, it should be documented.

Ah, right. I didn't understand you. You mean we should add a commented GRUB_CMDLINE_LINUX in that file?

Quoted 11 lines

Well, I think it can be important when you want grub2 to replace grub because people don't want their computer do not boot any longer (some options (noapictimer) missing can make my system unbootable). For now, it's probably not urgent.
A simple

	sed '/^# kopt=/!d;s/^# kopt=//g' /boot/grub/menu.lst

gives the kernel command line
Then one could use a "echo GRUB_CMD_LINE_LINUX=$(sed '/^# kopt=/!d;s/^# kopt=//g' /boot/grub/menu.lst) >> /etc/default/grub

It's probably not very robust,

That's incomplete. First, kopt includes a "root=" parameter which update-grub2 generates automaticaly; that should be skipped. You need to consider what happens if you run this code multiple times, or if GRUB_CMD_LINE_LINUX was already in /etc/default/grub, etc...

The hard part about this is not extracting the data, but handling all the corner cases and making sure nothing breaks.

Quoted 3 lines

so a better transitional solution could
be to ask in debconf for experimental importing of grub1 configuration. If not, one could also add these informations to README.Debian

In general, I really dislike documenting bugs or limitations. If the code is not robust, I think it's better to spend time in improving its robustness than documenting that it isn't robust.

Quoted 2 lines

I can try to do a patch for this, but I need some advices do not make common and obvious mistakes on how manage this conversion.

You need to make sure GRUB_CMD_LINE_LINUX is only added once, and only when it contains relevant info (for "ro" I don't know what it helps with, but I'd just skip it unless we see some indication that it serves a purpose).

And you can't assume menu.lst exists.

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)
#7 lore raw
In reply to Martin Braure de Calignon
Quoted 5 lines · Martin Braure de Calignon
Quoted 5 lines

Yes, but first I need to understand better what you saw. Does "graphical" mean it was in VESA mode? You can tell that because "terminal" command would return "gfxterm" rather than "console". Or does it simply mean you had a menu?
When you say "with no entry", does this mean you didn't see any text

Quoted 8 lines

at all

Quoted 3 lines

(including the messages at the top and bottom)? Or just that there were no options in the menu?

I've just reinstall the default configuration files of grub2 and reboot. What I have is a black and white screen with "GNU GRub Version 1.95", then a menu without any entry and then the message on the bottom saying me that I can do some commands.

Ok, so you have fonts. What are the color settings? (run "set" and check for menu_color_* variables)

Quoted 2 lines

Then I go in 'command mode', do a insmod lvm, then configFile /boot/grub/grub.cfg and it works perfectly.

When you're in command mode, is "normal" module inserted? (use lsmod)

What happens if you don't insmod lvm and try configfile /boot/grub/grub.cfg directly?

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)
#8 lore raw
Quoted 2 lines · Robert Millan

Ok, so you have fonts. What are the color settings? (run "set" and check for menu_color_* variables)

set gives the following output :
?=1
color_highlight=
color_normal=
default=0
prefix=(hd0,9)/boot/grub
root=(hd0,9)

so no menu_color* variables

Quoted 1 line

When you're in command mode, is "normal" module inserted? (use lsmod)

yes it is (modules loaded are : font, normal, _chain, biosdisk, pc, ext2 and fshelp)

Quoted 2 lines

What happens if you don't insmod lvm and try configfile /boot/grub/grub.cfg directly?

It try to load it, then it seems it can't, because I'm again on the same black & white menu.

Here's my grub.cfg in attachement (it has been generated by update-grub)

Cheers,

Signature · 1 line
Martin Braure de Calignon

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by /usr/sbin/update-grub using templates

# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
set default=0
set timeout=5
set root=(hd0,9)
font (mainvg-usr)/share/grub/unicode.pff
set gfxmode=640x480
insmod gfxterm
insmod vbe
terminal gfxterm
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_hurd ###
### END /etc/grub.d/10_hurd ###

### BEGIN /etc/grub.d/10_linux ###

menuentry "Debian GNU/Linux, linux 2.6.23-1-amd64" {
	linux	(hd0,9)/boot/vmlinuz-2.6.23-1-amd64 root=/dev/hda9 ro noapictimer splash vga=792 quiet
	initrd	(hd0,9)/boot/initrd.img-2.6.23-1-amd64
}
menuentry "Debian GNU/Linux, linux 2.6.23-1-amd64 (single-user mode)" {
	linux	(hd0,9)/boot/vmlinuz-2.6.23-1-amd64 root=/dev/hda9 ro single noapictimer splash vga=792 quiet
	initrd	(hd0,9)/boot/initrd.img-2.6.23-1-amd64
}

### END /etc/grub.d/10_linux ###

#9 lore raw
Quoted 6 lines · Martin Braure de Calignon
Quoted 2 lines · Robert Millan

Ok, so you have fonts. What are the color settings? (run "set" and check for menu_color_* variables)

set gives the following output :
?=1

Here is the problem ! Some command return error code, then the script is not parsed correctly. this problem can be fixed by my parser patch.

Signature · 1 line
Bean
#10 lore raw
Quoted 10 lines · Bean
Quoted 6 lines · Martin Braure de Calignon
Quoted 2 lines · Robert Millan

Ok, so you have fonts. What are the color settings? (run "set" and check for menu_color_* variables)

set gives the following output :
?=1

Here is the problem ! Some command return error code, then the script is not parsed correctly. this problem can be fixed by my parser patch.

I think the most likely command to cause the error is

font (mainvg-usr)/share/grub/unicode.pff
or
terminal gfxterm

Signature · 1 line
Bean
#11 lore raw
Quoted 5 lines · Bean

I think the most likely command to cause the error is

font (mainvg-usr)/share/grub/unicode.pff
or
terminal gfxterm

I think 'font' line can't work because font are on my /usr, and /usr is LVM and lvm module is not loaded... But I though grub2 know how to deals with it.
You're patch for the parser is on the cvs or svn or git (I don't know which one you use)

Signature · 1 line
Martin Braure de Calignon
#12 lore raw
Quoted 8 lines · Martin Braure de Calignon
Quoted 5 lines · Bean

I think the most likely command to cause the error is

font (mainvg-usr)/share/grub/unicode.pff
or
terminal gfxterm

Quoted 5 lines

I think 'font' line can't work because font are on my /usr, and /usr is LVM and lvm module is not loaded... But I though grub2 know how to deals with it.
You're patch for the parser is on the cvs or svn or git (I don't know which one you use)

It's here:

http://lists.gnu.org/archive/html/grub-devel/2007-12/msg00204.html

Signature · 1 line
Bean
#13 lore raw
In reply to Martin Braure de Calignon
Quoted 11 lines · Martin Braure de Calignon
Quoted 5 lines · Bean

I think the most likely command to cause the error is

font (mainvg-usr)/share/grub/unicode.pff
or
terminal gfxterm

I think 'font' line can't work because font are on my /usr, and /usr is LVM and lvm module is not loaded... But I though grub2 know how to deals with it.

Uhm unfortunately update-grub doesn't know how to detect that this file won't be accessible (since this is in fact a bug..).

But I'd rather fix the bug than adding a bug detector in update-grub ;-)

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)
#14 lore raw

PATCH 1/1 force load of lvm and raid before entering normal mode (Re: LVM on debian)

In reply to Martin Braure de Calignon
Quoted 11 lines · Martin Braure de Calignon
Quoted 5 lines · Bean

I think the most likely command to cause the error is

font (mainvg-usr)/share/grub/unicode.pff
or
terminal gfxterm

I think 'font' line can't work because font are on my /usr, and /usr is LVM and lvm module is not loaded... But I though grub2 know how to deals with it.

It's a bit funny. I tried to fix your problem, and at some point I realized I was fixing something else. Then got back at your problem, and turned out we just need to force load of "lvm" and "raid" before entering normal mode.

Please try attached patch and report (note: this is unrelated to the parser error Bean fixed; the parser error simply makes the real problem in your setup go away unnoticed).

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)
kern/main.c +5 -0
diff -ur grub2/kern/main.c grub2.lvm/kern/main.c
@@ -99,6 +99,11 @@
 static void
 grub_load_normal_mode (void)
 {
+  /* Before entering normal mode, always insert these whenever
+     they're available.  */
+  grub_dl_load ("lvm");
+  grub_dl_load ("raid");
+
   /* Load the module.  */
   grub_dl_load ("normal");
   
#15 lore raw

Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)

Quoted 3 lines · Robert Millan

It's a bit funny. I tried to fix your problem, and at some point I realized I was fixing something else.

Ok, so I fixed lvm/raid handling in core.img (by grub-install). This will help those who (unlike you) have their /boot under LVM or software RAID.

Please could someone test? (I'm CCing a few people who I heard have this problem)

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)
include/grub/util/getroot.h +1 -1
diff -x '*~' -x configure -x config.h.in -ur grub2/include/grub/util/getroot.h test/include/grub/util/getroot.h
@@ -21,6 +21,6 @@
 
 char *grub_guess_root_device (const char *dir);
 char *grub_get_prefix (const char *dir);
-char *grub_util_get_grub_dev (const char *os_dev);
+char *grub_util_get_grub_dev (const char *dev_type, const char *os_dev);
 
 #endif /* ! GRUB_UTIL_GETROOT_HEADER */
util/getroot.c +32 -2
diff -x '*~' -x configure -x config.h.in -ur grub2/util/getroot.c test/util/getroot.c
@@ -239,11 +239,41 @@
   return os_dev;
 }
 
+static char *dev_types[] = {
+  "",
+  "lvm",
+  "raid",
+};
+
+enum {
+  TYPE_RAW,
+  TYPE_LVM,
+  TYPE_RAID,
+};
+
 char *
-grub_util_get_grub_dev (const char *os_dev)
+grub_util_get_dev_type (const char *os_dev)
 {
   /* Check for LVM.  */
   if (!strncmp (os_dev, "/dev/mapper/", 12))
+    return dev_types[TYPE_LVM];
+
+  /* Check for RAID.  */
+  if (!strncmp (os_dev, "/dev/md", 7))
+    return dev_types[TYPE_RAID];
+
+  /* If it's not RAID or LVM, it should be a biosdisk.  */
+  return dev_types[TYPE_RAW];
+}
+
+char *
+grub_util_get_grub_dev (const char *type, const char *os_dev)
+{
+  if (! type)
+    type = grub_util_get_dev_type (os_dev);
+
+  /* Check for LVM.  */
+  if (!strcmp (type, "lvm"))
     {
       char *grub_dev = xmalloc (strlen (os_dev) - 12 + 1);
 
@@ -253,7 +283,7 @@
     }
 
   /* Check for RAID.  */
-  if (!strncmp (os_dev, "/dev/md", 7))
+  if (!strcmp (type, "raid"))
     {
       const char *p;
       char *grub_dev = xmalloc (20);
util/grub-probe.c +19 -5
diff -x '*~' -x configure -x config.h.in -ur grub2/util/grub-probe.c test/util/grub-probe.c
@@ -39,10 +39,13 @@
 #define _GNU_SOURCE	1
 #include <getopt.h>
 
-#define PRINT_FS	0
-#define PRINT_DRIVE	1
-#define PRINT_DEVICE	2
-#define PRINT_PARTMAP	3
+enum {
+  PRINT_FS,
+  PRINT_DRIVE,
+  PRINT_DEVICE,
+  PRINT_PARTMAP,
+  PRINT_TYPE,
+};
 
 int print = PRINT_FS;
 
@@ -74,6 +77,7 @@
 {
   char *device_name;
   char *drive_name = NULL;
+  char *type_name;
   grub_device_t dev;
   grub_fs_t fs;
   
@@ -87,7 +91,17 @@
       goto end;
     }
 
-  drive_name = grub_util_get_grub_dev (device_name);
+  type_name = grub_util_get_dev_type (device_name);
+  if (! type_name)
+    grub_util_error ("cannot identify drive type for %s.\n", device_name);
+  
+  if (print == PRINT_TYPE)
+    {
+      printf ("(%s)\n", type_name);
+      goto end;
+    }
+
+  drive_name = grub_util_get_grub_dev (type_name, device_name);
   if (! drive_name)
     grub_util_error ("cannot find a GRUB drive for %s.\n", device_name);
   
util/i386/pc/grub-install.in +4 -1
diff -x '*~' -x configure -x config.h.in -ur grub2/util/i386/pc/grub-install.in test/util/i386/pc/grub-install.in
@@ -223,8 +223,11 @@
 # filesystem will be accessible).
 partmap_module=`$grub_probe --target=partmap --device-map=${device_map} ${grubdir} 2> /dev/null`
 
+# Device type module, if any (lvm, raid).
+devtype_module=`$grub_probe --target=type --device-map=${device_map} ${grubdir}`
+
 # _chain is often useful
-modules="$modules $fs_module $partmap_module biosdisk _chain"
+modules="$modules $fs_module $partmap_module $devtype_module biosdisk _chain"
 
 $grub_mkimage --output=${grubdir}/core.img --prefix=`make_system_path_relative_to_its_root ${grubdir}` $modules || exit 1
 
util/i386/pc/grub-setup.c +3 -3
diff -x '*~' -x configure -x config.h.in -ur grub2/util/i386/pc/grub-setup.c test/util/i386/pc/grub-setup.c
@@ -668,7 +668,7 @@
   if (! dest_dev)
     {
       /* Possibly, the user specified an OS device file.  */
-      dest_dev = grub_util_get_grub_dev (argv[optind]);
+      dest_dev = grub_util_get_grub_dev (NULL, argv[optind]);
       if (! dest_dev)
 	{
 	  fprintf (stderr, "Invalid device `%s'.\n", argv[optind]);
@@ -694,7 +694,7 @@
     }
   else
     {
-      root_dev = grub_util_get_grub_dev (grub_guess_root_device (dir ? : DEFAULT_DIRECTORY));
+      root_dev = grub_util_get_grub_dev (NULL, grub_guess_root_device (dir ? : DEFAULT_DIRECTORY));
       if (! root_dev)
 	{
 	  grub_util_info ("guessing the root device failed, because of `%s'",
@@ -734,7 +734,7 @@
 		 dir ? : DEFAULT_DIRECTORY,
 		 boot_file ? : DEFAULT_BOOT_FILE,
 		 core_file ? : DEFAULT_CORE_FILE,
-		 root_dev, grub_util_get_grub_dev (devicelist[i]), 1);
+		 root_dev, grub_util_get_grub_dev (NULL, devicelist[i]), 1);
 	}
 
       free (raid_prefix);
#16 lore raw

Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)

Quoted 10 lines · Robert Millan
Quoted 3 lines · Robert Millan

It's a bit funny. I tried to fix your problem, and at some point I realized I was fixing something else.

Ok, so I fixed lvm/raid handling in core.img (by grub-install). This will help those who (unlike you) have their /boot under LVM or software RAID.

Please could someone test? (I'm CCing a few people who I heard have this problem)

Ok it works perfectly here after a grub-install "(hd0)"

I didn't test graphical console before, it's really slow but everythings works now :-)

Thanks

Signature · 1 line
Martin Braure de Calignon
#17 lore raw

Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)

In reply to Robert Millan
Quoted 2 lines · Robert Millan

Ok, so I fixed lvm/raid handling in core.img (by grub-install). This will help those who (unlike you) have their /boot under LVM or software RAID.

I applied both pathces, but lvm does not work for me yet. The second patch has

     +devtype_module=`$grub_probe --target=type --device-map=${device_map} ${grubdir}`

but my grub-probe patched against latest CVS does grok --target=type, it says

Try ``grub-probe --help'' for more information. -t, --target=(fs|drive|device|partmap)

Should I be pulling some git branch of yours?

When I replace the line above with

     +devtype_module=`$grub_probe --target=device --device-map=${device_map} ${grubdir}`

grub-install issues

   grub-mkimage --output=/boot/grub/core.img --prefix=/boot/grub ext2 /dev/mapper/lvmraid-lvm1 biosdisk _chain
   grub-mkimage: error: cannot stat /dev/mapper/lvmraid-lvm1.mod

(odd btw, how there is also no gpt in the list. that won't work, right?)

This grub-mkimage line gave me an idea: you have lvm loaded before ext2, which could be why lvm inserted in core.img does not work. So I manually did

    grub-mkimage --output=/boot/grub/core.img --prefix=/boot/grub ext2 lvm pc gpt biosdisk _chain
    grub-setup '(hd0)'

but that again gave me a grub rescue> prompt with exactly the same problems as before: error: unknown device, until I rmmod lvm, insmod lvm by hand

(reboot)

grub rescue> set
prefix=(lvmraid-lvm0)/boot/grub
root=lvmraid-lvm0
grub rescue> insmod normal
error: unknown device
grub rescue> lsmod
Name Ref Count Dependencies
biosdisk 1
gpt 1
pc 1
ext2 1 fshelp
fshelp 2
lvm 1
grub rescue> ls
(hd0) (hd0,1) (hd0,5) (hd0,6) (hd0) (hd1,1) (hd1,5) (hd1,6) grub rescue> rmmod lvm
grub rescue> insmod (hd1,1)/boot/grub/lvm.mod grub rescue> ls
(lvmraid-lvm0) ...
grub rescue> insmod normal
grub rescue> normal

(See
http://lists.gnu.org/archive/html/grub-devel/2008-01/msg00146.html)

Greetings,
Jan.

Signature · 2 lines
Jan Nieuwenhuizen <[email protected]> | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien       | http://www.lilypond.org
#18 lore raw

Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)

Quoted 10 lines · Jan Nieuwenhuizen
Quoted 2 lines · Robert Millan

Ok, so I fixed lvm/raid handling in core.img (by grub-install). This will help those who (unlike you) have their /boot under LVM or software RAID.

I applied both pathces, but lvm does not work for me yet. The second patch has

     +devtype_module=`$grub_probe --target=type --device-map=${device_map} ${grubdir}`
Quoted 7 lines

but my grub-probe patched against latest CVS does grok --target=type, it says

Try ``grub-probe --help'' for more information. -t, --target=(fs|drive|device|partmap)

Should I be pulling some git branch of yours?

Try this one.

Quoted 3 lines

When I replace the line above with

     +devtype_module=`$grub_probe --target=device --device-map=${device_map} ${grubdir}`

No, --target=device returns a device name which is not what you want.

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)

Only in grub2.lvm: config.h.in~

include/grub/util/getroot.h +1 -1
diff -x configure -x config.h.in -ur grub2/include/grub/util/getroot.h grub2.lvm/include/grub/util/getroot.h
@@ -21,6 +21,6 @@
 
 char *grub_guess_root_device (const char *dir);
 char *grub_get_prefix (const char *dir);
-char *grub_util_get_grub_dev (const char *os_dev);
+char *grub_util_get_grub_dev (const char *dev_type, const char *os_dev);
 
 #endif /* ! GRUB_UTIL_GETROOT_HEADER */
util/getroot.c +32 -2
diff -x configure -x config.h.in -ur grub2/util/getroot.c grub2.lvm/util/getroot.c
@@ -239,11 +239,41 @@
   return os_dev;
 }
 
+static char *dev_types[] = {
+  "",
+  "lvm",
+  "raid",
+};
+
+enum {
+  TYPE_RAW,
+  TYPE_LVM,
+  TYPE_RAID,
+};
+
 char *
-grub_util_get_grub_dev (const char *os_dev)
+grub_util_get_dev_type (const char *os_dev)
 {
   /* Check for LVM.  */
   if (!strncmp (os_dev, "/dev/mapper/", 12))
+    return dev_types[TYPE_LVM];
+
+  /* Check for RAID.  */
+  if (!strncmp (os_dev, "/dev/md", 7))
+    return dev_types[TYPE_RAID];
+
+  /* If it's not RAID or LVM, it should be a biosdisk.  */
+  return dev_types[TYPE_RAW];
+}
+
+char *
+grub_util_get_grub_dev (const char *type, const char *os_dev)
+{
+  if (! type)
+    type = grub_util_get_dev_type (os_dev);
+
+  /* Check for LVM.  */
+  if (!strcmp (type, "lvm"))
     {
       char *grub_dev = xmalloc (strlen (os_dev) - 12 + 1);
 
@@ -253,7 +283,7 @@
     }
 
   /* Check for RAID.  */
-  if (!strncmp (os_dev, "/dev/md", 7))
+  if (!strcmp (type, "raid"))
     {
       const char *p;
       char *grub_dev = xmalloc (20);
util/grub-probe.c +21 -5
diff -x configure -x config.h.in -ur grub2/util/grub-probe.c grub2.lvm/util/grub-probe.c
@@ -39,10 +39,13 @@
 #define _GNU_SOURCE	1
 #include <getopt.h>
 
-#define PRINT_FS	0
-#define PRINT_DRIVE	1
-#define PRINT_DEVICE	2
-#define PRINT_PARTMAP	3
+enum {
+  PRINT_FS,
+  PRINT_DRIVE,
+  PRINT_DEVICE,
+  PRINT_PARTMAP,
+  PRINT_TYPE,
+};
 
 int print = PRINT_FS;
 
@@ -74,6 +77,7 @@
 {
   char *device_name;
   char *drive_name = NULL;
+  char *type_name;
   grub_device_t dev;
   grub_fs_t fs;
   
@@ -87,7 +91,17 @@
       goto end;
     }
 
-  drive_name = grub_util_get_grub_dev (device_name);
+  type_name = grub_util_get_dev_type (device_name);
+  if (! type_name)
+    grub_util_error ("cannot identify drive type for %s.\n", device_name);
+  
+  if (print == PRINT_TYPE)
+    {
+      printf ("%s\n", type_name);
+      goto end;
+    }
+
+  drive_name = grub_util_get_grub_dev (type_name, device_name);
   if (! drive_name)
     grub_util_error ("cannot find a GRUB drive for %s.\n", device_name);
   
@@ -206,6 +220,8 @@
 	      print = PRINT_DEVICE;
 	    else if (!strcmp (optarg, "partmap"))
 	      print = PRINT_PARTMAP;
+	    else if (!strcmp (optarg, "type"))
+	      print = PRINT_TYPE;
 	    else
 	      usage (1);
 	    break;

Only in grub2.lvm/util: grub-probe.c~

util/i386/pc/grub-install.in +4 -1
diff -x configure -x config.h.in -ur grub2/util/i386/pc/grub-install.in grub2.lvm/util/i386/pc/grub-install.in
@@ -223,8 +223,11 @@
 # filesystem will be accessible).
 partmap_module=`$grub_probe --target=partmap --device-map=${device_map} ${grubdir} 2> /dev/null`
 
+# Device type module, if any (lvm, raid).
+devtype_module=`$grub_probe --target=type --device-map=${device_map} ${grubdir}`
+
 # _chain is often useful
-modules="$modules $fs_module $partmap_module biosdisk _chain"
+modules="$modules $fs_module $partmap_module $devtype_module biosdisk _chain"
 
 $grub_mkimage --output=${grubdir}/core.img --prefix=`make_system_path_relative_to_its_root ${grubdir}` $modules || exit 1
 
util/i386/pc/grub-setup.c +3 -3
diff -x configure -x config.h.in -ur grub2/util/i386/pc/grub-setup.c grub2.lvm/util/i386/pc/grub-setup.c
@@ -668,7 +668,7 @@
   if (! dest_dev)
     {
       /* Possibly, the user specified an OS device file.  */
-      dest_dev = grub_util_get_grub_dev (argv[optind]);
+      dest_dev = grub_util_get_grub_dev (NULL, argv[optind]);
       if (! dest_dev)
 	{
 	  fprintf (stderr, "Invalid device `%s'.\n", argv[optind]);
@@ -694,7 +694,7 @@
     }
   else
     {
-      root_dev = grub_util_get_grub_dev (grub_guess_root_device (dir ? : DEFAULT_DIRECTORY));
+      root_dev = grub_util_get_grub_dev (NULL, grub_guess_root_device (dir ? : DEFAULT_DIRECTORY));
       if (! root_dev)
 	{
 	  grub_util_info ("guessing the root device failed, because of `%s'",
@@ -734,7 +734,7 @@
 		 dir ? : DEFAULT_DIRECTORY,
 		 boot_file ? : DEFAULT_BOOT_FILE,
 		 core_file ? : DEFAULT_CORE_FILE,
-		 root_dev, grub_util_get_grub_dev (devicelist[i]), 1);
+		 root_dev, grub_util_get_grub_dev (NULL, devicelist[i]), 1);
 	}
 
       free (raid_prefix);
#19 lore raw

Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)

Quoted 1 line · Robert Millan

Try this one.

That's better, grub-install now does

   grub-mkimage --output=/tmp/boot/grub/core.img --prefix=/tmp/boot/grub ext2 lvm biosdisk _chain

I haven't tested yet, but this won't work, gpt (or pc?) is also needed, right?

I remember having seen

grub rescue> ls
(hd0) (hd1)

ie: no partitions when I tried without gpt/pc. I do not know how to recover from that from withing grub (cannot mount anything to insmod gpt/pc from).

Here's how grub-probe is called

grub-probe --target=partmap --device-map=/boot/grub/device.map /boot/grub
grub-probe: error: Cannot detect partition map for lvmraid-lvm1

Greetings,
Jan.

Signature · 2 lines
Jan Nieuwenhuizen <[email protected]> | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien       | http://www.lilypond.org
#20 lore raw

Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)

Quoted 7 lines · Jan Nieuwenhuizen
Quoted 1 line · Robert Millan

Try this one.

That's better, grub-install now does

   grub-mkimage --output=/tmp/boot/grub/core.img --prefix=/tmp/boot/grub ext2 lvm biosdisk _chain

Try putting lvm after biosdisk (I mentioned this in another mail).

Quoted 1 line

I haven't tested yet, but this won't work, gpt (or pc?) is also needed, right?

Yep.

Quoted 8 lines

I remember having seen

grub rescue> ls
(hd0) (hd1)

ie: no partitions when I tried without gpt/pc. I do not know how to recover from that from withing grub (cannot mount anything to insmod gpt/pc from).

You can't.

Quoted 2 lines

grub-probe --target=partmap --device-map=/boot/grub/device.map /boot/grub
grub-probe: error: Cannot detect partition map for lvmraid-lvm1

Wait, do lvm devices actually contain a partition map? If not, then this is normal, although in this case grub-probe should tell you the partmap for whatever physical partition contains the lvm data.

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)
#21 lore raw

Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)

Quoted 1 line · Robert Millan

Wait, do lvm devices actually contain a partition map?

I don't think so. LVM devices have volume groups and logical volumes.

Quoted 4 lines

If not, then this is
normal, although in this case grub-probe should tell you the partmap for
whatever physical partition contains the lvm data.

Yes. Or at least grub-install should check if grub-probe reports an error when checking for the partmap and warn the user or insert gpt/pc.

Greetings,
Jan.

Signature · 2 lines
Jan Nieuwenhuizen <[email protected]> | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien       | http://www.lilypond.org
#22 lore raw

Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)

Quoted 6 lines · Jan Nieuwenhuizen
Quoted 1 line · Robert Millan

Wait, do lvm devices actually contain a partition map?

I don't think so. LVM devices have volume groups and logical volumes.

Quoted 7 lines
Quoted 4 lines

If not, then this is
normal, although in this case grub-probe should tell you the partmap for
whatever physical partition contains the lvm data.

Yes. Or at least grub-install should check if grub-probe reports an error when checking for the partmap and warn the user or insert gpt/pc.

Partition maps aren't really mandatory; much like lvm/raid.

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)
#23 lore raw

Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)

Quoted 1 line · Robert Millan

Partition maps aren't really mandatory; much like lvm/raid.

Hmm, yes of course. But having one may save your day if booting fails and
you have useful non-lvm partitions. It is very useful if you can browse/use all your hdx,y if booting fails?

Jan.

Signature · 2 lines
Jan Nieuwenhuizen <[email protected]> | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien       | http://www.lilypond.org
#24 lore raw

Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)

Quoted 8 lines · Jan Nieuwenhuizen
Quoted 1 line · Robert Millan

Partition maps aren't really mandatory; much like lvm/raid.

Hmm, yes of course. But having one may save your day if booting fails and
you have useful non-lvm partitions. It is very useful if you can browse/use all your hdx,y if booting fails?

The problem with that is it can't really solve the problem, only provide a half-baked solution. If you include pc and gpt, you're misusing space in a component where it's really critical, and you still don't support all partitions GRUB might be installed on. For that, you'd have to load _all_ partition maps, which means even more space.

My point is that if you try at blindly guessing which partition map is needed, whether it works or not simply depends on your luck at guessing. And if you pick more than one option, it doesn't come for free.

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)
#25 lore raw

Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)

Quoted 5 lines · Robert Millan

The problem with that is it can't really solve the problem, only provide a half-baked solution. If you include pc and gpt, you're misusing space in a component where it's really critical, and you still don't support all partitions GRUB might be installed on. For that, you'd have to load _all_ partition maps, which means even more space.

I understand, and I've been wondering about this. As I do not have much if any knowledge for the sizing constraints of a bootloader, so I cannot appreciate the efforts of reducing space.

As a (blonde) user, I would think that you'd want to use *as much* rather than as little space you can. Why not (from a sizing pov, stability could be another issue), after core.img contains all necessary modules, fill up any `remaining' space (if that is how it works) with extra non-essential modules? Little harm in the ability to read more devices, I would say?

Greetings,
Jan.

Signature · 2 lines
Jan Nieuwenhuizen <[email protected]> | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien       | http://www.lilypond.org
#26 lore raw

Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)

Quoted 11 lines · Jan Nieuwenhuizen
Quoted 5 lines · Robert Millan

The problem with that is it can't really solve the problem, only provide a half-baked solution. If you include pc and gpt, you're misusing space in a component where it's really critical, and you still don't support all partitions GRUB might be installed on. For that, you'd have to load _all_ partition maps, which means even more space.

I understand, and I've been wondering about this. As I do not have much if any knowledge for the sizing constraints of a bootloader, so I cannot appreciate the efforts of reducing space.

The mission of core.img is being able to access /boot/grub, from where you can load anything you want. It has to be as small as possible, because if it won't fit in partition boot record, this can be a significant inconvenient.

Ironicaly, the big problem is for LVM/RAID users themselves:

if (must_embed && !able_to_embed)
grub_util_error ("Can't embed the core image, but this is required when\n"
"the root device is on a RAID array or LVM volume.");

Quoted 1 line

As a (blonde) user,

Uhm how is the color of your hear related to this? :-)

Quoted 6 lines

I would think that you'd want to use *as much*
rather than as little space you can. Why not (from a sizing pov, stability could be another issue), after core.img contains all necessary modules, fill up any `remaining' space (if that is how it works) with extra non-essential modules? Little harm in the ability to read more devices, I would say?

No, the goal in core.img is not to provide useful features, just access /boot/grub. It has to be as small as possible. The smaller, the more chances it'll work.

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)
#27 lore raw

Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)

In reply to Robert Millan

With your second patch, executing :

grub-probe --target=type /usr/share/grub/unicode.pff output :
lvm

So it seems to gives correct output (but I have only unicode.pff not unifont.pff)

So I think it's great :-)

Signature · 1 line
Martin Braure de Calignon
#28 lore raw

Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)

Quoted 11 lines · Martin Braure de Calignon

With your second patch, executing :

grub-probe --target=type /usr/share/grub/unicode.pff output :
lvm

So it seems to gives correct output (but I have only unicode.pff not unifont.pff)

So I think it's great :-)

Great. When I have a minute I'll polish that patch and eventually will be checked in.

Thanks

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)
#29 lore raw

Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)

In reply to Jan Nieuwenhuizen
Quoted 7 lines · Jan Nieuwenhuizen
    grub-mkimage --output=/boot/grub/core.img --prefix=/boot/grub ext2 lvm pc gpt biosdisk _chain
    grub-setup '(hd0)'

but that again gave me a grub rescue> prompt with exactly the same problems as before: error: unknown device, until I rmmod lvm, insmod lvm by hand

What happens if you change grub-mkimage parameter order? Put "lvm" as the last one.

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)
#30 lore raw

Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)

Quoted 4 lines · Robert Millan
Quoted 1 line
    grub-mkimage --output=/boot/grub/core.img --prefix=/boot/grub ext2 lvm pc gpt biosdisk _chain

What happens if you change grub-mkimage parameter order? Put "lvm" as the last one.

Yes, that's it. For the archives, this

    grub-mkimage --output=/boot/grub/core.img ext2 pc gpt biosdisk lvm

works for me. Thanks!

Jan.

Signature · 2 lines
Jan Nieuwenhuizen <[email protected]> | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien       | http://www.lilypond.org
#31 lore raw

Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)

Quoted 4 lines · Jan Nieuwenhuizen
Quoted 1 line · Robert Millan
Quoted 1 line
    grub-mkimage --output=/boot/grub/core.img --prefix=/boot/grub ext2 lvm pc gpt biosdisk _chain
Quoted 8 lines
Quoted 2 lines

What happens if you change grub-mkimage parameter order? Put "lvm" as the last one.

Yes, that's it. For the archives, this

    grub-mkimage --output=/boot/grub/core.img ext2 pc gpt biosdisk lvm

works for me. Thanks!

I reworked and cleaned up the patch a bit. Please, can you test this one?

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)
include/grub/util/getroot.h renamed from grub2/include/grub/util/getroot.h +10 -2
diff -x configure -x config.h.in -ur ../grub2/include/grub/util/getroot.h ./include/grub/util/getroot.h
@@ -1,6 +1,6 @@
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2003, 2007  Free Software Foundation, Inc.
+ *  Copyright (C) 2003, 2007, 2008  Free Software Foundation, Inc.
  *
  *  GRUB is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -19,8 +19,16 @@
 #ifndef GRUB_UTIL_GETROOT_HEADER
 #define GRUB_UTIL_GETROOT_HEADER	1
 
+enum grub_dev_abstraction_types {
+  GRUB_DEV_ABSTRACTION_NONE,
+  GRUB_DEV_ABSTRACTION_LVM,
+  GRUB_DEV_ABSTRACTION_RAID,
+  GRUB_DEV_ABSTRACTION_UNKNOWN,
+};
+
 char *grub_guess_root_device (const char *dir);
 char *grub_get_prefix (const char *dir);
-char *grub_util_get_grub_dev (const char *os_dev);
+int grub_util_get_dev_abstraction (const char *os_dev);
+char *grub_util_get_grub_dev (const int dev_abstraction, const char *os_dev);
 
 #endif /* ! GRUB_UTIL_GETROOT_HEADER */
util/getroot.c renamed from grub2/util/getroot.c +36 -17

93 lines not on this page · raw message

util/grub.d/00_header.in renamed from grub2/util/grub.d/00_header.in +7 -1
diff -x configure -x config.h.in -ur ../grub2/util/grub.d/00_header.in ./util/grub.d/00_header.in
@@ -1,7 +1,7 @@
 #! /bin/sh -e
 
 # update-grub helper script.
-# Copyright (C) 2006,2007  Free Software Foundation, Inc.
+# Copyright (C) 2006,2007,2008  Free Software Foundation, Inc.
 #
 # GRUB is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -24,6 +24,12 @@
 # for convert_system_path_to_grub_path()
 . ${libdir}/grub/update-grub_lib
 
+# Do this as early as possible, since other commands might depend on it.
+# (e.g. the `font' command might need lvm or raid modules)
+for i in ${GRUB_PRELOAD_MODULES} ; do
+  echo "insmod $i"
+done
+
 if [ "x${GRUB_DEFAULT}" = "x" ] ; then GRUB_DEFAULT=0 ; fi
 if [ "x${GRUB_TIMEOUT}" = "x" ] ; then GRUB_TIMEOUT=5 ; fi
 
util/grub-probe.c renamed from grub2/util/grub-probe.c +35 -7

78 lines not on this page · raw message

util/i386/pc/grub-install.in renamed from grub2/util/i386/pc/grub-install.in +5 -2
diff -x configure -x config.h.in -ur ../grub2/util/i386/pc/grub-install.in ./util/i386/pc/grub-install.in
@@ -1,7 +1,7 @@
 #! /bin/sh
 
 # Install GRUB on your drive.
-# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007  Free Software Foundation, Inc.
+# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008  Free Software Foundation, Inc.
 #
 # GRUB is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -223,8 +223,11 @@
 # filesystem will be accessible).
 partmap_module=`$grub_probe --target=partmap --device-map=${device_map} ${grubdir} 2> /dev/null`
 
+# Device abstraction module, if any (lvm, raid).
+devabstraction_module=`$grub_probe --target=abstraction --device-map=${device_map} ${grubdir}`
+
 # _chain is often useful
-modules="$modules $fs_module $partmap_module biosdisk _chain"
+modules="$modules $fs_module $partmap_module biosdisk $devabstraction_module _chain"
 
 $grub_mkimage --output=${grubdir}/core.img --prefix=`make_system_path_relative_to_its_root ${grubdir}` $modules || exit 1
 
util/i386/pc/grub-setup.c renamed from grub2/util/i386/pc/grub-setup.c +4 -4
diff -x configure -x config.h.in -ur ../grub2/util/i386/pc/grub-setup.c ./util/i386/pc/grub-setup.c
@@ -1,7 +1,7 @@
 /* grub-setup.c - make GRUB usable */
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007  Free Software Foundation, Inc.
+ *  Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008  Free Software Foundation, Inc.
  *
  *  GRUB is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -668,7 +668,7 @@
   if (! dest_dev)
     {
       /* Possibly, the user specified an OS device file.  */
-      dest_dev = grub_util_get_grub_dev (argv[optind]);
+      dest_dev = grub_util_get_grub_dev (GRUB_DEV_ABSTRACTION_UNKNOWN, argv[optind]);
       if (! dest_dev)
 	{
 	  fprintf (stderr, "Invalid device `%s'.\n", argv[optind]);
@@ -694,7 +694,7 @@
     }
   else
     {
-      root_dev = grub_util_get_grub_dev (grub_guess_root_device (dir ? : DEFAULT_DIRECTORY));
+      root_dev = grub_util_get_grub_dev (GRUB_DEV_ABSTRACTION_UNKNOWN, grub_guess_root_device (dir ? : DEFAULT_DIRECTORY));
       if (! root_dev)
 	{
 	  grub_util_info ("guessing the root device failed, because of `%s'",
@@ -734,7 +734,7 @@
 		 dir ? : DEFAULT_DIRECTORY,
 		 boot_file ? : DEFAULT_BOOT_FILE,
 		 core_file ? : DEFAULT_CORE_FILE,
-		 root_dev, grub_util_get_grub_dev (devicelist[i]), 1);
+		 root_dev, grub_util_get_grub_dev (GRUB_DEV_ABSTRACTION_UNKNOWN, devicelist[i]), 1);
 	}
 
       free (raid_prefix);
util/update-grub.in renamed from grub2/util/update-grub.in +2 -2
diff -x configure -x config.h.in -ur ../grub2/util/update-grub.in ./util/update-grub.in
@@ -1,7 +1,7 @@
 #! /bin/sh -e
 
 # Generate grub.cfg by inspecting /boot contents.
-# Copyright (C) 2006,2007  Free Software Foundation, Inc.
+# Copyright (C) 2006,2007,2008  Free Software Foundation, Inc.
 #
 # GRUB is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -121,7 +121,7 @@
 
 # These are defined in this script, export them here so that user can
 # override them.
-export GRUB_DEVICE GRUB_FS GRUB_DRIVE GRUB_DRIVE_BOOT GRUB_DRIVE_BOOT_GRUB GRUB_FONT_PATH
+export GRUB_DEVICE GRUB_FS GRUB_DRIVE GRUB_DRIVE_BOOT GRUB_DRIVE_BOOT_GRUB GRUB_FONT_PATH GRUB_PRELOAD_MODULES
 
 # These are optional, user-defined variables.
 export GRUB_DEFAULT GRUB_TIMEOUT GRUB_DISTRIBUTOR GRUB_CMDLINE_LINUX GRUB_TERMINAL GRUB_SERIAL_COMMAND
util/update-grub_lib.in renamed from grub2/util/update-grub_lib.in +4 -9
diff -x configure -x config.h.in -ur ../grub2/util/update-grub_lib.in ./util/update-grub_lib.in
@@ -1,5 +1,5 @@
 # Helper library for update-grub
-# Copyright (C) 2007  Free Software Foundation, Inc.
+# Copyright (C) 2007,2008  Free Software Foundation, Inc.
 #
 # GRUB is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -93,19 +93,14 @@
 
 font_path ()
 {
-  if [ "x${GRUB_FONT_PATH}" = "x" ] ; then : ; else
-    echo "${GRUB_FONT_PATH}"
-    return 0
-  fi
-
   # Prefer system path for space reasons (/boot/grub might be a very small
   # partition in case of OpenFirmware, etc).
   for dir in ${pkgdatadir} /usr/share/grub /boot/grub ; do
     # Prefer complete fonts over incomplete ones.
     for basename in unicode unifont ascii ; do
-      if path=`convert_system_path_to_grub_path ${dir}/${basename}.pff` ; then
-        GRUB_FONT_PATH="${path}"
-        echo "${GRUB_FONT_PATH}"
+      path="${dir}/${basename}.pff"
+      if convert_system_path_to_grub_path ${path} ; then
+        GRUB_PRELOAD_MODULES="`${GRUB_PRELOAD_MODULES} ${grub-probe} -t abstraction ${path}`"
         return 0
       fi
     done
#32 lore raw

Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)

Quoted 1 line · Robert Millan

I reworked and cleaned up the patch a bit. Please, can you test this one?

This has lvm after biosdisk, which looks ok.

    grub-mkimage --output=/boot/grub/core.img --prefix=/tmp/boot/grub ext2 biosdisk lvm _chain

Haven't boot-tested this yet, but should be ok.

Btw, I'm editing grub-install all the time to not really install, what about a --dry-run option? (patch against your version attached)

Greetings,
Jan.

Signature · 2 lines
Jan Nieuwenhuizen <[email protected]> | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien       | http://www.lilypond.org

Index: ChangeLog
===================================================================
RCS file: /sources/grub/grub2/ChangeLog,v
retrieving revision 1.484

ChangeLog +4 -0
diff -p -u -r1.484 ChangeLog
@@ -1,3 +1,7 @@
+2008-01-09  Jan Nieuwenhuizen  <[email protected]>
+
+	* util/i386/pc/grub-install.in: Add --dry-run option.
+
 2008-01-08  Robert Millan  <[email protected]>
 
 	* loader/i386/pc/linux.c (grub_rescue_cmd_linux): For
i386/pc/grub-install.in renamed from i386/pc/grub-install.in~ +11 -6
@@ -44,6 +44,7 @@
 force_lba=
 recheck=no
 debug=no
+dry_run=
 
 # for make_system_path_relative_to_its_root()
 . ${libdir}/grub/update-grub_lib
@@ -57,6 +58,7 @@
 
   -h, --help              print this message and exit
   -v, --version           print the version information and exit
+  -n, --dry-run           do not install grub, just print install commands
   --modules=MODULES       pre-load specified modules MODULES
   --root-directory=DIR    install GRUB images under the directory DIR
                           instead of the root directory
@@ -86,6 +88,8 @@
     -v | --version)
 	echo "grub-install (GNU GRUB ${PACKAGE_VERSION})"
 	exit 0 ;;
+    -n | --dry-run)
+	dry_run=echo ;;
     --modules=*)
 	modules=`echo "$option" | sed 's/--modules=//'` ;;
     --root-directory=*)
@@ -174,8 +178,8 @@
 fi
 
 # Create the GRUB directory if it is not present.
-test -d "$bootdir" || mkdir "$bootdir" || exit 1
-test -d "$grubdir" || mkdir "$grubdir" || exit 1
+test -d "$bootdir" || $dry_run mkdir "$bootdir" || exit 1
+test -d "$grubdir" || $dry_run mkdir "$grubdir" || exit 1
 
 # If --recheck is specified, remove the device map, if present.
 if test $recheck = yes; then
@@ -203,11 +207,11 @@
 # Copy the GRUB images to the GRUB directory.
 for file in ${grubdir}/*.mod ${grubdir}/*.lst ${grubdir}/*.img; do
     if test -f $file && [ "`basename $file`" != menu.lst ]; then
-	rm -f $file || exit 1
+	$dry_run rm -f $file || exit 1
     fi
 done
 for file in ${pkglibdir}/*.mod ${pkglibdir}/*.lst ${pkglibdir}/*.img; do
-    cp -f $file ${grubdir} || exit 1
+    $dry_run cp -f $file ${grubdir} || exit 1
 done
 
 # Create the core image. First, auto-detect the filesystem module.
@@ -229,13 +233,14 @@
 # _chain is often useful
 modules="$modules $fs_module $partmap_module biosdisk $devabstraction_module _chain"
 
-$grub_mkimage --output=${grubdir}/core.img --prefix=`make_system_path_relative_to_its_root ${grubdir}` $modules || exit 1
+$dry_run $grub_mkimage --output=${grubdir}/core.img --prefix=`make_system_path_relative_to_its_root ${grubdir}` $modules || exit 1
 
 # Now perform the installation.
-$grub_setup --directory=${grubdir} --device-map=${device_map} \
+$dry_run $grub_setup --directory=${grubdir} --device-map=${device_map} \
     ${install_device} || exit 1
 
 # Prompt the user to check if the device map is correct.
+test -n "$dry_run" && echo "DRY RUN: Grub was not (re)installed."
 echo "Installation finished. No error reported."
 echo "This is the contents of the device map $device_map."
 echo "Check if this is correct or not. If any of the lines is incorrect,"
#33 lore raw

Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)

Quoted 9 lines · Jan Nieuwenhuizen
Quoted 1 line · Robert Millan

I reworked and cleaned up the patch a bit. Please, can you test this one?

This has lvm after biosdisk, which looks ok.

    grub-mkimage --output=/boot/grub/core.img --prefix=/tmp/boot/grub ext2 biosdisk lvm _chain

Haven't boot-tested this yet, but should be ok.

That's fine. You could also test `update-grub' though. Well, not you, someone who has LVM in /usr but not in /boot.

Quoted 2 lines

Btw, I'm editing grub-install all the time to not really install, what about a --dry-run option? (patch against your version attached)

Not sure what will others think, but I don't see this as something useful enough for the general user to justify the added complexity.

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)
#34 lore raw

Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)

In reply to Robert Millan
Quoted 8 lines · Robert Millan
Quoted 7 lines · Jan Nieuwenhuizen
Quoted 4 lines · Robert Millan
Quoted 1 line
    grub-mkimage --output=/boot/grub/core.img --prefix=/boot/grub ext2 lvm pc gpt biosdisk _chain

What happens if you change grub-mkimage parameter order? Put "lvm" as the last one.

Quoted 7 lines
Quoted 5 lines

Yes, that's it. For the archives, this

    grub-mkimage --output=/boot/grub/core.img ext2 pc gpt biosdisk lvm

works for me. Thanks!

I reworked and cleaned up the patch a bit. Please, can you test this one?

Préparation du remplacement de grub-pc 1.95+20080107-1 (en utilisant .../grub-pc_1.95+20080107-1_amd64.deb) ... Dépaquetage de la mise à jour de grub-pc ... Paramétrage de grub-pc (1.95+20080107-1) ... Installation de la nouvelle version du fichier de configuration /etc/grub.d/00_header ... /usr/lib/grub/update-grub_lib: line 103: probe: command not found Updating /boot/grub/grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.23-1-amd64
Found initrd image: /boot/initrd.img-2.6.23-1-amd64 done

after dpkg-reocnfigure grub-pc

dpkg-reconfigure grub-pc
/usr/lib/grub/update-grub_lib: line 103: probe: command not found Updating /boot/grub/grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.23-1-amd64
Found initrd image: /boot/initrd.img-2.6.23-1-amd64 done

seems that ${grub-probe} = probe ?

Signature · 1 line
Martin Braure de Calignon
#35 lore raw

Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)

Le mercredi 09 janvier 2008 à 14:40 +0100, Martin Braure de Calignon a écrit :

Quoted 5 lines

/usr/lib/grub/update-grub_lib: line 103: probe: command not found Updating /boot/grub/grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.23-1-amd64
Found initrd image: /boot/initrd.img-2.6.23-1-amd64 done

GRUB_PRELOAD_MODULES="`${GRUB_PRELOAD_MODULES} ${grub-probe} -t abstrac

on this line change ${grub-probe} ${grub_probe}

now I reboot to see if it works

Signature · 1 line
Martin Braure de Calignon
#36 lore raw

Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)

Quoted 4 lines · Martin Braure de Calignon

GRUB_PRELOAD_MODULES="`${GRUB_PRELOAD_MODULES} ${grub-probe} -t abstrac

on this line change ${grub-probe} ${grub_probe}

Thanks

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)
#37 lore raw

Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)

Quoted 7 lines · Robert Millan
Quoted 4 lines · Martin Braure de Calignon

GRUB_PRELOAD_MODULES="`${GRUB_PRELOAD_MODULES} ${grub-probe} -t abstrac

on this line change ${grub-probe} ${grub_probe}

Thanks

It didn't work because I only do a dpkg -i grub-pc_*.deb and the old conf-files still exists..
But I have removed all my /etc/grub.d/ then do a dpkg with --force-confmiss

Here's my grub.cfg in attachement. I don't see any insmod lvm :-/ Did I missed something ? I didn't reboot yet. If you think everything is ok, I'll try to reboot. But I have apply the first page you gave us (with modification in kern.c to insmod lvm on normal module loading)

Signature · 1 line
Martin Braure de Calignon

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by /usr/sbin/update-grub using templates

# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
set default=0
set timeout=5
set root=(hd0,9)
font (mainvg-usr)/share/grub/unicode.pff
terminal console
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_hurd ###
### END /etc/grub.d/10_hurd ###

### BEGIN /etc/grub.d/10_linux ###

menuentry "Debian GNU/Linux, linux 2.6.23-1-amd64" {
	linux	(hd0,9)/boot/vmlinuz-2.6.23-1-amd64 root=/dev/hda9 ro noapictimer splash vga=792 quiet
	initrd	(hd0,9)/boot/initrd.img-2.6.23-1-amd64
}
menuentry "Debian GNU/Linux, linux 2.6.23-1-amd64 (single-user mode)" {
	linux	(hd0,9)/boot/vmlinuz-2.6.23-1-amd64 root=/dev/hda9 ro single noapictimer splash vga=792 quiet
	initrd	(hd0,9)/boot/initrd.img-2.6.23-1-amd64
}

### END /etc/grub.d/10_linux ###

#38 lore raw

Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)

Quoted 8 lines · Martin Braure de Calignon
Quoted 6 lines · Robert Millan
Quoted 4 lines · Martin Braure de Calignon

GRUB_PRELOAD_MODULES="`${GRUB_PRELOAD_MODULES} ${grub-probe} -t abstrac

on this line change ${grub-probe} ${grub_probe}

Quoted 8 lines
Quoted 1 line

Thanks

It didn't work because I only do a dpkg -i grub-pc_*.deb and the old conf-files still exists..
But I have removed all my /etc/grub.d/ then do a dpkg with --force-confmiss

Here's my grub.cfg in attachement. I don't see any insmod lvm :-/

There should be one. Can you find out why 00_header is not echoing it?

Quoted 1 line

(with modification in kern.c to insmod lvm on normal module loading)

Please discard that, my latest patch obsoletes it.

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)
#39 lore raw

Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)

Quoted 1 line · Robert Millan

There should be one. Can you find out why 00_header is not echoing it?

because font_path is never called ?

with font_path under update-grub_lib in 00headers it works

Signature · 1 line
Martin Braure de Calignon
#40 lore raw

PATCH 1/1 fix `lvm' and `raid' loading for grub-install/core.img and update-grub/grub.cfg problems

I just installed an LVM test system to debug this.

Quoted 6 lines · Martin Braure de Calignon
Quoted 1 line · Robert Millan

There should be one. Can you find out why 00_header is not echoing it?

because font_path is never called ?

It was; the problem had to do with the variable not being exported.

I'm proposing the attached patch for commit (ChangeLog entry in patch header).

This fixes the two known problems regarding load of lvm/raid modules. I found other two issues with lvm in runtime, which I just committed since the fix was one-liner.

The remaining known problem is detecting partmap; I'll probably find time to do that one too, but I'll need to know how can one obtain a machine-parseable list of physical devices that conform an LVM virtual device (and the same for software RAID).

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)

* include/grub/util/getroot.h (grub_dev_abstraction_types): New enum. (grub_util_get_dev_abstraction): New function prototype. (grub_util_get_grub_dev): Add `dev_abstraction' parameter.

* util/getroot.c: Include `<grub/util/getroot.h>' (grub_util_get_grub_dev): Move detection of abstraction type to ... (grub_util_get_dev_abstraction): ... here (new function).

* util/grub-emu.c (main): Update calls to grub_util_get_grub_dev() with new `dev_abstraction' parameter.
* util/i386/pc/grub-setup.c (main): Likewise.

* util/grub-probe.c: Convert PRINT_* to an enum. Add `PRINT_ABSTRACTION'.
(probe): Probe for abstraction type when requested. (main): Understand `--target=abstraction'.

* util/i386/efi/grub-install.in: Add abstraction module to core image when it is found to be necessary.
* util/i386/pc/grub-install.in: Likewise.
* util/powerpc/ieee1275/grub-install.in: Likewise.

* util/update-grub_lib.in (font_path): Return system path without converting to GRUB path.
* util/update-grub.in: Convert system path returned by font_path() to a GRUB path. Use grub-probe -t abstraction' to determine what abstraction module is needed for loading fonts (if any). Export that as GRUB_PRELOAD_MODULES'.
* util/grub.d/00_header.in: Process `GRUB_PRELOAD_MODULES' (print insmod commands).

include/grub/util/getroot.h +10 -2
diff -urp grub2/include/grub/util/getroot.h lvm/include/grub/util/getroot.h
@@ -1,6 +1,6 @@
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2003, 2007  Free Software Foundation, Inc.
+ *  Copyright (C) 2003, 2007, 2008  Free Software Foundation, Inc.
  *
  *  GRUB is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -19,8 +19,16 @@
 #ifndef GRUB_UTIL_GETROOT_HEADER
 #define GRUB_UTIL_GETROOT_HEADER	1
 
+enum grub_dev_abstraction_types {
+  GRUB_DEV_ABSTRACTION_NONE,
+  GRUB_DEV_ABSTRACTION_LVM,
+  GRUB_DEV_ABSTRACTION_RAID,
+  GRUB_DEV_ABSTRACTION_UNKNOWN,
+};
+
 char *grub_guess_root_device (const char *dir);
 char *grub_get_prefix (const char *dir);
-char *grub_util_get_grub_dev (const char *os_dev);
+int grub_util_get_dev_abstraction (const char *os_dev);
+char *grub_util_get_grub_dev (const int dev_abstraction, const char *os_dev);
 
 #endif /* ! GRUB_UTIL_GETROOT_HEADER */
util/getroot.c +36 -17

93 lines not on this page · raw message

util/grub.d/00_header.in +7 -1
diff -urp grub2/util/grub.d/00_header.in lvm/util/grub.d/00_header.in
@@ -1,7 +1,7 @@
 #! /bin/sh -e
 
 # update-grub helper script.
-# Copyright (C) 2006,2007  Free Software Foundation, Inc.
+# Copyright (C) 2006,2007,2008  Free Software Foundation, Inc.
 #
 # GRUB is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -24,6 +24,12 @@ platform=@platform@
 # for convert_system_path_to_grub_path()
 . ${libdir}/grub/update-grub_lib
 
+# Do this as early as possible, since other commands might depend on it.
+# (e.g. the `font' command might need lvm or raid modules)
+for i in ${GRUB_PRELOAD_MODULES} ; do
+  echo "insmod $i"
+done
+
 if [ "x${GRUB_DEFAULT}" = "x" ] ; then GRUB_DEFAULT=0 ; fi
 if [ "x${GRUB_TIMEOUT}" = "x" ] ; then GRUB_TIMEOUT=5 ; fi
 
util/grub-emu.c +2 -2
diff -urp grub2/util/grub-emu.c lvm/util/grub-emu.c
@@ -1,6 +1,6 @@
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2003,2004,2005,2006,2007  Free Software Foundation, Inc.
+ *  Copyright (C) 2003,2004,2005,2006,2007,2008  Free Software Foundation, Inc.
  *
  *  GRUB is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -186,7 +186,7 @@ main (int argc, char *argv[])
       if (! device_name)
         grub_util_error ("cannot find a device for %s.\n", args.dir ? : DEFAULT_DIRECTORY);
 
-      args.root_dev = grub_util_get_grub_dev (device_name);
+      args.root_dev = grub_util_get_grub_dev (GRUB_DEV_ABSTRACTION_UNKNOWN, device_name);
       if (! args.root_dev)
 	{
 	  grub_util_info ("guessing the root device failed, because of `%s'",
util/grub-probe.c +36 -8

80 lines not on this page · raw message

util/i386/efi/grub-install.in +5 -2
diff -urp grub2/util/i386/efi/grub-install.in lvm/util/i386/efi/grub-install.in
@@ -1,7 +1,7 @@
 #! /bin/sh
 
 # Install GRUB on your EFI partition.
-# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007  Free Software Foundation, Inc.
+# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008  Free Software Foundation, Inc.
 #
 # GRUB is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -190,8 +190,11 @@ fi
 # filesystem will be accessible).
 partmap_module=`$grub_probe --target=partmap --device-map=${device_map} ${grubdir} 2> /dev/null`
 
+# Device abstraction module, if any (lvm, raid).
+devabstraction_module=`$grub_probe --target=abstraction --device-map=${device_map} ${grubdir}`
+
 # _chain is often useful
-modules="$modules $fs_module $partmap_module _chain"
+modules="$modules $fs_module $partmap_module $devabstraction_module _chain"
 
 $grub_mkimage --output=${grubdir}/grub.efi $modules || exit 1
 
util/i386/pc/grub-install.in +5 -2
diff -urp grub2/util/i386/pc/grub-install.in lvm/util/i386/pc/grub-install.in
@@ -1,7 +1,7 @@
 #! /bin/sh
 
 # Install GRUB on your drive.
-# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007  Free Software Foundation, Inc.
+# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008  Free Software Foundation, Inc.
 #
 # GRUB is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -223,8 +223,11 @@ fi
 # filesystem will be accessible).
 partmap_module=`$grub_probe --target=partmap --device-map=${device_map} ${grubdir} 2> /dev/null`
 
+# Device abstraction module, if any (lvm, raid).
+devabstraction_module=`$grub_probe --target=abstraction --device-map=${device_map} ${grubdir}`
+
 # _chain is often useful
-modules="$modules $fs_module $partmap_module biosdisk _chain"
+modules="$modules $fs_module $partmap_module biosdisk $devabstraction_module _chain"
 
 $grub_mkimage --output=${grubdir}/core.img --prefix=`make_system_path_relative_to_its_root ${grubdir}` $modules || exit 1
 
util/i386/pc/grub-setup.c +4 -4
diff -urp grub2/util/i386/pc/grub-setup.c lvm/util/i386/pc/grub-setup.c
@@ -1,7 +1,7 @@
 /* grub-setup.c - make GRUB usable */
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007  Free Software Foundation, Inc.
+ *  Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008  Free Software Foundation, Inc.
  *
  *  GRUB is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -668,7 +668,7 @@ main (int argc, char *argv[])
   if (! dest_dev)
     {
       /* Possibly, the user specified an OS device file.  */
-      dest_dev = grub_util_get_grub_dev (argv[optind]);
+      dest_dev = grub_util_get_grub_dev (GRUB_DEV_ABSTRACTION_UNKNOWN, argv[optind]);
       if (! dest_dev)
 	{
 	  fprintf (stderr, "Invalid device `%s'.\n", argv[optind]);
@@ -694,7 +694,7 @@ main (int argc, char *argv[])
     }
   else
     {
-      root_dev = grub_util_get_grub_dev (grub_guess_root_device (dir ? : DEFAULT_DIRECTORY));
+      root_dev = grub_util_get_grub_dev (GRUB_DEV_ABSTRACTION_UNKNOWN, grub_guess_root_device (dir ? : DEFAULT_DIRECTORY));
       if (! root_dev)
 	{
 	  grub_util_info ("guessing the root device failed, because of `%s'",
@@ -734,7 +734,7 @@ main (int argc, char *argv[])
 		 dir ? : DEFAULT_DIRECTORY,
 		 boot_file ? : DEFAULT_BOOT_FILE,
 		 core_file ? : DEFAULT_CORE_FILE,
-		 root_dev, grub_util_get_grub_dev (devicelist[i]), 1);
+		 root_dev, grub_util_get_grub_dev (GRUB_DEV_ABSTRACTION_UNKNOWN, devicelist[i]), 1);
 	}
 
       free (raid_prefix);
util/powerpc/ieee1275/grub-install.in +5 -2
diff -urp grub2/util/powerpc/ieee1275/grub-install.in lvm/util/powerpc/ieee1275/grub-install.in
@@ -1,7 +1,7 @@
 #! /bin/sh
 
 # Install GRUB on your drive.
-# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007  Free Software Foundation, Inc.
+# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008  Free Software Foundation, Inc.
 #
 # GRUB is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -176,7 +176,10 @@ fi
 # filesystem will be accessible).
 partmap_module=`$grub_probe --target=partmap --device-map=${device_map} ${grubdir} 2> /dev/null`
 
-modules="$modules $fs_module $partmap_module"
+# Device abstraction module, if any (lvm, raid).
+devabstraction_module=`$grub_probe --target=abstraction --device-map=${device_map} ${grubdir}`
+
+modules="$modules $fs_module $partmap_module $devabstraction_module"
 
 # Now perform the installation.
 "$grub_mkimage" --output=${grubdir}/grub $modules || exit 1
util/update-grub.in +6 -3
diff -urp grub2/util/update-grub.in lvm/util/update-grub.in
@@ -1,7 +1,7 @@
 #! /bin/sh -e
 
 # Generate grub.cfg by inspecting /boot contents.
-# Copyright (C) 2006,2007  Free Software Foundation, Inc.
+# Copyright (C) 2006,2007,2008  Free Software Foundation, Inc.
 #
 # GRUB is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -103,7 +103,10 @@ esac
 # check for terminals that require fonts
 case ${GRUB_TERMINAL} in
   gfxterm)
-    if GRUB_FONT_PATH=`font_path` ; then : ; else
+    if path=`font_path` ; then
+      GRUB_FONT_PATH="`convert_system_path_to_grub_path ${path}`"
+      GRUB_PRELOAD_MODULES="`${GRUB_PRELOAD_MODULES} ${grub_probe} -t abstraction ${path}`"
+    else
       # fallback to console
       GRUB_TERMINAL=console
     fi
@@ -121,7 +124,7 @@ esac
 
 # These are defined in this script, export them here so that user can
 # override them.
-export GRUB_DEVICE GRUB_FS GRUB_DRIVE GRUB_DRIVE_BOOT GRUB_DRIVE_BOOT_GRUB GRUB_FONT_PATH
+export GRUB_DEVICE GRUB_FS GRUB_DRIVE GRUB_DRIVE_BOOT GRUB_DRIVE_BOOT_GRUB GRUB_FONT_PATH GRUB_PRELOAD_MODULES
 
 # These are optional, user-defined variables.
 export GRUB_DEFAULT GRUB_TIMEOUT GRUB_DISTRIBUTOR GRUB_CMDLINE_LINUX GRUB_TERMINAL GRUB_SERIAL_COMMAND
util/update-grub_lib.in +4 -9
diff -urp grub2/util/update-grub_lib.in lvm/util/update-grub_lib.in
@@ -1,5 +1,5 @@
 # Helper library for update-grub
-# Copyright (C) 2007  Free Software Foundation, Inc.
+# Copyright (C) 2007,2008  Free Software Foundation, Inc.
 #
 # GRUB is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -93,19 +93,14 @@ convert_system_path_to_grub_path ()
 
 font_path ()
 {
-  if [ "x${GRUB_FONT_PATH}" = "x" ] ; then : ; else
-    echo "${GRUB_FONT_PATH}"
-    return 0
-  fi
-
   # Prefer system path for space reasons (/boot/grub might be a very small
   # partition in case of OpenFirmware, etc).
   for dir in ${pkgdatadir} /usr/share/grub /boot/grub ; do
     # Prefer complete fonts over incomplete ones.
     for basename in unicode unifont ascii ; do
-      if path=`convert_system_path_to_grub_path ${dir}/${basename}.pff` ; then
-        GRUB_FONT_PATH="${path}"
-        echo "${GRUB_FONT_PATH}"
+      path="${dir}/${basename}.pff"
+      if convert_system_path_to_grub_path ${path} > /dev/null ; then
+        echo "${path}"
         return 0
       fi
     done
#41 lore raw

Re: [PATCH] fix `lvm' and `raid' loading for grub-install/core.img and update-grub/grub.cfg problems

New patch, a bit simpler (after giving it a though, I don't think the gained speed is worth the extra complication)

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)

* include/grub/util/getroot.h (grub_dev_abstraction_types): New enum. (grub_util_get_dev_abstraction): New function prototype.

* util/getroot.c: Include `<grub/util/getroot.h>' (grub_util_get_grub_dev): Move detection of abstraction type to ... (grub_util_get_dev_abstraction): ... here (new function).

* util/grub-probe.c: Convert PRINT_* to an enum. Add `PRINT_ABSTRACTION'.
(probe): Probe for abstraction type when requested. (main): Understand `--target=abstraction'.

* util/i386/efi/grub-install.in: Add abstraction module to core image when it is found to be necessary.
* util/i386/pc/grub-install.in: Likewise.
* util/powerpc/ieee1275/grub-install.in: Likewise.

* util/update-grub_lib.in (font_path): Return system path without converting to GRUB path.
* util/update-grub.in: Convert system path returned by font_path() to a GRUB path. Use grub-probe -t abstraction' to determine what abstraction module is needed for loading fonts (if any). Export that as GRUB_PRELOAD_MODULES'.
* util/grub.d/00_header.in: Process `GRUB_PRELOAD_MODULES' (print insmod commands).

include/grub/util/getroot.h +8 -1
diff -x configure -x config.h.in -urp grub2/include/grub/util/getroot.h lvmraid/include/grub/util/getroot.h
@@ -1,6 +1,6 @@
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2003, 2007  Free Software Foundation, Inc.
+ *  Copyright (C) 2003, 2007, 2008  Free Software Foundation, Inc.
  *
  *  GRUB is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -19,8 +19,15 @@
 #ifndef GRUB_UTIL_GETROOT_HEADER
 #define GRUB_UTIL_GETROOT_HEADER	1
 
+enum grub_dev_abstraction_types {
+  GRUB_DEV_ABSTRACTION_NONE,
+  GRUB_DEV_ABSTRACTION_LVM,
+  GRUB_DEV_ABSTRACTION_RAID,
+};
+
 char *grub_guess_root_device (const char *dir);
 char *grub_get_prefix (const char *dir);
+int grub_util_get_dev_abstraction (const char *os_dev);
 char *grub_util_get_grub_dev (const char *os_dev);
 
 #endif /* ! GRUB_UTIL_GETROOT_HEADER */
util/getroot.c +33 -17

90 lines not on this page · raw message

util/grub.d/00_header.in +7 -1
diff -x configure -x config.h.in -urp grub2/util/grub.d/00_header.in lvmraid/util/grub.d/00_header.in
@@ -1,7 +1,7 @@
 #! /bin/sh -e
 
 # update-grub helper script.
-# Copyright (C) 2006,2007  Free Software Foundation, Inc.
+# Copyright (C) 2006,2007,2008  Free Software Foundation, Inc.
 #
 # GRUB is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -24,6 +24,12 @@ platform=@platform@
 # for convert_system_path_to_grub_path()
 . ${libdir}/grub/update-grub_lib
 
+# Do this as early as possible, since other commands might depend on it.
+# (e.g. the `font' command might need lvm or raid modules)
+for i in ${GRUB_PRELOAD_MODULES} ; do
+  echo "insmod $i"
+done
+
 if [ "x${GRUB_DEFAULT}" = "x" ] ; then GRUB_DEFAULT=0 ; fi
 if [ "x${GRUB_TIMEOUT}" = "x" ] ; then GRUB_TIMEOUT=5 ; fi
 
util/grub-probe.c +35 -7

78 lines not on this page · raw message

util/i386/efi/grub-install.in +5 -2
diff -x configure -x config.h.in -urp grub2/util/i386/efi/grub-install.in lvmraid/util/i386/efi/grub-install.in
@@ -1,7 +1,7 @@
 #! /bin/sh
 
 # Install GRUB on your EFI partition.
-# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007  Free Software Foundation, Inc.
+# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008  Free Software Foundation, Inc.
 #
 # GRUB is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -190,8 +190,11 @@ fi
 # filesystem will be accessible).
 partmap_module=`$grub_probe --target=partmap --device-map=${device_map} ${grubdir} 2> /dev/null`
 
+# Device abstraction module, if any (lvm, raid).
+devabstraction_module=`$grub_probe --target=abstraction --device-map=${device_map} ${grubdir}`
+
 # _chain is often useful
-modules="$modules $fs_module $partmap_module _chain"
+modules="$modules $fs_module $partmap_module $devabstraction_module _chain"
 
 $grub_mkimage --output=${grubdir}/grub.efi $modules || exit 1
 
util/i386/pc/grub-install.in +5 -2
diff -x configure -x config.h.in -urp grub2/util/i386/pc/grub-install.in lvmraid/util/i386/pc/grub-install.in
@@ -1,7 +1,7 @@
 #! /bin/sh
 
 # Install GRUB on your drive.
-# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007  Free Software Foundation, Inc.
+# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008  Free Software Foundation, Inc.
 #
 # GRUB is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -223,8 +223,11 @@ fi
 # filesystem will be accessible).
 partmap_module=`$grub_probe --target=partmap --device-map=${device_map} ${grubdir} 2> /dev/null`
 
+# Device abstraction module, if any (lvm, raid).
+devabstraction_module=`$grub_probe --target=abstraction --device-map=${device_map} ${grubdir}`
+
 # _chain is often useful
-modules="$modules $fs_module $partmap_module biosdisk _chain"
+modules="$modules $fs_module $partmap_module biosdisk $devabstraction_module _chain"
 
 $grub_mkimage --output=${grubdir}/core.img --prefix=`make_system_path_relative_to_its_root ${grubdir}` $modules || exit 1
 
util/powerpc/ieee1275/grub-install.in +5 -2
diff -x configure -x config.h.in -urp grub2/util/powerpc/ieee1275/grub-install.in lvmraid/util/powerpc/ieee1275/grub-install.in
@@ -1,7 +1,7 @@
 #! /bin/sh
 
 # Install GRUB on your drive.
-# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007  Free Software Foundation, Inc.
+# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008  Free Software Foundation, Inc.
 #
 # GRUB is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -176,7 +176,10 @@ fi
 # filesystem will be accessible).
 partmap_module=`$grub_probe --target=partmap --device-map=${device_map} ${grubdir} 2> /dev/null`
 
-modules="$modules $fs_module $partmap_module"
+# Device abstraction module, if any (lvm, raid).
+devabstraction_module=`$grub_probe --target=abstraction --device-map=${device_map} ${grubdir}`
+
+modules="$modules $fs_module $partmap_module $devabstraction_module"
 
 # Now perform the installation.
 "$grub_mkimage" --output=${grubdir}/grub $modules || exit 1
util/update-grub.in +6 -3
diff -x configure -x config.h.in -urp grub2/util/update-grub.in lvmraid/util/update-grub.in
@@ -1,7 +1,7 @@
 #! /bin/sh -e
 
 # Generate grub.cfg by inspecting /boot contents.
-# Copyright (C) 2006,2007  Free Software Foundation, Inc.
+# Copyright (C) 2006,2007,2008  Free Software Foundation, Inc.
 #
 # GRUB is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -103,7 +103,10 @@ esac
 # check for terminals that require fonts
 case ${GRUB_TERMINAL} in
   gfxterm)
-    if GRUB_FONT_PATH=`font_path` ; then : ; else
+    if path=`font_path` ; then
+      GRUB_FONT_PATH="`convert_system_path_to_grub_path ${path}`"
+      GRUB_PRELOAD_MODULES="`${GRUB_PRELOAD_MODULES} ${grub_probe} -t abstraction ${path}`"
+    else
       # fallback to console
       GRUB_TERMINAL=console
     fi
@@ -121,7 +124,7 @@ esac
 
 # These are defined in this script, export them here so that user can
 # override them.
-export GRUB_DEVICE GRUB_FS GRUB_DRIVE GRUB_DRIVE_BOOT GRUB_DRIVE_BOOT_GRUB GRUB_FONT_PATH
+export GRUB_DEVICE GRUB_FS GRUB_DRIVE GRUB_DRIVE_BOOT GRUB_DRIVE_BOOT_GRUB GRUB_FONT_PATH GRUB_PRELOAD_MODULES
 
 # These are optional, user-defined variables.
 export GRUB_DEFAULT GRUB_TIMEOUT GRUB_DISTRIBUTOR GRUB_CMDLINE_LINUX GRUB_TERMINAL GRUB_SERIAL_COMMAND
util/update-grub_lib.in +4 -9
diff -x configure -x config.h.in -urp grub2/util/update-grub_lib.in lvmraid/util/update-grub_lib.in
@@ -1,5 +1,5 @@
 # Helper library for update-grub
-# Copyright (C) 2007  Free Software Foundation, Inc.
+# Copyright (C) 2007,2008  Free Software Foundation, Inc.
 #
 # GRUB is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -93,19 +93,14 @@ convert_system_path_to_grub_path ()
 
 font_path ()
 {
-  if [ "x${GRUB_FONT_PATH}" = "x" ] ; then : ; else
-    echo "${GRUB_FONT_PATH}"
-    return 0
-  fi
-
   # Prefer system path for space reasons (/boot/grub might be a very small
   # partition in case of OpenFirmware, etc).
   for dir in ${pkgdatadir} /usr/share/grub /boot/grub ; do
     # Prefer complete fonts over incomplete ones.
     for basename in unicode unifont ascii ; do
-      if path=`convert_system_path_to_grub_path ${dir}/${basename}.pff` ; then
-        GRUB_FONT_PATH="${path}"
-        echo "${GRUB_FONT_PATH}"
+      path="${dir}/${basename}.pff"
+      if convert_system_path_to_grub_path ${path} > /dev/null ; then
+        echo "${path}"
         return 0
       fi
     done
#42 lore raw

Re: [PATCH] fix `lvm' and `raid' loading for grub-install/core.img and update-grub/grub.cfg problems

Committed.

Quoted 419 lines · Robert Millan

New patch, a bit simpler (after giving it a though, I don't think the gained speed is worth the extra complication)

Signature · 34 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)


	* include/grub/util/getroot.h (grub_dev_abstraction_types): New enum.
	(grub_util_get_dev_abstraction): New function prototype.

	* util/getroot.c: Include `<grub/util/getroot.h>'
	(grub_util_get_grub_dev): Move detection of abstraction type to ...
	(grub_util_get_dev_abstraction): ... here (new function).

	* util/grub-probe.c: Convert PRINT_* to an enum.  Add
	`PRINT_ABSTRACTION'.
	(probe): Probe for abstraction type when requested.
	(main): Understand `--target=abstraction'.

	* util/i386/efi/grub-install.in: Add abstraction module to core
	image when it is found to be necessary.
	* util/i386/pc/grub-install.in: Likewise.
	* util/powerpc/ieee1275/grub-install.in: Likewise.

	* util/update-grub_lib.in (font_path): Return system path without
	converting to GRUB path.
	* util/update-grub.in: Convert system path returned by font_path()
	to a GRUB path.  Use `grub-probe -t abstraction' to determine what
	abstraction module is needed for loading fonts (if any).  Export
	that as `GRUB_PRELOAD_MODULES'.
	* util/grub.d/00_header.in: Process `GRUB_PRELOAD_MODULES' (print
	insmod commands).

diff -x configure -x config.h.in -urp grub2/include/grub/util/getroot.h lvmraid/include/grub/util/getroot.h
include/grub/util/getroot.h +8 -1
@@ -1,6 +1,6 @@
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2003, 2007  Free Software Foundation, Inc.
+ *  Copyright (C) 2003, 2007, 2008  Free Software Foundation, Inc.
  *
  *  GRUB is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -19,8 +19,15 @@
 #ifndef GRUB_UTIL_GETROOT_HEADER
 #define GRUB_UTIL_GETROOT_HEADER	1
 
+enum grub_dev_abstraction_types {
+  GRUB_DEV_ABSTRACTION_NONE,
+  GRUB_DEV_ABSTRACTION_LVM,
+  GRUB_DEV_ABSTRACTION_RAID,
+};
+
 char *grub_guess_root_device (const char *dir);
 char *grub_get_prefix (const char *dir);
+int grub_util_get_dev_abstraction (const char *os_dev);
 char *grub_util_get_grub_dev (const char *os_dev);
 
 #endif /* ! GRUB_UTIL_GETROOT_HEADER */

diff -x configure -x config.h.in -urp grub2/util/getroot.c lvmraid/util/getroot.c

util/getroot.c +33 -17
@@ -1,7 +1,7 @@
 /* getroot.c - Get root device */
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 1999,2000,2001,2002,2003,2006,2007  Free Software Foundation, Inc.
+ *  Copyright (C) 1999,2000,2001,2002,2003,2006,2007,2008  Free Software Foundation, Inc.
  *
  *  GRUB is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -24,6 +24,7 @@
 
 #include <grub/util/misc.h>
 #include <grub/util/biosdisk.h>
+#include <grub/util/getroot.h>
 
 static void
 strip_extra_slashes (char *dir)
@@ -239,27 +240,42 @@ grub_guess_root_device (const char *dir)
   return os_dev;
 }
 
-char *
-grub_util_get_grub_dev (const char *os_dev)
+int
+grub_util_get_dev_abstraction (const char *os_dev)
 {
   /* Check for LVM.  */
   if (!strncmp (os_dev, "/dev/mapper/", 12))
-    {
-      char *grub_dev = xmalloc (strlen (os_dev) - 12 + 1);
-
-      strcpy (grub_dev, os_dev+12);
-
-      return grub_dev;
-    }
+    return GRUB_DEV_ABSTRACTION_LVM;
 
   /* Check for RAID.  */
   if (!strncmp (os_dev, "/dev/md", 7))
+    return GRUB_DEV_ABSTRACTION_RAID;
+
+  /* No abstraction found.  */
+  return GRUB_DEV_ABSTRACTION_NONE;
+}
+
+char *
+grub_util_get_grub_dev (const char *os_dev)
+{
+  char *grub_dev;
+
+  switch (grub_util_get_dev_abstraction (os_dev))
     {
-      const char *p;
-      char *grub_dev = xmalloc (20);
+    case GRUB_DEV_ABSTRACTION_LVM:
+      grub_dev = xmalloc (strlen (os_dev) - 12 + 1);
+
+      strcpy (grub_dev, os_dev + 12);
+
+      break;
+
+    case GRUB_DEV_ABSTRACTION_RAID:
+      grub_dev = xmalloc (20);
 
       if (os_dev[7] == '_' && os_dev[8] == 'd')
 	{
+	  const char *p;
+
 	  /* This a partitionable RAID device of the form /dev/md_dNNpMM. */
 	  int i;
 
@@ -297,17 +313,17 @@ grub_util_get_grub_dev (const char *os_d
 	}
       else if (os_dev[7] >= '0' && os_dev[7] <= '9')
 	{
-	  p = os_dev + 5;
-	  memcpy (grub_dev, p, 7);
+	  memcpy (grub_dev, os_dev + 5, 7);
 	  grub_dev[7] = '\0';
 	}
       else
 	grub_util_error ("Unknown kind of RAID device `%s'", os_dev);
 
+      break;
 
-      return grub_dev;
+    default:  /* GRUB_DEV_ABSTRACTION_NONE */
+      grub_dev = grub_util_biosdisk_get_grub_dev (os_dev);
     }
 
-  /* If it's not RAID or LVM, it should be a biosdisk.  */
-  return grub_util_biosdisk_get_grub_dev (os_dev);
+  return grub_dev;
 }

diff -x configure -x config.h.in -urp grub2/util/grub.d/00_header.in lvmraid/util/grub.d/00_header.in

util/grub.d/00_header.in +7 -1
@@ -1,7 +1,7 @@
 #! /bin/sh -e
 
 # update-grub helper script.
-# Copyright (C) 2006,2007  Free Software Foundation, Inc.
+# Copyright (C) 2006,2007,2008  Free Software Foundation, Inc.
 #
 # GRUB is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -24,6 +24,12 @@ platform=@platform@
 # for convert_system_path_to_grub_path()
 . ${libdir}/grub/update-grub_lib
 
+# Do this as early as possible, since other commands might depend on it.
+# (e.g. the `font' command might need lvm or raid modules)
+for i in ${GRUB_PRELOAD_MODULES} ; do
+  echo "insmod $i"
+done
+
 if [ "x${GRUB_DEFAULT}" = "x" ] ; then GRUB_DEFAULT=0 ; fi
 if [ "x${GRUB_TIMEOUT}" = "x" ] ; then GRUB_TIMEOUT=5 ; fi
 

diff -x configure -x config.h.in -urp grub2/util/grub-probe.c lvmraid/util/grub-probe.c

util/grub-probe.c +35 -7
@@ -1,7 +1,7 @@
 /* grub-probe.c - probe device information for a given path */
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2005,2006,2007 Free Software Foundation, Inc.
+ *  Copyright (C) 2005,2006,2007,2008 Free Software Foundation, Inc.
  *
  *  GRUB is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -39,10 +39,13 @@
 #define _GNU_SOURCE	1
 #include <getopt.h>
 
-#define PRINT_FS	0
-#define PRINT_DRIVE	1
-#define PRINT_DEVICE	2
-#define PRINT_PARTMAP	3
+enum {
+  PRINT_FS,
+  PRINT_DRIVE,
+  PRINT_DEVICE,
+  PRINT_PARTMAP,
+  PRINT_ABSTRACTION,
+};
 
 int print = PRINT_FS;
 
@@ -74,6 +77,7 @@ probe (const char *path)
 {
   char *device_name;
   char *drive_name = NULL;
+  int abstraction_type;
   grub_device_t dev;
   grub_fs_t fs;
 
@@ -87,6 +91,28 @@ probe (const char *path)
       goto end;
     }
 
+  abstraction_type = grub_util_get_dev_abstraction (device_name);
+  /* No need to check for errors; lack of abstraction is permissible.  */
+  
+  if (print == PRINT_ABSTRACTION)
+    {
+      char *abstraction_name;
+      switch (abstraction_type)
+	{
+	case GRUB_DEV_ABSTRACTION_NONE:
+	  grub_util_info ("did not find LVM/RAID in %s, assuming raw device", device_name);
+	  goto end;
+	case GRUB_DEV_ABSTRACTION_LVM:
+	  abstraction_name = "lvm";
+	  break;
+	case GRUB_DEV_ABSTRACTION_RAID:
+	  abstraction_name = "raid";
+	  break;
+	}
+      printf ("%s\n", abstraction_name);
+      goto end;
+    }
+
   drive_name = grub_util_get_grub_dev (device_name);
   if (! drive_name)
     grub_util_error ("cannot find a GRUB drive for %s.\n", device_name);
@@ -159,8 +185,8 @@ Usage: grub-probe [OPTION]... PATH\n\
 Probe device information for a given path.\n\
 \n\
   -m, --device-map=FILE     use FILE as the device map [default=%s]\n\
-  -t, --target=(fs|drive|device|partmap)\n\
-                            print filesystem module, GRUB drive, system device or partition map module [default=fs]\n\
+  -t, --target=(fs|drive|device|partmap|abstraction)\n\
+                            print filesystem module, GRUB drive, system device, partition map module or abstraction module [default=fs]\n\
   -h, --help                display this message and exit\n\
   -V, --version             print version information and exit\n\
   -v, --verbose             print verbose messages\n\
@@ -206,6 +232,8 @@ main (int argc, char *argv[])
 	      print = PRINT_DEVICE;
 	    else if (!strcmp (optarg, "partmap"))
 	      print = PRINT_PARTMAP;
+	    else if (!strcmp (optarg, "abstraction"))
+	      print = PRINT_ABSTRACTION;
 	    else
 	      usage (1);
 	    break;

diff -x configure -x config.h.in -urp grub2/util/i386/efi/grub-install.in lvmraid/util/i386/efi/grub-install.in

util/i386/efi/grub-install.in +5 -2
@@ -1,7 +1,7 @@
 #! /bin/sh
 
 # Install GRUB on your EFI partition.
-# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007  Free Software Foundation, Inc.
+# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008  Free Software Foundation, Inc.
 #
 # GRUB is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -190,8 +190,11 @@ fi
 # filesystem will be accessible).
 partmap_module=`$grub_probe --target=partmap --device-map=${device_map} ${grubdir} 2> /dev/null`
 
+# Device abstraction module, if any (lvm, raid).
+devabstraction_module=`$grub_probe --target=abstraction --device-map=${device_map} ${grubdir}`
+
 # _chain is often useful
-modules="$modules $fs_module $partmap_module _chain"
+modules="$modules $fs_module $partmap_module $devabstraction_module _chain"
 
 $grub_mkimage --output=${grubdir}/grub.efi $modules || exit 1
 

diff -x configure -x config.h.in -urp grub2/util/i386/pc/grub-install.in lvmraid/util/i386/pc/grub-install.in

util/i386/pc/grub-install.in +5 -2
@@ -1,7 +1,7 @@
 #! /bin/sh
 
 # Install GRUB on your drive.
-# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007  Free Software Foundation, Inc.
+# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008  Free Software Foundation, Inc.
 #
 # GRUB is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -223,8 +223,11 @@ fi
 # filesystem will be accessible).
 partmap_module=`$grub_probe --target=partmap --device-map=${device_map} ${grubdir} 2> /dev/null`
 
+# Device abstraction module, if any (lvm, raid).
+devabstraction_module=`$grub_probe --target=abstraction --device-map=${device_map} ${grubdir}`
+
 # _chain is often useful
-modules="$modules $fs_module $partmap_module biosdisk _chain"
+modules="$modules $fs_module $partmap_module biosdisk $devabstraction_module _chain"
 
 $grub_mkimage --output=${grubdir}/core.img --prefix=`make_system_path_relative_to_its_root ${grubdir}` $modules || exit 1
 

diff -x configure -x config.h.in -urp grub2/util/powerpc/ieee1275/grub-install.in lvmraid/util/powerpc/ieee1275/grub-install.in

util/powerpc/ieee1275/grub-install.in +5 -2
@@ -1,7 +1,7 @@
 #! /bin/sh
 
 # Install GRUB on your drive.
-# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007  Free Software Foundation, Inc.
+# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008  Free Software Foundation, Inc.
 #
 # GRUB is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -176,7 +176,10 @@ fi
 # filesystem will be accessible).
 partmap_module=`$grub_probe --target=partmap --device-map=${device_map} ${grubdir} 2> /dev/null`
 
-modules="$modules $fs_module $partmap_module"
+# Device abstraction module, if any (lvm, raid).
+devabstraction_module=`$grub_probe --target=abstraction --device-map=${device_map} ${grubdir}`
+
+modules="$modules $fs_module $partmap_module $devabstraction_module"
 
 # Now perform the installation.
 "$grub_mkimage" --output=${grubdir}/grub $modules || exit 1

diff -x configure -x config.h.in -urp grub2/util/update-grub.in lvmraid/util/update-grub.in

util/update-grub.in +6 -3
@@ -1,7 +1,7 @@
 #! /bin/sh -e
 
 # Generate grub.cfg by inspecting /boot contents.
-# Copyright (C) 2006,2007  Free Software Foundation, Inc.
+# Copyright (C) 2006,2007,2008  Free Software Foundation, Inc.
 #
 # GRUB is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -103,7 +103,10 @@ esac
 # check for terminals that require fonts
 case ${GRUB_TERMINAL} in
   gfxterm)
-    if GRUB_FONT_PATH=`font_path` ; then : ; else
+    if path=`font_path` ; then
+      GRUB_FONT_PATH="`convert_system_path_to_grub_path ${path}`"
+      GRUB_PRELOAD_MODULES="`${GRUB_PRELOAD_MODULES} ${grub_probe} -t abstraction ${path}`"
+    else
       # fallback to console
       GRUB_TERMINAL=console
     fi
@@ -121,7 +124,7 @@ esac
 
 # These are defined in this script, export them here so that user can
 # override them.
-export GRUB_DEVICE GRUB_FS GRUB_DRIVE GRUB_DRIVE_BOOT GRUB_DRIVE_BOOT_GRUB GRUB_FONT_PATH
+export GRUB_DEVICE GRUB_FS GRUB_DRIVE GRUB_DRIVE_BOOT GRUB_DRIVE_BOOT_GRUB GRUB_FONT_PATH GRUB_PRELOAD_MODULES
 
 # These are optional, user-defined variables.
 export GRUB_DEFAULT GRUB_TIMEOUT GRUB_DISTRIBUTOR GRUB_CMDLINE_LINUX GRUB_TERMINAL GRUB_SERIAL_COMMAND

diff -x configure -x config.h.in -urp grub2/util/update-grub_lib.in lvmraid/util/update-grub_lib.in

util/update-grub_lib.in +4 -9
@@ -1,5 +1,5 @@
 # Helper library for update-grub
-# Copyright (C) 2007  Free Software Foundation, Inc.
+# Copyright (C) 2007,2008  Free Software Foundation, Inc.
 #
 # GRUB is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -93,19 +93,14 @@ convert_system_path_to_grub_path ()
 
 font_path ()
 {
-  if [ "x${GRUB_FONT_PATH}" = "x" ] ; then : ; else
-    echo "${GRUB_FONT_PATH}"
-    return 0
-  fi
-
   # Prefer system path for space reasons (/boot/grub might be a very small
   # partition in case of OpenFirmware, etc).
   for dir in ${pkgdatadir} /usr/share/grub /boot/grub ; do
     # Prefer complete fonts over incomplete ones.
     for basename in unicode unifont ascii ; do
-      if path=`convert_system_path_to_grub_path ${dir}/${basename}.pff` ; then
-        GRUB_FONT_PATH="${path}"
-        echo "${GRUB_FONT_PATH}"
+      path="${dir}/${basename}.pff"
+      if convert_system_path_to_grub_path ${path} > /dev/null ; then
+        echo "${path}"
         return 0
       fi
     done

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)
#43 lore raw

Re: [PATCH] fix `lvm' and `raid' loading for grub-install/core.img and update-grub/grub.cfg problems

In reply to Robert Millan
Quoted 2 lines · Robert Millan

New patch, a bit simpler (after giving it a though, I don't think the gained speed is worth the extra complication)

What does this patch fix? Too many problems in one thread...

BTW, does it also work for the case both LVM and RAID are used?

--
Marco

#44 lore raw

Re: [PATCH] fix `lvm' and `raid' loading for grub-install/core.img and update-grub/grub.cfg problems

Quoted 6 lines · Marco Gerards
Quoted 2 lines · Robert Millan

New patch, a bit simpler (after giving it a though, I don't think the gained speed is worth the extra complication)

What does this patch fix? Too many problems in one thread...

It fixes loading of lvm/raid modules in two situations:

- In core.img, by grub-install, when they're needed to access /boot. This is still not enough to get it working due to another bug (detection of partmap).

- In grub.cfg, by update-grub, when they're needed to access /usr for the font file.

Quoted 1 line

BTW, does it also work for the case both LVM and RAID are used?

No, for that we need to handle recursion in grub-probe, which is the same we'll need to get partmap detection working on lvm/raid.

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)
#45 lore raw

Re: [PATCH] fix `lvm' and `raid' loading for grub-install/core.img and update-grub/grub.cfg problems

Quoted 8 lines · Robert Millan
Quoted 6 lines · Marco Gerards
Quoted 2 lines · Robert Millan

New patch, a bit simpler (after giving it a though, I don't think the gained speed is worth the extra complication)

What does this patch fix? Too many problems in one thread...

Quoted 8 lines

It fixes loading of lvm/raid modules in two situations:

- In core.img, by grub-install, when they're needed to access /boot. This is still not enough to get it working due to another bug (detection of partmap).

- In grub.cfg, by update-grub, when they're needed to access /usr for the font file.

Oh, great. Why can't this font be put in /boot/grub? Using /usr can mean we need: raid, lvm, fshelp, a fs and a partitioning scheme module in addition to what we need to access /boot.

Quoted 4 lines
Quoted 1 line

BTW, does it also work for the case both LVM and RAID are used?

No, for that we need to handle recursion in grub-probe, which is the same we'll need to get partmap detection working on lvm/raid.

You are working on this? Or is this bug documented?

--
Marco

#46 lore raw

Re: [PATCH] fix `lvm' and `raid' loading for grub-install/core.img and update-grub/grub.cfg problems

Quoted 16 lines · Marco Gerards
Quoted 14 lines · Robert Millan
Quoted 6 lines · Marco Gerards
Quoted 2 lines · Robert Millan

New patch, a bit simpler (after giving it a though, I don't think the gained speed is worth the extra complication)

What does this patch fix? Too many problems in one thread...

It fixes loading of lvm/raid modules in two situations:

- In core.img, by grub-install, when they're needed to access /boot. This is still not enough to get it working due to another bug (detection of partmap).

Quoted 6 lines
Quoted 2 lines

- In grub.cfg, by update-grub, when they're needed to access /usr for the font file.

Oh, great. Why can't this font be put in /boot/grub? Using /usr can mean we need: raid, lvm, fshelp, a fs and a partitioning scheme module in addition to what we need to access /boot.

/boot/grub might be a mount point for a small storage device, and so big stuff like fonts might not fit (I got reports of this happening in Debian BTS).

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

BTW, does it also work for the case both LVM and RAID are used?

No, for that we need to handle recursion in grub-probe, which is the same we'll need to get partmap detection working on lvm/raid.

You are working on this?

No, although I thought a bit about it and how to solve it.

Quoted 1 line

Or is this bug documented?

Maybe we have something buried deep in Debian BTS. It might take more time to find it than to fix the bug, though ;-)

The problem is like: When LVM is based on physical partitions that belong to a pc or gpt table, "grub-probe -t partmap /some/lvmed/mntpoint" won't work.

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)
#47 lore raw

Re: [PATCH] fix `lvm' and `raid' loading for grub-install/core.img and update-grub/grub.cfg problems

In reply to Robert Millan
Quoted 4 lines · Robert Millan

The remaining known problem is detecting partmap; I'll probably find time to do that one too, but I'll need to know how can one obtain a machine-parseable list of physical devices that conform an LVM virtual device (and the same for software RAID).

pvdisplay -c
/dev/sdc2:lvmplain:976734105:-1:8:8:-1:4096:119230:59615:59615:ZvABzO-Tzzz-v5ho-r9pG-RTz5-DEEB-sWlM7G /dev/md0:lvmraid:619514368:-1:8:8:-1:4096:75624:44904:30720:6AGq0k-ldg0-yswb-ft3W-LG1b-nuIe-40Mcl7

Jan.

Signature · 2 lines
Jan Nieuwenhuizen <[email protected]> | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien       | http://www.lilypond.org
#49 lore raw

Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)

Quoted 6 lines · Martin Braure de Calignon

Is it normal ?

Quoted 2 lines

grub-probe /usr
ext2

and not lvm :-/

Yes, the default is "-t fs". Try with "-t abstraction".

Did my patch work?

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)
#50 lore raw

Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)

In reply to Robert Millan
Quoted 3 lines · Robert Millan

It's a bit funny. I tried to fix your problem, and at some point I realized I was fixing something else. Then got back at your problem, and turned out we just need to force load of "lvm" and "raid" before entering normal mode.

Ah, but this looks promising form my lvm in core bug too, I'll give it a test.

Greetings,
Jan.

Signature · 2 lines
Jan Nieuwenhuizen <[email protected]> | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien       | http://www.lilypond.org
#51 lore raw

Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)

Quoted 8 lines · Jan Nieuwenhuizen
Quoted 3 lines · Robert Millan

It's a bit funny. I tried to fix your problem, and at some point I realized I was fixing something else. Then got back at your problem, and turned out we just need to force load of "lvm" and "raid" before entering normal mode.

Ah, but this looks promising form my lvm in core bug too, I'll give it a test.

Don't expect grub_dl_load("lvm") to give you lvm.mod if you need lvm.mod in order to access lvm.mod in first place :-)

In those cases, the only way to load lvm.mod in core.img is to have it in from the beginning (this is what my other patch hopefuly does).

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)
#52 lore raw

Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)

In reply to Robert Millan
Quoted 13 lines · Robert Millan
Quoted 11 lines · Martin Braure de Calignon
Quoted 5 lines · Bean

I think the most likely command to cause the error is

font (mainvg-usr)/share/grub/unicode.pff
or
terminal gfxterm

I think 'font' line can't work because font are on my /usr, and /usr is LVM and lvm module is not loaded... But I though grub2 know how to deals with it.

Quoted 7 lines

It's a bit funny. I tried to fix your problem, and at some point I realized I was fixing something else. Then got back at your problem, and turned out we just need to force load of "lvm" and "raid" before entering normal mode.

Please try attached patch and report (note: this is unrelated to the parser error Bean fixed; the parser error simply makes the real problem in your setup go away unnoticed).

my previous post was for this patch testing

Signature · 1 line
Martin Braure de Calignon
#53 lore raw

Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)

Quoted 6 lines · Martin Braure de Calignon
Quoted 4 lines

Please try attached patch and report (note: this is unrelated to the parser error Bean fixed; the parser error simply makes the real problem in your setup go away unnoticed).

my previous post was for this patch testing

Good. Could you also try the other one and run:

grub-probe --target=type /usr/...../unifont.pff ?

It should tell you that you need lvm. update-grub can use that to add conditional "insmod lvm" calls. I think that'd be the right way to solve it.

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)
#54 lore raw
In reply to Bean
Quoted 10 lines · Bean
Quoted 6 lines · Martin Braure de Calignon
Quoted 2 lines · Robert Millan

Ok, so you have fonts. What are the color settings? (run "set" and check for menu_color_* variables)

set gives the following output :
?=1

Here is the problem ! Some command return error code, then the script is not parsed correctly. this problem can be fixed by my parser patch.

Ugh.. I forgot about that one. Will you check it in soon?

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)
#55 lore raw
Quoted 7 lines · Robert Millan
Quoted 5 lines · Bean
Quoted 4 lines · Martin Braure de Calignon
Quoted 2 lines · Robert Millan

Ok, so you have fonts. What are the color settings? (run "set" and check for menu_color_* variables)

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

set gives the following output :
?=1

Here is the problem ! Some command return error code, then the script is not parsed correctly. this problem can be fixed by my parser patch.

Ugh.. I forgot about that one. Will you check it in soon?

should i wait for macro to check it first ?

Signature · 1 line
Bean
#56 lore raw
Quoted 11 lines · Bean
Quoted 10 lines · Robert Millan
Quoted 8 lines · Bean
Quoted 6 lines · Martin Braure de Calignon
Quoted 2 lines · Robert Millan

Ok, so you have fonts. What are the color settings? (run "set" and check for menu_color_* variables)

set gives the following output :
?=1

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

Here is the problem ! Some command return error code, then the script is not parsed correctly. this problem can be fixed by my parser patch.

Ugh.. I forgot about that one. Will you check it in soon?

should i wait for macro to check it first ?

I don't know. You can try mailing him directly.

Anyway, if you did something wrong we can always revert it.

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)
#57 lore raw
Quoted 15 lines · Robert Millan
Quoted 14 lines · Bean
Quoted 13 lines · Robert Millan
Quoted 10 lines · Bean
Quoted 6 lines · Martin Braure de Calignon
Quoted 2 lines · Robert Millan

Ok, so you have fonts. What are the color settings? (run "set" and check for menu_color_* variables)

set gives the following output :
?=1

Here is the problem ! Some command return error code, then the script is not parsed correctly. this problem can be fixed by my parser patch.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Ugh.. I forgot about that one. Will you check it in soon?

should i wait for macro to check it first ?

I don't know. You can try mailing him directly.

Anyway, if you did something wrong we can always revert it.

This patch was reviewed.

--
Marco

#58 lore raw
In reply to Martin Braure de Calignon
Quoted 12 lines · Martin Braure de Calignon
Quoted 2 lines · Robert Millan

Ok, so you have fonts. What are the color settings? (run "set" and check for menu_color_* variables)

set gives the following output :
?=1
color_highlight=
color_normal=
default=0
prefix=(hd0,9)/boot/grub
root=(hd0,9)

Quoted 8 lines

so no menu_color* variables

Quoted 1 line

When you're in command mode, is "normal" module inserted? (use lsmod)

yes it is (modules loaded are : font, normal, _chain, biosdisk, pc, ext2 and fshelp)

Quoted 2 lines

What happens if you don't insmod lvm and try configfile /boot/grub/grub.cfg directly?

It try to load it, then it seems it can't, because I'm again on the same black & white menu.

Does your empty menu look exactly like this one?

http://aybabtu.com/tmp/screenshot.png

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)
#61 lore raw
In reply to Martin Braure de Calignon
Quoted 9 lines · Martin Braure de Calignon
Quoted 4 lines · Robert Millan

Does your empty menu look exactly like this one?

http://aybabtu.com/tmp/screenshot.png

Not exactly, it looks like this one, but I have a rectangular zone and a highlighted blank line where the menu should be

Ok. That means it has nothing to do with colors (I was afraid that you got black on black menu color somehow).

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)