LinuxQuestions.org
Help answer threads with 0 replies.
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 07-20-2007, 10:31 AM   #1
PaulFXH
Member
 
Registered: Jul 2007
Location: Belo Horizonte, MG, Brazil
Distribution: Ubuntu, Mint, Haiku
Posts: 54

Rep: Reputation: 15
Mounting with "-o loop"


I have been trying to access the unzipped version of initrd.img in PCLOS using a loopback filesystem but cannot get this command to work:
Code:
mount -o loop /tmp/initrd /mnt/loop
When I try it, I repeatedly get this error message:
Code:
mount: you must specify the filesystem type
and after this, nothing is available in the /mnt/loop directory.
Although I have googled extensively on this, I can't seem to come up with an answer as to why this won't work for me.

I have also tried this essentially the same command in Mandriva
Code:
mount initrd.mdk -o loop /mnt/images
but get exactly the same error message that I get in PCLOS. So, the problem doesn't seem to be distro-specific.

I have tried running the command
Code:
modprobe loop
but this did not at all improve matters.

However, before running
Code:
mount -o loop /tmp/initrd /mnt/loop
I tried
Code:
mkfs -t ext2 /tmp/initrd
This time, the mount command proceded without any error message. However, the directory to which /tmp/initrd was supposed to be mounted remained empty.

I hope somebody can help me understand what's going wrong here and what I need to do to get this loopback mount command to work.

Thanks
Paul
 
Old 07-20-2007, 10:38 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

The first mount command you tried said it all: mount: you must specify the filesystem type

Try something like this:

mount -o loop -t iso9660 /tmp/initrd /mnt/loop

the -t iso9660 could be different (ext2, vfat etc etc).

Hope this helps.
 
Old 07-20-2007, 04:59 PM   #3
PaulFXH
Member
 
Registered: Jul 2007
Location: Belo Horizonte, MG, Brazil
Distribution: Ubuntu, Mint, Haiku
Posts: 54

Original Poster
Rep: Reputation: 15
Thanks for your suggestion.
However, when I tried this I got this error:

Code:
wrong fs type, bad option, bad superblock on /dev/loop0,
       missing codepage or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so
dmesg | tail then gives me

Code:
[   68.473635] kjournald starting.  Commit interval 5 seconds
[   68.474355] EXT3 FS on sdb13, internal journal
[   68.474452] EXT3-fs: mounted filesystem with ordered data mode.
[   68.516971] kjournald starting.  Commit interval 5 seconds
[   68.517665] EXT3 FS on sdb11, internal journal
[   68.517777] EXT3-fs: mounted filesystem with ordered data mode.
[   72.696973] vmnet1: no IPv6 routers present
[   72.860765] vmnet8: no IPv6 routers present
[ 1562.949897] loop: loaded (max 8 devices)
[ 1653.830289] VFS: Can't find an ext2 filesystem on dev loop0
Absolutely the only way I can get the "mount -o loop" command to do anything without errors is to use mkfs beforehand.
Even then, it doesn't seem to actually do what it's supposed to i.e. mount the initrd directory.
It seems there is no easy solution to this one.
 
Old 07-21-2007, 07:01 AM   #4
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

I just downloaded the pclinuxos-2007.iso.

After mounting this iso (mount -o loop -t iso9660 /data/Downloads/pclinuxos-2007.iso /mnt/loop1/) I copied the /mnt/loop1/isolinux/initrd.gz to /mnt and unzipped it.

After that I can mount the initrd file with the following command: mount -t ext2 -o loop /mnt/initrd /mnt/loop2

The only 2 directories I had to create: /mnt/loop1 and mnt/loop2 (using the mkdir command, no need for mkfs).

What command(s) did you actually use to get the 'wrong fs type, bad option....' message?

Hope this helps.
 
Old 07-23-2007, 06:28 PM   #5
PaulFXH
Member
 
Registered: Jul 2007
Location: Belo Horizonte, MG, Brazil
Distribution: Ubuntu, Mint, Haiku
Posts: 54

Original Poster
Rep: Reputation: 15
Thanks for your reply and sorry for the delay in replying but I took the weekend off. It certainly seems that what I'm trying to do should be relatively easy. Unfortunately, for me it simply refuses to work.
Actually, right now I'm working on the Mandriva issue I mentioned in the first post.

Here is exactly what I've done. Note that, because I can't as yet boot into my Mandriva system, to do the below commands, I've first chroot-ed into the Mandriva system:
Code:
cd /boot
cp initrd-2.6.17-13mdvlegacy.img /root
cd /root
mv initrd-2.6.17-13mdvlegacy.img initrd.img.gz
gunzip initrd.img.gz
mkdir /mnt/images
mount initrd.img -o loop /mnt/images
the last command results in this error message:
Code:
mount: you must specify the filesystem type
If I substitute the last command with
Code:
mount -t ext2 initrd.img -o loop /mnt/images
I get this error
Code:
mount: wrong fs type, bad option, bad superblock on /dev/loop0,
       missing codepage or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so
If I substitute the above last command with
Code:
mount -t ext2 -o loop initrd.img /mnt/images
I get the exact same error message.
Any idea where I'm going wrong?
Thanks
Paul
 
Old 07-24-2007, 04:40 AM   #6
gloriant
Member
 
Registered: Sep 2004
Distribution: Debian{Woody,Sarge,Etch}, UbuntuLTS6.06, SuSE{6.2,8.0}
Posts: 42

Rep: Reputation: 16
it is possible there's no kernel support for the fs-type of your initrd. There are some initrd's that are minix for instance, and that's I guess not always standard compiled (anymore).
Code:
mount -o loop -t minix initrd.img /tmp/initrd
Have you tried to mount the compressed image ? Many kernels allow the mounting of compressed ram fs (cramfs)
Code:
mount -o loop -t cramfs initrd.img.gz /tmp/initrd
However if minix or cramfs is not compiled in your kernel, you're up for a kernel-reconfigure-recompile cycle.
 
Old 07-24-2007, 04:54 AM   #7
pwc101
Senior Member
 
Registered: Oct 2005
Location: UK
Distribution: Slackware
Posts: 1,847

Rep: Reputation: 128Reputation: 128
You might be able to determine what type of file system the initrd.img has by using file:
Code:
file initrd.img
This has worked for me in the past.
 
Old 07-24-2007, 05:24 AM   #8
PaulFXH
Member
 
Registered: Jul 2007
Location: Belo Horizonte, MG, Brazil
Distribution: Ubuntu, Mint, Haiku
Posts: 54

Original Poster
Rep: Reputation: 15
Thanks for the replies.
Here's what I did following your advice:

1)
Code:
paul@paul:~/Desktop$ file initrd.img.gz
initrd.img.gz: gzip compressed data, from Unix, last modified: Fri Jul  6 20:27:45 2007, max compression
2)After unzipping the above initrd.img.gz file the file type becomes:
Code:
paul@paul:~/Desktop$ file initrd.img
initrd.img: ASCII cpio archive (SVR4 with no CRC)
3) Using the mount command on the zipped file as shown in gloriant's post, I get the following:
Code:
paul@paul:~/Desktop$ sudo mount -o loop -t cramfs initrd.img.gz initrd
mount: wrong fs type, bad option, bad superblock on /dev/loop0,
       missing codepage or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so
Ringing any bells?

Thanks
Paul
 
Old 07-24-2007, 05:35 AM   #9
pwc101
Senior Member
 
Registered: Oct 2005
Location: UK
Distribution: Slackware
Posts: 1,847

Rep: Reputation: 128Reputation: 128
I googled about cpio archives, and came across this thread: http://www.linuxquestions.org/questi...d.php?t=333913

Might have something you can try?...
 
Old 07-24-2007, 05:39 AM   #10
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 57
When you chrooted, did you mount /proc and /dev ?
 
Old 07-24-2007, 08:02 AM   #11
PaulFXH
Member
 
Registered: Jul 2007
Location: Belo Horizonte, MG, Brazil
Distribution: Ubuntu, Mint, Haiku
Posts: 54

Original Poster
Rep: Reputation: 15
Thanks for the replies.

@pwc101
Yes, I know how to open a cpio archive using
Code:
cpio -i -d -H newc -F initrd.img --no-absolute-filenames
This gives a bunch of folders/files. In the lib folder are contained all of the existing modules/drivers in the initrd.img.
So, possibly, I can just add the extra modules/drivers I need in the /lib folder and re-compress it as a cpio archive and then gzip that.
Don't yet know how to re-compress a decompressed cpio but worth a look.
Nevertheless, even if this turns out to be a viable alternative method to achieve what I want, I would certainly like to know why the "mount -o loop" command that is widely described for accessing initrd.img files just won't work for me.

@nx5000
Before I chrooted to /media/disk-13, I used
Code:
mount --bind /dev /media/disk-13/dev
However, didn't mount /proc
Nevertheless, I have since tried the "mount -o loop" command without any chroot (actually within Ubuntu) and I get the exact same error messages.
So, don't believe the mount fails because I chrooted.
 
Old 07-24-2007, 08:36 AM   #12
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 57
I always use the cpio command for unpacking/repacking cpio archives, I don't think there is support in loop; it's not a FS, it is only an archive, like tar.

cd /tmp
mkdir initrd
cd initrd
zcat /boot/initrd.img-2.6.24 | cpio -H newc -idv
Make modifications
Then repack
find . -depth -print | cpio -o | gzip -9 >/tmp/initrd-new.img-2.6.24
 
Old 07-24-2007, 10:01 AM   #13
PaulFXH
Member
 
Registered: Jul 2007
Location: Belo Horizonte, MG, Brazil
Distribution: Ubuntu, Mint, Haiku
Posts: 54

Original Poster
Rep: Reputation: 15
Thanks for this suggestion.
A dry-run I tried just now seems to work fine although I'm puzzled as to how the "repack" command knows to include ALL of the folders released when the "parent" initrd.img was opened.
However, it's more important that it works rather than that I understand it.
When I try the "real thing" later tonight, I'll have to do it in a chroot environment as I'm unable to boot into my Mandriva system any other way fr the moment.
If you foresee any problems doing this through chroot, perhaps you'd let me know although I don't see why it should be a problem.
I'll post again if this works.
 
Old 07-24-2007, 11:11 AM   #14
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 57
Quote:
Originally Posted by PaulFXH
Thanks for this suggestion.
A dry-run I tried just now seems to work fine although I'm puzzled as to how the "repack" command knows to include ALL of the folders released when the "parent" initrd.img was opened.
The find does not know anything, you just ask to pack ALL files included in /tmp/initrd (in my example). That's why I create a new directory to not mess with other files in /tmp
 
Old 07-25-2007, 04:20 AM   #15
PaulFXH
Member
 
Registered: Jul 2007
Location: Belo Horizonte, MG, Brazil
Distribution: Ubuntu, Mint, Haiku
Posts: 54

Original Poster
Rep: Reputation: 15
OK, I tried out your suggestion in full and it "seems" to have created a viable initrd.img Your method seems at least as simple as that which I was trying and is possibly even easier.
However, the reason I'm sounding dubious is that I still haven't managed to get the initrd.img configuration right in that I still can't boot to Mandriva from the usb HDD.
It appears something in there is preventing this drive from restarting during the initial RAMdisk reading.
But that's another issue that I'm going to post to the Hardware section of this forum.
Thanks a lot for your help
Paul

Last edited by PaulFXH; 07-25-2007 at 04:22 AM.
 
  


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
bash script: how do I refer to a counter i in a "for i in" loop frankie_DJ Programming 5 07-24-2007 08:45 AM
crypto, "shred", ext3, and loop device expaand Linux - Security 8 06-26-2006 07:46 AM
Install stops at "Calibrating delay loop" eam Linux - General 0 07-23-2004 07:39 PM
PHP "for.. loop" to insert into mysql Boby Programming 10 05-29-2004 10:07 AM
hang during "Calibrating Delay Loop...."? ninereeds Linux - Hardware 3 07-21-2003 07:01 AM

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

All times are GMT -5. The time now is 08:22 PM.

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