* Does grub2 solve this problem I am having with grub1? RE: usbsticks. @ 2008-01-31 16:08 Paul Elliott 2008-01-31 16:58 ` Pavel Roskin 0 siblings, 1 reply; 15+ messages in thread From: Paul Elliott @ 2008-01-31 16:08 UTC (permalink / raw) To: Grub-devel [-- Attachment #1: Type: text/plain, Size: 923 bytes --] I am having this problem with grub1 and I wonder if grub2 solves it. The problem is at the time I setup the grub system I do not know what device my usbstick will be on. To be explicit I am writting menu.lst for a grub booter on a usbstick and I do not know what to put for X in the following statement: root (hdX,0) The usb stick will be used on many different computers with different number of hard drives. Therefore X actually varries. Is there a solution for this in grub2? That is in writting the equivalent of menu.lst for grub2, is there a way to specify "the device that my menu.lst and my stage files are on" without knowing in advance where that will be? If so, how would one do this in grub2? -- Paul Elliott 1(512)837-1096 pelliott@io.com PMB 181, 11900 Metric Blvd Suite J http://www.io.com/~pelliott/pme/ Austin TX 78758-3117 [-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --] ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Does grub2 solve this problem I am having with grub1? RE: usbsticks. 2008-01-31 16:08 Does grub2 solve this problem I am having with grub1? RE: usbsticks Paul Elliott @ 2008-01-31 16:58 ` Pavel Roskin 2008-02-01 4:34 ` Paul Elliott 0 siblings, 1 reply; 15+ messages in thread From: Pavel Roskin @ 2008-01-31 16:58 UTC (permalink / raw) To: The development of GRUB 2; +Cc: Paul Elliott On Thu, 2008-01-31 at 10:08 -0600, Paul Elliott wrote: > Is there a solution for this in grub2? That is in writting > the equivalent of menu.lst for grub2, is there a way to > specify "the device that my menu.lst and my stage files > are on" without knowing in advance where that will be? > > If so, how would one do this in grub2? I think that device will be in the root variable. You'll just need to use paths without the device name, e.g. linux /boot/vmlinuz initrd /boot/initrd.img -- Regards, Pavel Roskin ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Does grub2 solve this problem I am having with grub1? RE: usbsticks. 2008-01-31 16:58 ` Pavel Roskin @ 2008-02-01 4:34 ` Paul Elliott 2008-02-01 4:50 ` Pavel Roskin 0 siblings, 1 reply; 15+ messages in thread From: Paul Elliott @ 2008-02-01 4:34 UTC (permalink / raw) To: The development of GRUB 2 [-- Attachment #1: Type: text/plain, Size: 1041 bytes --] On Thu, Jan 31, 2008 at 11:58:01AM -0500, Pavel Roskin wrote: > On Thu, 2008-01-31 at 10:08 -0600, Paul Elliott wrote: > > > Is there a solution for this in grub2? That is in writting > > the equivalent of menu.lst for grub2, is there a way to > > specify "the device that my menu.lst and my stage files > > are on" without knowing in advance where that will be? > > > > If so, how would one do this in grub2? > > I think that device will be in the root variable. You'll just need to > use paths without the device name, e.g. > > linux /boot/vmlinuz > initrd /boot/initrd.img > Ok, but how do I say the same device as I am in now, but the 3rd partiton, rather than the first. How do I say (hdX,3) where X in the device I am in now? And X may vary at boot time depending on the number of hard disks on the target system? -- Paul Elliott 1(512)837-1096 pelliott@io.com PMB 181, 11900 Metric Blvd Suite J http://www.io.com/~pelliott/pme/ Austin TX 78758-3117 [-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --] ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Does grub2 solve this problem I am having with grub1? RE: usbsticks. 2008-02-01 4:34 ` Paul Elliott @ 2008-02-01 4:50 ` Pavel Roskin 2008-02-01 12:59 ` Paul Elliott 0 siblings, 1 reply; 15+ messages in thread From: Pavel Roskin @ 2008-02-01 4:50 UTC (permalink / raw) To: The development of GRUB 2 On Thu, 2008-01-31 at 22:34 -0600, Paul Elliott wrote: > Ok, but how do I say the same device as I am in now, but the > 3rd partiton, rather than the first. > > How do I say (hdX,3) where X in the device I am in now? And > X may vary at boot time depending on the number of hard disks > on the target system? I wish I knew the answer. There is some undocumented scripting functionality, but it doesn't appear to be capable of that yet. Perhaps there should be a "boot_device" variable for that purpose. -- Regards, Pavel Roskin ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Does grub2 solve this problem I am having with grub1? RE: usbsticks. 2008-02-01 4:50 ` Pavel Roskin @ 2008-02-01 12:59 ` Paul Elliott 2008-02-01 17:25 ` Pavel Roskin 0 siblings, 1 reply; 15+ messages in thread From: Paul Elliott @ 2008-02-01 12:59 UTC (permalink / raw) To: The development of GRUB 2 [-- Attachment #1: Type: text/plain, Size: 1602 bytes --] On Thu, Jan 31, 2008 at 11:50:37PM -0500, Pavel Roskin wrote: > On Thu, 2008-01-31 at 22:34 -0600, Paul Elliott wrote: > > > Ok, but how do I say the same device as I am in now, but the > > 3rd partiton, rather than the first. > > > > How do I say (hdX,3) where X in the device I am in now? And > > X may vary at boot time depending on the number of hard disks > > on the target system? > > I wish I knew the answer. There is some undocumented scripting > functionality, but it doesn't appear to be capable of that yet. Perhaps > there should be a "boot_device" variable for that purpose. > As usb devices become more used this will be an important problem. For example, I want to create a usb flash drive for use in an installfest, for people with no CD or floppy. Partition 1 will have the kernel and initrd for the Fedora installation process. Partition 2 will have the same for Opensuse. Partiton 3 the same for Mandriva. Partiton 4 ubuntu. How do I write a menu.lst to boot these different kernels with different parameters, and partitions? I do not know which device the usbstick will be at boot time, because the target systems have different number of hard disks. As matters now stand, there is no way to do it, and you seem to be telling me the problem is not fixed with grub2! It is easy to think of many analogous problems, in the comercial world. -- Paul Elliott 1(512)837-1096 pelliott@io.com PMB 181, 11900 Metric Blvd Suite J http://www.io.com/~pelliott/pme/ Austin TX 78758-3117 [-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --] ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Does grub2 solve this problem I am having with grub1? RE: usbsticks. 2008-02-01 12:59 ` Paul Elliott @ 2008-02-01 17:25 ` Pavel Roskin 2008-02-01 18:44 ` Paul Elliott 0 siblings, 1 reply; 15+ messages in thread From: Pavel Roskin @ 2008-02-01 17:25 UTC (permalink / raw) To: The development of GRUB 2 On Fri, 2008-02-01 at 06:59 -0600, Paul Elliott wrote: > As usb devices become more used this will be an important problem. Are you sure that it will be seen as a separate device? > For example, I want to create a usb flash drive for use in an > installfest, for people with no CD or floppy. That would be great. > Partition 1 will have the kernel and initrd for the Fedora installation > process. > > Partition 2 will have the same for Opensuse. > > Partiton 3 the same for Mandriva. > > Partiton 4 ubuntu. > > How do I write a menu.lst to boot these different kernels with > different parameters, and partitions? I do not know which device the > usbstick will be at boot time, because the target systems have > different number of hard disks. Would not the boot device be hd0? > As matters now stand, there is no way to do it, and you seem to be > telling me the problem is not fixed with grub2! Even if I add boot_device now, there is an issue with the variable expansion, to that ($boot_device,3) would not expand to a valid device name. One possible approach would be to use LVM (Logical Volume Manager) - it's supported by grub2. You could install grub on a small boot partition and allocate the rest to as an LVM partition, that would be split into volumes. Then you could refer to the volumes by name. > It is easy to think of many analogous problems, in the comercial world. I agree. -- Regards, Pavel Roskin ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Does grub2 solve this problem I am having with grub1? RE: usbsticks. 2008-02-01 17:25 ` Pavel Roskin @ 2008-02-01 18:44 ` Paul Elliott 2008-02-01 20:14 ` Pavel Roskin 2008-02-02 12:11 ` Yoshinori K. Okuji 0 siblings, 2 replies; 15+ messages in thread From: Paul Elliott @ 2008-02-01 18:44 UTC (permalink / raw) To: The development of GRUB 2 [-- Attachment #1: Type: text/plain, Size: 3036 bytes --] On Fri, Feb 01, 2008 at 12:25:30PM -0500, Pavel Roskin wrote: > On Fri, 2008-02-01 at 06:59 -0600, Paul Elliott wrote: > > > As usb devices become more used this will be an important problem. > > Are you sure that it will be seen as a separate device? > > > For example, I want to create a usb flash drive for use in an > > installfest, for people with no CD or floppy. > > That would be great. > > > Partition 1 will have the kernel and initrd for the Fedora installation > > process. > > > > Partition 2 will have the same for Opensuse. > > > > Partiton 3 the same for Mandriva. > > > > Partiton 4 ubuntu. > > > > How do I write a menu.lst to boot these different kernels with > > different parameters, and partitions? I do not know which device the > > usbstick will be at boot time, because the target systems have > > different number of hard disks. > > Would not the boot device be hd0? No, usually the first hard disk is hd0, the second hard disk is hd1, and the usb sticks come after that. At least that is how it works under my computer. Usually it is because the number of hard disks differ that causes you not to know which device the usb stick is. The Problem does not have to involve usbsticks. One can imagine a situation in which to device one is booting from is always the first scsi disk. But some computers have one or more IDE drives wich are recognized by the bios as hd0, hd1, ect. The Fedora/RedHat kernels/initrd have this feature where you can specify the root partition to the kernel/initrd by volume label. You can say 'root=LABEL=/' to tell the kernel to find the partition with the label '/' and use that as the root partition. This feature does not require LVN. The kernel/initrd will check all the partitons and find the one lableled '/'. But this does not have anything to do with how one specifies partitions to grub. But perhaps grub should adopt a similar feature. > > > As matters now stand, there is no way to do it, and you seem to be > > telling me the problem is not fixed with grub2! > > Even if I add boot_device now, there is an issue with the variable > expansion, to that ($boot_device,3) would not expand to a valid device > name. > > One possible approach would be to use LVM (Logical Volume Manager) - > it's supported by grub2. You could install grub on a small boot > partition and allocate the rest to as an LVM partition, that would be > split into volumes. Then you could refer to the volumes by name. > This seems a long way to drag the cat around the barn. Or this would be like kicking dead whales down the beach. One should not have to invoke the complexity of LVN just so one can specify partitions. > > It is easy to think of many analogous problems, in the comercial world. > > I agree. > -- Paul Elliott 1(512)837-1096 pelliott@io.com PMB 181, 11900 Metric Blvd Suite J http://www.io.com/~pelliott/pme/ Austin TX 78758-3117 [-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --] ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Does grub2 solve this problem I am having with grub1? RE: usbsticks. 2008-02-01 18:44 ` Paul Elliott @ 2008-02-01 20:14 ` Pavel Roskin 2008-02-01 21:45 ` Paul Elliott 2008-02-02 12:11 ` Yoshinori K. Okuji 1 sibling, 1 reply; 15+ messages in thread From: Pavel Roskin @ 2008-02-01 20:14 UTC (permalink / raw) To: The development of GRUB 2 On Fri, 2008-02-01 at 12:44 -0600, Paul Elliott wrote: > > One possible approach would be to use LVM (Logical Volume Manager) - > > it's supported by grub2. You could install grub on a small boot > > partition and allocate the rest to as an LVM partition, that would be > > split into volumes. Then you could refer to the volumes by name. > > > > This seems a long way to drag the cat around the barn. Or this > would be like kicking dead whales down the beach. One should > not have to invoke the complexity of LVN just so one can specify > partitions. OK, let's fix GRUB. As for the expansion issue, I think I see how to fix it. grub_script_arg_add() should append expanded variables to the last argument, rather than allocate a new argument, unless the new argument is separated by spaces from the previous one. GRUB_SCRIPT_ARG_TYPE_STR and GRUB_SCRIPT_ARG_TYPE_VAR are "write only". I think we should discard grub_script_arg_type_t or use it to keep track of spaces in the input. As for the "boot_device", it could be set in the same place as "root", namely in grub_set_root_dev() in kern/main.c. -- Regards, Pavel Roskin ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Does grub2 solve this problem I am having with grub1? RE: usbsticks. 2008-02-01 20:14 ` Pavel Roskin @ 2008-02-01 21:45 ` Paul Elliott 2008-02-01 21:50 ` Robert Millan 0 siblings, 1 reply; 15+ messages in thread From: Paul Elliott @ 2008-02-01 21:45 UTC (permalink / raw) To: The development of GRUB 2 [-- Attachment #1: Type: text/plain, Size: 1746 bytes --] On Fri, Feb 01, 2008 at 03:14:51PM -0500, Pavel Roskin wrote: > On Fri, 2008-02-01 at 12:44 -0600, Paul Elliott wrote: > > > One possible approach would be to use LVM (Logical Volume Manager) - > > > it's supported by grub2. You could install grub on a small boot > > > partition and allocate the rest to as an LVM partition, that would be > > > split into volumes. Then you could refer to the volumes by name. > > > > > > > This seems a long way to drag the cat around the barn. Or this > > would be like kicking dead whales down the beach. One should > > not have to invoke the complexity of LVN just so one can specify > > partitions. > > OK, let's fix GRUB. > > As for the expansion issue, I think I see how to fix it. > grub_script_arg_add() should append expanded variables to the last > argument, rather than allocate a new argument, unless the new argument > is separated by spaces from the previous one. > > GRUB_SCRIPT_ARG_TYPE_STR and GRUB_SCRIPT_ARG_TYPE_VAR are "write only". > I think we should discard grub_script_arg_type_t or use it to keep track > of spaces in the input. > > As for the "boot_device", it could be set in the same place as "root", > namely in grub_set_root_dev() in kern/main.c. > Ok, you are well into grub2 internals, and beond the areas I am familiar with. I am glad the problem is being addressed and glad I could be helpfull in pointing out the problem. When grub2 is finished, I will look in the manual and see what syntax I need to use to solve problems like this. -- Paul Elliott 1(512)837-1096 pelliott@io.com PMB 181, 11900 Metric Blvd Suite J http://www.io.com/~pelliott/pme/ Austin TX 78758-3117 [-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --] ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Does grub2 solve this problem I am having with grub1? RE: usbsticks. 2008-02-01 21:45 ` Paul Elliott @ 2008-02-01 21:50 ` Robert Millan 0 siblings, 0 replies; 15+ messages in thread From: Robert Millan @ 2008-02-01 21:50 UTC (permalink / raw) To: The development of GRUB 2 On Fri, Feb 01, 2008 at 03:45:40PM -0600, Paul Elliott wrote: > > When grub2 is finished, I will look in the manual and see what > syntax I need to use to solve problems like this. Finished or not, we won't have a manual untill someone volunteers to work on it. -- 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 /.) ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Does grub2 solve this problem I am having with grub1? RE: usbsticks. 2008-02-01 18:44 ` Paul Elliott 2008-02-01 20:14 ` Pavel Roskin @ 2008-02-02 12:11 ` Yoshinori K. Okuji 2008-02-02 14:34 ` Paul Elliott 2008-02-04 13:24 ` Paul Elliott 1 sibling, 2 replies; 15+ messages in thread From: Yoshinori K. Okuji @ 2008-02-02 12:11 UTC (permalink / raw) To: The development of GRUB 2 On Friday 01 February 2008 19:44, Paul Elliott wrote: > > Would not the boot device be hd0? > > No, usually the first hard disk is hd0, the second hard disk > is hd1, and the usb sticks come after that. At least that is > how it works under my computer. Usually it is because the number > of hard disks differ that causes you not to know which device > the usb stick is. Nope. If you boot from a usb disk, it is always hd0. This is the PC BIOS. > The Problem does not have to involve usbsticks. One can imagine > a situation in which to device one is booting from is always > the first scsi disk. But some computers have one or more IDE > drives wich are recognized by the bios as hd0, hd1, ect. No. If you boot from a SCSI disk, it is hd0. All IDE disks are shifted to hd1, hd2, etc. > The Fedora/RedHat kernels/initrd have this feature where you can > specify the root partition to the kernel/initrd by volume label. You > can say 'root=LABEL=/' to tell the kernel to find the partition with the > label '/' and use that as the root partition. This feature does not > require LVN. The kernel/initrd will check all the partitons and find > the one lableled '/'. > > But this does not have anything to do with how one > specifies partitions to grub. But perhaps grub should adopt a similar > feature. It is already there. GRUB 2 already supports setting a root based on a filesystem label or a path. Okuji ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Does grub2 solve this problem I am having with grub1? RE: usbsticks. 2008-02-02 12:11 ` Yoshinori K. Okuji @ 2008-02-02 14:34 ` Paul Elliott 2008-02-03 5:58 ` Pavel Roskin 2008-02-04 13:24 ` Paul Elliott 1 sibling, 1 reply; 15+ messages in thread From: Paul Elliott @ 2008-02-02 14:34 UTC (permalink / raw) To: The development of GRUB 2 [-- Attachment #1: Type: text/plain, Size: 448 bytes --] On Sat, Feb 02, 2008 at 01:11:18PM +0100, Yoshinori K. Okuji wrote: > > It is already there. GRUB 2 already supports setting a root based on a > filesystem label or a path. > What is the syntax? How do I set it up? Are there example grub2 setups? -- Paul Elliott 1(512)837-1096 pelliott@io.com PMB 181, 11900 Metric Blvd Suite J http://www.io.com/~pelliott/pme/ Austin TX 78758-3117 [-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --] ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Does grub2 solve this problem I am having with grub1? RE: usbsticks. 2008-02-02 14:34 ` Paul Elliott @ 2008-02-03 5:58 ` Pavel Roskin 2008-02-04 3:46 ` Pavel Roskin 0 siblings, 1 reply; 15+ messages in thread From: Pavel Roskin @ 2008-02-03 5:58 UTC (permalink / raw) To: The development of GRUB 2 On Sat, 2008-02-02 at 08:34 -0600, Paul Elliott wrote: > On Sat, Feb 02, 2008 at 01:11:18PM +0100, Yoshinori K. Okuji wrote: > > > > It is already there. GRUB 2 already supports setting a root based on a > > filesystem label or a path. Indeed! That's much easier that LVM :-) > What is the syntax? How do I set it up? Are there example grub2 setups? grub> help search Usage: search [-f|-l|-s] NAME Search devices by a file or a filesystem label. If --set is specified, the first device found is set to a variable. If no variable name is specified, "root" is used. -f, --file search devices by a file (default) -l, --label search devices by a filesystem label -s, --set=VAR set a variable to the first device found -h, --help display this help and exit -u, --usage display the usage of this command and exit grub> That means, you can use unique labels like "usbstick-fedora8" and then use: search -f usbstick-fedora8 linux /boot/vmlinuz-2.6.24-f8 initrd /boot/initrd-2.6.24-f8.img or something like that. -- Regards, Pavel Roskin ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Does grub2 solve this problem I am having with grub1? RE: usbsticks. 2008-02-03 5:58 ` Pavel Roskin @ 2008-02-04 3:46 ` Pavel Roskin 0 siblings, 0 replies; 15+ messages in thread From: Pavel Roskin @ 2008-02-04 3:46 UTC (permalink / raw) To: The development of GRUB 2 On Sun, 2008-02-03 at 00:58 -0500, Pavel Roskin wrote: > grub> help search > Usage: search [-f|-l|-s] NAME > Search devices by a file or a filesystem label. If --set is specified, > the first device found is set to a variable. If no variable name is > specified, "root" is used. Actually, I was wrong to assume that "root" is used even if "--set" is not specified. > That means, you can use unique labels like "usbstick-fedora8" and then > use: > > search -f usbstick-fedora8 That should be: search -f usbstick-fedora8 -s -- Regards, Pavel Roskin ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Does grub2 solve this problem I am having with grub1? RE: usbsticks. 2008-02-02 12:11 ` Yoshinori K. Okuji 2008-02-02 14:34 ` Paul Elliott @ 2008-02-04 13:24 ` Paul Elliott 1 sibling, 0 replies; 15+ messages in thread From: Paul Elliott @ 2008-02-04 13:24 UTC (permalink / raw) To: The development of GRUB 2 [-- Attachment #1: Type: text/plain, Size: 570 bytes --] On Sat, Feb 02, 2008 at 01:11:18PM +0100, Yoshinori K. Okuji wrote: > > Nope. If you boot from a usb disk, it is always hd0. This is the PC BIOS. > I just tried this on my nephew's Dell. Durring boot I pushed F12 to bring up the boot device menu. I choose usb device. I had a usbstick with super grub disk on it. When it booted, it showed the boot device was hd1. -- Paul Elliott 1(512)837-1096 pelliott@io.com PMB 181, 11900 Metric Blvd Suite J http://www.io.com/~pelliott/pme/ Austin TX 78758-3117 [-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --] ^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2008-02-04 13:25 UTC | newest] Thread overview: 15+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-01-31 16:08 Does grub2 solve this problem I am having with grub1? RE: usbsticks Paul Elliott 2008-01-31 16:58 ` Pavel Roskin 2008-02-01 4:34 ` Paul Elliott 2008-02-01 4:50 ` Pavel Roskin 2008-02-01 12:59 ` Paul Elliott 2008-02-01 17:25 ` Pavel Roskin 2008-02-01 18:44 ` Paul Elliott 2008-02-01 20:14 ` Pavel Roskin 2008-02-01 21:45 ` Paul Elliott 2008-02-01 21:50 ` Robert Millan 2008-02-02 12:11 ` Yoshinori K. Okuji 2008-02-02 14:34 ` Paul Elliott 2008-02-03 5:58 ` Pavel Roskin 2008-02-04 3:46 ` Pavel Roskin 2008-02-04 13:24 ` Paul Elliott
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.