Linux - GeneralThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.