View previous topic :: View next topic |
Author |
Message |
Zman_Ace n00b
Joined: 12 May 2006 Posts: 8
|
Posted: Fri May 12, 2006 12:24 am Post subject: Installed windows and I think it messed up my boot partition |
|
|
Disclaimer: I'm very new to this and am still unfamiliar with a ton of the command interface...but I want to learn so that's why i'm still trying.
I did my research and decided to choose gentoo...mostly because of this forum to be honest. I don't like posting "easy" questions and I have probably spent too much time searching through the docs and forums here.
So I installed gentoo on my laptop, got my nic working, finished installing, got my nvidia drivers working, got my linksys wireless G card working, installed amsn...the hard way, and i was working on getting eclipse installed with the web standards extensions (my biggest headache until now) until I had to install xp today to get some other work done.
After the install, I guess xp fried my boot partition (hope not) and obviously it kicked grub out of the MBR. I need to get that fixed if at all possible and I'd like to do it without having to start from scratch.
So I have rebooted using the most recent version of the LiveCD (the one I installed with) and I'd like to give you guys the fdisk info because I know you're going to ask for it, but when I go to terminal and type fdisk, it says:
Code: |
gentoo@livecd ~ $ fdisk
bash: fdisk: command not found
|
I've read in other posts that you can reinstall grub but you need to do something with chroot...well, I've been reading part "6.a Chrooting" in the handbook and I guess I'm still to much of a newbie because I can't seem to make sense of it.
Code: |
gentoo@livecd ~ $ chroot /mnt/gentoo /bin/bash
chroot: cannot change root directory to /mnt/gentoo: Operation not permitted
|
I'm sure the answer exists these forums already but I've been searching and fighting this all day with no luck so this post is my last resort.
Thanks for any help I can get.
Z |
|
Back to top |
|
|
benster n00b
Joined: 30 Nov 2005 Posts: 67 Location: Funkytown
|
Posted: Fri May 12, 2006 1:27 am Post subject: |
|
|
Don't fret, this isn't a huge problem, XP is too friendly and does this auto"magically" for you. The idea is that if you're dual booting then you have to have a non-XP bootloader installed; grub knows how to boot both XP and many other operating systems, you just have to configure it correctly.
My first guess is that when running the livecd, you need to be root. Seeing the '$' at your prompt where you try to chroot makes me think you tried that as a regular user (not root). I don't know if the livecd has the whoami command, but that'd normally tell you what user you are. You want to be root I think to chroot. Certainly when you get to grub.
If I am wrong on that part though, then chroot is erring on some more basic level. Sanity check: Is /mnt/gentoo mounted when you try to chroot? Or if it is mounted, then maybe it's mounted with some funky permissions. But even when you chroot you need to be root to reinstall grub. |
|
Back to top |
|
|
bobspencer123 Guru
Joined: 19 Dec 2005 Posts: 544
|
Posted: Fri May 12, 2006 1:37 am Post subject: |
|
|
Try using a console (if you can with the livecd). I think you can but i've never used it before.
then try these commands:
Code: |
su
[enter password] --I hope this works with the livecd
mount /dev/hda4 /mnt/gentoo --this is assuming that your / partition is hda4 if it isn't then adjust accordingly
mount /dev/hda2 /mnt/gentoo/boot --if you get a no directory type error then create directory with
mkdir /mnt/gentoo/boot --and try again
chroot /mnt/gentoo /bin/bash
env-update && source /etc/profile
grub --no-floppy
root (hd0,1) --once again this is assuming that /boot is /dev/hda2
setup (hd0) --install grub to mbr of /dev/hda
quit
reboot
|
but of course if you can't enter root password then this is for nothing. |
|
Back to top |
|
|
Zman_Ace n00b
Joined: 12 May 2006 Posts: 8
|
Posted: Fri May 12, 2006 1:52 am Post subject: |
|
|
well, I can get into the console.
when i boot with livecd it automatically logs in as user "gentoo"
i tried "su" but i think its looking for the livecd root user password instead of the one i setup for "root" during the initial install. I'm looking for it but I can't find it.
Any ideas? |
|
Back to top |
|
|
dmartinsca Guru
Joined: 09 Dec 2005 Posts: 303 Location: Ontario, Canada
|
Posted: Fri May 12, 2006 2:09 am Post subject: |
|
|
XP just wipes grub from the MBR, telling grub to re-write there is all you need to do.
Both benster and bobspencer are right. You need to be the root user to make changes like this. In the livecd, click applications>System>Terminal. The command to gain root access on the live cd is sudo su -
I'll list the sections of the handbook you need to follow to fix this.
Section 4e. Mounting: You may want to run fdisk -l first to remind yourself of the partition layout you used.
Section 6a. Chrooting: You can skip the mirror selection and Copy DNS Info sections.
Section 10b. Using GRUB: You don't need to run emerge grub again. Edit your /boot/grub/grub.conf file so you can boot windows. Install grub using either the grub-install method or manually.
Section 10d Rebooting |
|
Back to top |
|
|
benster n00b
Joined: 30 Nov 2005 Posts: 67 Location: Funkytown
|
Posted: Fri May 12, 2006 2:11 am Post subject: |
|
|
The livecd has to trust you to become root, as long as you have physical access to the machine, i.e. accessing it locally. My recollection is that it dumps you to a prompt and says the root password has been scrambled for security, but that's from the 2005.1 installer; I haven't used the 2006.0 installer.
Try 'sudo passwd' to change the root password. Or try 'sudo su' to actually become root. IIRC, it gets scrambled, but the consoles fire up a root terminal after you hit enter, so you cannot know the password they generated, but can change it to something you know instead.
Worse comes to worse, when the livecd boots, you could type 'gentoo single' to get you into single user mode, which by definition is root.[/url]
Reading this this somewhat useful post the guy says that if you get root from GDM from the live cd, it won't ask you for password. Then you can start a terminal inside gnome and change the rootpassword with passwd. |
|
Back to top |
|
|
Zman_Ace n00b
Joined: 12 May 2006 Posts: 8
|
Posted: Fri May 12, 2006 6:45 am Post subject: |
|
|
dmartinsca wrote: | XP just wipes grub from the MBR, telling grub to re-write there is all you need to do.
Both benster and bobspencer are right. You need to be the root user to make changes like this. In the livecd, click applications>System>Terminal. The command to gain root access on the live cd is sudo su -
I'll list the sections of the handbook you need to follow to fix this.
Section 4e. Mounting: You may want to run fdisk -l first to remind yourself of the partition layout you used.
Section 6a. Chrooting: You can skip the mirror selection and Copy DNS Info sections.
Section 10b. Using GRUB: You don't need to run emerge grub again. Edit your /boot/grub/grub.conf file so you can boot windows. Install grub using either the grub-install method or manually.
Section 10d Rebooting |
This was a HUGE help. However, the xp install really did wipe out my boot partition. I just installed grub and rebooted and I'm at the grub prompt. Its just sitting there laughing at me...
I had a copy of my grub.conf file so I used that, but the grub.conf file is pointing to files in the /boot/ directory and they aren't there. (splash.xpm.gz, kernel-genkernel-x86-2.6.15.3, initramfs-genkernel-x86-2.6.15.3)
Code: |
default 0
timeout 30
splashimage=(hd0,0)/grub/splash.xpm.gz
title=Gentoo Linux
root (hd0,0)
kernel /kernel-genkernel-x86-2.6.15.3 root=/dev/ram0 init=/linuxrc ramdisk=8192
real_root=/dev/hda3
initrd /initramfs-genkernel-x86-2.6.15.3
|
Is there an easy way (or any way) to get it back? |
|
Back to top |
|
|
benster n00b
Joined: 30 Nov 2005 Posts: 67 Location: Funkytown
|
Posted: Fri May 12, 2006 7:02 am Post subject: |
|
|
The files are probably not lost at all. Depending on how you partitioned your system, I bet either you had the /boot partition mounted during the install, in which case the files were written there. And now, when your files are lost, you haven't mounted /boot, so the root partition has an empty /boot directory where the usually mounted /boot would be "docked", and thus you see no files. Or vice versa, you forgot to mount boot for the install process and the files got written to /boot on the root partition, and now when you mount /boot you see nothing because the directory has been replaced with a (empty) mount point. Mounting just replaces directories with other directories that happen to live on different devices, whether it's another drive, partition, or network resource. If this is the problem, then you'd just want to copy the files to a temp directory and mount (or umount) to get the correct /boot in place and copy the files there.
One of the not-always-publicized facts about gentoo linux is that it does not mount /boot upon boot, even if you tell it (according to my experience) in your fstab. That's assuming you have a separate partition for /boot, which I recommend.
You can certainly mount /boot if you do it from the command line, but that's why those files could be missing from your /boot directory, because gentoo has this practice of not mounting boot when the system starts.
And there's no mystery about XP wiping out the MBR. That's what it does when it installs. |
|
Back to top |
|
|
Zman_Ace n00b
Joined: 12 May 2006 Posts: 8
|
Posted: Fri May 12, 2006 1:37 pm Post subject: |
|
|
well, when i installed gentoo, hda1 was 100MB ext2. Now it is 100MB HPFS/NTFS.
the only things there were windows startup files. windows formatted it. |
|
Back to top |
|
|
troymc Guru
Joined: 22 Mar 2006 Posts: 553
|
Posted: Fri May 12, 2006 1:51 pm Post subject: |
|
|
Zman_Ace wrote: | well, when i installed gentoo, hda1 was 100MB ext2. Now it is 100MB HPFS/NTFS.
the only things there were windows startup files. windows formatted it. |
yep. goner. pfffft.
Be sure & send a nice thank you letter to your Uncle Billy & let him know how much you appreciate him taking care of you!
troymc |
|
Back to top |
|
|
Zman_Ace n00b
Joined: 12 May 2006 Posts: 8
|
Posted: Fri May 12, 2006 2:06 pm Post subject: |
|
|
wonderful. thanks for the confirmation.
now what do i do? |
|
Back to top |
|
|
benster n00b
Joined: 30 Nov 2005 Posts: 67 Location: Funkytown
|
Posted: Fri May 12, 2006 3:51 pm Post subject: |
|
|
I guess that Windows didn't know what to do, did you have any other NTFS or FAT32 partitions on hda to begin with? That may be the reason it cloberred /dev/hda1. Double check though that your root partition doesn't have any files in it's /boot directory.
Solution: boot the livecd, reformat /dev/hda1 as ext2 and mount it (mount your root as /mnt/gentoo first) to /mnt/gentoo/boot chroot to /mnt/gentoo as in the installation guide. I would re-emerge grub (as it's conf files which live in /boot/grub) are now gone, and go to /usr/src and reproduce a kernel (with genkernel preferably as in the installation guide). Then your kernel and grub information should be happily living in /boot again. Then make sure you edit the /boot/grub/grub.conf (or menu.lst) file to correctly suit your configuration, there should be a commented out example on how to boot windows there. Then install-grub /dev/hda and you should be set to dual boot I think. |
|
Back to top |
|
|
chadb n00b
Joined: 12 May 2006 Posts: 36 Location: AB,Canada
|
Posted: Fri May 12, 2006 5:49 pm Post subject: |
|
|
OOPS
Code:
gentoo@livecd ~ $ fdisk
bash: fdisk: command not found
I've read in other posts that you can reinstall grub but you need to do something with chroot...well, I've been reading part "6.a Chrooting" in the handbook and I guess I'm still to much of a newbie because I can't seem to make sense of it.
Code:
gentoo@livecd ~ $ chroot /mnt/gentoo /bin/bash
chroot: cannot change root directory to /mnt/gentoo: Operation not permitted
i have seen these commands too. i cant seem to get my installation going after untar of stages + snapshots _________________ never seem to do things the easy way $@#% |
|
Back to top |
|
|
dmartinsca Guru
Joined: 09 Dec 2005 Posts: 303 Location: Ontario, Canada
|
Posted: Fri May 12, 2006 8:08 pm Post subject: |
|
|
chadb, you need to be working as the root user. The dollar sign($) at the end of your command prompt shows that you are not the root user. If you are using the gentoo livecd, type sudo su - to become the root user and try again
When you are the root user, the dollar sign at the end of the prompt will be replaced with a hash or pound sign(#). In linux, normal users do not have permissions to read the partition table, chroot, mount partitions, delete system files, etc. |
|
Back to top |
|
|
Zman_Ace n00b
Joined: 12 May 2006 Posts: 8
|
Posted: Fri May 12, 2006 9:34 pm Post subject: |
|
|
okay, i feel like this is a stupid question...
formating the /boot partition...
i can fdisk and change the fs flag easy enough but i'm thinking that doesn't automatically format it. what's the format command for linux?
sorry. |
|
Back to top |
|
|
troymc Guru
Joined: 22 Mar 2006 Posts: 553
|
Posted: Fri May 12, 2006 9:45 pm Post subject: |
|
|
Depends on the type of filesystem you want.
You're looking for something like mkreiserfs or mke2fs
Since this is /boot you probably want mke2fs.
troymc |
|
Back to top |
|
|
Zman_Ace n00b
Joined: 12 May 2006 Posts: 8
|
Posted: Sat May 13, 2006 8:00 pm Post subject: |
|
|
okay, here's the deal...
ran mke2fs and here is my current fdisk info:
Code: |
Device Boot Start End Blocks Id System
/dev/hda1 * 1 13 104391 c W95 FAT32 (LBA)
/dev/hda2 14 141 1028160 82 Linux swap / Solaris
/dev/hda3 142 1216 8634937+ 83 Linux
/dev/hda4 1217 3648 19535040 5 Extended
/dev/hda5 1217 2392 9446188+ 7 HPFS/NTFS
/dev/hda6 2393 3648 10088788+ b W95 FAT32
|
I then ran genkernel to get it back into /boot. then emerged grub. i ran into an error and found that I needed to exit chroot environment and run this command:
Code: |
mount -t proc none /mnt/gentoo/proc
|
I then went back to chroot and entered the following:
Code: |
cp /proc/mounts /etc/mtab
|
I then emerged grub again and it ran successfully.
I put the grub.conf file in the /boot/grub directory:
Code: |
livecd grub # cat grub.conf
default 0
timeout 30
splashimage=(hd0,0)/grub/splash.xpm.gz
title=Gentoo Linux
root (hd0,0)
kernel /kernel-genkernel-x86-2.6.15.3 root=/dev/ram0 init=/linuxrc ramdisk=8192 real_root=/dev/hda3
initrd /initramfs-genkernel-x86-2.6.15.3
|
I will want to set it up to dual boot to xp but for right now, I just want to see if I can get it to boot to gentoo first. I next try to run grub-install.
I first typed this:
Code: |
livecd grub # grep -v rootfs /proc/mounts > /etc/mtab
|
Then I ran:
Code: | grub-install /dev/hda |
this ran for a long time before it gave me the message:
Code: |
livecd grub # grub-install /dev/hda
The file /boot/grub/stage1 not read correctly.
|
so thinking this file may be messed up, i emerged grub again, went throught the same processes as stated above, then ran grub-install again...same error.
Any ideas? |
|
Back to top |
|
|
dmartinsca Guru
Joined: 09 Dec 2005 Posts: 303 Location: Ontario, Canada
|
Posted: Sat May 13, 2006 8:15 pm Post subject: |
|
|
The output from fdisk shows that your hda1 partition is marked as a W95 FAT32 partition, this might be screwing grub up. Use fdisk to change the partition type to 83. 't' lets you change the partition type. Also, check that the stage1 file exists in /boot/grub/: ls -l /boot/grub/
I have the following files in that directory:
Code: | dmartins@unstable ~ $ ls -l /boot/grub
total 438
-rw-r--r-- 1 root root 197 2006-04-11 07:25 default
-rw------- 1 root root 45 2006-04-10 18:50 device.map
-rw-r--r-- 1 root root 8052 2006-04-19 15:21 e2fs_stage1_5
-rw-r--r-- 1 root root 7812 2006-04-19 15:21 fat_stage1_5
-rw-r--r-- 1 root root 7060 2006-04-19 15:21 ffs_stage1_5
-rw------- 1 root root 238 2006-05-02 03:02 grub.conf
-rw-r--r-- 1 root root 1624 2006-04-19 15:21 grub.conf.sample
-rw-r--r-- 1 root root 7124 2006-04-19 15:21 iso9660_stage1_5
-rw-r--r-- 1 root root 8576 2006-04-19 15:21 jfs_stage1_5
lrwxrwxrwx 1 root root 9 2006-04-11 07:23 menu.lst -> grub.conf
-rw-r--r-- 1 root root 7284 2006-04-19 15:21 minix_stage1_5
-rw-r--r-- 1 root root 9556 2006-04-19 15:21 reiserfs_stage1_5
-rw-r--r-- 1 root root 33856 2006-04-19 15:21 splash.xpm.gz
-rw-r--r-- 1 root root 512 2006-04-19 15:21 stage1
-rw-r--r-- 1 root root 105544 2006-04-19 15:21 stage2
-rw-r--r-- 1 root root 105544 2006-04-19 15:21 stage2_eltorito
-rw-r--r-- 1 root root 105544 2006-04-11 07:25 stage2.old
-rw-r--r-- 1 root root 7368 2006-04-19 15:21 ufs2_stage1_5
-rw-r--r-- 1 root root 6708 2006-04-19 15:21 vstafs_stage1_5
-rw-r--r-- 1 root root 9404 2006-04-19 15:21 xfs_stage1_5 |
|
|
Back to top |
|
|
cyrillic Watchman
Joined: 19 Feb 2003 Posts: 7313 Location: Groton, Massachusetts USA
|
Posted: Sat May 13, 2006 8:16 pm Post subject: |
|
|
Zman_Ace wrote: | here is my current fdisk info:
Code: |
Device Boot Start End Blocks Id System
/dev/hda1 * 1 13 104391 c W95 FAT32 (LBA)
/dev/hda2 14 141 1028160 82 Linux swap / Solaris
/dev/hda3 142 1216 8634937+ 83 Linux
/dev/hda4 1217 3648 19535040 5 Extended
/dev/hda5 1217 2392 9446188+ 7 HPFS/NTFS
/dev/hda6 2393 3648 10088788+ b W95 FAT32
| |
Linux can boot from any partition, but Windows can only boot from a primary partition.
The way you have the harddrive partitioned, you are forcing the Windows installer to clobber your Linux /boot partition in order to install NTLDR (the Windows bootloader). |
|
Back to top |
|
|
Zman_Ace n00b
Joined: 12 May 2006 Posts: 8
|
Posted: Sat May 13, 2006 10:40 pm Post subject: |
|
|
So you're saying there's no way I can get it to boot to both with my partitions like this?
Basically, just start over? At this point, I'm not opposed to that idea if that's what it comes down to. |
|
Back to top |
|
|
jmbsvicetto Moderator
Joined: 27 Apr 2005 Posts: 4734 Location: Angra do Heroísmo (PT)
|
Posted: Sat May 13, 2006 11:34 pm Post subject: |
|
|
Hi.
If you haven't finish your Windows installation, you can boot with the live-cd and move your /dev/hda3 partition to /dev/hda5. You would need to change the type of the partition and format it with your prefered Linux filesystem. Then you would need to copy the files from one partition to the other. In case you don't understand, this would overwrite your windows installation and force you to install it again. You would need to update your /etc/fstab and grub.conf also. _________________ Jorge.
Your twisted, but hopefully friendly daemon.
AMD64 / x86 / Sparc Gentoo
Help answer || emwrap.sh
|
|
Back to top |
|
|
|