LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (https://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   repair Debian bootloader & GRUB (https://www.linuxquestions.org/questions/linux-from-scratch-13/repair-debian-bootloader-and-grub-4175425179/)

Garrett85 09-01-2012 04:13 PM

repair Debian bootloader & GRUB
 
I'M trying to work my way through the linux from scratch project and I'M on page http://www.linuxfromscratch.org/lfs/...er08/grub.html I've really messed up my boot up process. I did make a boot disk as descriped in the above link.The computer originally had Debian (CLI only) has the host system from which I was building my Linux from scratch system. Now when I turn on the computer it has one OS in the list that's labeled "GRUB Linux...........", when I click enter the screen goes black and says "Press any key to continue", then goes back to the boot loader with "GRUB Linux...........". If I boot the system with the book disk it's just a prompt that says GRUB. Can anyone tell me how to repair my Debian bootloader from my current state? Thanks.

spiky0011 09-01-2012 04:36 PM

Hi

A good place to start, load a live cd, then post the output of
Code:

sudo fdisk -l
and
Code:

sudo blkid
Also the /boot/grub/grub.cfg from host and grub.cfg fom lfs.
I,m not saying I can help but it will be good info to get help from others.
Think that should be enough for now.

stoat 09-01-2012 04:58 PM

One thing you can try right now is to manually boot the Debian system from that boot disk's grub> prompt. Debian has been using GRUB 2 for a long time, so I guess your Debian system has a core.img file. You might be able to manually boot it like this rough example (that will need considerable customizing by you)...
Code:

grub> linux (hdx,y)/boot/grub/core.img
grub> boot

First, you need to change x & y to the drive & partition with the Debian boot files. Use GRUB 2 enumeration for those since the boot disk is GRUB 2.

Next, if your Debian system has a separate boot partition, then omit the "/boot" part of the path in the linux command.

Next, the core.img file may be in a folder named differently. Generically, it usually has been in /boot/grub. But in Fedora as an example, it is now in /boot/grub2/i386-pc. It may be something else again in Debian (I don't use Debian at the moment). Change that part of the path when you know where it is in the Debian system.

When that linux command line is adjusted perfectly, enter the boot command and see if it boots Debian. If it does, then repair the Debian GRUB boot loader with the usual grub-install command in the running Debian system.

If all that worked, it should at least put you back to where you were before. Then continue on with what you want to do next.


P.S.: Just FYI, the Super Grub 2 Disk is a free and popular utility for emergency booting a Linux system with a busted GRUB 2 boot loader. It won't repair the boot loader like the old legacy Super Grub Disk did. But that doesn't really matter much if it boots the system. The boot loader is easy to repair after the system is running..
.
.

Garrett85 09-01-2012 10:29 PM

Quote:

Originally Posted by spiky0011 (Post 4770195)
Hi

A good place to start, load a live cd, then post the output of
Code:

sudo fdisk -l
and
Code:

sudo blkid
Also the /boot/grub/grub.cfg from host and grub.cfg fom lfs.
I,m not saying I can help but it will be good info to get help from others.
Think that should be enough for now.

Disk /dev/sda: 250.1 GB, 2500059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sectors size (logical/physical): 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifiers: 0x00006aec

sudo fdisk -l
Device Boot Start End Blocks Id System
/sda1 1 26747 214842368 83 Linux
/sda2 26747 26869 976896 82 Linux swap / Solaris
/sda3 * 26869 30402 28378112 83 Linux


sudo blkid
/dev/sda1: UUID="5cde3219-5770-42b9-9daf-b310870dfcdb" SEC_TYPE="ext2" TYPE="ext3"
/dev/sda2: UUID="3480e36d-9636-4acl-8461-ea1756499Ob4" TYPE="swap"
/dev/sda3: UUID="e4Ob23cl-4127-4575-9902-5ff6f2e5ac32" TYPE="ext4"

There is no /grub/grub.cfg on my debian system, I found a few other grub files I'll try and get on here later, I can't copy and past because it's two different machiens. Thanks.

Garrett85 09-01-2012 10:50 PM

grub.cfg
 
Quote:

Originally Posted by spiky0011 (Post 4770195)
Hi

A good place to start, load a live cd, then post the output of
Code:

sudo fdisk -l
and
Code:

sudo blkid
Also the /boot/grub/grub.cfg from host and grub.cfg fom lfs.
I,m not saying I can help but it will be good info to get help from others.
Think that should be enough for now.

# Begin /boot/grub/grub.cfg
set default=0
set timeout=5

insmod ext2
set root=(hd0,2)

menuentry "GNU/Linux, Linux 3.2.6-lfs-71"
{
linux /boot/vmlinuz-3.2.6-lfs-7.1 root=/dev/sda1 ro
}

spiky0011 09-02-2012 02:17 AM

Hi

So there is only 1 os system on this pc? "lfs"
Try changing
Quote:

set root=(hd0,2)
to
Quote:

set root=(hd0,1)

Garrett85 09-02-2012 01:59 PM

Quote:

Originally Posted by spiky0011 (Post 4770449)
Hi

So there is only 1 os system on this pc? "lfs"
Try changing to

No, there are two, a Debian and the LFS system. LFS is on sda1 and I think Debian is on sda3. I was trying to repair the Debian boot system or at leat configure the LFS boot system from a live CD. The live CD was working fine yesterday but now the screen just goes black and the moniture shows no activity after selectin "LIVE" from the debian Live CD. Any thoughts? Could you please explain the syntax of (hd0,2)?

spiky0011 09-02-2012 02:23 PM

Did you just copy the commands in the book I see you used scripts to build.
hd0 is the numbering of the harddrive ,2 the two is the partitions on the drive,
Hope that clears that bit.
So where did you build lfs? sda2 is swap.
I dont use Debain but google says /boot/grub/grub.cfg
I take it you boot and get a screen similar.
I dont know why the live cd wont boot nothing should stop that.

EDDY1 09-03-2012 03:24 AM

Lfs requirements state that you must have a running system along with build tools to install LFS to another partition,so I find it hard to believe that LFS is on sda1 unless you partitioned the drive to have the 3 partitions then installed debian to sda3.
I would say that debian is on sda1. & you'll need to reinstall grub.

Garrett85 09-03-2012 12:45 PM

Quote:

Originally Posted by EDDY1 (Post 4771203)
Lfs requirements state that you must have a running system along with build tools to install LFS to another partition,so I find it hard to believe that LFS is on sda1 unless you partitioned the drive to have the 3 partitions then installed debian to sda3.
I would say that debian is on sda1. & you'll need to reinstall grub.

Your first guess is right, I have Debian installed on sda3. The LFS partitoin is on sda1.

Garrett85 09-03-2012 12:56 PM

root:/boot/grub# cat grub.cfg
# Begin /boot/grub/grub.cfg
set default=0
set timeout=5
set pager=1

insmod ext2
set root=(hd0,1)

menuentry "GNU/Linux, Linux 3.2.6-lfs-7.1" {
linux /boot/vmlinuz-3.2.6-lfs-7.1 root=/dev/sda1 ro
}
root:/boot/grub#

spiky0011 09-03-2012 01:00 PM

I take it thats the grub.cfg on lfs

Garrett85 09-03-2012 01:17 PM

Quote:

Originally Posted by spiky0011 (Post 4771625)
I take it thats the grub.cfg on lfs

Yes. I am able to boot the computer now using a boot disk that one of you guys on here suggested. I've also think I've fixed the LFS GRUB anyway but it still will not boot that I don't think it's a grub problem anymore. I've been told I have a Kernel driver problem. Does anyone know where I can find some sort of log created when installed and or configureing the kernel?

spiky0011 09-03-2012 01:31 PM

Just a little note when you post if you can show the errors or any relevent msgs you are getting it will help.

What errors are you getting. when you boot from grub.
The config log from the kernel is in /boot config-3.2

Garrett85 09-03-2012 01:33 PM

Quote:

Originally Posted by spiky0011 (Post 4771648)
Just a little note when you post if you can show the errors or any relevent msgs you are getting it will help.

What errors are you getting. when you boot from grub.
The config log from the kernel is in /boot config-3.2

2.033750] VFS : Unable to mount root fs via NFS, trying floppy
2.034037] VFS : Cannot open root device "sda2" or unknown-black(2,0)
2.034109] Please append a correct "root=" boot option ; here are the available partitions:
2.034209] Kernel panic - not syncing: VFS : Unable to mount root fs on unknown -block(2,0)

spiky0011 09-03-2012 01:48 PM

Can you post /etc/fstab

Garrett85 09-03-2012 02:34 PM

fstab
 
Quote:

Originally Posted by spiky0011 (Post 4771663)
Can you post /etc/fstab


This is from the LFS chroot
# Begin /etc/fstab

# file system mount-point type options dump fsck
# order

/dev/sda1 / ext3 defaults 1 1
/dev/sda2 swap swap pri=1 0 0
proc /proc proc nosuid,noexec,nodev 0 0
sysfs /sys sysfs nosuid,noexec,nodev 0 0
devpts /dev/pts devpts gid=4,mod=620 0 0
tmpfs /run tmpfs defaults 0 0
devtmpfs /dev devtmpfs mode=0755,nosuid 0 0

# End /etc/fstab


This is from the Debian Host system

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
# / was on /dev/sda3 during installation
UUID=e40b23c1-4127-4575-9902-5ff6f2e5ac32 / ext4 errors=remount
-ro 0 1
# swap was on /dev/sda2 during installation
UUID=3480e36d-9636-4ac1-8461-ea17564990b4 none swap sw
0 0
/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto 0 0

spiky0011 09-03-2012 02:44 PM

All ok there.
Do you have all the correct settings in the kernel file systems devices etc.

Garrett85 09-03-2012 03:34 PM

Quote:

Originally Posted by spiky0011 (Post 4771704)
All ok there.
Do you have all the correct settings in the kernel file systems devices etc.

Say what?

Someone told me I had a kernel driver problem.

EDDY1 09-03-2012 03:46 PM

http://karuppuswamy.com/wordpress/20...rescue-prompt/

spiky0011 09-03-2012 03:48 PM

So have you checked that and made sure it not set as a module. I would also set filesystem ext2 to [y] not [m] and check ext3 and maybe ext4

Maybe pastebin your kernel config file

Garrett85 09-03-2012 05:11 PM

1 Attachment(s)
Quote:

Originally Posted by spiky0011 (Post 4771746)
So have you checked that and made sure it not set as a module. I would also set filesystem ext2 to [y] not [m] and check ext3 and maybe ext4

Maybe pastebin your kernel config file

I've attached my .config file

spiky0011 09-03-2012 05:14 PM

Put it up on pastebin.com It,s not always good opening files.

Garrett85 09-03-2012 06:18 PM

.config.cfg pastebin
 
Quote:

Originally Posted by spiky0011 (Post 4771789)
Put it up on pastebin.com It,s not always good opening files.

http://pastebin.com/hZeq90zJ


All times are GMT -5. The time now is 10:16 AM.