Multiboot with /boot partition, kernel overwritten
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Multiboot with /boot partition, kernel overwritten
i have a 30 gb drive and wanted to try out several distro's. after reading some threads here i thought it was a good idea to create a separate /boot partition. i'm using grub for the bootloader. this is my drive layout:
hda1 5 gb ntfs windowsxp
hda2 70 mb ext2 /boot
hda3 500 mb swap /swap
hda5 5 gb reiser suse 9.2
hda6 3 gb nothing yet, want to use it for mandrake 10
hda7 3 gb reiser ubuntu 4.10
hda8 8 gb fat32 data
hda9 3 gb ext3 /home for all three distro's
now last night i installed ubuntu and parted gave me some errors that there were errors on hda2 and hda9 which had to be corrected but i went ahead anyway, since suse didn't have any problems with them. then when it came to the bootloader configuration i told it to install grub to hda7 (ubuntu's partition) and it said it couldn'write to the partition. tried again, and it worked. when i rebooted the whole screen filled up with GRUBGRUBGRUBGRUBGRUBGRUBGRUBGRUBGRUBGRUBGRUBGRUBGRUBGRUBGRUB
so i got the suse cd and used it to boot to the suse on my harddrive and checked the boot partition. so it seems ubuntu wrote grub to the mbr anyway and overwrote the menu.lst on the boot partition. but what's worse, it uses the same version of the kernel (2.6.8-5.24-default i think, i'm doing this from memory) so the suse initrd and kernel got overwritten so no chance of booting suse from the harddrive. well the kernel is still there since suse calls it vmlinux and ubuntu vmlinuz but the initrd's are identical.
so now for my question: how can i recover the initrd from suse and could i create separate directories in the /boot directory for each distro and change the menu.lst accordingly to prevent this from happening again, i.e. /boot/suse/vmlinuz, /boot/ubuntu/vmlinuz? i read that this is usually not a problem cause most distro's use different kernels so i wasn't really prepared for this.
btw i know how to restore the mbr but have had problems in the past reinstalling grub. last time i just reinstalled suse completely
damn. long post, but a complex problem. if anyone could shed any light on this it would be greatly appreciated. and i'm still pretty noobish so details please!
1) you may well have issues with the partition errors so that may need a re-write.
or you may need to filesysetemcheck fsck?
2) I assume you had suse grub in mbr and then you overwrote mbr with new distro?
if so there was no need. Once grub is in mbr and you did not overwrite the suse stage1.5 and stage2 files grub would still have been ok, so next time jump the grub steps for your new distro.
3) Now lets look at grub menu issues http://www.linuxquestions.org/questi...hreadid=237511
there are lots of menu.lst examples so grub is pointed to a kernel and an initrd image and off you go.
4) EDIT I created a /boot/suse and moved a copy of /grub into it and then I tried
root (hd0,0)/boot/suse > response ok MY /BOOT IS ON HDA1
setup (hd0) > response failed grub still looked at /boot and ignored my suse subfolder
So /boot/suse and other such folders will fail
THIS MEANS we (until someone finds a better soln)
rename your vmlinuz and initrd files so you know which is which
and ditto initrd files
then make copies elsewhere so when you install your other distro if they are deleted you can copy them back.
But if there are deletions, beaware that means that tho grub is in mbr it will not find a deleted stage2 file.......so copy /grub elsewere and then after you complete second distro copy /boot/grub and redo grub command
to repoint stage1 file to stage2 and your /boot is on hda2
5) its not entirely clear to me if you truly have a suse initrd or not as you say they are identical?
if still there just change your menu file to point to it
if not there then see if suse has a mkinitrd command and re-create the initial ram disk image
Just to repeat in case you need to overwrite
1) install suse and then rename each vmlinuz file and initrd file as
ditto for other suse kernels but version 2 or any name you like
2) install ubuntu but bypass any attempt to redo grub so the grub pointer files are not lost, and name your vmlinuz as vmlinuz-ubuetc
3) amend your menu.lst or grub.conf accordingly
you will be using suse grub to boot either system, ok?
install command PARTIAL success but loss of my splashimage.....hohum AND LOSS OF MENU
firstly how I did it with /boot on (hd0,0)
1) create folder /boot/suse/ then move grub folder and contents to sub-folder of suse so its /boot/suse/grub
2) open terminal command su and passwd
install --stage2=/boot/suse/grub/stage2 /boot/suse/grub/stage1 d (hd0) /boot/suse/grub/stage2 0x8000 p (hd0,0)/boot/suse/grub/menu.lst
Notes I did not get any error message or any success message whereas with the SETUP command I always get a message.
2) The only change you need to make to above is your absolute path to menu which will be
NOTE there is no gap between ) and /boot
Note in the install command there is no gap between the equals sign and its surrounds and gaps as normal everywhere else.
sorry about the mess, I had to google to see how it worked.
3) EXPLAIN as per manual
4) on reboot, grub jumped menu WT? and jumped (missed) my splashimage (no great loss)
then kernel messages were messy graphics similar to a failed splashimage then the last few lines of my local scripts loading, mainly my hdparm settings the screen finally gave clear fonts and gave clear boot login screen to gui kde .
5) I may try adding the absolute way to my splashimage file but that is trivial as I have lost my mbr to menu screen.
2) i told ubuntu to not install to mbr but to it's own partition but wrote to mbr anyway. will skip it next time
5) the initrd was definitely gone
i've been experimenting some myself and have partially fixed it.
ok booted suse via the cd and went to yast and restored the mbr. rebooted to check and it went to xp, so ok. booted suse again and created /ubuntu/ directory on the boot partition. aus9, i did not mean create separate folder for grub, only for initrd and vmlinuz. copied initrd, vmlinuz and config files to ubuntu folder. did an online update and updated the kernel, so i have a new kernel and initrd for suse. created /suse/ folder and copied them there. went to bootloader configuration, created new menu.lst to include both suse and ubuntu
same thing for ubuntu. let yast reinstall grub to mbr, booted and it worked. the advantage of the separate directories is that you don't need to edit your menu.lst after a kernel upgrade. just copy the vmlinuz, initrd and new versions to the corresponding folder and voila.
i too lost my bootsplash though, not the complete suse bootsplash, just for grub.
ubuntu still gives me some crap, won't go straight to runlevel5. get a lot of failed blabla modules.dep and goes to root prompt. then when i init 5 it will start x but still gives me a lot of the above. but i don't think it's related, is it?
I did not have any kernel errors other than my normal ones so I would be concerned if you have NEW errors.
2) I restored my mbr and parrtition with my trusty partimage file so can't comment any further than my fading brain cells can engage, (they force you drink amber fluid in aussieland as the water is so-so)
3) There is something wrong if you told it to install to a partition and it wrote to mbr
setup (hd0,1) and not setup (hd0) should have got grub to partition BUT
if its on a partition you need a bootloader in mbr to get to that partition, I assume you knew that and aren't telling me what bootloader you want in mbr.....lilo? groan No my guess is you are doing the ntloader to chainload thing...heh heh
4) If you had not changed your inittab file to a different runlevel you have a problem and need to think about some kernel file needing to find the kernel and initrd at a certain place. Maybe a re-compile might be the answer but I am not a kernel expert.
3) well i didn't know that in order to install grub to partition it would write to mbr too
i'm not using ntldr to chainload, i use grub in mbr, first installed by suse, then obviously overwritten by ubuntu
4) what i don't get is that suse doesn't seem to mind i moved those files but ubuntu is. is it a debian thing? come to think of it, i only copied the new kernel and initrd to /suse/ so they are also still in /boot/ maybe that's why it's not giving me any problems. i'll delete them and see if it gives me the same crap. still have the backups in /suse/ so shouldn't be a problem to go back.
when i recompile the kernel, could i tell it to look in the new folder? i know you (aus9) said you're not a kernel expert, so maybe if someone with some compiling experience could help me out? thnx in advance. if noone can help i'll have to try the renaming option.
umm, not sure but you never confirmed your grub in mbr was a suse until now, see my first post.
that means suse grub in mbr can go to another chainloader including another grub installed on a partition.
Why you want to I don't know?
So lets go back to basics.
1) Have you solved any PARTED errors?
2) Do you agree that you may also overwritten one of your grub files on the second distro install so grub (suse in mbr) can not find the rest of the booting files
3) And jumping to your move of some files grub (suse in mbr) will no longer find the blocklist for stage2 correctly
RESOLUTION....ignoring kernel re-compile which you can make a separate post
1) Check your partitions with another tool such as cfdisk or qtparted and make sure they are resolved first
I WILL SHOUT THIS so it is clearer, if a partition is stuffed it is misleading to look at other issues. so fix this first please please.
When I make a comment or ask a question I assume you know what I am asking, if you don't say so and we can be more verbose.
2) Then if you had not had to re-format any partition, you may need to re-embed the stage1 file for suse in mbr, to point to your grub files on the partition......stage1.5 and stage2 and menu.lst or grub.conf
This is done by redoing the grub command in a terminal
su and passwd
assuming /boot is still on hda2 = (hd0,1)
this command makes mbr point to the rest of the needed grub files irrespective if you menu wish is to boot a windows system. Is that clearer?
yes its a suse grub in mbr and is running fine after reinstalling it from yast as i wrote in my second to last post. i don't really want to chainload, i just like the idea i can still boot ubuntu from my gag floppy if my mbr is screwed and there's still a bootloader on the partition. that's all.
1) there's nothing wrong with the partitions. suse boots and uses them fine. ubuntu boots and does an fsck and that's fine. they show up fine in cfdisk too.
2)yes i've probably overwritten some stuff but that's not a problem anymore since grub is running now.
i finally got what you were saying, ubuntu did not write grub to mbr but did overwrite the stage 1.5 and stage 2 files on (hd0,1) so the suse grub couldn't find the right files.
3) i've put the ubuntu vmlinuz and initrd in the boot partition and pointed the menu.lst straight to it. whether i put the ubuntu files in the root of the boot partition or in a separate ubuntu directory i still get the same errors. i just noticed something in my menu.lst, the errors are probably due to a typo . suse boots fine from the suse directory even when i delete the files from the root of the boot partition so that seems to work.
i'm not moving any grub files, just the kernel and initrd.