6. Answers to Frequently Asked Questions

6.1. How can a non-root user mount and unmount discs?

Most mount commands support the user option. If you make an entry such as the following in /etc/fstab:

/dev/sbpcd  /mnt/cdrom   iso9660     user,noauto,ro

then an ordinary user will be allowed to mount and unmount the drive using these commands:

% mount /mnt/cdrom
% umount /mnt/cdrom

By default the disc will be mounted with some options that help enforce security (e.g. programs cannot executed, device files are ignored). If this is too restrictive you can use additional options (e.g. the "exec" option will enable execution or programs). See the mount(8) man page for details.

Another method is to get the usermount package which allows non-root users to mount and unmount removable devices such as floppies and CD-ROMs, but restricts access to other devices (such as hard disk partitions). It is available on major archive sites.

Yet another option is to use the sudo program which allows users to run selective programs with root privileges.

6.2. Why do I get device is busy when unmounting a CD-ROM?

The disc cannot be unmounted if any processes are accessing the drive, including having their default directory set to the mounted filesystem. If you cannot identify the processes using the disc, you can use the fuser command, as shown in the following example.

% umount /cdrom
umount: /dev/hdd: device is busy
% fuser -v /cdrom
                     USER       PID ACCESS COMMAND
/mnt/cdrom           tranter    133 ..c..  bash

On some systems you may need to be root when running the fuser command in order to see the processes of other users.

6.3. How do I export a CD-ROM to other hosts over NFS?

You need to add an entry to the /etc/exports file. Users on other machines will then be able to mount the device. See the exports(5) man page for details.

6.4. Can I boot Linux from a CD-ROM?

Most Linux distributions support directly booting a Linux kernel from CD as an alternative to a boot floppy. This requires a bootable CD and ROM BIOS and CD-ROM drive which supporting booting from CD.

The latest version of mkisofs supports creating such disks using the El Torito standard for bootable CDs.

6.5. How can I read digital data from audio CDs?

Heiko Eissfeldt (heiko@colossus.escape.de) and Olaf Kindel have written a utility that reads audio data and saves it as .wav format sound files. The package is called cdda2wav.tar.gz and can be found on www.ibiblio.org.

Another utility to extract digital audio is cdparanoia available from http://www.xiph.org/paranoia.

Because CD-ROM drives are changing very quickly, it is difficult to list which models support reading digital data. Your best bet is to get the latest cdda2wav or cdparanoia package and read the documentation.

For more information on this subject, see the web site http://www.tardis.ed.ac.uk/~psyche/cdda/ and the alt.cd-rom FAQ listed in the references section.

6.6. Why doesn't the find command work properly?

On ISO-9660 formatted discs without the Rock Ridge Extensions, you need to add the -noleaf option to the find command. See the find(1) man page for details.

(In my experience virtually all recent Linux CDs use the Rock Ridge extensions, so this problem should occur very rarely.)

6.7. Does Linux support any recordable CD-ROM drives?

Linux supports most CD-R and CD-RW drives. The cdrecord and mkisofs tools can be used to burn CDs, there are also many graphical front-ends to these tools. For more information see the Linux CD-Writing HOWTO.

6.8. Why do I get mount: Read-only file system when mounting a CD-ROM?

CD-ROM is a read-only media. With some early kernels you could mount a CD-ROM for read/write; attempts to write data to the CD would simple be ignored. As of kernel version 1.1.33 this was corrected so that CD-ROMs must be mounted read only (e.g. using the -r option to mount).

6.9. Why does the disc tray open when I shut down the system?

The sbpcd driver supports automatically ejecting the CD when it is unmounted. In some older kernel versions this was the default behaviour. If you shut down the system, a mounted CD will be unmounted, causing it to eject.

This feature is for convenience when changing discs. If the tray is open when you mount or read a CD, it will also automatically be closed.

I found that this caused problems with a few programs (e.g. cdplay and workbone). As of the 1.1.60 kernel you can control this feature under software control. A sample program is included in the sbpcd documentation file (or use the eject program). You can also control the default behaviour by editing the kernel source file sbpcd.h.

6.10. I have a "special" CD that can't be mounted

If you have a particular disc that cannot be mounted, here are some possible reasons:

  1. It is an XA, CD-R, or CD-RW disc and your drive or the Linux driver does not support reading these discs (this is only likely for very old drives).

  2. It is a DVD disc, which is only readable by a DVD-ROM drive.

  3. The disc doesn't use an ISO-9660 file system (e.g. some use SunOS or HFS).

  4. It is an audio CD.

  5. The CD is damaged or defective.

  6. You put it in the drive upside down :-)

6.11. Do multi-platter CD-ROM drives work with Linux?

Several users have reported success with SCSI multi-disc CD-ROM changers. You probably need to enable the "Probe all LUNs on each SCSI device" kernel configuration option (this is not necessary if your CD changer is already known to the SCSI-driver. Have a look at /usr/src/linux/drivers/scsi.c).

At least one user also had to increase a SCSI timeout value in the kernel driver. A symptom of this is an error message like "wrong fs type, bad option, bad superblock on /dev/sr5, or too many mounted file systems" when trying to mount a CD for the first time, but a second mount immediately afterwards succeeds. To increase the timeout increase the value of IOCTL_TIMEOUT at the beginning of /usr/src/linux/drivers/scsi/sr_ioctl.c and recompile the kernel. A value of 10000 instead of the default 3000 is reported to work with a NEC Multispin 4Xc.

It might be necessary to create additional block special files, so that all LUNs can be accessed. A device file is needed for every LUN. So for a 7 disc changer /dev/sr0 to /dev/sr6 are needed (more if you have additional SCSI CD-ROM drives). To create the block special file execute mknod /dev/sr? b 11 ? as root with ? being the required number.

The Nakamichi MBR-7 7 disc changer, NEC Multispin 4Xc and Pioneer 12 disc changer have been reported to work.

EIDE/ATAPI multi-disc changers are also available. The kernel has support for some drives using the CDROM_SELECT_DISC ioctl function. The IDE-CD kernel driver documentation file includes source code for a program to select changer slots, or you can use various utilities such as the eject program described earlier.

6.12. I get "/cdrom: Permission denied" errors

Some CDs have root directory file permissions that only allow user root to read them. This is an error on the part of the CD-ROM vendor and is a real inconvenience. A more common occurrence is for certain files or directories not to be world readable. Some people have patched their kernels to work around the problem.

Also see the related question on hidden files later in this document.

6.13. How do I interpret IDE CD kernel error messages?

What does it mean when I get a kernel message from the IDE CD-ROM driver like "hdxx: code: xx key: x asc: xx ascq: x"?

This is an status/error message from the IDE CD-ROM drive. By default the IDECD driver prints out the raw information instead of wasting kernel space with error messages. You can change the default to display the actual error messages by going into /usr/src/linux/drivers/block/ide-cd.c, changing the value of VERBOSE_IDE_CD_ERRORS to 1, and recompiling the kernel.

6.14. How can I tell what speed CD-ROM I have?

Here's one way. This command measures how long is takes to read 1500K of data from CD:

% time -p dd if=/dev/cdrom of=/dev/null bs=1k count=1500
1500+0 records in
1500+0 records out
real 5.24
user 0.03
sys 5.07

The transfer rate of single speed drives is 150 kilobytes per second, which should take about 10 seconds. At double speed it would take five seconds, quad speed would take 2.5, etc.

The "real" time above is probably the best number to look at -- in this case it indicates a double speed drive. You can increase the amount of data transferred to get a more accurate value (the data does not get cached). You should probably run the command a few times and take the average.

I've also written a small C program that measures and reports CD-ROM data transfer rate; I can send it to you on request.

6.15. My CD-ROM stopped working after Linux was installed

The usual symptom is that the boot disk used to initially install Linux recognized your CD-ROM drive, but after Linux was installed on the hard drive or floppy and rebooted it no longer recognizes the CD-ROM.

The most common reason for this problem is that with some Linux distributions the kernel that is installed on your hard drive (or floppy) is not necessarily the same one that was on your boot disk. You selected a boot disk that matched your CD-ROM hardware, while the kernel you installed is a "generic" kernel that is lacking CD-ROM support. You can verify this by following the troubleshooting guidelines discussed previously in this document (e.g. start by checking /proc/devices).

The solution is to recompile the kernel, ensuring that the drivers for your CD-ROM drive and any others that are needed (e.g. SCSI controller, ISO-9660 file system) are included. See the Kernel HOWTO if you don't know how to do this.

If you passed any command line options to the boot disk (e.g. "hdc=cdrom") you need to add these to your boot program configuration file (typically /etc/lilo.conf).

6.16. There are "hidden" files on a CD which I can't read

Some CDs have files with the "hidden" bit set on them. Normally these files are not visible. If you mount the CD with the "unhide" option then the files should be accessible (this doesn't seem to be documented anywhere).

6.17. Where is the CD-ROM API documented?

If you want to write your own application, such as an audio CD player program, you will need to understand the application programming interface (API) provided by Linux.

Originally the CD-ROM kernel drivers used their own ioctl() functions to support features specific to each drive. Header files such as /usr/include/linux/sbpcd.h describe these. Because many of the drivers were based on other drivers, the interfaces, while not identical, have a lot in common.

More recently there has been an initiative headed by David van Leeuwen (david@tm.tno.nl) to standardize the API for CD-ROM drives, putting common code in one place and ensuring that all drivers exhibit the same behaviour. This is documented in the file /usr/src/linux/Documentation/cdrom/cdrom-standard.tex. Several kernel drivers support this. As of the 2.0 kernel all CD-ROM drivers conform to this API.

My book, Linux Multimedia Guide, goes into quite a bit of detail on how to program CD-ROM drives, especially for audio functions. See the end of the References section.

6.18. Why don't I see long filenames on this Windows CD-ROM?

If you have a CD-ROM which has long filenames under Windows but not under Linux, it may be formatted using Microsoft's proprietary Joliet filesystem. See the next question for a solution.

6.19. Is Microsoft's Joliet filesystem supported?

Microsoft has created an extension to the ISO CD-ROM format called Joliet. It allows for long filenames encoded using the 16-bit UNICODE format.

Starting with version 2.0.34 the Linux kernel has support for the Microsoft Joliet file system extensions. You need to enable support for it in the kernel.

If you want to display filenames with native language characters from Joliet CD-ROMs correctly on the screen, you need to enable support in the kernel for the appropriate NLS ISO8859 character sets.

6.20. Does Linux support "enhanced" CDs?

Some audio CDs are "enhanced" with additional data. Typically you will find that these CDs have the usual audio CD tracks as well as a data track which can be mounted as an ISO-9660 file system.

An enhanced CD I examined had Microsoft Windows and Apple Macintosh applications on it (which won't run directly under Linux of course, although I had partial success running the Windows application under the WINE Windows emulator). There were some GIF images which could be viewed using a standard viewer such as xv and some animations in Apple QuickTime format which could be viewed using the xanim program. It was a multi-session disk which some very old CD-ROM drives do not support reading. On the disc was a readme.txt file containing an Enhanced CD FAQ.

6.21. Does Linux support DVD-ROM?

SCSI and ATAPI compliant DVD-ROM drives should work under Linux for reading discs formatted with an ISO-9660 file system. In other words they will work as a (possibly large) CD-ROM drive.

Many DVD-ROM discs use the UDF file system. Recent kernels have UDF filesystem support.

A number of Linux MPEG-2 DVD players are available. For more information see the DVD Playing HOWTO.

6.22. Does Linux support CD-RW?

SCSI and ATAPI compliant CD-RW drives work under Linux for discs formatted with an ISO-9660 or UDF file system. This includes the ability to write to the disc. Utilities such as cdrecord can be used to erase a disc.

6.23. How do I mount a multi-session disc?

You mount a multi-session disc like any other CD-ROM. The normal behaviour for multi-session support is that the last session will be seen when you mount the disc. You will not see multiple partitions. If it does not work it could be for three reasons:

  1. Your CD-ROM drive does not support reading multi-session CDs (it would probably have to be quite old for this to be the case).

  2. The Linux kernel driver for your CD-ROM type does not support multi-session (mostly only some old proprietary, non-IDE/ATAPI and non-SCSI drives fall into this category).

  3. If you are mounting a CD with a file system other than ISO-9660, then multi-session may not be supported.

6.24. How do I read a CD volume label?

There is a small utility called volname included with recent versions of the eject program. Alternatively you can run this shell command:

dd if=/dev/cdrom bs=1 skip=32808 count=32 

assuming /dev/cdrom is the device file name for your drive.

6.25. My IDE CD-R or CD-RW drive is not working with Linux

You need to use the IDE SCSI emulation driver for writable drives. See the Linux CD-Writing HOWTO for more information.

6.26. Is the insert your brand/model here IDE CD-ROM drive supported?

Yes, of course it is. Linux supports the IDE interface used by all modern IDE CD-ROM drives. It has been like this since kernel version 1.1.85.

6.27. I can't seem to find a driver for my IDE drive in the kernel source?

Unlike for the older proprietary drives, there isn't a specific driver for each model of ATAPI/IDE CD-ROM drives. All drives conforming to the standard should work with the ATAPI CD-ROM driver included in the standard Linux kernel.

6.28. I'm having problems with my CD-ROM on Red Hat 7.1

You may be running into an issue with hardware that does not support DMA (Direct Memory Access). RedHat ships a highly tuned version of the Linux kernel which enables DMA on selected IDE controller chipsets. Information on this issue can be found at http://www.exocore.com/linux/rhl71dma/

Hosting by: Hurra Communications Ltd.
Generated: 2007-01-26 17:58:27