Jump to content


grub-install


  • Please log in to reply
13 replies to this topic

#1 OFFLINE   réjean

réjean

    Discussion Deity

  • Forum MVP
  • 3,984 posts

Posted 20 July 2012 - 06:27 PM

Hi all!
I installed a new processor yesterday and now if I want to boot into PCLinuxOs Zen I have to press on F11 first and then scroll down to the Sata drive, after floppy, cdrom and I think hda to get my grub back.
I have an old command line "grub-install /dev/hda" in my notes. How can I go about changing the grub because if I don't do anything I get a grub (probably from another PCLinuxOS installed on a IDE hd with an entry for itself, one for safe mode and one for Windows but none for mandriva, or mageia or PCLinuxOS Phoenix)?

Edited by réjean, 20 July 2012 - 06:28 PM.


registered linux user #374889

#2 OFFLINE   V.T. Eric Layton

V.T. Eric Layton

    Nocturnal Slacker

  • Forum Admins
  • 14,847 posts

Posted 20 July 2012 - 06:36 PM

Let's make sure we all understand what you're doing here. We need some information:
  • how many hard drives do you have installed on this system?
  • how many operating systems are installed?
  • which OS controls your MBR and GRUB?
  • what exactly are you wanting to do here?

Posted Image


#3 OFFLINE   réjean

réjean

    Discussion Deity

  • Forum MVP
  • 3,984 posts

Posted 20 July 2012 - 10:15 PM

Ok!
2 hardrives. One IDE and one Sata.
My Sata drive is where I have PCLinuxOS Zen installed and the Grub that I was using;
Posted Image

Then there is a IDE drfive with a few OSes on;
Posted Image

So what I want to do is make the Zen Grub the default one (as it was until last night) and aulogin (as it was).

registered linux user #374889

#4 OFFLINE   V.T. Eric Layton

V.T. Eric Layton

    Nocturnal Slacker

  • Forum Admins
  • 14,847 posts

Posted 20 July 2012 - 10:45 PM

  • Boot up PCLOS Zen (or chroot into it)
  • Use fdisk to determine how that operating system sees the drives

# fdisk -l

  • Determine which drive you want the BIOS to boot from
  • Install the PCLOS Zen on that drive's MBR

# grub-install /dev/<boot drive> (hd* for EIDE drives - sd* for SATA drives, where the * denotes drive number a=1, b=2, etc.)

  • Reboot
  • Make sure your BIOS boot order is set to boot the correct drive FIRST
Your PCLOS Zen's GRUB should come up at restart. Now you'll just need to manually edit PCLOS Zen's menu.lst (if that is legacy GRUB) to boot your other operating systems. If PCLOS Zen is using the newer GRUB, you'll have to wait for a GRUB2 expert to come along and help you. ;)

Luck!

~Eric

Posted Image


#5 OFFLINE   sunrat

sunrat

    Discussion Deity

  • Forum Moderators
  • 3,574 posts

Posted 21 July 2012 - 02:05 PM

View PostV.T. Eric Layton, on 20 July 2012 - 10:45 PM, said:

Now you'll just need to manually edit PCLOS Zen's menu.lst (if that is legacy GRUB) to boot your other operating systems. If PCLOS Zen is using the newer GRUB, you'll have to wait for a GRUB2 expert to come along and help you. ;)
I think Zen uses legacy GRUB. In GRUB2 you just do update-grub to add all your other OSs.
registered Linux user number 324659  || The importance of Reading The *Fine* Manual! :D
Posted ImagePosted ImagePosted Image  
Today's subliminal thought is:

#6 OFFLINE   réjean

réjean

    Discussion Deity

  • Forum MVP
  • 3,984 posts

Posted 21 July 2012 - 02:35 PM

Thanks Eric!
[rejean@localhost ~]$ su
Password:
[root@localhost rejean]#fdisk -l

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00011388

   Device Boot	  Start		 End	  Blocks   Id  System
/dev/sda1   *		2048	66074623	33036288   83  Linux
/dev/sda2		66074624   170932223	52428800   83  Linux
/dev/sda3	   170947665  1256347259   542699797+   5  Extended
/dev/sda5	   170947728   215977859	22515066   83  Linux
/dev/sda6	   215977923   232348094	 8185086   82  Linux swap / Solaris
/dev/sda7	   232348158  1256347259   511999551	7  HPFS/NTFS

Disk /dev/sdb: 251.0 GB, 251000193024 bytes
255 heads, 63 sectors/track, 30515 cylinders, total 490234752 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xa34da34d

   Device Boot	  Start		 End	  Blocks   Id  System
/dev/sdb1   *		  63	78140159	39070048+   7  HPFS/NTFS
/dev/sdb2		78140160   117210239	19535040   83  Linux
/dev/sdb3	   117210301   490223474   186506587	5  Extended
/dev/sdb5	   117210303   118190204	  489951   82  Linux swap / Solaris
/dev/sdb6	   118190268   159123824	20466778+  83  Linux
/dev/sdb7	   159123888   200507264	20691688+  83  Linux
/dev/sdb8   *   200507266   220042304	 9767519+  83  Linux
/dev/sdb9	   220042368   239577344	 9767488+  83  Linux
/dev/sdb10	  239577408   280527029	20474811   83  Linux
/dev/sdb11	  280527093   490223474   104848191	b  W95 FAT32
[root@localhost rejean]#

That's what was puzzling me. One OS sees the drives one way, another another way. What is sda for one becomes sdb for another or vice-versa.. For instance in this case sda is a sata drive while sdb is a EIDE.

registered linux user #374889

#7 OFFLINE   burninbush

burninbush

    Multithreader

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,157 posts

Posted 21 July 2012 - 05:19 PM

I'll offer another way in that I've used many times when installs went wrong ...

Find a live cd that boots with grub legacy; older Mepis, Suse, Ubuntu, others.  Boot from that cd, and when the first screen comes up hit Escape, then C.  This will get you into grub command mode, loaded from the cd.  Then at the prompt, enter ...

grub>  kernel (hd0,7)/boot/vm ..... and hit tab, which will offer to complete that line, resulting in ...

grub> kernel (hd0,7)/boot/vmlinuz ... then add

grub> kernel (hd0,7)/boot/vmlinuz root=/dev/sda8 ro .... and then finally

grub> initrd (hd0,7)/boot/in ... hit Tab to get

grub >initrd (hd0,7)/boot/initrd.img .... and finally,

grub> boot

and that will cause it to boot the system that is on /dev/sda8.  Change that to pick the partition you want to boot.  Not all distros use an initrd, but many do, will do no harm to ask grub about it.

And then, once booted, you are in the real OS with all its environment, etc.

If you know where the original used-to-work menu.lst is located, then you can just say

grub> configfile (hd0,7)/boot/grub/menu.lst  

which will bring up the menu.lst you are accustomed to seeing; select as usual.

Note -- re hd0 vs hd1 ... grub takes it's clue from the bios boot order.  If you don't see what you expect, try using (hd1,7) where I used hd0 above.

#8 OFFLINE   V.T. Eric Layton

V.T. Eric Layton

    Nocturnal Slacker

  • Forum Admins
  • 14,847 posts

Posted 21 July 2012 - 10:02 PM

View Postsunrat, on 21 July 2012 - 02:05 PM, said:

In GRUB2 you just do update-grub to add all your other OSs.

Yeah... that would be nice if it actually worked. With numerous distros across numerous drives and no grub installed in / directories on my installations, that magical command just don't work. :(

View Postréjean, on 21 July 2012 - 02:35 PM, said:



That's what was puzzling me. One OS sees the drives one way, another another way. What is sda for one becomes sdb for another or vice-versa.. For instance in this case sda is a sata drive while sdb is a EIDE.

You ONLY need to be concerned with how the operating system you plan on using as the GRUB CONTROLLER sees the drives.

Posted Image


#9 OFFLINE   sunrat

sunrat

    Discussion Deity

  • Forum Moderators
  • 3,574 posts

Posted 21 July 2012 - 11:57 PM

View PostV.T. Eric Layton, on 21 July 2012 - 10:02 PM, said:

Yeah... that would be nice if it actually worked. With numerous distros across numerous drives and no grub installed in / directories on my installations, that magical command just don't work. :(
Sorry, it may be only a Debian (or aptosid?) thing. When I run update-grub it automatically runs os-prober and generates entries for grub.cfg before updating.
Maybe some other distros will need these commands to be run separately, and even perhaps edit /etc/grub.d/$_custom manually.
registered Linux user number 324659  || The importance of Reading The *Fine* Manual! :D
Posted ImagePosted ImagePosted Image  
Today's subliminal thought is:

#10 OFFLINE   saturnian

saturnian

    Message Mogul

  • Members
  • PipPipPipPipPip
  • 456 posts

Posted 22 July 2012 - 02:58 AM

View PostV.T. Eric Layton, on 21 July 2012 - 10:02 PM, said:

Yeah... that would be nice if it actually worked. With numerous distros across numerous drives and no grub installed in / directories on my installations, that magical command just don't work.

View Postsunrat, on 21 July 2012 - 11:57 PM, said:

Sorry, it may be only a Debian (or aptosid?) thing. When I run update-grub it automatically runs os-prober and generates entries for grub.cfg before updating.
Maybe some other distros will need these commands to be run separately, and even perhaps edit /etc/grub.d/$_custom manually.

Works the same here, with Debian's grub2 doing the booting. But, yeah, I guess the key is having grub from the other distros installed on their / directories. Then all you have to do is run update-grub from Debian.

#11 OFFLINE   sunrat

sunrat

    Discussion Deity

  • Forum Moderators
  • 3,574 posts

Posted 22 July 2012 - 09:07 AM

View Postsaturnian, on 22 July 2012 - 02:58 AM, said:

.... But, yeah, I guess the key is having grub from the other distros installed on their / directories...
I don't think even that is necessary. I just perused my grub.cfg and it appears to boot other OS kernels directly. It's late and I'm tired now, but tomorrow I will install AntiX with no GRUB and see if update-grub detects it.
PS. Sorry for hijacking your thread, rejean.
registered Linux user number 324659  || The importance of Reading The *Fine* Manual! :D
Posted ImagePosted ImagePosted Image  
Today's subliminal thought is:

#12 OFFLINE   réjean

réjean

    Discussion Deity

  • Forum MVP
  • 3,984 posts

Posted 22 July 2012 - 03:40 PM

Quote

PS. Sorry for hijacking your thread, rejean.
No problem Roger! I got my answer and whatever more anyone of you is contributing is a bonus. Always glad to learn something new.

registered linux user #374889

#13 OFFLINE   V.T. Eric Layton

V.T. Eric Layton

    Nocturnal Slacker

  • Forum Admins
  • 14,847 posts

Posted 22 July 2012 - 03:44 PM

Debian always did have the best GRUB, in my experience. :yes:

Posted Image


#14 OFFLINE   sunrat

sunrat

    Discussion Deity

  • Forum Moderators
  • 3,574 posts

Posted 22 July 2012 - 09:01 PM

View PostV.T. Eric Layton, on 22 July 2012 - 03:44 PM, said:

Debian always did have the best GRUB, in my experience. :yes:
True dat. And they invented os-prober. :thumbsup: B)
registered Linux user number 324659  || The importance of Reading The *Fine* Manual! :D
Posted ImagePosted ImagePosted Image  
Today's subliminal thought is:




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users