You are not logged in.

#1 2011-12-31 01:59:46

exuberant
Member
Registered: 2011-04-08
Posts: 9

Screwed up MBR and boot partition, can't fix it [SOLVED]

Hi,

I have been defeated. Been trying to fix my computer the whole day and know I'm lost.
It's a long story, but my whole system got screwed when I tried installing windows on top of arch (I didn't get it to install, but I don't care anymore).

I was able to install GRUB2, I tried configuring it with grub.cfg , but when trying to boot it says it's missing kernel, boot partition has linux2.6, and I was using linux 3, I'm not really sure how to get the kernel I was using, should it be in my root partition? .

I'd like to get my system as it was before, I have root , var and home partitions and not sure how.

Thanks

Last edited by exuberant (2011-12-31 10:27:47)

Offline

#2 2011-12-31 02:49:10

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,741

Re: Screwed up MBR and boot partition, can't fix it [SOLVED]

First off, welcome to Arch Linux Forums
Can you be a bit more specific.
What distribution had you been using? Just verifying it was an Arch system.
Have you ever had a system installed that used 2.6?
Is it possible you have more than one boot partition?
How did you try to install Windows, did you have a spare partition? Did you try to install Windows to replace Arch?
How did you install GRUB2? was it from an Arch boot disk?
You state you've root.  Is that from a boot media, or are you able to boot the system from the disk?


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#3 2011-12-31 03:11:05

exuberant
Member
Registered: 2011-04-08
Posts: 9

Re: Screwed up MBR and boot partition, can't fix it [SOLVED]

Thanks for your reply.
I was using Arch, I last updated a few days ago.
The kernel that's on the boot partition is from a debian live cd I had laying around.
It is not possible I have more than one boot partition. I have 1 hard drive, but plenty of free space.
Windows wanted to use the start of my disk, so I used gparted to move 20 gb free space at the beginning. Creating a partition in the beginning also caused all partitions numbers to move up (sda2->sda3), when I gave up on windows, I tried moving everything forward like it was before, but it didn't work. Then I remembered that when installing grub, installers check for other mount points, but that didn't work, and instead overwrote my boot partition. So know I've got a temporary debian system installed(sda9) and a boot partition that won't boot Arch.


This is my fdisk output: sda5 is arch sd6 var and sd7 home

Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000080

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          12       96358+  83  Linux
/dev/sda2              13         401     3124642+  82  Linux swap / Solaris
/dev/sda4            2744       14648    95619073    5  Extended
/dev/sda5            2744        4203    11719680   83  Linux
/dev/sda6            4239        5212     7815168   83  Linux
/dev/sda7            5227       10326    40957952   83  Linux
/dev/sda8           10393       13432    24411136   83  Linux
/dev/sda9           13432       14648     9764864   83  Linux

Offline

#4 2011-12-31 04:06:15

the.ridikulus.rat
Member
From: Indiana, USA
Registered: 2011-10-04
Posts: 765

Re: Screwed up MBR and boot partition, can't fix it [SOLVED]

Try this from grub> prompt

grub > insmod search_fs_file
grub > search.file /vmlinuz-linux root
grub > linux /vmlinuz-linux ro root=/dev/<ur device>
grub > initrd /initramfs-linux.img
grub > boot

If /vmlinuz-linux does not work, try /boot/vmlinuz-linux and /boot/initramfs-linux.img . Also post your grub.cfg .

Offline

#5 2011-12-31 04:44:58

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,741

Re: Screwed up MBR and boot partition, can't fix it [SOLVED]

You should probably look at this article on chroot.  You can start from a CD, or any other Linux environment.  You can mount your Arch partition, then mount your boot partition using the mount point inside your Arch partition.  Once that is done, you can chroot into you Arch Linux environment.  Once you do that, it is easy to fix things.  For example, you can use pacman to re-install your kernel and it will rebuild the initrd and the kernel on the boot partition.

It is a really handy tool to have in your hip pocket.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#6 2011-12-31 10:06:22

GSF1200S
Member
Registered: 2008-12-24
Posts: 474

Re: Screwed up MBR and boot partition, can't fix it [SOLVED]

ewaller wrote:

You should probably look at this article on chroot.  You can start from a CD, or any other Linux environment.  You can mount your Arch partition, then mount your boot partition using the mount point inside your Arch partition.  Once that is done, you can chroot into you Arch Linux environment.  Once you do that, it is easy to fix things.  For example, you can use pacman to re-install your kernel and it will rebuild the initrd and the kernel on the boot partition.

It is a really handy tool to have in your hip pocket.

Indeed. Run a livecd, run fdisk -l as root to get a partition scheme layout, decide which one is arch, mount arch's root partition in /mnt, then mount --bind proc /mnt/proc, mount --bind sys /mnt/sys, mount --bind dev /mnt/dev, then chroot /mnt. Simply ensure that /etc/fstab is pointed to the correct /boot parition (if there is none, it wont be listed in fstab as it will be part of arch's root), then reinstall the kernel. Then, grub-install /dev/sda (if that is the labeling of your hard drive- if partitions were /dev/sdb1 for example, then it would be grub-install /dev/sdb), and make sure Grub is pointed to the right partitions. If you have problems, give us your grub.cfg and /etc/fstab smile

Offline

#7 2011-12-31 10:27:04

exuberant
Member
Registered: 2011-04-08
Posts: 9

Re: Screwed up MBR and boot partition, can't fix it [SOLVED]

the.ridikulus.rat wrote:

Try this from grub> prompt

grub > insmod search_fs_file
grub > search.file /vmlinuz-linux root
grub > linux /vmlinuz-linux ro root=/dev/<ur device>
grub > initrd /initramfs-linux.img
grub > boot

Thanks, this worked for me. The second line is a bit magical for me though, what does it do?

ewaller wrote:

You should probably look at this article on chroot.  You can start from a CD, or any other Linux environment.  You can mount your Arch partition, then mount your boot partition using the mount point inside your Arch partition.  Once that is done, you can chroot into you Arch Linux environment.  Once you do that, it is easy to fix things.  For example, you can use pacman to re-install your kernel and it will rebuild the initrd and the kernel on the boot partition.

It is a really handy tool to have in your hip pocket.

Thanks for that article, it's what I was looking for! I tried doing something like that before, but got stuck on the 'format error' and wasn't sure why (now I know).

Offline

Board footer

Powered by FluxBB