Linux - GeneralThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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 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.
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?
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
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.
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
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.
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
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.
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
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
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.