LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 10-05-2010, 01:36 AM   #1
Hok
LQ Newbie
 
Registered: Oct 2008
Posts: 7

Rep: Reputation: 0
Question Getting output from GRUB during boot from USB key


So, I have a home-brewed Linux system that I've installed on a USB key. I'm plugging this into a laptop. I can tell from what is going on that it has successfully loaded the kernel and is running the shell script that is specified on the "kernel" line in the GRUB configuration. But... although I can get output from printk() calls in the kernel just fine, I get nothing from "echo" commands (or any other commands) in the initialization shell script. I can see that the commands are being run, but the output is just disappearing into the void.

This is problematic because there are other problems, but I can't get debug output to track those down...

Given that printk() output goes to the laptop screen as expected, it seems that GRUB must be sending other output to something other than the console, yet the grub.conf configuration is quite simple:

default=0
timeout=0

title Test
root (hd0,0)
kernel /boot/vmlinuz ro root=/dev/ram init=/linuxrc ramdisk_size=16384
initrd /boot/initrd.gz
savedefault

Any hints about what I'm missing? Thanks!
 
Old 10-05-2010, 05:15 AM   #2
Larry Webb
LQ Veteran
 
Registered: Jul 2006
Location: Crystal Beach, Texas
Distribution: Suse for mail +
Posts: 5,100
Blog Entries: 7

Rep: Reputation: 229Reputation: 229Reputation: 229
If it is on a usb key it would not be

root (hd0,0)

it would be root (hdx,0) x being the number fdisk lists as the usb drive.

To be able to help more you need to tell us which version of grub you are using by the command grub-install -v and the results of fdisk -l from terminal using an installed distro or a live cd.

Last edited by Larry Webb; 10-05-2010 at 05:16 AM.
 
Old 10-05-2010, 09:06 PM   #3
Hok
LQ Newbie
 
Registered: Oct 2008
Posts: 7

Original Poster
Rep: Reputation: 0
Good catch! But it seems there is something else going on. First, though, here's the information you asked about:

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

[root@wedge ~]# grub-install -v
grub-install (GNU GRUB 0.97)
[root@wedge ~]# fdisk -l

Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000f09af

Device Boot Start End Blocks Id System
/dev/sda1 * 1 51 409600 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 51 561 4096000 83 Linux
Partition 2 does not end on cylinder boundary.
/dev/sda3 561 816 2048000 83 Linux
Partition 3 does not end on cylinder boundary.
/dev/sda4 816 19457 149734721 83 Linux

Disk /dev/dm-1: 153.3 GB, 153326285824 bytes
255 heads, 63 sectors/track, 18640 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

Disk /dev/dm-1 doesn't contain a valid partition table

Disk /dev/dm-2: 21.0 GB, 20971520000 bytes
255 heads, 63 sectors/track, 2549 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xe8070000

Disk /dev/dm-2 doesn't contain a valid partition table

Disk /dev/dm-3: 8388 MB, 8388608000 bytes
255 heads, 63 sectors/track, 1019 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x08020000

Disk /dev/dm-3 doesn't contain a valid partition table

Disk /dev/dm-4: 83.9 GB, 83886080000 bytes
255 heads, 63 sectors/track, 10198 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xe8070000

Disk /dev/dm-4 doesn't contain a valid partition table

Disk /dev/dm-5: 21.0 GB, 20969451520 bytes
255 heads, 63 sectors/track, 2549 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

Disk /dev/dm-5 doesn't contain a valid partition table

Disk /dev/dm-0: 83.9 GB, 83884011520 bytes
255 heads, 63 sectors/track, 10198 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

Disk /dev/dm-0 doesn't contain a valid partition table

Disk /dev/dm-6: 2095 MB, 2095083520 bytes
255 heads, 63 sectors/track, 254 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x65f47968

Disk /dev/dm-6 doesn't contain a valid partition table

Disk /dev/dm-7: 8388 MB, 8388079616 bytes
255 heads, 63 sectors/track, 1019 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

Disk /dev/dm-7 doesn't contain a valid partition table

Disk /dev/sdb: 4009 MB, 4009754624 bytes
124 heads, 62 sectors/track, 1018 cylinders
Units = cylinders of 7688 * 512 = 3936256 bytes
Disk identifier: 0xc3072e18

Device Boot Start End Blocks Id System
/dev/sdb1 * 1 7 26907+ 83 Linux
/dev/sdb2 8 1018 3886284 83 Linux

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

/dev/sda is the hard disk on the laptop. /dev/sdb is the USB key. Since the laptop normally boots off of /dev/sda1 and that's referred to as (hd0,0), I changed the root command on the USB key to (hd1,0) to boot from /dev/sdb1.

But strangely, it doesn't seem to matter. Regardless of the hdX number I use, the result is the same. It tries to boot using the kernel on the USB key, and while I get printk() output from the kernel, there's nothing from the system init program. Also no GRUB menu, or anything like that. All I get is

GRUB loading stage2
Some prink() output that I put in the kernel for debugging
The init program (a shell script) starts
Kernel panic when the script aborts

To debug the abort, I need to see what is going on as the script runs. But I get no console output from "echo" or any of the other commands that I put into the script, so I'm stuck.
 
Old 10-05-2010, 11:21 PM   #4
Larry Webb
LQ Veteran
 
Registered: Jul 2006
Location: Crystal Beach, Texas
Distribution: Suse for mail +
Posts: 5,100
Blog Entries: 7

Rep: Reputation: 229Reputation: 229Reputation: 229
Which linux distro do you have on the usb? Can you boot your distro on the internal drive? Are there any error codes when trying to boot the usb?
 
Old 10-06-2010, 11:48 PM   #5
Hok
LQ Newbie
 
Registered: Oct 2008
Posts: 7

Original Poster
Rep: Reputation: 0
The USB has the home-grown system on it, so it's not running any distribution per se (except itself!). It boots fine when I copy the system to a compact flash card and use it as an embedded operating system on a generic single-board computer, but for some reason the USB key is giving me troubles.

The main difference is that the single-board computer has neither a keyboard nor a display, so the console is a serial port. To get that working, however, I have to add "serial" and "terminal" commands to the GRUB configuration. I deleted those from the GRUB configuration for the USB, hoping that it would default to the laptop's own keyboard and display, but it didn't seem to help.

There are no (visible) error codes when booting from the USB key. Eventually there is a kernel panic, but this occurs well into the init program. The fact that it is able to run the kernel, start the init program, and get partway through it all seems to indicate that the bootstrap process is works OK. I just can't get output from anything except the kernel. Weird.
 
  


Reply

Tags
boot, grub config, output, usb thumb drive


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Difference in Kernel output between USB key vs USB HDD...using udevadm samaresh4 Linux - Kernel 0 05-19-2010 07:43 PM
Boot from USB key, does suspend or hibernate work? paulsiu Linux - Hardware 1 05-02-2008 02:34 PM
USB Key Stops System Boot Up. swamprat Linux - Newbie 1 04-13-2008 08:15 PM
usb key boot on laptop guldo Linux - General 4 08-22-2005 09:07 PM
USB memory key hangs boot enryfox Linux - Hardware 4 07-18-2004 03:04 AM


All times are GMT -5. The time now is 06:57 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration