LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-17-2005, 02:15 AM   #1
aus9
LQ 5k Club
 
Registered: Oct 2003
Location: Western Australia
Distribution: Icewm
Posts: 5,842

Rep: Reputation: Disabled
GRUB the boot loader trouble-shooter


INTRODUCTION
See my link to know I will give you credit when credit is due
http://www.linuxquestions.org/questi...hreadid=237511

If grub is not in mbr.....no grub appears on screen on bios boot to mbr....so you need to read how to use your install cds to get into rescue mode.
Otherwise, you can use a Knoppix cd.

Briefly that is
load knoppix b4 hard drive by changing bios boot order
click on a terminal (konsole opens)
$ su
$ grub
$ root (hdX,Y) # where x and y will define your /boot partition
$ setup (hdX) # where X is the drive you want bios to see first.

ALL USERS
Note 1 Pressing the TAB key for autocompletion only works if you are defining root or have defined root.
Note 2 Spelling of grub commands can be checked by just pressing TAB at the prompt with nothing else like this.
Note 3 GREEN text is the screen shots.....you either press enter at the end of the line showing grub> ....or press the TAB key to autocomplete.

grub> PRESS TAB
Possible commands are:
altconfigfile blocklist boot cat chainloader clear cmp color configfile debug device displayapm displaymem dump embed find fstest geometry halt help hide impsprobe initrd install ioprobe kernel lock makeactive map
md5crypt module modulenounzip pager partnew parttype password pause quit read reboot root rootnoverify savedefault serial setkey setup terminal terminfo testload
testvbe unhide uppermem vbeprobe


A MS TROUBLE-SHOOTING.
Without a flowchart I am using steps M (No) to lead down the dark alley of success.

M1 at the menu screen PRESS C (for commands to try stuff direct)[
or if prompt is showing start typing.

M2 test what grub finds is a MS format

grub> root (hd0, PRESS TAB
Possible partitions are:
Partition num: 0, Filesystem type is fat, partition type 0xc
Partition num: 1, Filesystem type is reiserfs, partition type 0x83
Partition num: 2, Filesystem type is reiserfs, partition type 0x83
Partition num: 4, Filesystem type is reiserfs, partition type 0x83
Partition num: 5, Filesystem type is reiserfs, partition type 0x83
Partition num: 6, Filesystem type is reiserfs, partition type 0x83
Partition num: 7, Filesystem type unknown, partition type 0x82


I only have a w98 but all MS users should be able to recognise that (hd0,0) will be a fat file system. Lets confirm.

For those who have MS on a non-first drive first partition system you need to jump to M8 for the map commands.

M3 confirm MS file partition to load
grub> root (hd0,0)
Filesystem type is fat, partition type 0xc


M4 MS likes bootable partitions it can see so switch on the flag
No harm if its already on. Persons who had to jump to M8 rejoin here, only after completing M8 stuff.

grub> makeactive
# grub gives no feedback

M5 Tell grub to use the MS bootloader
grub> chainloader +1
MS now boots otherwise step M6

M6 force the boot to MS as step M5 fails
grub> boot

M7 if you have booted, when you get back into linux amend your /boot/grub/menu.lst file to reflect the new changes.
################end of M series for normal users

M8 MS ON NON-FIRST PARTITION FIRST DRIVES START HERE
You are here only if MS is not on first drive first partition.

To boot first drive but NOT first partition jump to M11
Otherwise you are booting a second or third drive please continue
To recap you attempted to find partition info and did this
grub> root (hd PRESS TAB to get responses eg
hd0
hd1


M9 Check non-first drive for C drive
root (hd1, PRESS TAB
Partition num: 0, Filesystem type is fat, partition type 0xc
Partition num: 1, Filesystem type is reiserfs, partition type 0x83

So C drive is (hd1,0) continue.

M10 issue root and map commands
grub> root (hd1,0) change this to suit where C drive sits
grub> map (hd1) (hd0)
grub> map (hd0) (hd1)


Note we must use two maps (or swaps) swap a to b and swap b to a.
Does not matter which we swap first.

The main howto explains that MS is now tricked. Now goto M4
############end of other drive steps

M11 Check C drive on first drive but not first partition
Recap you may have this setup
grub> root (hd0, PRESS TAB
Possible partitions are:
Partition num: 0, Filesystem type is reiserfs, partition type 0x83
Partition num: 1, Filesystem type is reiserfs, partition type 0x83
Partition num: 2, Filesystem type is fat, partition type 0xc


so instead of a map drive command we use it to map partitions, still the same logic to trick MS that hd0,2 is hd0,0

M12 Issue root and map commands
grub> root (hd0,2) change this to suit where C drive sits.
grub> map (hd0,2) (hd0,0)
grub> map (hd0,0) (hd0,2)


The main howto explains that MS is now tricked. Now go to M4
###########end of MS stuff########################################

B LINUX TROUBLESHOOTING

L1 OUR GOAL IS TO BOOT SOMETHING LIKE THIS

The sequence to test is
root (hdX,Y)
kernel {/boot}/vmlinux (or bzImage or kernel ) WITH KERNEL PARAMETERS
initrd {/boot}/initrd.img OR NO INITRD LINE

L2 TESTING THE ROOT COMMAND
root (hdX,Y) defines a search path for grub to find the next command files.
IT MUST define either the /boot partition or the / partition as /boot is a sub-folder to /

BUT on the kernel line we may need the structure /boot/ etc or WITHOUT /boot
so to kill 2 birds with one stone we try this
grub> find /boot/bzImage
Error 15: File not found
grub> find /boot/kernel
Error 15: File not found
grub> find /boot/vmlinuz
Error 15: File not found
grub> find /bzImage
Error 15: File not found
grub> find /kernel
Error 15: File not found
grub> find /vmlinuz
(hd0,1)


I know what my structure is but by doing all permutations you get the idea.
We all know now that the kernel is called vmlinuz and its on (hd0,1) AND no /boot to be used as a part of the kernel command.

To be blunt you either have /boot as a separate partition, IMHO the best way OR
its on the main / as is therefore a subfolder to /.

If you already know that....then if you have /boot partition you drop the /boot from your command.....otherwise you leave them in.

L3 TEST KERNEL LINE root=/dev
our sequence so far is root (hd0,1) and the first part of kernel we already know is
kernel /vmlinuz and not /boot/vmlinuz.

How do we find the root=/dev/sdX or hdX parameter? 2 ways
WAY 1
The /etc/fstab file sits on / partition so find it

grub> find /etc/fstab
# typed long hand
(hd0,2)


WAY 2
If you have more than one linux it may get multiple responses. In which case you may need to print to screen each response like this
For each response change the root command ....for searching and then issue the cat command
grub> root (hd0,2)
Filesystem type is reiserfs, partition type 0x83

grub> cat /etc/f
AND PRESS THE TAB KEY to autocomplete so that you get the full line
grub> cat /etc/fstab
Possible files are: fstab fstab~


grub> cat /etc/fstab
/dev/sda3 / reiserfs notail,noatime 1 1
/dev/sda6 /a reiserfs notail,noatime 1 2
/dev/sda2 /boot reiserfs notail,noatime 1 2
none /dev/pts devpts mode=0620 0 0
/dev/hda /mnt/cdrom auto umask=0,user,iocharset=iso8859-15,codepage=850,noauto,ro
,exec,users 0 0
/dev/fd0 /mnt/floppy auto umask=0,user,codepage=850,iocharset=iso8859-15,noauto,s
ync 0 0
/dev/sda1 /mnt/windows vfat umask=0,iocharset=iso8859-15,codepage=850 0 0
none /proc proc defaults 0 0
/dev/sda5 /usr reiserfs notail,noatime 1 2
/dev/sda7 /z reiserfs notail,noatime 1 2
/dev/sda8 swap swap defaults 0 0


/dev/sda3 is the bit we need for the "root=/dev/sda3" part of the kernel command line
so our sequence so far
root (hd0,1)
kernel /vmlinz root=/dev/sda3

L4 CHECKING THE OTHER KERNEL PARAMETERS
Info is in your kernel docs at
/usr/src/(kernel name) /Documentation/kernel-parameters.txt
online here
http://lwn.net/Articles/14632/

This section is under severe edit as I think of some to add.....I am not a kernel guru

Some kernel appends can be checked as working or not there in /VAR/LOG/DMESG

ro means read only the partition of /boot while kernel is loading...the rw status or otherwise is then determined by your /etc/ files

noraid means don't load any software raid

root=/dev/hda means tell kernel where your / partition is AND ITS COMPULSORY paramter.
Note hda is an example change it to to suit the /etc/fstab file

acpi=ht means enable hyperthreading for your processor

hdX=ide-scsi some old kernels (distros) need this to get cd burners to work

nofb means no frame buffer......a graphics driver

apci=off means don't use the power management

vga=ask some people like bigger fonts so see what your kernel messages can handle



L5 CHECK IF INITRD IS NEEDED AND NAME
grub> root (hd0,1)
Filesystem type is reiserfs, partition type 0x83

grub> find /
Possible files are: grub message-graphic System.map System.map-2.6.8.1-10mdk System.map-2.6.9 us-latin1.klt config-2.6.8.1-10mdk config-2.6.9 configkernel.h-2.6.8.1-10mdk initrd.img
reiserfs_priv initrd-2.6.8.1-10mdk.img initrd-2.6.9.img vmlinuz kernel.h vmlinuz-2.6.8.1-10mdk vmlinuz-2.6.9

NOTE grub is a FOLDER

grub can use LINK files so vmlinuz and initrd can be used

Response shows that for kernel-2.6.8.1-10 it has an initrd
but kernel-2.6.9 there is no initrd.

so our sequence to boot the 2.6.8 series so far is
root (hd0,1)
kernel /vmlinuz root=/dev/sda3 WITH KERNEL PARAMETERS
initrd /initrd.img

But for 2.6.9 series its
root (hd0,1)
kernel /vmlinuz-2.6.9 root=/dev/sda3 WITH KERNEL PARAMETERS



WHAT NEXT
At some point you must issue commands to either get into MS or Linux.
If they work write them down. Then boot into linux and with root access powers edit the /boot/grub/menu.lst file to exactly those commands but add a title line so you can choose it later. Read the rest of the howto on other stuff if you like.

SPLASHIMAGE FAILS
Check that the command is available to use if at mbr menu
press TAB to see all commands

b) if system has booted try su then grub then tab

then check the pathway in your menu file is correct
then check with a graphics program.....the image is viewable and correct graphic size as per myhowto.

Note, I prefer you have no fancy stuff......use the bootloader to get to your fancy stuff and keep the bootloader as simple as possible.

Last edited by aus9; 04-06-2008 at 01:12 AM.
 
Old 01-17-2005, 02:31 AM   #2
aus9
LQ 5k Club
 
Registered: Oct 2003
Location: Western Australia
Distribution: Icewm
Posts: 5,842

Original Poster
Rep: Reputation: Disabled
EDIT LOG
1 start the basic stuff
2 start MS stuff
3 change from MS rootnoverify to root with map commands
4 start the kernel appends
5 severe edits under control jan 24 2005
6 new wiki link for embed-like pix under severe edit

Last edited by aus9; 03-26-2006 at 08:58 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
DISCUSSION: HOWTO GRUB BOOTLOADER AND TROUBLE-SHOOTER aus9 LinuxAnswers Discussion 6 04-16-2024 05:25 AM
DISCUSSION: Set up Grub by hand runlevel0 LinuxAnswers Discussion 3 08-20-2010 04:21 AM
DISCUSSION: Booting Windows on second HD with Grub talLinux LinuxAnswers Discussion 5 02-13-2007 09:37 AM
DISCUSSION: GRUB bootloader aus9 LinuxAnswers Discussion 1 10-01-2004 09:58 AM
Discussion: Slackware and GRUB nirvanix Slackware 3 10-26-2003 10:54 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:34 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration