Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Solved: Stuck in grub2
View unanswered posts
View posts from last 24 hours

Goto page 1, 2, 3, 4, 5  Next  
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
mark2
Apprentice
Apprentice


Joined: 22 May 2012
Posts: 197
Location: South Carolina

PostPosted: Mon Oct 21, 2013 3:34 pm    Post subject: Solved: Stuck in grub2 Reply with quote

Long absence here (health issues but not relevant).

I am trying to get back on track with a new install on a new hard drive, since the old one died. Went through some issues I had not seen before that I will address in a separate forum. Right now, after installing grub2 and doing the mkconfig thing and rebooting, I am now stuck at the grub prompt and do not seem to be able to make it boot into the OS. I use the tab function that pulls up the commands and then options and other stuff. Wish I could be more specific but I am not in front of my machine. I am sending this from work but will break for lunch shortly to check the forum at home. Most of the results I get are "invalid file name".

Can we go from there?

Thanks,
Mark
_________________
"Flying is learning how to throw yourself at the ground and miss." - Douglas Adams


Last edited by mark2 on Mon Nov 25, 2013 6:48 am; edited 3 times in total
Back to top
View user's profile Send private message
eyoung100
Veteran
Veteran


Joined: 23 Jan 2004
Posts: 1411

PostPosted: Mon Oct 21, 2013 4:09 pm    Post subject: Reply with quote

The easiest way to fix this is to:
Code:
emerge -C sys-boot/grub:2
emerge sys-boot/grub or sys-boot/grub-static


depending on your arch. Get all the file paths etc straight in Grub-1, and once you get it booting in grub 1, emerge grub-2
_________________
The Birth and Growth of Science is the Death and Atrophy of Art -- Unknown
Registerd Linux User #363735
Adopt a Post | Strip Comments| Emerge Wrapper
Back to top
View user's profile Send private message
mark2
Apprentice
Apprentice


Joined: 22 May 2012
Posts: 197
Location: South Carolina

PostPosted: Mon Oct 21, 2013 4:18 pm    Post subject: Reply with quote

Thanks, eyoung100,

But my problem is that I cannot get to a prompt of any kind other than grub>. I will try, however, emerge if it will run from the grub> prompt.
_________________
"Flying is learning how to throw yourself at the ground and miss." - Douglas Adams
Back to top
View user's profile Send private message
eyoung100
Veteran
Veteran


Joined: 23 Jan 2004
Posts: 1411

PostPosted: Mon Oct 21, 2013 4:33 pm    Post subject: Reply with quote

Use a LiveCD, mount your root and boot partition, go into the chroot, use emerge etc etc....
_________________
The Birth and Growth of Science is the Death and Atrophy of Art -- Unknown
Registerd Linux User #363735
Adopt a Post | Strip Comments| Emerge Wrapper
Back to top
View user's profile Send private message
Logicien
l33t
l33t


Joined: 16 Sep 2005
Posts: 856
Location: Montréal

PostPosted: Mon Oct 21, 2013 4:39 pm    Post subject: Reply with quote

In /etc/default/grub try to disable the theme and the background image and reexecute
Code:
grub2-mkconfig -o /boot/grub/grub.cfg

If a problem occur with the theme and the background image that can prevent Grub from working properly. Note that the e key is for editing an entry and Control+x is to boot the entry in edit mode after you modify it or not.
_________________
Paul
Back to top
View user's profile Send private message
mark2
Apprentice
Apprentice


Joined: 22 May 2012
Posts: 197
Location: South Carolina

PostPosted: Mon Oct 21, 2013 10:19 pm    Post subject: Reply with quote

@eyoung100:

Ok. I booted into the live cd, but I don't understand how to mount root and boot. I don't have a good grasp of linux commands. When I try it (using the handbook as a guide), it tells me those mount points don't exist. Which I figure is because I am basically in the install procedure of the live cd and don't understand how to chroot without going through the install process, which should be unnecessary.

@Logicien:

grub2-mkconfig command doesn't work because I am not in the installed prompt. It did work before I rebooted and got stuck in the grub> prompt.

Thanks for your patience. I wish I remembered more of what I went through before, but these commands and the help are just not very clear to me and I just get very frustrated.
_________________
"Flying is learning how to throw yourself at the ground and miss." - Douglas Adams
Back to top
View user's profile Send private message
eyoung100
Veteran
Veteran


Joined: 23 Jan 2004
Posts: 1411

PostPosted: Mon Oct 21, 2013 10:37 pm    Post subject: Reply with quote

Boot from the Gentoo Minimal Install CD:
Code:
# dmesg | grep sd <--Post output
parted /dev/sd(choose letter from previous result)
cd /mnt/gentoo
mount -v /dev/sd(previous result) /mnt/gentoo <--- This is your root or /
mount -v /dev/sd(previous result) /mnt/gentoo/boot <--- This is /boot
swapon /dev/sd(previous result)
mount -t proc none /mnt/gentoo/proc
mount --rbind /sys /mnt/gentoo/sys
mount --rbind /dev /mnt/gentoo/dev
chroot /mnt/gentoo /bin/bash
source /etc/profile
export PS1="(chroot) $PS1" <--- You are now in the chroot


Mounting this way allows your system to "boot" into repair mode
Now at the prompt type grub2, should give you grub>
_________________
The Birth and Growth of Science is the Death and Atrophy of Art -- Unknown
Registerd Linux User #363735
Adopt a Post | Strip Comments| Emerge Wrapper
Back to top
View user's profile Send private message
Logicien
l33t
l33t


Joined: 16 Sep 2005
Posts: 856
Location: Montréal

PostPosted: Mon Oct 21, 2013 10:41 pm    Post subject: Reply with quote

First you must login as root or use the sudo command from the livecd. Than you must create the mount points for your root and boot (if you have one) partitions
Code:
mkdir /mnt/gentoo /mnt/gentoo/boot

Than you must mount the root and boot partitions in those mount points using the good filesystem ( ext4, reiserfs, etc) and device file (/dev/sda1, etc) for each. The
Code:
blkid

command should give you the informations that the mount command need. Here is an example when the root and boot partitions are formated in Ext4 filesystem in /dev/sda1 and sda2 partitions respectively
Code:
mount -t ext4 /dev/sda1 /mnt/gentoo
mount -t ext4 /dev/sda2 /mnt/gentoo/boot

The commands do not specify any mount options, so the defaults one are use, what's imply read/write. After that, you must bind some virtual filesystems of the host to your /mnt/gentoo directory to be able to use them in chroot
Code:
mount -o bind /dev /mnt/gentoo/dev
mount -o bind /proc /mnt/gentoo/proc
mount -o bind /sys /mnt/gentoo/sys

Now you can pass in chroot
Code:
HOME=/root SHELL=/bin/bash USER=root chroot /mnt/gentoo

Now in chroot you can execute the commands you want from Gentoo like emerge and grub2-mkconfig.
_________________
Paul
Back to top
View user's profile Send private message
mark2
Apprentice
Apprentice


Joined: 22 May 2012
Posts: 197
Location: South Carolina

PostPosted: Wed Oct 23, 2013 7:02 pm    Post subject: Reply with quote

Thanks to you both. I have tried both ways and first:
@eyoung100
Code:
dmesg | grep sda
sd 3:0:0:0: [sda] 488281250 512-byte logical blocks: (250 GB/232 GiB)
sd 3:0:0:0: [sda] Write Protect is off
sd 3:0:0:0: [sda] Mode Sense: 00 3a 00 00
sd 3:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
   sda: sda1 sda2 sda3
sd 3:0:0:0: [sda] Attached SCSI disk


Unfortunately, after going into chroot, grub2 does not give me grub>.
Code:
bash: grub2: command not found


I have emerged grub:2 according to the Grub2 Quick Start wiki and modified /etc/portage/make.conf to include:
Code:
# Standard PC (BIOS)
GRUB_PLATFORMS="pc"


I then ran
Code:
emerge --ask sys-boot/grub:2


And after a few miles of scrolling code, I would reboot and still come up to the grub> prompt. When I type boot, it tells me to load the kernel first. And typing boot then tab, it tells me Possible commands are: load_env loadfont. Then load_env, tab gives me nothing to go on. This is not only not intuitive, but also extremely non-productive. I did not have nearly this much difficulty installing gentoo before.

@Lucien:
Your instructions also worked, but the end result was pretty much the same. Though I could run emerge and grub-mkconfig, it did not help.

I am still stuck. :cry:

My system is an Athlon64, dual core processor and I did the correct tarball install. Looks like I will have to go back to an earlier grub.

But thanks again for your suggestions.
_________________
"Flying is learning how to throw yourself at the ground and miss." - Douglas Adams
Back to top
View user's profile Send private message
eyoung100
Veteran
Veteran


Joined: 23 Jan 2004
Posts: 1411

PostPosted: Wed Oct 23, 2013 7:13 pm    Post subject: Reply with quote

Go back into chroot:
Code:
emerge -C sys-boot/grub:2 && emerge sys-boot/grub-static


Follow Section 10.b of the Gentoo Handbook, then follow this Wiki:
Gentoo Wiki: GRUB2
_________________
The Birth and Growth of Science is the Death and Atrophy of Art -- Unknown
Registerd Linux User #363735
Adopt a Post | Strip Comments| Emerge Wrapper
Back to top
View user's profile Send private message
mark2
Apprentice
Apprentice


Joined: 22 May 2012
Posts: 197
Location: South Carolina

PostPosted: Thu Oct 24, 2013 11:55 am    Post subject: Reply with quote

Code:
emerge -C sys-boot/grub:2 && emerge sys-boot/grub-static

Failed: unable to resolve host address -- http://distfiles.gentoo.org/ etc.... also with all the other addresses. Maybe because I am in chroot?
_________________
"Flying is learning how to throw yourself at the ground and miss." - Douglas Adams
Back to top
View user's profile Send private message
Logicien
l33t
l33t


Joined: 16 Sep 2005
Posts: 856
Location: Montréal

PostPosted: Thu Oct 24, 2013 3:17 pm    Post subject: Reply with quote

It's because you are not connected to the Internet. The Url to download the needed packages by emerge cannot be resolv from domain name to IP address. First you have to connect to the Internet with the host going out the chroot. When Internet work with the host
Code:
cp /etc/resolv.conf /mnt/gentoo/etc/resolv.conf

and go back to chroot to execute the emerge command.
_________________
Paul
Back to top
View user's profile Send private message
eyoung100
Veteran
Veteran


Joined: 23 Jan 2004
Posts: 1411

PostPosted: Thu Oct 24, 2013 8:32 pm    Post subject: Reply with quote

Logicien wrote:
It's because you are not connected to the Internet. The Url to download the needed packages by emerge cannot be resolv from domain name to IP address. First you have to connect to the Internet with the host going out the chroot. When Internet work with the host
Code:
cp /etc/resolv.conf /mnt/gentoo/etc/resolv.conf

and go back to chroot to execute the emerge command.


See Sections 3.b and 6.a of the Handbook.
_________________
The Birth and Growth of Science is the Death and Atrophy of Art -- Unknown
Registerd Linux User #363735
Adopt a Post | Strip Comments| Emerge Wrapper
Back to top
View user's profile Send private message
mark2
Apprentice
Apprentice


Joined: 22 May 2012
Posts: 197
Location: South Carolina

PostPosted: Mon Oct 28, 2013 5:47 pm    Post subject: Reply with quote

Yes, gentlemen, that did work. I am now in at my root prompt. I can now through the steps (in other threads) to restoring my gui, etc... .

I do have one question, though: is there any advange in installing grub2? And if I do it, will it mess things up again or will it allow me to continue as I am?

Thanks again for helping me to remember. :)

Mark
_________________
"Flying is learning how to throw yourself at the ground and miss." - Douglas Adams
Back to top
View user's profile Send private message
Logicien
l33t
l33t


Joined: 16 Sep 2005
Posts: 856
Location: Montréal

PostPosted: Tue Oct 29, 2013 2:12 am    Post subject: Reply with quote

Emerge Grub is one thing, install it is an other thing, make a configuration file for it is an other thing too.

One advantage of Grub2 is that it is up to date and it will stay longer than Grub1. Grub2 in EFI boot mode can be harder to understand how to use than the PC boot mode version. After emerging Grub2, you will be able to continue as it was before in chroot.

Reading the handbook for Grub 1 or 2 will help you more.
_________________
Paul
Back to top
View user's profile Send private message
mark2
Apprentice
Apprentice


Joined: 22 May 2012
Posts: 197
Location: South Carolina

PostPosted: Tue Oct 29, 2013 3:50 pm    Post subject: Reply with quote

Thank you, Logicien. I was just going to create the grub.conf file, as I have done before. But one thing that I noticed was that when I rebooted, I got a splash screen to choose what I wanted to boot. That must have come from the grub.cfg file even though I had removed grub2 and have yet not created grub.conf? And the grub.cfg looks like script and not a text file. Will continue at very next opportunity. :)
_________________
"Flying is learning how to throw yourself at the ground and miss." - Douglas Adams
Back to top
View user's profile Send private message
eyoung100
Veteran
Veteran


Joined: 23 Jan 2004
Posts: 1411

PostPosted: Tue Oct 29, 2013 3:56 pm    Post subject: Reply with quote

Can you post your grub.conf file etc so we know which version of grub actually booted :?:
_________________
The Birth and Growth of Science is the Death and Atrophy of Art -- Unknown
Registerd Linux User #363735
Adopt a Post | Strip Comments| Emerge Wrapper
Back to top
View user's profile Send private message
mark2
Apprentice
Apprentice


Joined: 22 May 2012
Posts: 197
Location: South Carolina

PostPosted: Tue Oct 29, 2013 6:37 pm    Post subject: Reply with quote

Well, see, that's the thing. I have not yet created the grub.conf file as referenced in Section 10.b of the Gentoo Handbook; it does not yet exist. Am I looking in the wrong place (/boot/grub/grub.conf)? That's why I'm curious as to how I got the splash screen allowing me to choose. Although, I do think it is the 0.97 version since I could not boot with the grub2.
_________________
"Flying is learning how to throw yourself at the ground and miss." - Douglas Adams
Back to top
View user's profile Send private message
eyoung100
Veteran
Veteran


Joined: 23 Jan 2004
Posts: 1411

PostPosted: Tue Oct 29, 2013 8:57 pm    Post subject: Reply with quote

Read the version info at the top

First line, Top Center: Grub - <version> - <Memory used> / <Memory Free>
_________________
The Birth and Growth of Science is the Death and Atrophy of Art -- Unknown
Registerd Linux User #363735
Adopt a Post | Strip Comments| Emerge Wrapper
Back to top
View user's profile Send private message
mark2
Apprentice
Apprentice


Joined: 22 May 2012
Posts: 197
Location: South Carolina

PostPosted: Tue Oct 29, 2013 11:10 pm    Post subject: Reply with quote

The wildest thing just happened. My grandchildren got to it after I had started creating grub.conf, but did not get finished. Just found it at a login prompt. Logged in as root and ran startx. Lo and behold, I now have the three windows plus xclock. Grub shows version 0.97 (640K lower / 9126K upper memory). :lol:
_________________
"Flying is learning how to throw yourself at the ground and miss." - Douglas Adams
Back to top
View user's profile Send private message
mark2
Apprentice
Apprentice


Joined: 22 May 2012
Posts: 197
Location: South Carolina

PostPosted: Wed Oct 30, 2013 4:35 am    Post subject: Reply with quote

Rats! Was going good, I thought, until I started trying to get video drivers installed (which it did), then emerging xorg-server, after which something didn't go right. I rebooted and now I can't mount my file system due to a kernel panic. Also, it seems that the upper memory is much higher than it showed in an xterm window running grub. The version is still 0.97. Guess I have to research how to get past this kernel panic. :cry:
_________________
"Flying is learning how to throw yourself at the ground and miss." - Douglas Adams
Back to top
View user's profile Send private message
eyoung100
Veteran
Veteran


Joined: 23 Jan 2004
Posts: 1411

PostPosted: Wed Oct 30, 2013 1:43 pm    Post subject: Reply with quote

Code:
cat /etc/fstab

_________________
The Birth and Growth of Science is the Death and Atrophy of Art -- Unknown
Registerd Linux User #363735
Adopt a Post | Strip Comments| Emerge Wrapper
Back to top
View user's profile Send private message
mark2
Apprentice
Apprentice


Joined: 22 May 2012
Posts: 197
Location: South Carolina

PostPosted: Thu Oct 31, 2013 3:29 pm    Post subject: Reply with quote

Code:
cat /etc/fstab

I had to go in with the livecd and chroot again, but there is no fstab. Nano pulled up a blank. But I did finally learn how to load the kernel in grub2 by using the "linux" command. The next problem was in telling it to boot. No matter if I used root=/dev/sda3, or root=(hd0,msdos1), or the UUID, it could not find the partition and boot. I'm wondering if I needed to put double quotes around the UUID and see if that helps. I will try that in a little while on my lunch break.

Edit: oh yes, and I did emerge grub2 again.
_________________
"Flying is learning how to throw yourself at the ground and miss." - Douglas Adams
Back to top
View user's profile Send private message
eyoung100
Veteran
Veteran


Joined: 23 Jan 2004
Posts: 1411

PostPosted: Thu Oct 31, 2013 4:05 pm    Post subject: Reply with quote

If you have no /mnt/gentoo/etc/fstab you need to create one
_________________
The Birth and Growth of Science is the Death and Atrophy of Art -- Unknown
Registerd Linux User #363735
Adopt a Post | Strip Comments| Emerge Wrapper
Back to top
View user's profile Send private message
mark2
Apprentice
Apprentice


Joined: 22 May 2012
Posts: 197
Location: South Carolina

PostPosted: Sun Nov 03, 2013 1:46 pm    Post subject: Reply with quote

My /mnt/gentoo/etc/fstab is:
Code:
# /etc/fstab: static file system information.
#
# noatime turns off atimes for increased performance (atimes normally aren't
# needed); notail increases performance of ReiserFS (at the expense of storage
# efficiency). It's safe to drop the noatime options if you want and to
# switch between notail / tail freely.
#
# The root filesystem should have a pass number of either 0 or 1.
# All other filesystems should have a pass number of 0 or greater than 1.
#
# See the manpage fstab(5) for more information.
#
 
# <fs> <mountpoint> <type> <opts> <dump/pass>
 
# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.
/dev/sda1 /boot ext3 noauto,noatime 1 2
/dev/sda3 / ext4 noatime 0 1
/dev/sda2 none swap sw 0 0
/dev/cdrom /mnt/cdrom auto noauto,user 0 0
# /dev/fd0 /mnt/floppy auto noauto 0 0


Sorry for the delay in posting, had family matters got in the way. :)

Edit: I found this way out of my dilemma at https://fedoraproject.org/wiki/GRUB_2?rd=Grub2#Encountering_the_dreaded_Grub2_boot_prompt. And beginning at the section Encountering the dreaded Grub2 boot prompt, after determining my partitions as they are seen by grub2, I began:
Step 1: Declare the root partition:
Code:
grub> set root=(hd0,3)

Step 2: Declare your kernel, and this is where I had trouble figuring out how to use the commands in Grub2:
Code:
grub> linux (hd0,1)/kernel-genkernel-x86_64-3..10.7-gentoo-r1 root=/dev/sda3
# NOTE : add other kernel args if you have need of them
# NOTE : change the numbers to match your system

Step 3: Declare your initrd:
Code:
grub> initrd (hd0,1)/initramfs-genkernel-x86_64-3.10.7-gentoo-r1
# NOTE : change the numbers to match your system

Step 4: Finally, boot your system with the chosen files:
Code:
grub> boot

Then it says to open a terminal window, but in my case, I came up with 3 terminal windows and my Hwclock. And so, when I get back to it I will follow the next step, which is:
Step 5: Issue the grub2-mkconfig command to re-create the grub.cfg file grub2 needed to boot your system:
Code:
grub2-mkconfig -o /boot/grub/grub.cfg

Now this part I am not completely sure about, but since I have gotten this far, I will also do this:
Issue the grub2-install command to install grub2 to your hard drive and make use of your config:
Code:
grub2-install --boot-directory=/boot /dev/sda

Even though I had already done the grub-install, I had not specified the part with: --boot-directory=/boot /dev/sda. And so, if all goes well tonight, I will post back and mark this thread Solved! And then, I can go back through some other topics to see about fixing my gui.

Thanks guys, for all the help. This is one fantastic forum. 8)
_________________
"Flying is learning how to throw yourself at the ground and miss." - Douglas Adams


Last edited by mark2 on Mon Dec 09, 2013 3:46 am; edited 1 time in total
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Goto page 1, 2, 3, 4, 5  Next
Page 1 of 5

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum