LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-05-2008, 04:43 PM   #1
PB0711
Member
 
Registered: Aug 2004
Location: London, UK
Distribution: Ubuntu 10.10, ubuntu 11.04, suse 9.2, OSX
Posts: 259

Rep: Reputation: 30
GRUB issue: /boot partition was deleted while installing XP


dear all,

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

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.
 
Old 08-05-2008, 06:13 PM   #2
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 335Reputation: 335Reputation: 335Reputation: 335
Your profile says that you use Ubuntu. I believe that Ubuntu has a system repair option in the live CD installer.
 
Old 08-05-2008, 06:14 PM   #3
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,542

Rep: Reputation: 2496Reputation: 2496Reputation: 2496Reputation: 2496Reputation: 2496Reputation: 2496Reputation: 2496Reputation: 2496Reputation: 2496Reputation: 2496Reputation: 2496
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).
 
Old 08-05-2008, 06:24 PM   #4
PB0711
Member
 
Registered: Aug 2004
Location: London, UK
Distribution: Ubuntu 10.10, ubuntu 11.04, suse 9.2, OSX
Posts: 259

Original Poster
Rep: Reputation: 30
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?

Last edited by PB0711; 08-05-2008 at 06:28 PM.
 
Old 08-05-2008, 06:42 PM   #5
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 116Reputation: 116
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.
 
Old 08-05-2008, 08:19 PM   #6
PB0711
Member
 
Registered: Aug 2004
Location: London, UK
Distribution: Ubuntu 10.10, ubuntu 11.04, suse 9.2, OSX
Posts: 259

Original Poster
Rep: Reputation: 30
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

just FYI I did
root@ubuntu:/# tar cvf /homeDIR_BK.tar /home/*******/
which worked quite nicely 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:/#
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Ubuntu 7.10 Dual Boot with XP, ubuntu partition deleted, grub 1.5 error 22 narchy Linux - Newbie 11 02-07-2011 03:54 AM
Grub Error 22, deleted partition kmorsch Linux - Newbie 29 07-09-2009 01:20 AM
URGENT: FC3 partition deleted - GRUB is there! Moodamultani Linux - Software 2 03-21-2006 02:19 PM
deleted linux partition adn the boot loader was deleted also,now i have only gnu grub boris199 Linux - Laptop and Netbook 2 01-29-2005 04:53 PM
Grub - Deleted Partition digipsythe Linux - Newbie 1 04-12-2004 12:38 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:34 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration