LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 05-19-2012, 12:43 PM   #1
feeblebrain
Member
 
Registered: Feb 2011
Posts: 55

Rep: Reputation: 0
Grub from scratch, maybe?


Hello,

For the reasons of furthering familiarity with Linux and its file system, I decided to create a small project based very loosely on Pocket_Linux (even though it appears to be quite out of date). However, I opted to do this on a usb stick, instead of floppies.

To summarize;

1. I created two partitions on the usb and formated them ext2.

2. I compiled a Linux kernel 2.6.32.59, with minimal support as was needed for the most basic features of my laptop, and transferred it into /boot on what I chose to be my root partition on the usb stick.

3. I saved myself the hassle of building Grub from source (a couple of attempts were frustrating, as they were producing compiler errors) by simply transferring my present Debian's Grub to the usb stick with...

Code:
grub-install /dev/sdb --root-directory=/mnt/temp
.../mnt/temp being where I had mounted /sdb1, which I had chosen to be my root partition.

4. Then I booted from the usb, correctly suspecting that I would be presented with the grub cli screen.

It is at this point that I run into trouble, as Grub insists on a different drive/device naming protocol which is utterly confusing, especially since even that has changed from an earlier version (Legacy) with which I never had any contact, but for which there abounds lots of web pages that will lead you up a dead end.

Anyway...

I did this at the Grub prompt;

Code:
set root=(hd0,1)
linux /boot/vmlinuz root=/dev/sdb1
boot
Well, to my surprise, I actually DO boot up my personal kernel, but there's a problem, it seems, with the second line of the above code, specifically, the...

Code:
root=/dev/sdb1
...part. I do get a list of "available partitions". In fact here's what appears after my kernel has booted...

Code:
VFS: Cannot open root device "sdb1" or unkown-block(0,0)
Please append a correct "root=" boot option; here are the available partitions:
0300        156290904  hda driver: ide-gd
  0301         78280442  hda1
  0302                1  hda2
  0305         76005376  hda5
  0306          2002944  hda6
1f00             4096  mtdblock0 (driver?)
0800             8192  sda driver: sd
1f01           131072  mtdblock1 (driver?)
1f02            16384  mtdblock2 (driver?)
I have tried some variations on the "root=" option, but no to avail. How can I know what is what, and how to set the correct root partition (which I know to be my "linux format" sdb1)?

Any help? My thanks in advance...
 
Old 05-19-2012, 01:25 PM   #2
em31amit
Member
 
Registered: Apr 2012
Location: /root
Distribution: Ubuntu, Redhat, Fedora, CentOS
Posts: 190

Rep: Reputation: 55
use hda1 instead of sda1 or else set labels on filesystems/partition and use label in kernel line instead of using particular block device name
 
Old 05-19-2012, 02:05 PM   #3
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,980

Rep: Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624
I'd think that if you booted to the usb then it would be labeled as sda.
 
Old 05-19-2012, 07:55 PM   #4
feeblebrain
Member
 
Registered: Feb 2011
Posts: 55

Original Poster
Rep: Reputation: 0
You know, I learned some shard of new knowledge inductively from jefro's comment, but it is another story. For right here, I eventually got some success trying em31amit's suggestion of root=hda1, but there is something weird about it. It seems to indicate that the partition (hda1) is ntfs, which would be analogous to what is on my laptop's hard drive (a derelict Windows XP installation) on the first partition, and not the usb stick, which only has two partitions, both ext2.

Put me to wondering. These numbers (the second column) just before hda1, etcetera...

Code:
 0300        156290904  hda driver: ide-gd
  0301         78280442  hda1
  0302                1  hda2
  0305         76005376  hda5
  0306          2002944  hda6
1f00             4096  mtdblock0 (driver?)
0800             8192  sda driver: sd
1f01           131072  mtdblock1 (driver?)
1f02            16384  mtdblock2 (driver?)
..are the size of the drive partitions in blocks. An fdisk -l output of my laptop, from Debian, gives me these specs (abbreviated)...

Code:
Device      .......     Blocks        .......    System
/dev/sda1               78280442                 HPFS/NTFS
/dev/sda2               78009345                 Extended
/dev/sda5               76005376                 Linux
/dev/sda6                2002944                 Linux swap / Solaris

/dev/sdb1                 205905+                Linux
/dev/sdb2                 790560                 Linux
The last two are my usb partitions. So, my usb is not being read by the kernel, apparently. Presumably that is what the (driver?) business and those 'garbage' numbers are about? Though I did select the options for building usb support into the kernel (it was one of the few things I did build into it, as it is experimental), it is possible and probable that I left something important out. I will rebuild it, taking more care.

Thanks for the comments!

Last edited by feeblebrain; 05-19-2012 at 08:02 PM.
 
Old 05-19-2012, 09:50 PM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
I'm surprised you can still enumerate hda with that kernel.
You'll need udev (and appropriate init scripts) for the sda? partitions.

The mtd would imply a flash (not USB) device.
 
Old 05-19-2012, 10:55 PM   #6
em31amit
Member
 
Registered: Apr 2012
Location: /root
Distribution: Ubuntu, Redhat, Fedora, CentOS
Posts: 190

Rep: Reputation: 55
I would say set labels on USB disk filesystem.and try.to.use it while booting to passing it to kernel . Also you can use filesystem uid's that is very common nowadays .. creating devices by name is responsibility of udev. You should also check that too.

Last edited by em31amit; 05-19-2012 at 10:56 PM.
 
Old 05-19-2012, 10:56 PM   #7
feeblebrain
Member
 
Registered: Feb 2011
Posts: 55

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by syg00 View Post
I'm surprised you can still enumerate hda with that kernel.
You'll need udev (and appropriate init scripts) for the sda? partitions.

The mtd would imply a flash (not USB) device.
Thanks.

Okay, I am taking a guess here, because this is beyond me at this time and I don't know. I assume that the udev rules would go on the flash drive (I stand corrected) that I have booted from, in a /etc/udev/rules.d directory? How can I get to them if, once my kernel has booted, I am unable to access it? What am I seeing wrong here?
 
Old 05-19-2012, 11:00 PM   #8
feeblebrain
Member
 
Registered: Feb 2011
Posts: 55

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by em31amit View Post
I would say set labels on USB disk filesystem.and try.to.use it while booting to passing it to kernel . Also you can use filesystem uid's that is very common nowadays .. creating devices by name is responsibility of udev. You should also check that too.
Thanks, I will try that, for now.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Installing Grub from scratch to boot Windows? littlebigman Linux - Software 5 01-11-2010 01:57 PM
Installing GRUB or GRUB2 from scratch williamv2 Linux - Newbie 10 03-31-2009 09:31 PM
ali aladdin v agp stinks :scratch: :scratch: :scratch: Mr Marmmalade Linux - Hardware 1 07-08-2003 05:11 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:35 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