LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   GRUB issue: /boot partition was deleted while installing XP (https://www.linuxquestions.org/questions/linux-general-1/grub-issue-boot-partition-was-deleted-while-installing-xp-660708/)

PB0711 08-05-2008 04:43 PM

GRUB issue: /boot partition was deleted while installing XP
 
dear all,

Thanks for looking at this :D
I always seem to have GRUB issues :o

Anyway, I needed to install WinXP on my HP Dv9500t laptop, for some really annoying software which is only windows and I can't be bothered to wine it. So While installing I wrote over the /boot partition of the hard drive :( Now there is nothing in boot except for some things that I've made from other pc's. Any idea? Should I just reinstall everything? I don't really want to do that if I don't have to but I will if I must. If I do whats the easyist way to back things up? Make an iso with dd or a tar.gz? and can someone remind me of the commands ?

Thanks,

paul

Code:

root@ubuntu:/# fdisk -l

Disk /dev/sda: 100.0 GB, 100030242816 bytes
255 heads, 63 sectors/track, 12161 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0004c869

  Device Boot      Start        End      Blocks  Id  System
/dev/sda1  *          1        555    4458006    7  HPFS/NTFS
/dev/sda2            556      12161    93225195  83  Linux

Disk /dev/sdb: 100.0 GB, 100030242816 bytes
255 heads, 63 sectors/track, 12161 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x1248f1c6

  Device Boot      Start        End      Blocks  Id  System
/dev/sdb1              1          32      257008+  83  Linux
/dev/sdb2              33      12160    97418160    f  W95 Ext'd (LBA)
/dev/sdb5              33        542    4096543+  82  Linux swap / Solaris
/dev/sdb6            543      12160    93321553+  7  HPFS/NTFS


root@ubuntu:/# mkdir /media/ubuntu
root@ubuntu:/# mount /dev/sda2 /media/ubuntu/
root@ubuntu:/# mount /dev/sdb1 /media/ubuntu/boot
root@ubuntu:/# mount --bind /dev/ /media/ubuntu/dev/
root@ubuntu:/# mount --bind /proc /media/ubuntu/proc
root@ubuntu:/# umount /dev/sdc1
root@ubuntu:/# mount /dev/sdc1 /media/ubuntu/local
root@ubuntu:/# chroot /media/ubuntu/
root@ubuntu:/# ls boot/
grub  lost+found
root@ubuntu:/# ls boot/grub/
default  device.map  menu.lst  menu.lst~
grub-install /dev/sda
/dev/sda does not have any corresponding BIOS drive.
grub-install --recheck /dev/sda2
Probing devices to guess BIOS drives. This may take a long time.
Could not find device for /boot: Not found or not a block device.
grub-install /dev/sda
Could not find device for /boot: Not found or not a block device.


stress_junkie 08-05-2008 06:13 PM

Your profile says that you use Ubuntu. I believe that Ubuntu has a system repair option in the live CD installer.

yancek 08-05-2008 06:14 PM

windows overwrites mbr. You just need to re-install Grub to the mbr of the first drive. If you can't boot from the hardrive use a Live CD, in a terminal type "grub" to get the grub prompt (grub>), then enter:

geometry (hd0)
geometry (hd1)
find /sbin/init
find /boot/vmlinuz

so you know where the files you need are and then do the following:
root (hd0,1)
setup (hd0)
quit

This assumes your Linux distro in on sda2, if it's on sdb1, change the root entry to (hd1,0).

PB0711 08-05-2008 06:24 PM

Sorry forgot to say that. Yes we're using Ubuntu Hardy and no I didn't see the repair option on the live disc. So I booted up the live disc and mounted the hard drives (2 sata HDD) as in my first post. Then I did
Code:

root@ubuntu:/boot# ls -lhR
.:
total 13K
drwxr-xr-x 2 root root 1.0K 2008-08-05 14:53 grub
drwx------ 2 root root  12K 2008-08-04 14:54 lost+found

./grub:
total 10K
-rw-r--r-- 1 root root  191 2008-08-04 15:54 default
-rw-r--r-- 1 root root  60 2008-08-05 14:53 device.map
-rw-r--r-- 1 root root 3.7K 2008-08-05 14:52 menu.lst
-rw-r--r-- 1 root root 3.7K 2008-08-05 14:52 menu.lst~

./lost+found:
total 0

this is what I'm saying I wrote over the boot partition. I had to totally remake it. However, i don't have a stage1 or a vmlinuz file anymore because Win XP formatted the boot partition and used it as C:/
Hence when I do do
Code:

root@ubuntu:/boot# grub
Probing devices to guess BIOS drives. This may take a long time.

      [ Minimal BASH-like line editing is supported.  For
        the  first  word,  TAB  lists  possible  command
        completions.  Anywhere else TAB lists the possible
        completions of a device/filename. ]
grub> geometry (hd0)
geometry (hd1)
find /sbin/init
find /boot/vmlinuzgeometry (hd0)
drive 0x80: C/H/S = 12161/255/63, The number of sectors = 195371568, /dev/sda
  Partition num: 0,  Filesystem type unknown, partition type 0x7
  Partition num: 1,  Filesystem type is ext2fs, partition type 0x83
grub> geometry (hd1)
drive 0x81: C/H/S = 12161/255/63, The number of sectors = 195371568, /dev/sdb
  Partition num: 0,  Filesystem type is ext2fs, partition type 0x83
  Partition num: 4,  Filesystem type unknown, partition type 0x82
  Partition num: 5,  Filesystem type unknown, partition type 0x7
grub> find /sbin/init
 (hd0,1)
grub> root (hd0,1)
root (hd0,1)
grub> setup (hd0)
setup (hd0)
 Checking if "/boot/grub/stage1" exists... no
 Checking if "/grub/stage1" exists... no

Error 15: File not found
grub>

I get File not found because it's not there. Any way to make it?

jiml8 08-05-2008 06:42 PM

So, you were booting out of a separate /boot partition? And it is now gone? (it is certainly not there...). Does that mean your kernel is missing too?

In this event, you will either need to recreate it and put the right stuff in it, or you need to put a /boot directory on your / partition. You should be able to get what you need off of a live CD that matches your distro. This is probably going to mess up your package manager though, but you can fix that.

Just fire up the live CD, remount the partition (sda2, it looks like) that is your system parttion as writable, then copy /boot from the live CD onto it.

Then, install grub.

PB0711 08-05-2008 08:19 PM

I copied over what the live CD had and this is what I got. I probably could mess around and get it all working but with the different kernel version I can't be bothered. My partitions are kind of nasty anyway so fresh install here we come :D

just FYI I did
root@ubuntu:/# tar cvf /homeDIR_BK.tar /home/*******/
which worked quite nicely :D but it was too big for gzip otherwise I would do
root@ubuntu:/# tar cvf - /home/********/ | gzip > /homeDIR_BK.tar.gz

here is what the live CD gave and my different kerenl images so ....yea
Code:

root@ubuntu:/# ls boot/
abi-2.6.24-16-generic            lost+found
config-2.6.24-16-generic          memtest86+.bin
grub                              System.map-2.6.24-16-generic
initrd.img-2.6.24-16-generic.bak  vmlinuz-2.6.24-16-generic
root@ubuntu:/#
root@ubuntu:/# ls -lh /
total 24G
drwxr-xr-x  2 root root 4.0K 2008-08-03 12:51 bin
drwxr-xr-x  4 root root 1.0K 2008-08-05 16:51 boot
lrwxrwxrwx  1 root root  11 2008-06-29 11:31 cdrom -> media/cdrom
drwxr-xr-x  12 root root  15K 2008-08-05 06:47 dev
drwxr-xr-x 146 root root  12K 2008-08-05 16:15 etc
drwxr-xr-x  3 root root 4.0K 2008-08-05 17:52 home
-rw-r--r--  1 root root  24G 2008-08-05 18:06 homeDIR_BK.tar
drwxr-xr-x  2 root root 4.0K 2008-04-22 11:02 initrd
lrwxrwxrwx  1 root root  33 2008-06-29 20:22 initrd.img -> boot/initrd.img-2.6.24-19-generic
lrwxrwxrwx  1 root root  33 2008-06-29 11:40 initrd.img.old -> boot/initrd.img-2.6.24-16-generic
........
........
........
lrwxrwxrwx  1 root root  30 2008-06-29 20:22 vmlinuz -> boot/vmlinuz-2.6.24-19-generic
lrwxrwxrwx  1 root root  30 2008-06-29 11:40 vmlinuz.old -> boot/vmlinuz-2.6.24-16-generic
root@ubuntu:/#



All times are GMT -5. The time now is 03:09 PM.