PDA

View Full Version : help in updating grub after moving /boot to a different partition


infra_red_dude
12-07-2007, 07:53 PM
this is my present setup now:

/boot on hd(0,7) - boot partition
/ on hd(0,9) - root partition
and other std. linux and windows partitions.

when i installed ubuntu 7.04 my setup was like this
/boot on hd(0,8 ) - boot partition
/ on hd(0.9) - root partition
and other std. linux and windows partitions.

recently i split a fat32 partition into two using gparted from widin ubuntu and rearranged/formatted some partitions. now my setup is as shown above. everything is working fine and i face no problems as such. i updated grub and edited the entries so that it points to the correct boot partition.

problem is when ubuntu automatically runs the grub-update command (for e.g after making any changes or installing/updating the kernel/modules). when the grub update is automatically run it installs grub but it edits the menu.lst file to include the boot partition wid the old value (hd0,8 ) whereas now the boot partition is on hd(0,7). everytime this happens i hafta make sure that i manually edit the grub menu list and change hd(0,8 ) to hd(0,7) otherwise it fails to boot (of corz i can edit the command line from widin grub and correct it but i dun want this hassle). please do help me out. i did search on the net... but cudn't find anything which was productive for me.

praka123
12-07-2007, 08:01 PM
I know this phenomenon where partn numbers are changed,experienced before.the soltn will be for one thing use fdisk /dev/hda and go to expert mode to fix partn order.(press x;press f)
and if that doesnt go well,go to /boot/grub/menu.lst and see the entries kopt and groot correct.also the option # updatedefaultentry=false to be set.

infra_red_dude
12-07-2007, 08:51 PM
^^^ oops!!! that worsned things!!! :D had to do some restoration work. any other suggestions? does grub store the boot partition number somewhere? i'm unable to find that....

praka123
12-07-2007, 09:31 PM
Only think am aware of is setting menu.lst correct options.grub manual sure got more info.
http://www.gnu.org/software/grub/
I have gone through this partn number changing when with Windows XP installed and changed partn.that time grub was reinstalled and it correctly detects.one thing you can do is try setting grub manually(be sure about /boot and / ).try

infra_red_dude
12-07-2007, 09:38 PM
one thing you can do is try setting grub manually(be sure about /boot and / ).try
yeah thats what i do after every update which i wanna avoid. i'm not able to find out where does grub store the boot partition number.

cynosure
12-07-2007, 09:39 PM
I downloaded Super Grub Installer a few months back. It has some advanced options in it.
I havnt used it much (And when I do, I always screw up the boot order:D), but try it.

infra_red_dude
12-07-2007, 09:39 PM
edit: how stupid of me! i've been looking everywhere but /usr/sbin/update-grub script!!! :D

will try to go thru it and edit it once and for all!!! will get back if i face any problems!

praka123
12-07-2007, 10:04 PM
aah...editing scripts?I dont know how it helps :?

infra_red_dude
12-07-2007, 11:05 PM
oops!! no not editing the script. trying to figure from where and how the update-script obtains the boot partition number :)

edit: the find_device function in the script is responsible for determining the boot partition number.... hmm.. gotta dig out more now!

edit2: i guess i'll hafta go thru it several times to understand it. i'm no programmer.. mebbe someone can help me :)

praka123
14-07-2007, 05:21 AM
Do u have a seperate /boot partn?if true,there may be chance that u got grub installed to ur /boot dir on / root partn instead of /boot partition.also ur /etc/fstab shud be checked.post here.
again scrutinize ur /boot/grub/menu.lst groot= entry
## default grub root device
## e.g. groot=(hd0,0)
# groot=(hd0,8 )
^mine.i got a seperate /boot partn @/dev/sda9 so in grub (hd0,8 )
u know that :D
onlything u can check is that ur hdd is detected correctly by looking at /boot/grub/device.map for correct entries of ur hdds.
for eg; mine got:
(hd0) /dev/sda there.for multiple hdd i think u know how to enter then.
another problem somewhere i read was grub got problem in reading partn entered as uuid's and LABEL's instead of direct name.although blkid command can show the o/p.
edit:all ur manual edits in menu.lst must not be btwn:

### BEGIN AUTOMAGIC KERNELS LIST
and
### END DEBIAN AUTOMAGIC KERNELS LIST
else they are over written !!!

infra_red_dude
15-07-2007, 01:27 PM
thank you prakash! :) i guess the problem is solved!! :) i'll test it as soon as i can!

yes prakash! problem solved.. tested today! thanks pal :) but now the update-grub boot script refuses to detect the windows vista installation and removes the entry from the the menu list... so i haf a backup menu list... which i hafta replace again everytime...:(