Re: Restore /boot? (wiped out by ubuntu install)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Paul,
Thanks for the excellent help. I appreciate the effort you went to writing this up. I now have it working the way I want. See my comments below.

-gene

Paul Johnson wrote, On 01/06/2008 05:06 PM:
On Jan 6, 2008 3:36 PM, Gene Smith <gds@xxxxxxxxxxxxx> wrote:
I had a working Fedore 8 on /dev/sdb. On unused LogVol's on sdb I
installed ubuntu. However, ubuntu (live version) *insisted* on
reformatting /boot (/dev/sdb1). I did not go back and save the original
Fedora 8 /boot files (vmlinuz-, etc) thinking I could easily get them
back somehow, but can't determine how.

Is there a way to restore the Fedora 8 /boot contents (w/o a complete
reinstall) so it will run again?

You should not have let Ubuntu share the boot partition that Fedora
was already using.  That was the mistake, in my opinion.

Well, I think it insisted that it had to re-format a /boot partition. I was hoping it would share the one on /dev/sdb with fedora 8. The other choice was to use the /boot partition on /dev/sda which was also in use by fc 6. Anyhow, I let it do its thing thinking I could probably "rescue" it later. Was a bit harder than I thought!


Now, how to fix?  I'd try this way.  The Most direct route is to
create a new partition where you can boot ubuntu from.  Create &
format that partition, copy the files from your sdb1 to that new
partition, then do the grub magic so that the system will boot from
that new partition.  That amounts to running grub install and editing
grub.conf so that it knows where your boot partition is.  I have
actually done this job and followed a few web pages while doing it.

Be sure Ubuntu runs from that new boot partition before proceeding.

Since both the fc 6 on sda and f8 installed on sdb are lvm based, creating a new partition would require wiping the drive, I think, Instead I had created some new LogVol's on the copious free space of 500G sdb for ubuntu where it installed OK previously (but taking over /boot).

To restore the f8 /boot I first saved the ubuntu vmlinuz and initrd.img over on to sda (in they got deleted, which they didn't) and, like you suggested, ran "grub-install /dev/sda". But first I had to get a few rpms from the current updates repository to get back the f8 specific contents of /boot:

kernel-2.6.23.9-85.fc8.i686.rpm
fedora-logos-8.0.3-1.fc8.noarch.rpm
grub-0.97-19.i386.rpm

I copied these to the f8 /boot after downloading with fc 6. The fedora-logos rpm was just to get back the grub splash screen for f8. Don't think I really needed grub but had to have kernel.

When running the f8 rescue (in chroot mode), these rpms reported as already installed. So I had to --force the installs which placed the proper f8 vmlinuz, etc files back into /boot. I then edited the /boot/grub/grub.conf that ubuntu put there to reference the respective operating systems. Then, again from f8 rescue I ran "grub-install /dev/sdb" to install the bootloader on sdb. Now when I set the bios to boot from sdb I see the fedora 8 splash and have choice of f8 and ubuntu on sdb and can also select fc 6 (installed on sda) from there too.

The old partition from which you were booting probably had a label
from Fedora.  Probably it was /boot.  You can reformat that partition
and re-install that label with e2label.  Then boot from your fedora
rescue disk and it will dump you into a shell, where you can chroot to
mount the existing drive.  I believe if you re-install the kernel rpm
from that point, it will probably do the work needed to drop vmlinuz
onto your hard disk.  Perhaps you also need to re-install the grub
rpm.

I did "--force" the re-install of grub rpm but I don't think it had any useful effect. Didn't change anything in /boot AFAIK.


Supposing that works, then, depending on how you mark your partitions,
either the Fedora or the Ubuntu will start by default.  In the
grub.conf on the system that runs, you can put in the commands needed
to boot the other one.

Yes, also set the grub.conf on sda so it will boot fc 6 (on sda) as well as f8 and ubuntu on sdb. So regardless of which disk I boot from, I can select any OS.


Be careful about disk labels. If Ubuntu is using labels like Fedora,
you need to make sure that only the Fedora boot partition has the
label /boot.  The Ubuntu should be labeled something else
(Use e2label).

Didn't seem to have a problem with labels. Possibly because I am using LVMs (except for the sda1 and sdb1 /boot sectors).


I'm googling a bit to get you started. This one looks better than most.

http://danleff.net/myarticles/fedorainstall/linuxinstallharddrives5.html

Good article.


For me, the most difficult thing was to understand that the term
"root" is used in 2 senses in the grub. conf.

title Fedora (2.6.23.9-85.fc8)
        root (hd0,2)
        kernel /vmlinuz-2.6.23.9-85.fc8 ro root=LABEL=/laproot agp=off
agpgart=off
        initrd /initrd-2.6.23.9-85.fc8.img

The first one refers to the partition where /boot is located.  The
second one, in the kernel like, refers to the partition in which "/"
is located.

Well, what got me confused was the concept of (hdx,y). I originally thought /dev/sdb1 was *always* (hd1,0) and /dev/sda1 == (hd0,0). I finally realized that if my bios is set to boot from, say, /dev/sdb1 (2nd hard drive) then to grub on sdb, sdb1 is seen as (hd0,0) and /dev/sda1 is (hd1,0).

I'm just a simple political scientist, Captain Kirk, but
wouldn't it have been better to call the first option "boot"?

Yes, but obfuscation is so much fun!


When you reboot your system, it may be necessary to use the "e"
option in the boot prompt and fix these references.  Once it starts
properly, you can get in and revise /etc/grub.conf.


Seems OK without using "e"

P/S: There is still one thing I don't understand. When the "live-ubuntu" installed on sdb it seemed to install grub on sda (I didn't tell it to). I had to always boot from sda via the bios. (Booting from sdb just printed "GRUB" and hung.) Not sure how you do this yourself. Would not boot from sdb but /boot on sdb contained the grub.conf for ubuntu. Possibly the DVD install of ubuntu is more flexible?



[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux