LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 01-06-2005, 05:29 PM   #1
Law1213
Member
 
Registered: Jul 2004
Location: UK
Distribution: Gentoo
Posts: 52

Rep: Reputation: 17
Angry Mounting boot/initrd.img


Ok guys I need some help here. Im wanting to boot off my usb hard drive so I need to mount my initrd.img and add some usb modules. My problem....well, I cant get the damn initrd.img to mount even when trying the suggested mount commands from various sites.

I've tried the following and a few other variations:-

mkdir initrd
zcat boot/initrd.img > initrd.img
mount initrd.img initrd -o loop

and the mount command always seems to give me the following error:-

/dev/loop0: Invalid argument
mount: you must specify the filesystem type

I've tried specifying a few filesystems, not sure for certain if they are the right ones. People have told me that the command should just work and not ask for one. Any help you can give me on mounting this .img file would be helpful.

Thanks.
 
Old 01-06-2005, 08:49 PM   #2
jailbait
Guru
 
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Debian Wheezy, Debian Jessie
Posts: 7,472

Rep: Reputation: 154Reputation: 154
"I've tried the following and a few other variations:-

mkdir initrd
zcat boot/initrd.img > initrd.img
mount initrd.img initrd -o loop

and the mount command always seems to give me the following error:-

/dev/loop0: Invalid argument
mount: you must specify the filesystem type"

You are using the mount command and the mount command is calling the losetup command. I suggest that you try splitting your command into a losetup command followed by a mount command. This is no more likely to work than the combined command but it may help you isolate where the error is.

losetup -d /dev/loop0
echo "$?"
mount /dev/loop0 initrd
echo "$?"

The echo commands will give you the return codes from the commands.

If you have problems with /dev/loop0 try /dev/loop1 etc. Maybe something is already using /dev/loop0.

-------------------
Steve Stites

Last edited by jailbait; 01-06-2005 at 08:51 PM.
 
Old 01-07-2005, 11:17 AM   #3
Law1213
Member
 
Registered: Jul 2004
Location: UK
Distribution: Gentoo
Posts: 52

Original Poster
Rep: Reputation: 17
Unhappy

Ok I gave it a try and got the following results:-

root@chris-laptop boot]# losetup -d /dev/loop0
ioctl: LOOP_CLR_FD: No such device or address
[root@chris-laptop boot]# echo "$?"
1
[root@chris-laptop boot]# mount /dev/loop0 initrd
/dev/loop0: Invalid argument
mount: /dev/loop0: can't read superblock
[root@chris-laptop boot]# losetup -d /dev/loop1
ioctl: LOOP_CLR_FD: No such device or address
[root@chris-laptop boot]# mount /dev/loop1 initrd
/dev/loop1: Invalid argument
mount: /dev/loop1: can't read superblock

Thanks for the suggestion btw.

Not having much luck here, any more ideas would be most welcome. I have also tried using the slackware boot cd and using the console from there with the same errors, Im guessing Im missing something with the mount command. btw, does anyone know the actual parameter for the filesystem type when mounting a .img file so I can be sure that it is not the problem.
 
Old 01-07-2005, 01:46 PM   #4
jailbait
Guru
 
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Debian Wheezy, Debian Jessie
Posts: 7,472

Rep: Reputation: 154Reputation: 154
"root@chris-laptop boot]# losetup -d /dev/loop0
ioctl: LOOP_CLR_FD: No such device or address"

Sounds like you are missing your loop devices. Check to see if /dev/loop0 through /dev/loop7 exist.

------------------------
Steve Stites
 
Old 01-07-2005, 05:17 PM   #5
Law1213
Member
 
Registered: Jul 2004
Location: UK
Distribution: Gentoo
Posts: 52

Original Poster
Rep: Reputation: 17
Unhappy

/dev/loop0 to loop7 are listed
 
Old 01-07-2005, 06:08 PM   #6
jailbait
Guru
 
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Debian Wheezy, Debian Jessie
Posts: 7,472

Rep: Reputation: 154Reputation: 154
"/dev/loop0 to loop7 are listed"

It is possible that your loop module was compiled as a loadable module. If the loop module is not loaded then you would probably get the error message that the loop device does not exist. Also in my previous test I may have had the file name and mount point backwards. Try this test:

lsmod
(look to see if loop is loaded)
modprobe loop
echo "$?"
lsmod
(look to see if loop is loaded)
(Then run the following commands regardless of whether modprobe worked because loop might be part of the bootable kernel instead of being loadable.)
losetup /dev/loop0 initrd.img
echo "$?"
mount /dev/loop0 initrd
echo "$?"


or you could try:
modprobe loop
echo "$?"
mount initrd initrd.img -o loop
echo "$?"

-----------------------------
Steve Stites

Last edited by jailbait; 01-07-2005 at 06:21 PM.
 
Old 01-08-2005, 08:20 AM   #7
Law1213
Member
 
Registered: Jul 2004
Location: UK
Distribution: Gentoo
Posts: 52

Original Poster
Rep: Reputation: 17
Thumbs up Getting there

Hey,

You were right about the module not being loaded I managed to get the commands working as far as:-

lsmod
modprobe loop
echo "$?"
lsmod
losetup /dev/loop0 initrd.img (this worked successfully)

but it failed on mount /dev/loop0 initrd, with the error

[root@chris-laptop boot]# mount /dev/loop0 initrd
/dev/loop0: Invalid argument
mount: you must specify the filesystem type

I also tried the following:-

[root@chris-laptop boot]# modprobe loop
[root@chris-laptop boot]# echo "$?"
0
[root@chris-laptop boot]# mount initrd.img initrd -o loop
/dev/loop0: Invalid argument
mount: you must specify the filesystem type
[root@chris-laptop boot]# echo "$?"
32
[root@chris-laptop boot]#

Thanks for the help so far

btw I also tried the following site (its for handhelds but I believe the commands should still work) without success: http://www.handhelds.org/handhelds-faq/filesystems.html (might be useful for some ideas)

Last edited by Law1213; 01-08-2005 at 08:52 AM.
 
Old 01-08-2005, 09:36 AM   #8
ValidiusMaximus
Member
 
Registered: Mar 2004
Distribution: Debian Sarge
Posts: 169

Rep: Reputation: 30
initrd kernels are the devil
 
Old 01-08-2005, 05:28 PM   #9
jailbait
Guru
 
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Debian Wheezy, Debian Jessie
Posts: 7,472

Rep: Reputation: 154Reputation: 154
"but it failed on mount /dev/loop0 initrd, with the error

[root@chris-laptop boot]# mount /dev/loop0 initrd
/dev/loop0: Invalid argument
mount: you must specify the filesystem type"

As I said before I may have confused your initrd and intird.img. What losetup does is to set up a correspondence between a file system and a file. This way you can create a file system within an ordinary file. I think that you are using initrd as the file system name and initrd.img as the file name. (In previous posts I may have scrambled your usage of these names. Also I am assuming that you have these two files set up correctly.) The losetup command sets up initrd as a file system which can be referenced as wither /dev/loop0 or initrd. Then the mount command mounts the initrd file system on the initrd.img file. So assuming that I have the names straight then the following command sequence should work:

modprobe loop
losetup /dev/loop0 initrd
mount -t ext2 /dev/loop0 initrd.img

If this does not work then I think the next thing to explore is exactly what are initrd and initrd.img and how you set them up.

-----------------------
Steve Stites
 
Old 01-09-2005, 07:54 AM   #10
Law1213
Member
 
Registered: Jul 2004
Location: UK
Distribution: Gentoo
Posts: 52

Original Poster
Rep: Reputation: 17
Thumbs up Woo I've done it

After getting fed up of trying to mount my initrd.img (and corrupting it oops) I used the mkinitrd command to generate a new initrd.img and added the modules I needed, still I plan on looking into figuring out how to mount this for the future, but right now I have a whole load of new problems I need to sort out

Thanks alot for all your help
 
Old 01-25-2005, 02:37 PM   #11
ErikEngerd
LQ Newbie
 
Registered: Oct 2003
Posts: 6

Rep: Reputation: 0
Hi,


I had the same problem that you had, but digging around a bit in the script /sbin/mkinitrd, I found the solution.

The reason you cannot mount the initrd image is because it is zipped.
If you do the following:

cp initrd myrd.gz
gunzip myrd.gz
mkdir /mnt/initrd
mount -t ext2 -oloop myrd /mnt/initrd

Then it works. Luckily, mkinitrd is just a shell script and not a binary file.

Cheers
Erik
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Kernel Panic - Missing "initrd.img-2.6.8-2-686" in /boot MKSrivastava Debian 2 12-02-2005 03:09 PM
how to make initrd.img for your kernel without boot disk? donaldtalbert Linux - Software 1 06-19-2005 10:30 PM
Initrd.img spaguzz Linux - Software 1 12-09-2004 03:21 PM
initrd.img php_rocks Linux - Newbie 1 08-31-2003 11:20 PM
No /boot/initrd*.img in RH7? stoub Linux - Newbie 0 12-15-2002 10:59 PM


All times are GMT -5. The time now is 02:57 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration