LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora
User Name
Password
Fedora This forum is for the discussion of the Fedora Project.

Notices


Reply
  Search this Thread
Old 01-27-2012, 02:58 PM   #1
kayasaman
Member
 
Registered: Sep 2008
Location: Under the bridge where proper engineers walkover
Distribution: Various Linux, Solaris, BSD, Cisco
Posts: 443

Rep: Reputation: 32
Creating a new initrd image to USB boot Fedora 15


Hi,

I used to run Fedora 15 x64 on my old laptop which doesn't work any more now.

I would like to use my HD as a USB bootable device in an enclosure which I have on my new machine.

The issue seems to be that I need to create a new initrd to pre-load the USB drivers so when the GRUB of the new machine tries booting the USB disk I don't get the H/C/I error (sorry can't remember the letters directly) that I'm facing.

Buildwise the disk is sound as I can boot it in the family laptop as it's the same hardware as my old one.

This is as far as I got:

Code:
mkinitrd /boot/initramfs-2.6.41.4-1.fc15.x86_64.img 2.6.41.4-1 --preload ext4:usbcore:sd_mod:ehci_hcd:uhci_hcd:ohci_hcd:usb-storage:scsi_mod --force
Unfortunately I encountered many errors with this as I don't think the system could find all the modules:

Code:
# mkinitrd /boot/initramfs-2.6.41.4-1.fc15.x86_64.img 2.6.41.4-1 --preload kernel/drivers/usb/usbcore:kernel/drivers/usb/usb-storage:kernel/drivers/scsi/scsi --force
/sbin/mkinitrd: line 52: read_args: command not found
find: `/lib/modules/2.6.41.4-1/': No such file or directory
find: `/lib/modules/2.6.41.4-1/': No such file or directory
find: `/lib/modules/2.6.41.4-1/': No such file or directory
find: `/lib/modules/2.6.41.4-1/': No such file or directory
find: `/lib/modules/2.6.41.4-1/': No such file or directory
find: `/lib/modules/2.6.41.4-1/': No such file or directory
find: `/lib/modules/2.6.41.4-1/': No such file or directory
Is the error I kept getting. <I tried with various module names after using the locate command to search for them as the original directive I got from Salix (Slackware)>


Can anyone help me???


Thanks a lot
 
Old 01-28-2012, 08:14 AM   #2
RockDoctor
Senior Member
 
Registered: Nov 2003
Location: Minnesota, US
Distribution: Fedora, Ubuntu, Manjaro
Posts: 1,791

Rep: Reputation: 427Reputation: 427Reputation: 427Reputation: 427Reputation: 427
You might want to try using dracut, which is what Fedora uses to create its initramfs file.
Code:
man dracut
 
Old 01-28-2012, 08:27 AM   #3
kayasaman
Member
 
Registered: Sep 2008
Location: Under the bridge where proper engineers walkover
Distribution: Various Linux, Solaris, BSD, Cisco
Posts: 443

Original Poster
Rep: Reputation: 32
Thanks for the response!

This is the list of modules that dracut gives me:

Code:
ls /usr/share/dracut/modules.d
00bootchart   90crypt           91crypt-gpg     95udev-rules   98syslog
00dash        90dm              95dasd          95zfcp         99base
05busybox     90dmraid          95dasd_mod      96securityfs   99fs-lib
10i18n        90dmsquash-live   95debug         97biosdevname  99shutdown
10rpmversion  90kernel-modules  95fstab-sys     97masterkey
50plymouth    90lvm             95resume        98ecryptfs
60xen         90mdraid          95rootfs-block  98integrity
90btrfs       90multipath       95terminfo      98selinux
I don't see any usb modules in there??

In any case which ones would I need in general for what I'm trying to do?


These are all the dracut options available for download:

Code:
dracut-caps.noarch : Dracut modules to build a dracut initramfs which drops
                   : capabilities
dracut-fips.noarch : Dracut modules to build a dracut initramfs with an
                   : integrity check
dracut-modules-olpc.x86_64 : OLPC modules for dracut initramfs
dracut-network.noarch : Dracut modules to build a dracut initramfs with network
                      : support
dracut-tools.noarch : Dracut tools to build the local initramfs
osr-dracut-module.noarch : Dracut modules for open sharedroot
dracut.noarch : Initramfs generator using udev
osr-dracut-module-chroot.noarch : Additional chroot modules for chroot required
                                : open-sharedroot
osr-dracut-module-cluster.noarch : Additional base cluster modules for shared
                                 : booting with open-sharedroot
So am wondering which ones contain the modules I would need; am guessing not the last 2.?
 
Old 01-28-2012, 09:03 AM   #4
RockDoctor
Senior Member
 
Registered: Nov 2003
Location: Minnesota, US
Distribution: Fedora, Ubuntu, Manjaro
Posts: 1,791

Rep: Reputation: 427Reputation: 427Reputation: 427Reputation: 427Reputation: 427
You need kernel modules, not dracut modules. Have a look at the -d and --add-drivers options on the man page.

Although I haven't yet tried what I'm recommending, I hope hou canget it to work. I've got a nice new 2TB external drive from which I'd like to be able to boot on occasion.
 
Old 01-28-2012, 09:05 AM   #5
kayasaman
Member
 
Registered: Sep 2008
Location: Under the bridge where proper engineers walkover
Distribution: Various Linux, Solaris, BSD, Cisco
Posts: 443

Original Poster
Rep: Reputation: 32
Quote:
You need kernel modules, not dracut modules. Have a look at the -d and --add-drivers options on the man page.

Although I haven't yet tried what I'm recommending, I hope hou canget it to work. I've got a nice new 2TB external drive from which I'd like to be able to boot on occasion.
Haha so your using me as your guinea pig... lol



Actually in all my Google'ing I came across this:

http://forums.fedoraforum.org/showthread.php?t=19896

which is very old... Fedora Core 1-3 is being used but they created a shell script:

Code:
#!/bin/nash


mount -t proc /proc /proc
setquiet
echo Mounted /proc filesystem
echo Mounting sysfs
mount -t sysfs none /sys
echo "Loading jbd.ko module"
insmod /lib/jbd.ko
echo "Loading ext3.ko module"
insmod /lib/ext3.ko
echo Creating block devices
mkdevices /dev
echo Creating root device
mkrootdev /dev/root
umount /sys
echo 0x0100 > /proc/sys/kernel/real-root-dev
echo Mounting root filesystem
mount -o defaults --ro -t ext3 /dev/root /sysroot
pivot_root /sysroot /sysroot/initrd
umount /initrd/procEdit your script to load the USB drivers.
#!/bin/nash
mount -t proc /proc /proc
setquiet
echo Mounted /proc filesystem
echo Mounting sysfs
mount -t sysfs none /sys
echo "Loading jbd.ko module"
insmod /lib/jbd.ko
echo "Loading ext3.ko module"
insmod /lib/ext3.ko echo "*** Loading scsi_mod ***"
insmod /lib/scsi_mod.ko
echo "*** Loading sd_mod ***"
insmod /lib/sd_mod.ko
echo "*** Loading usb-storage ***"
insmod /lib/usb-storage.ko
echo "*** Loading usb-uhci ***"
insmod /lib/ehci-hcd.ko
echo "*** Sleeping 5 seconds ***"
/bin/sleep 5echo Creating block devices
mkdevices /dev
echo Creating root device
mkrootdev /dev/rootecho "*** Reread partition table ***"
/sbin/sfdisk -R /dev/sdaumount /sys
echo 0x0100 > /proc/sys/kernel/real-root-dev
echo Mounting root filesystem
mount -o defaults --ro -t ext3 /dev/root /sysroot
pivot_root /sysroot /sysroot/initrd
To do the new adding of modules???

Would I need to do that instead or use dracut of which I have no idea if the modules are included or not as they don't seem to be?
 
Old 01-28-2012, 09:23 AM   #6
kayasaman
Member
 
Registered: Sep 2008
Location: Under the bridge where proper engineers walkover
Distribution: Various Linux, Solaris, BSD, Cisco
Posts: 443

Original Poster
Rep: Reputation: 32
Ok well....

Have just tried this:

Code:
dracut -d ext4:usbcore:sd_mod:ehci_hcd:uhci_hcd:ohci_hcd:usb-storage:scsi_mod --force
Will need to pull the disk out of the 'family' machine now and back into the chassis and my system.

BRB!!
 
Old 01-28-2012, 09:35 AM   #7
kayasaman
Member
 
Registered: Sep 2008
Location: Under the bridge where proper engineers walkover
Distribution: Various Linux, Solaris, BSD, Cisco
Posts: 443

Original Poster
Rep: Reputation: 32
Just to append I did a:

Code:
yum install kernel-devel
before hand.

It didn't work however


Will have a look back at mkinitrd and see if any errors come up there.
 
Old 01-28-2012, 09:44 AM   #8
kayasaman
Member
 
Registered: Sep 2008
Location: Under the bridge where proper engineers walkover
Distribution: Various Linux, Solaris, BSD, Cisco
Posts: 443

Original Poster
Rep: Reputation: 32
Ok just tested with mkinitrd again and still I have a bunch of errors claiming that /lib/modules... no such file or directory????

I'm lost!


Basically ran this again:

Code:
mkinitrd /boot/initramfs-2.6.41.4-1.fc15.x86_64.img 2.6.41.4-1 --preload ext4:usbcore:sd_mod:ehci_hcd:uhci_hcd:ohci_hcd:usb_storage:scsi_mod --force

Last edited by kayasaman; 01-28-2012 at 09:45 AM.
 
Old 01-28-2012, 10:05 AM   #9
kayasaman
Member
 
Registered: Sep 2008
Location: Under the bridge where proper engineers walkover
Distribution: Various Linux, Solaris, BSD, Cisco
Posts: 443

Original Poster
Rep: Reputation: 32
well....

am totally out of ideas now.

I managed to figure out that a line in Grub was wrong: '(hd1,msdos1)' should infact read '(hd1,msdos0)'.


Personally I think that the modules I'm trying to load are either incorrect or their names are wrong!

Code:
locate usb | grep storage
revials usb-storage not usb_storage... so in this case until I know that I have the right modules and 'are' infact loading them I will wait for someone with better/more ideas.
 
Old 01-28-2012, 11:13 PM   #10
RockDoctor
Senior Member
 
Registered: Nov 2003
Location: Minnesota, US
Distribution: Fedora, Ubuntu, Manjaro
Posts: 1,791

Rep: Reputation: 427Reputation: 427Reputation: 427Reputation: 427Reputation: 427
Currently running F16, if that makes a diference. I tried looking for all of the modules you're trying to load, and came up with the following:
Code:
~$ locate hcd
/lib/modules/3.2.1-3.fc16.i686/kernel/drivers/usb/host/isp1362-hcd.ko
/lib/modules/3.2.1-3.fc16.i686/kernel/drivers/usb/host/sl811-hcd.ko
/lib/modules/3.2.1-3.fc16.i686/kernel/drivers/usb/host/u132-hcd.ko
/lib/modules/3.2.1-3.fc16.i686/kernel/drivers/usb/host/whci/whci-hcd.ko
~$
I can tell you that
Code:
dracut -H --add-drivers usb-storage test3initramfs `uname -r`
did generate an initramfs file called test3initramfs (as it should); it's less than half the size of the default initramfs. Haven't tried booting from it, and don't currently have my external drive to try it on.
 
Old 01-29-2012, 02:59 AM   #11
kayasaman
Member
 
Registered: Sep 2008
Location: Under the bridge where proper engineers walkover
Distribution: Various Linux, Solaris, BSD, Cisco
Posts: 443

Original Poster
Rep: Reputation: 32
I tried again using:

Code:
usbcore whci-hcd: usb-storage ehci-usb
for the

Quote:
dracut -H --add-drivers usb-storage test3initramfs `uname -r`
command you posted.


I had the same result I couldn't boot and instead got the C/H/S values error again
 
Old 01-29-2012, 09:58 AM   #12
kayasaman
Member
 
Registered: Sep 2008
Location: Under the bridge where proper engineers walkover
Distribution: Various Linux, Solaris, BSD, Cisco
Posts: 443

Original Poster
Rep: Reputation: 32
Ok not sure if one needs to do this actually!

I did manage to boot in the end and let this be a lesson for anyone with USB3.0 architecture/port in their machine... the BIOS detection is still iffy - for booting at least!


The problem was solved ...ok am gona tell the long and boring version


Basically I discovered this:

http://lists.gnu.org/archive/html/he.../msg00022.html

which led me to try to do this:


Code:
insmod part_msdos
insmod usb
insmod usbms
insmod ext2
insmod gzio
set root (hd1,msdos1)

This didn't work why????

I typed in ls and hd0 was mentioned and all the partitions that were on it but no hd1????


Ok so referring to the link I thought that Grub being installed on the USB drive may make Grub2 of F16 go funny as the disk sectors would be all screwy from Grubs perspective.


I then tried a failing (or failed) USB IDE enclosure of a really old disk and tried to ls from Grub with that.

Before I got into Grub the BIOS came up with no bootable partition found LOL


Right now the issue was just to stick my USB 3.0 enclosure into the same port and viola everything works!!!!! Bypass Grub2 of hd0 or sda altogether......


I think the USB 3.0 architecture still has a few kinks in it that need to be ironed out or my particular BIOS version can't boot it? Either way the 'powered' USB 2.0 port did the trick.



RockDoctor.... thanks for all the help much appreciated.... now GO BOOT YOUR ENCLOSURE :P


It should JUST work!!!
 
  


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
creating live usb image using moblin image creator 2 mobquest Linux - Newbie 0 07-08-2009 11:35 PM
qemu boot of live USB image hands loading initrd.img poblano Linux - Software 1 03-09-2008 09:45 AM
USB Installation hangs at creating initrd SUSE 10.1 oozie SUSE / openSUSE 4 10-22-2006 04:45 PM
creating initrd to boot from LVM jcai Linux - General 3 06-12-2006 01:04 PM
Creating custom initrd image in suse 9.1 Anmol SUSE / openSUSE 1 01-08-2005 02:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora

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