LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.

Notices


Reply
  Search this Thread
Old 08-15-2011, 02:49 PM   #1
mbzadegan
Member
 
Registered: Jul 2011
Location: Beside of Andromeda !
Distribution: OpenBSD, RedHat, Arch, ..
Posts: 90

Rep: Reputation: Disabled
Question Booting LFS from USB stick ?


Hi everybody,
How can boot LFS from usb stick ? in other words i bootabled my usb stick with syslinux and i want to boot LFS from my USB stick ...
 
Old 08-16-2011, 08:06 AM   #2
kostya
Member
 
Registered: Mar 2010
Location: Moscow, Russia
Distribution: Ubuntu Studio, antix(mepis), Fedora, FreeBSD
Posts: 174
Blog Entries: 5

Rep: Reputation: 18
Do you mean to boot ALL your LFS installation from a USB stick?

Or do you want to use the USB stick to boot the kernel and then use your LFS which is installed on your HDD?

Last edited by kostya; 08-16-2011 at 08:12 AM.
 
Old 08-16-2011, 12:34 PM   #3
mbzadegan
Member
 
Registered: Jul 2011
Location: Beside of Andromeda !
Distribution: OpenBSD, RedHat, Arch, ..
Posts: 90

Original Poster
Rep: Reputation: Disabled
Dear kostya ,
I have not any HDD and i want to boot from my USB Stick ,
At first i bootabled my usb stick with syslinux and then copy all of LFS_LiveCD files to it ,
I configured syslinux.cfg with :

label linux
kernel linux root=UUID=07E6-1968 init=/sbin/init
append initrd=initramfs_data.cpio.gz

BUT when i booted from it these message was notified !

LFS LiveCD could not find its device.
Dropping you to a shell.
Please load the needed modules and, optionally, make /dev/lfs-cd a symlink pointing to the correct device.

sh: no job control in this shell
sh-3.2#

Last edited by mbzadegan; 08-16-2011 at 12:36 PM.
 
Old 08-16-2011, 02:18 PM   #4
hoes
Member
 
Registered: Sep 2005
Distribution: debian, linux from scratch
Posts: 190

Rep: Reputation: 51
I've made a bootable USB stick with LFS on it.
I used grub and installed it to the boot sector of the USB stick.
The most important part was however the initial ramdisk.

The key to the success was having the ramdisk run a script to find the root system.
It kept mounint every system until it found the LFS root and changed to this.

I reckon that the shell you get is part of the initial ramdisk.
That means that you have initial ramdisk support and could make a ramdiks to find the root.

I hope you find this quick reply a helpfull start.
Maybe there are better methods (although I saw a similar method on a KNOPPIX CD).
However, if you have some more question, feel free to ask.
 
1 members found this post helpful.
Old 08-16-2011, 02:40 PM   #5
mbzadegan
Member
 
Registered: Jul 2011
Location: Beside of Andromeda !
Distribution: OpenBSD, RedHat, Arch, ..
Posts: 90

Original Poster
Rep: Reputation: Disabled
Ok , That's right .
It seems that i must definite root.ext2 to the root append of kernel .
How i can do it with syslinux ?
 
Old 08-16-2011, 04:03 PM   #6
hoes
Member
 
Registered: Sep 2005
Distribution: debian, linux from scratch
Posts: 190

Rep: Reputation: 51
I doubt whether that really is the problem.
I wouldn't mind having a look at the initrd and come up with something.

Can you give a link to the LFS bootable CD website?
 
Old 08-16-2011, 08:01 PM   #7
mbzadegan
Member
 
Registered: Jul 2011
Location: Beside of Andromeda !
Distribution: OpenBSD, RedHat, Arch, ..
Posts: 90

Original Poster
Rep: Reputation: Disabled
ftp://ftp.osuosl.org/pub/lfs-livecd/...-r2145-min.iso

Hint , When i put a LFS-LivCD on my cdrom the booting of USB Stick was TRUE , This means that LFS search for root.ext2 on CD-ROM , We must point it to USB Stick .

Last edited by mbzadegan; 08-17-2011 at 12:05 AM.
 
Old 08-17-2011, 07:32 AM   #8
kostya
Member
 
Registered: Mar 2010
Location: Moscow, Russia
Distribution: Ubuntu Studio, antix(mepis), Fedora, FreeBSD
Posts: 174
Blog Entries: 5

Rep: Reputation: 18
The advantage of GRUB2 is that it can actually boot from ISO image. I've done that with a number of images of different LiveCD distros, all of them on one USB stick. I'll try now with LFS one and report back .

BTW,This HOWTO gives general steps to follow.
 
Old 08-17-2011, 07:49 AM   #9
mbzadegan
Member
 
Registered: Jul 2011
Location: Beside of Andromeda !
Distribution: OpenBSD, RedHat, Arch, ..
Posts: 90

Original Poster
Rep: Reputation: Disabled
Tnx Dear kostya ,

Also , memdisk ( syslinux compatible ) can do it with iso images BUT unfortunately booting directly from iso image (with grub or memdisk) needs more memory .


I don't know how i can mount /dev/hda1 as /dev/lfs-cd on kernel appending ...
If we customize init file and force kernel to append USB stick , Booting will complete .
 
Old 08-17-2011, 08:46 AM   #10
kostya
Member
 
Registered: Mar 2010
Location: Moscow, Russia
Distribution: Ubuntu Studio, antix(mepis), Fedora, FreeBSD
Posts: 174
Blog Entries: 5

Rep: Reputation: 18
Didn't work the way I tried it .

OK, but there's a README on the LiveCD itself.
It says these interesting things:
Quote:
BOOTING FROM ISO IMAGE

If you want to boot this CD on a computer without a CD-ROM drive, follow the steps below.

Store the ISO image of this CD as a file on a partition formatted with one of the following filesystems: vfat, ntfs, ext2, ext3, ext4, jfs, reiserfs, reiser4, xfs

Copy the boot/isolinux/{linux,initramfs_data.cpio.gz} files from the CD to your hard disk

Configure the boot loader to load “linux” as a kernel image and “initramfs_data.cpio.gz” as an initrd. The following parameters have to be passed to the kernel:

rw root=iso:/dev/XXX:/path/to/lfslivecd.iso rootfstype=fs_type

where /dev/XXX is a partition where you stored the LiveCD image, and fs_type is the type of the filesystem on that partition. You may also want to add “rootflags=…” option if mounting this partition requires special flags.

If there is only Windows on the target computer, please use grub4dos as a boot loader. It is available from http://sourceforge.net/projects/grub4dos.
MAKING A BOOTABLE USB DRIVE

Install GRUB on a flash drive, then follow instructions in the “BOOTING FROM ISO IMAGE” above, using a partition on your flash drive. The following tips will ensure that the flash drive is bootable in any computer:

Use the persistent symlink such as “/dev/disk/by-uuid/890C-F46A” to identify the target partition.

Add “rootdelay=20” to the kernel arguments.
from which I derive that we must try, when booting from a USB stick, to supply this argument to our kernel line:
Code:
linux /boot/isolinux/linux rw root=iso:/dev/disk/by-uuid/0451-5CDC:/lfslivecd.iso rootfstype=vfat rootdelay=20
I'll try now and report .
 
1 members found this post helpful.
Old 08-17-2011, 09:14 AM   #11
kostya
Member
 
Registered: Mar 2010
Location: Moscow, Russia
Distribution: Ubuntu Studio, antix(mepis), Fedora, FreeBSD
Posts: 174
Blog Entries: 5

Rep: Reputation: 18
Well, it is the worst case possible:
it doesn't work the way the README suggests! In fact, the kernel (linux) doesn't understand not only such complicated command line as
Quote:
root=iso:/dev/disk/by-uuid/0451-5CDC:/lfslivecd.iso
It doesn't even understand the most common command like
Quote:
root=UUID=0451-5cdc
and says it cannot mount any such device.

So I don't know where to move further, only maybe email the developers of the LiveCD and ask them this very question.
Sorry .
 
1 members found this post helpful.
Old 08-17-2011, 09:52 AM   #12
kostya
Member
 
Registered: Mar 2010
Location: Moscow, Russia
Distribution: Ubuntu Studio, antix(mepis), Fedora, FreeBSD
Posts: 174
Blog Entries: 5

Rep: Reputation: 18
OK, I managed to boot it this way(part of grub2 config:
Quote:
set root=(hd0,1)
linux /linux64
initrd /initramfs_data64_cpio.gz
append rw root=iso:/dev/disk/by-uuid/0451-5CDC:/lfslivecd.iso rootfstype=vfat rootdelay=20
This way it boots up to the message form init that it can't find its LiveCD and therefore drops me to the shell. Which is strange, because at this stage all the needed devices are here and lfslivecd.iso absolutely available to use as root filesystem. Perhaps some more fine tuning of this process will bring some satisfaction?
We just CAN'T stop at this point where we are almost there .
 
1 members found this post helpful.
Old 08-17-2011, 11:03 AM   #13
mbzadegan
Member
 
Registered: Jul 2011
Location: Beside of Andromeda !
Distribution: OpenBSD, RedHat, Arch, ..
Posts: 90

Original Poster
Rep: Reputation: Disabled
Tnx , very good hints ,

I passed that state with root=iso:/dev/disk/by-uuid/07E6-1968:/lfslivecd.iso but i hanged on another state :

My New Error :

/init: line 172: mknod: Command not found
mount: special device /dev/root does not exist
Kernel panic - not syncing: Attempted to kill init!


My syslinux.cfg :

label linux
root (hd0,1)
kernel linux
append initrd=initramfs_data.cpio.gz rw root=iso:/dev/disk/by-uuid/07E6-1968:/lfslivecd.iso rootfstype=vfat rootdelay=20

Another Thanks for your very good hints .

Last edited by mbzadegan; 08-17-2011 at 12:49 PM.
 
Old 08-17-2011, 11:54 AM   #14
hoes
Member
 
Registered: Sep 2005
Distribution: debian, linux from scratch
Posts: 190

Rep: Reputation: 51
I had a quick galnce at the init file, that creates your error.

It is strange that mknod is ran.
You specified an iso file using "iso:*", which should do the trick.
BTW, are you sure taht initrd should be on the append line as well?
Could you perhaps try this: (that's grublike structure)

root (hd0,1)
initrd initramfs_data.cpio.gz
kernel linux
append rw root=iso:/dev/disk/by-uuid/07E6-1968:/lfslivecd.iso rootfstype=vfat rootdelay=20


The stupid thing is that mknod is not included in the image.
However, normally this shouldn't bother you, because iso mounting doesn't need it.
But that's just a sidenote.
 
Old 08-17-2011, 12:48 PM   #15
mbzadegan
Member
 
Registered: Jul 2011
Location: Beside of Andromeda !
Distribution: OpenBSD, RedHat, Arch, ..
Posts: 90

Original Poster
Rep: Reputation: Disabled
Unfortunately , it was same error .
 
  


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
[SOLVED] boot problem after installing LFS on a USB stick vmsda Linux From Scratch 1 03-28-2011 10:47 AM
Booting from USB stick Completely Clueless Linux - Hardware 2 08-25-2010 02:03 PM
GRUB: Booting from USB; Creating the Ultimate Bootable USB Stick Jinouchi Linux - Software 2 04-07-2010 04:17 PM
Booting from a USB stick LordAnta Linux - Hardware 2 06-22-2008 09:43 AM
Boot from USB stick if no booting USB in Bios 1kyle SUSE / openSUSE 1 03-26-2007 12:24 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

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