Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Grub issue (Error2) with pre-compiled Gentoo build
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
LJS
n00b
n00b


Joined: 09 Jan 2017
Posts: 6

PostPosted: Tue Jan 10, 2017 2:25 pm    Post subject: Grub issue (Error2) with pre-compiled Gentoo build Reply with quote

Hi there,

I’m hoping for a bit of help with a grub issue I'm having. Hopefully the following explanation makes sense:

I have a pre-compiled Gentoo build (kernel 2.6.31) that I'm trying to install on a small factor Intel D54250WYKH; I'm using a copy of https://www.system-rescue-cd.org/Download to do this.

My drives have been set up as follows...

Code:
Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xf29d4922

Device     Boot   Start       End   Sectors   Size Id Type
/dev/sda1          2048   1050623   1048576   512M 83 Linux
/dev/sda2       1050624   4122623   3072000   1.5G 83 Linux
/dev/sda3       4122624   6219775   2097152     1G 82 Linux swap / Solaris
/dev/sda4       6219776 976773167 970553392 462.8G 83 Linux


...and I've mounted them as such:

/dev/sda1 /tmp/boot/
/dev/sda2 /tmp/root
/dev/sda4 /tmp/hd/

( /dev/sda3 is my swap partition)


I've copied and untarred to these directories the relevant directories and files. Inside of /tmp/boot/ lives the following...

Code:
root@sysresccd /tmp/boot % ls -al
total 36372
drwxr-xr-x 5 root root     4096 Sep 22  2009 .
drwxrwxrwt 5 root root      120 Jan 10 10:22 ..
-rw-r--r-- 1 root root    62704 Oct 10  2007 config-2.6.22
-rw-r--r-- 1 root root    87476 Dec 12  2009 config-2.6.31
-rw-r--r-- 1 root root 13135948 Feb  5  2010 emd-initramfs.img
drwxr-xr-x 2 root root     4096 Sep 22  2009 grub
-rw-r--r-- 1 root root 13135948 Feb  5  2010 initrd.img
-rw-r--r-- 1 root root  2126224 Oct 10  2007 kernel-genkernel-x86-2.6.22-gentoo-r8
-rw-r--r-- 1 root root  2484944 Dec 12  2009 kernel-genkernel-x86-2.6.31-gentoo-r6
drwxr-xr-x 2 root root    16384 Sep 22  2009 lost+found
drwxr-xr-x 2 root root     4096 Sep 22  2009 memtest86
-rw-r--r-- 1 root root     5168 Aug  3  2006 splash.xpm.gz
-rw-r--r-- 1 root root  1286356 Dec 12  2009 System.map
-rw-r--r-- 1 root root  1013832 Oct 10  2007 System.map-genkernel-x86-2.6.22-gentoo-r8
-rw-r--r-- 1 root root  1286356 Dec 12  2009 System.map-genkernel-x86-2.6.31-gentoo-r6
-rw-r--r-- 1 root root  2484944 Dec 12  2009 vmlinuz


...and inside of /tmp/boot/grub/ I have the various conf and stage files...

Code:
root@sysresccd /tmp/boot/grub % ls -al
total 360
drwxr-xr-x 2 root root   4096 Sep 22  2009 .
drwxr-xr-x 5 root root   4096 Sep 22  2009 ..
-rw-r--r-- 1 root root   7584 Oct 10  2007 e2fs_stage1_5
-rw-r--r-- 1 root root   7424 Oct 10  2007 fat_stage1_5
-rw-r--r-- 1 root root   6720 Oct 10  2007 ffs_stage1_5
-rw-r--r-- 1 root root    292 Feb 11  2010 grub.conf
-rw-r--r-- 1 root root   6720 Oct 10  2007 iso9660_stage1_5
-rw-r--r-- 1 root root   8160 Oct 10  2007 jfs_stage1_5
-rw-r--r-- 1 root root    299 Feb  5  2010 menu.lst
-rw-r--r-- 1 root root   6880 Oct 10  2007 minix_stage1_5
-rw-r--r-- 1 root root   9248 Oct 10  2007 reiserfs_stage1_5
-rw-r--r-- 1 root root  33856 Aug  4  2006 splash.xpm.gz
-rw-r--r-- 1 root root    512 Oct 10  2007 stage1
-rw-r--r-- 1 root root 104828 Oct 10  2007 stage2
-rw-r--r-- 1 root root 104828 Oct 10  2007 stage2_eltorito
-rw-r--r-- 1 root root   7040 Oct 10  2007 ufs2_stage1_5
-rw-r--r-- 1 root root   6272 Oct 10  2007 vstafs_stage1_5
-rw-r--r-- 1 root root   8904 Oct 10  2007 xfs_stage1_5


The menu.lst file contains:

Code:
# Sample boot menu configuration file
#

# Boot automatically after 30 secs.
timeout 5

# By default, boot the first entry.
default 0

splashimage=(hd0,0)/splash.xpm.gz

# For booting GNU/Linux
title EMD GNU/Linux
root (hd0,0)
kernel /vmlinuz root=/dev/ram0 singledrive hd=sda
initrd /initrd.img



When I reboot the system I encounter an Error 2 message - this is happening at stage 1.5. Having looked into the issue online I've not managed to fix the problem, although I may be overlooking something painfully obvious.

If anybody can offer some help or suggestions I'd be really grateful.

code tags added for easy reading -- NeddySeagoon
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43213
Location: 56N 3W

PostPosted: Tue Jan 10, 2017 3:10 pm    Post subject: Reply with quote

LJS,

Welcome to Gentoo.

Code:
GRUB - Error 2: Bad File or Directory Type
means that grub does not understand something.

At one time grub has problems loading the splash image. Step one is therefore to comment out the
Code:
splashimage=(hd0,0)/splash.xpm.gz

Its not as pretty but it might help. Put it back later if you like.

Code:
kernel /vmlinuz root=/dev/ram0 singledrive hd=sda
initrd /initrd.img
does all the hard work.

Grub will load vmlinuz and initrd.img then jump to the kernel start and pass it
Code:
 root=/dev/ram0 singledrive hd=sda
.
Code:
root=/dev/ram0
tells it to mount the initrd.img as its root file system.
What happens after that depends on what the init script in the initrd does.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
LJS
n00b
n00b


Joined: 09 Jan 2017
Posts: 6

PostPosted: Tue Jan 10, 2017 5:11 pm    Post subject: Reply with quote

Neddy,

Thanks for the helpful reply.

I commented out splashimage=(hd0,0)/splash.xpm.gz as suggested but was presented with the same error.

One thing I didn't mention in my initial post was the final part of my installation process when setting up grub:

Code:
grub > device (hd0) /dev/sda
grub > root (hd0,0)
grub > setup (hd0)


I don't know whether or not it's the above configuration that might be causing the error. I wouldn't imagine so.

Do you have any further suggestions on what I might try next?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43213
Location: 56N 3W

PostPosted: Tue Jan 10, 2017 6:00 pm    Post subject: Reply with quote

LJS,

That extract installs grub to the master boot record. Providing there were no errors when you ran that, you should be good.
That you get Error 2 suggests that grub installed to the MBR and is trying to run.

The info page says
Code:
2 : Bad file or directory type
     This error is returned if a file requested is not a regular file,
     but something like a symbolic link, directory, or FIFO.


With
Code:
# splashimage=(hd0,0)/splash.xpm.gz
commented out, grub is only trying to read two files now ...
/vmlinuz and /initrd.img

You must give grub a kernel file to load. So comment out the
Code:
initrd /initrd.img
It won't work that way but at least the kernel could load and start if the initrd is the problem.
Just now, getting past the Error 2 is an improvement.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
LJS
n00b
n00b


Joined: 09 Jan 2017
Posts: 6

PostPosted: Wed Jan 11, 2017 11:47 am    Post subject: Reply with quote

Neddy,

Good morning. I've followed that last set of instructions but unfortunately have made no gains. After the same error appeared I then commented out all other statements with the exception of initrd /initrd.img to see what might happen, but got the same result. And if I comment out everything inside of menu.lst I continue to see Error 2 on the screen.

Might there be a doload= option I need to add in that trails kernel /vmlinuz root=/dev/ram0 singledrive, or does that not have any effect on how the kernal responds?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43213
Location: 56N 3W

PostPosted: Wed Jan 11, 2017 12:36 pm    Post subject: Reply with quote

LJS,

So far, it appears that grub stage1 loads from the MBR and that loads grub stage1.5 from the sectors following the MBR.
Thats what the
Code:
grub > device (hd0) /dev/sda
grub > root (hd0,0)
grub > setup (hd0)
installed.

Error messages from stage1.5 which loads stage2 from /boot/grub/stage2 are identical, so we can't be sure if the problem is
stage1.5 loading stage2 or stage2 loading the kernel and or/initrd.

Hmm maybe we can. If stage2 loaded, it would show you the grub menu, which would be a single line
Code:
EMD GNU/Linux
from your
Code:
title EMD GNU/Linux


When do you see Error2, before or after the menu is displayed?
If its before, the kernel and initrd are not involved, grub has not got that far yet.

What filesystem type is your /boot?
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
LJS
n00b
n00b


Joined: 09 Jan 2017
Posts: 6

PostPosted: Wed Jan 11, 2017 2:08 pm    Post subject: Reply with quote

Quote:
So far, it appears that grub stage1 loads from the MBR and that loads grub stage1.5 from the sectors following the MBR.
Thats what the
Code:
grub > device (hd0) /dev/sda
grub > root (hd0,0)
grub > setup (hd0)
installed.

Error messages from stage1.5 which loads stage2 from /boot/grub/stage2 are identical, so we can't be sure if the problem is
stage1.5 loading stage2 or stage2 loading the kernel and or/initrd.

Hmm maybe we can. If stage2 loaded, it would show you the grub menu, which would be a single line
Code:
EMD GNU/Linux
from your
Code:
title EMD GNU/Linux


Neddy, that all makes sense.

Quote:
When do you see Error2, before or after the menu is displayed?
If its before, the kernel and initrd are not involved, grub has not got that far yet.


I see Error 2 before the menu is displayed.

Quote:
What filesystem type is your /boot?


/boot and /root are ext2 and /hd is reiserfs.
Back to top
View user's profile Send private message
LJS
n00b
n00b


Joined: 09 Jan 2017
Posts: 6

PostPosted: Wed Jan 11, 2017 3:19 pm    Post subject: Reply with quote

Neddy,

During the last hour I downloaded a copy of this https://sourceforge.net/projects/boot-repair-cd/ and ran it hoping to get a report of what might be causing the issue. The report is here https://paste.ubuntu.com/23781766/ and I note the following between lines 202 and 255:

Quote:
Warning: Unable to open /dev/sr0 read-write (Read-only file system). /dev/sr0
has been opened read-only.


Error: /dev/sr0: unrecognised disk label



Error: /dev/zram0: unrecognised disk label



Error: /dev/zram1: unrecognised disk label



Error: /dev/zram2: unrecognised disk label



Error: /dev/zram3: unrecognised disk label

=================== parted -lm:

BYT;
/dev/sda:500GB:scsi:512:512:msdos:ATA Samsung SSD 850;
1:1049kB:538MB:537MB:ext2::;
2:538MB:2111MB:1573MB:ext2::;
3:2111MB:3185MB:1074MB:linux-swap(v1)::;
4:3185MB:500GB:497GB:reiserfs::boot;



Warning: Unable to open /dev/sr0 read-write (Read-only file system). /dev/sr0
has been opened read-only.


Error: /dev/sr0: unrecognised disk label



Error: /dev/zram0: unrecognised disk label



Error: /dev/zram1: unrecognised disk label



Error: /dev/zram2: unrecognised disk label



Error: /dev/zram3: unrecognised disk label



Are these errors significant at all?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43213
Location: 56N 3W

PostPosted: Wed Jan 11, 2017 4:54 pm    Post subject: Reply with quote

LJS,

Other than
Code:
/dev/sda:500GB:scsi:512:512:msdos:ATA Samsung SSD 850;
1:1049kB:538MB:537MB:ext2::;
2:538MB:2111MB:1573MB:ext2::;
3:2111MB:3185MB:1074MB:linux-swap(v1)::;
4:3185MB:500GB:497GB:reiserfs::boot;
which is as expected all the other things should be missing anyway.

Your Samsung SSD 850 is wasted here. Also, its being misrepresented. It has a 4kB physical block size, not the 512B shown there.
However, fdisk shows that your partitions are 4kB aligned, All the start blocks are exactly divisible by 8, so no harm done.

Tradition says that you should set the bootable flag on one partition.
Code:
   Device     Boot   Start       End   Sectors   Size Id Type
/dev/sda1          2048   1050623   1048576   512M 83 Linux
Linux doesn't care, grub doesn't care but a lot of BIOS implementations do.
Its harmless to go into fdisk and flip it.
Personally, I don't think its that ... its just a detail to check.

Your setup for installing grub to the MBR was a bit odd.
You said
Code:
dev/sda1 /tmp/boot/
/dev/sda2 /tmp/root


Lets try a more conventional grub install to the MBR.
Boot the RescueCD
Code:
mount /dev/sda2 /mnt/gentoo
mount /dev/sda1 /mnt/gentoo/boot

The rescueCD provides /mnt/gentoo and your root filesystem should provide /mnt/gentoo/boot
Code:
mount -t proc proc /mnt/gentoo/proc
mount -o bind /dev /mnt/gentoo/dev
mount -o bind /sys /mnt/gentoo/sys
The last mail fail if your binary Gentoo is too old to need /sys. Thats OK.

Code:
chroot /mnt/gentoo /bin/bash
from this point you are running your old Gentoo.
There may be some version issues.
Code:
source /etc/profile
env-update
to set up your environment.

Here you have a root shell on your binary distro. If you can get this far.

Repeat the grub install again and post the input and output line for line.

Code:
grub
root (hd0,0)
setup (hd0)
quit

What does grub say?

--------------------------------- edit -------------------------------------------------------------

Your hardware is an up to date Intel NUC if I read the specification correctly.
I only just looked. Your binary Gentoo is far too old to support that hardware.

Further, it will have enough CPU power and RAM to do its own Gentoo install.
Given that hardware platform, there is no point in continuing to get this
old Gentoo to run on it.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
LJS
n00b
n00b


Joined: 09 Jan 2017
Posts: 6

PostPosted: Wed Jan 11, 2017 5:13 pm    Post subject: Reply with quote

Neddy,

Thanks the analysis here. I'll make the suggested changes as soon as I can and report back.

-------------------------------------------------------------------------------------------------------

EDIT: just seen the edit you made yourself. Probably worth me jacking this in I agree. If something miraculous happens I'll be sure to update this thread.

Thanks again for all your help.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
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