LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   Grub install f up (https://www.linuxquestions.org/questions/debian-26/grub-install-f-up-916927/)

sdfi 12-03-2011 10:59 AM

Grub install f up
 
I have a system with voyage linux, and i wanted to put a regular debian install on the same machine, also. So i followed the install CD.. resized the exisiting partition, made new ones, all went well. Until GRUB.. i selected to install it (assuming it would pick up on the fact there already was a GRUB install..

as it picked up 'unknown linux distro' i went ahead and installed it to the MBR. Now my HDD doesn't boot. What do i do???

Hungry ghost 12-03-2011 11:45 AM

Do you have some liveCD from which you can repair grub? If you do, try the following from the liveCD:

Code:

mkdir /mnt/debian
mount /dev/your_debian_partition /mnt/debian
mount -o bind /dev /mnt/debian/dev
mount -o bind /sys /mnt/debian/sys
mount -t proc none /mnt/debian/proc
chroot /mnt/debian /bin/bash
update-grub2
grub-install /dev/sda

You could also download Super Grub Disc, and try to fix your grub install from there (I haven't used it, but I've read that it's very handy for these cases).

Regards.

widget 12-03-2011 12:55 PM

Quote:

Originally Posted by odiseo77 (Post 4541095)
Do you have some liveCD from which you can repair grub? If you do, try the following from the liveCD:

Code:

mkdir /mnt/debian
mount /dev/your_debian_partition /mnt/debian
mount -o bind /dev /mnt/debian/dev
chroot /mnt/debian /bin/bash
update-grub2
grub-install /dev/sda

You could also download Super Grub Disc, and try to fix your grub install from there (I haven't used it, but I've read that it's very handy for these cases).

Regards.

Use the directions above. Much better choice than third party tools.

Here is a link to more complete instructions;
https://help.ubuntu.com/community/Gr...stalling_GRUB2

Should work with either of your installs but I would go with the Debian as being more reliable than voyage that does not seem to be designed for real computer use anyway so may have some problems with file system paths.

I have not looked at voyage seriously so may just be blowing that out of some unnamed orifice. I would not trust it anyway for boot duty.

The command "update-grub2" is obsolete, by the way. It is just "update-grub". Both will still work but the "grub2" usage ended 2 years ago when support for grub-legacy was dropped.

62chevy 12-03-2011 01:19 PM

In Sid update-grub2 is a symbolic link to update-grub. In Squeeze I still have both in /usr/sbin.

widget 12-03-2011 03:54 PM

Quote:

Originally Posted by 62chevy (Post 4541139)
In Sid update-grub2 is a symbolic link to update-grub. In Squeeze I still have both in /usr/sbin.

If you try "update-grub" in Sid it will work fine. This is a native command for grub.

Documentation is a problem with grub-pc an Debian, much as I love it, is not always on top of the newest things. It is a surprise to me just how little is actually known about grub-pc and how to use it.

On the other hand I know that it is a moving target and that I am way behind the thing too. One of these days I really need to spend a couple, three days and catch up, probably totally screwing my grub a few times.

62chevy 12-03-2011 05:03 PM

Quote:

Originally Posted by widget (Post 4541245)
If you try "update-grub" in Sid it will work fine. This is a native command for grub.

Documentation is a problem with grub-pc an Debian, much as I love it, is not always on top of the newest things. It is a surprise to me just how little is actually known about grub-pc and how to use it.

On the other hand I know that it is a moving target and that I am way behind the thing too. One of these days I really need to spend a couple, three days and catch up, probably totally screwing my grub a few times.

One of my biggest complaints with Debian is the Documentation is either old or not there. Some docs date back to Sarge.

widget 12-03-2011 07:06 PM

Quote:

Originally Posted by 62chevy (Post 4541278)
One of my biggest complaints with Debian is the Documentation is either old or not there. Some docs date back to Sarge.

Grub has not done too well themselves with documentation.

The best is in the Ubuntu community documentation and
http://ubuntuforums.org/showthread.php?t=1195275

which is written by the guy guilty of most of the Ubuntu documentation. I prefer the forum thread. Only the first post is needed as he keeps it up to date.

It also has valuable links at the end. Many are other, specialty threads by the same guy, drs305, who was one of us that got hit at Ubuntu 9.10 alpha2 time with grub2 and NO documentation. That was fun.

The post linked above was actually started in that testing cycle put together with all the discoveries by those of us that were working on grub along with his extensive experimentation. He continues to experiment extensively and knows things that the Grub guys are not real sure about.

His thread on passwords in grub is worth reading for the paranoid.

You can also learn to mess with all the scripts in grub to get just what you want. He can pretty much get it to sit up and beg.

I stick with messing with symbolic menu entries and have no trouble with booting to a HDD that is really screwed and recovered through testdisk but can't be read by e2fscheck or os-prober. Generated menu entries do not work there at all.

Symbolic ones do.

for Debian branch Linux this works great if edited to your drive and partition table;
Code:

echo "Adding Squeezy on sda7" >&2
cat << EOF
menuentry "Squeezy on sda7" {
    set root=(hd0,7)
        linux /vmlinuz root=/dev/sda7 ro quiet
        initrd /initrd.img
}
EOF

This works for RH branch Linux;
Code:

echo "Adding Squeezy on sda7" >&2
cat << EOF
menuentry "Mandriva-Gnome" {
        linux (hd0,12)/boot/vmlinuz
        initrd (hd0,12)/boot/initrd.img
}

Add to your /etc/grub.d/40_custom file and save as 06_custom after editing. Anything can be used that you want between the "" marks. The first set is what you see in terminal when running "update-grub". The second is what you see on your screen menu.

The position of the { and } is critical.

If you have a long instruction string in the Debian branch entry do not have line wrapping enabled in you test editor.

These entries will always boot to the newest kernel on the defined partition.

The RH example is old (09). Don't even have Mandriva on here. I just used it last week, edited for my new install of an extremely bloated PCLOS FullMonty edition. Works like a charm.

Hungry ghost 12-03-2011 07:06 PM

Quote:

Originally Posted by widget (Post 4541126)
The command "update-grub2" is obsolete, by the way. It is just "update-grub". Both will still work but the "grub2" usage ended 2 years ago when support for grub-legacy was dropped.

Yes, I know. For some reason, I have the custom of using update-grub2 instead of just update-grub. Maybe a reminiscence of old times when grub2 started being implemented :)

Cheers.

Hungry ghost 12-03-2011 09:13 PM

To the OP: I forgot, the above commands won't work because you will need at least /sys mounted (and probably /proc as well), so try only one of the following options:

a) Follow the commands above but execute these couple of commands before the chroot command:

Code:

mount -o bind /sys /mnt/debian/sys
mount -t proc none /mnt/debian/proc

or b) execute the following (with the debian partition mounted on /mnt/debian):

Code:

grub-install --root-directory=/mnt/debian /dev/sda
(Sorry for the misleading advice in my first post, I forgot you need /sys and /proc mounted on the chrooted Debian in order for the commands to work. I edited my post to include these couple of commands).

Regards.

sdfi 12-04-2011 04:17 PM

wow I wish I always got this many responses! Anyway, after grub-install /Dev/sda I get;

this ms-dos style partition label has no post mbr gap embedding won't be possible. .. grub can only be installed using blocklists --unreliable and discouraged. use --force? ?

sdfi 12-04-2011 04:38 PM

well I caved and ran it with --force. it said no problems occurred. however, my system still fails to boot, still complaining 'hard disk boot sector invalid'.

Hungry ghost 12-04-2011 05:24 PM

hmm, strange. Could you download this script, uncompress it, give it execution permissions (chmod +x boot_info_script.sh) and run it like this?: ./boot_info_script.sh. Then please, attach the RESULTS.txt file here, so we can see it. One question: did you create an extra /boot partition for Debian, or only a root (/) partition? (In case you have created an extra /boot partition, which one is it?)

Regards.

widget 12-04-2011 05:31 PM

Quote:

Originally Posted by odiseo77 (Post 4541988)
hmm, strange. Could you download this script, uncompress it, give it execution permissions (chmod +x boot_info_script.sh) and run it like this?: ./boot_info_script.sh. Then please, attach the RESULTS.txt file here, so we can see it. One question: did you create an extra /boot partition for Debian, or only a root (/) partition? (In case you have created an extra /boot partition, which one is it?)

Regards.

+112

sdfi 12-04-2011 05:58 PM

1 Attachment(s)
i've attached it since it doesn't format properly with notepad;

widget 12-04-2011 06:46 PM

Ah, the wonders of using an OS made for imbedded use on a pc. This looks like fun.

You have a completely screwed grub installation and it will take some thought to straighten this out.

It appears that you have a mixed up MBR thinking that you are using grub-legacy while attempting to use the menu from grub-pc.

How this was done is beyond me but I would really like to know. Trying to duplicate that may be a good idea on another box so that a bug could be filed with what ever caused it. Has to be one grub or the other.

I will study more on your results.


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