-   Linux From Scratch (
-   -   Booting LFS from USB stick ? (

mbzadegan 08-15-2011 02:49 PM

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 ...

kostya 08-16-2011 08:06 AM

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?

mbzadegan 08-16-2011 12:34 PM

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

hoes 08-16-2011 02:18 PM

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.

mbzadegan 08-16-2011 02:40 PM

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 ?

hoes 08-16-2011 04:03 PM

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?

mbzadegan 08-16-2011 08:01 PM

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 .

kostya 08-17-2011 07:32 AM

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.

mbzadegan 08-17-2011 07:49 AM

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 .

kostya 08-17-2011 08:46 AM

Didn't work the way I tried it :).

OK, but there's a README on the LiveCD itself.
It says these interesting things:


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

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:

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 ;).

kostya 08-17-2011 09:14 AM

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

It doesn't even understand the most common command like

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 :(.

kostya 08-17-2011 09:52 AM

OK, I managed to boot it this way(part of grub2 config:

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 ;).

mbzadegan 08-17-2011 11:03 AM

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 .

hoes 08-17-2011 11:54 AM

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.

mbzadegan 08-17-2011 12:48 PM

Unfortunately , it was same error .

All times are GMT -5. The time now is 04:51 PM.