Previous Next Contents

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

The disc will be mounted with some options that help enforce security (e.g. programs cannot executed, device files are ignored); in some cases this may be too restrictive.

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.

The archive site ftp.cdrom.com has the source file mount.c which allows mounting an unmounting of CD-ROMs (only) by normal users. It runs as a setuid executable.

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

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?

When initially installing Linux the most common method is to use a boot floppy. Some distributions allow booting a Linux kernel on CD directly from DOS.

I've been told that it is possible to boot from ATAPI CD-ROM drives which have the appropriate ROM BIOS functions, but I have no first hand experience.

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 sunsite.unc.edu.

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

For more information on this subject, see the web site http://www.tardis.ed.ac.uk/~psyche/pc/cdrom/CDDA.html 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?

The X-CD-Roast package for Linux is a graphical front-end for using CD writers. The package can be found at sunsite.unc.edu in /pub/Linux/utls/disk-management/xcdroast-0.95.tar.gz

Also see the Linux CD-Writer mini-HOWTO document, found at ftp://sunsite.unc.edu/pub/Linux/docs/HOWTO/mini/CD-Writer or http://sunsite.unc.edu/mdw/HOWTO/CD-Writer.html.

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?

As of the 1.1.38 kernel, the sbpcd driver ejects the CD when it is unmounted. 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).

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

The "special" CD is likely an XA disc (like all Photo CDs or "one-offs" created using CD-R drives). Most of the Linux kernel CD-ROM drivers do not support XA discs, although you may be able to find a patch to add support on one of the archive sites.

The sbpcd driver does support XA. If you are using this driver you can determine if the disc is XA using the following procedure: go into the file sbpcd.c and enable the display of the "Table of Contents" (DBG_TOC). Build and install the new kernel and boot from it. During each mount the TOC info will be written (either to the console or to a log file). If the first displayed value in the TOC header line is "20", then it is an XA disc. That byte is "00" with normal disks. If the TOC display shows different tracks, that is also a sign that it is an XA disc.

(thanks to Eberhard Moenkeberg for the above information)

Other possibilities for unreadable CDs are:

  1. The disc doesn't use an ISO-9660 file system (e.g. some use SunOS or HFS)
  2. It is an audio CD
  3. The CD is damaged or defective
  4. 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. At least one user also had to increase a SCSI timeout value in the kernel driver. The Nakamichi MBR-7 7 disc changer and Pioneer 12 disc changer have been reported to work.

EIDE/ATAPI multi-disc changers are also available. The 2.0 kernel has rudimentary support for some drives using the CDROMLOADFROMSLOT ioctl function. The IDE-CD kernel driver documentation file includes source code for a program to select changer slots, or you can use a recent version of 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. The March 1995 InfoMagic CD set is one example. This is a real inconvenience.

The following patch, courtesy of Christoph Lameter ( clameter@waterf.org) patches the kernel to get around this problem.

From: clameter@waterf.org (Christoph Lameter)
Newsgroups: comp.os.linux.setup
Subject: Infomagic Developers Set: Fix for CD-Rom permissions
Date: 12 Apr 1995 20:32:03 -0700
Organization: The Water Fountain - Mining for streams of Living Water
NNTP-Posting-Host: waterf.org
X-Newsreader: TIN [version 1.2 PL2]

The March 1995 Edition of the Infomagic Developers CD-ROM Set has
problems because the information stored in the root directory
permissions is causing the following problems with using the CDs

1. Disc1 will always have the owner/group of 5101/51 and has write
access allowed (?)

2. Disc2 and 3 have rwx set for root and no rights at all for any
other group/user. These discs cannot be accessed from any user other
than root! I run a BBS and I need to make them accessible for download
by others.

I have seen several fixes to this problem already floating
around. Trouble is that these fixes usually change the rights for ALL
directories on the CD. This fix here changes ONLY the rights for the
root directory of the CD-Rom. If you want to run parts of Linux
directly off the CD you might run into trouble if all directories are
readable for everyone and if they are all owned by root.

This fix will set the rights for the root directory to r-xr-xr-x and
the owner/group to the values indicated in the uid and gid options to
the mount command.

To apply:
 cd /usr/src/linux/fs/isofs
 patch <**THIS MESSAGE**

and recompile kernel (you may have to fix up the patch by hand
depending on your kernel version).

This fix should probably be incorporated into the kernel. What business 
does data on a CD have to mess around with the permissions/owners of the 
mount-point anyways?

--- inode.c.ORIG        Wed Apr 12 17:24:36 1995
+++ inode.c     Wed Apr 12 17:59:12 1995
@@ -552,7 +552,15 @@
    these numbers in the inode structure. */
 
        if (!high_sierra)
-         parse_rock_ridge_inode(raw_inode, inode);
+       {  parse_rock_ridge_inode(raw_inode, inode);
+           /* check for access to the root directory rights/owner CL */
+          if((inode->i_sb->u.isofs_sb.s_firstdatazone) == inode->i_ino)
+           { /* Change owner/rights to the ones demanded by the mount command */
+             inode->i_uid = inode->i_sb->u.isofs_sb.s_uid;
+             inode->i_gid = inode->i_sb->u.isofs_sb.s_gid;
+            inode->i_mode = S_IRUGO | S_IXUGO | S_IFDIR;
+           }
+        }
        
 #ifdef DEBUG
        printk("Inode: %x extent: %x\n",inode->i_ino, inode->u.isofs_i.i_first_extent);
@@ -805,4 +813,3 @@
 }
 
 #endif
-

(Note that the above patch is somewhat old and probably won't apply cleanly against recent 2.0 kernels).

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 (in case you were wondering, the data does not get cached). You should probably run the command a few times and take the average.

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).


Previous Next Contents