Loop device

email.listen at googlemail.com email.listen at googlemail.com
Thu Jun 8 14:21:41 UTC 2006


Am Thu, 8. June 2006 12:44 schrieb Vignesh:
> First things first , Thanks Thomas for the time you spent on this...
I will never forget the trouble I had when I used loop devices for creating a 
cloop image. As I like to say, 'Often I was close to bite the edge of the 
table' (german: Oft war ich kurz davor in die Tischkante zu beissen)
Not to forget I only had Internet in the university and my computer was at 
home...

> I renamed the iso image to ubuntu.iso
>
> root at ubuntu:/home/vignesh # mount -o loop -t iso9660 ubuntu.iso mnt
> mount: could not find any device /dev/loop#
>
> Before Reboot
> root at ubuntu:~ # ls -lR /dev/loop*
> ls: /dev/loop*: No such file or directory
>
> After Reboot
>
> root at ubuntu:~ # ls -lR /dev/loop*
> ls: /dev/loop*: No such file or directory
Uuups :-/
I would expect an /etc/loop/ directory containing entries 0 to 7 or 
devices /dev/loop0 to /dev/loop7.
What makes me think may be you deleted them?
If you build your own customised live-cd ther must have been at least one loop 
device. No loop device, no cloop to build an own live-cd. Cloop uses a loop 
device too.

Never mind, there is always a way to solve a problem in GNU/Linux universe...

If you do a:
ls /dev/MA*

You will find a '/dev/MAKEDEV' which is a link to /sbin/MAKEDEV.
Precisely MAKEDEV is a shell script to create device entries in /dev/.
A 'man MAKEDEV' gives a lot of information about its services, a bit confusing 
for beginners. In short, chapter standard devices says that it will create 
loop devices from 0 to 7 if it is started as 'MAKDEV loop'.
You have to be in the /dev directory first before starting MAKEDEV!

So open a terminal, become root by typing:
sudo -s
Enter your user password, go to the /dev directory (use cd).
And then start:
MAKEDEV loop

You shoult see the new loop0 to loop 7 devices when you type:
ls -lR /dev/loop*

see also [1]

Now follow my last posting for mounting the iso image.
(we are getting closer to solve your problem :-))


[1] Background information

This (using MAKEDEV) was for a hoary system 
For a Dapper system the loop devices will disappear in the next reboot. 
This because dapper uses udev which creates devices in a much more dynamic way 
than it is done in hoary which uses devfs.

For dapper there are two ways to have all loop devices at bootup.
1) As recommended in /usr/share/doc/udev/README.gz:
  - It is recommended to use the /lib/udev/devices directory to place
    device nodes and symlinks in, which are copied to /dev at every boot.
    That way, nodes for broken subsystems or devices which can't be
    detected automatically by the kernel, will always be available.

So open a terminal and become root.
Go to the /lib/udev/devices/loop/ directory.
(A 'ls -l' shold show a device 0)

Create the new loop devices from 1 to 7 by typing:
mknod 1 b 7 1
mknod 2 b 7 2
mknod 3 b 7 3
mknod 4 b 7 4
mknod 5 b 7 5
mknod 6 b 7 6
mknod 7 b 7 7

Restart udev by typing:
/etc/init.d/udev restart

You now should see the new devices by typing:
ls -lR /dev/loop*


2) An entry in /etc/udev/links.conf

Start gedit as root, press <Alt>+<F2> and type:
sudo gedit /etc/udev/links.conf

Paste the following:

# hack to have loop devices from loop/0 to loop/7
M loop/1 b 7 1
M loop/1 b 7 1
M loop/2 b 7 2
M loop/3 b 7 3
M loop/4 b 7 4
M loop/5 b 7 5
M loop/6 b 7 6
M loop/7 b 7 7

Save the file.

Restart udev from a terminal by typing (as root):
/etc/init.d/udev restart

You now should see the new devices by typing:
ls -lR /dev/loop*

> root at ubuntu:~ # mount
> /dev/hda5 on / type ext3 (rw,errors=remount-ro)
> proc on /proc type proc (rw)
> sysfs on /sys type sysfs (rw)
> devpts on /dev/pts type devpts (rw,gid=5,mode=620)
> tmpfs on /dev/shm type tmpfs (rw)
> /dev/hda2 on /mnt/shared type ext3 (rw,noexec,nosuid,nodev)
> usbfs on /proc/bus/usb type usbfs (rw)
Ok, no loop mounted.

>
>  The image is my custom made Hoary livecd`s iso so I don`t remember the
> exact md5sum but I got this...
If it is your own iso image it may be a good idea for the next image you 
create also create an md5 file.
For this open a terminal and go to the directore where the image is stored.

To create a md5 file type:
md5sums Nameofyourimage.iso > Nameofyourimage.iso.md5

So you may check your own images md5 sum the next time.
A 'md5sums Nameofyourimage.iso' shold always be the same what is saved 
in 'Nameofyourimage.iso.md5'


> root at ubuntu:/home/vignesh # md5sum ubuntu.iso
> 58d90d71192b0436343871919d8cd310  ubuntu.iso
>
> root at ubuntu:/home/vignesh # file ubuntu.iso
> ubuntu.iso: data
>
> This is what I get.. So I can`t use this to make my next version of the
> livecd or what. I have a burned version of the bootable livecd , can I
> use that to make a bootable iso ?
A bootable iso?
You are talking of an iso image which is used on bootup to start the system?
As far as I know, no.

But you can use a live cd to customize it to your needs.
For this you may find informations on the site of Klaus Knopper, the man who 
brought Knoppix to us. (Applause, Laola, Soundtrac of a bombastic movie, 
somewhat like Franfred Man's Earth Band, Fanfare for a Common Man)


> OK... I copied the Hoary live iso.. I will use that itself..
Hmmm. it might be a better idea to use one of the dapper live CD's.
Or better than that, use a Knoppix. This because knoppix uses the unionfs file 
system, one of the most best advantages in my opinion.


> root at ubuntu:~ # mount -o loop -t iso9660 ubuntu-5.04-live-i386.iso mnt
> mount: could not find any device /dev/loop#
Ok, that is what we should expect. No loop device no loop mount.
And this sounds much better than the messages you showed in your former 
postings. 

> root at ubuntu:~ # file ubuntu-5.04-live-i386.iso
> ubuntu-5.04-live-i386.iso: ISO 9660 CD-ROM filesystem data 'Ubuntu 5.04
> i386            ' (bootable) root at ubuntu:~ #
>
OK, this is the original hoary live-cd, isn't it?


I would say after creating new loop devices you should be able to mount your 
image.

regards,
thomas




More information about the ubuntu-users mailing list