## 13.1 Setup

One likely cause of your CD/DVD not being found is that the appropriate module has not bee loaded. Try loading ide-scsi to see if that helps!

  # modprobe ide-scsi

If that works you may want to add ide-scsi to /etc/modules so it will be loaded on reboot.

Otherwise, to make use of a CD-ROM device you need to know what device it is mapped to. Let’s assume it is /dev/hde (but look through the output of the dmesg command to see which it is). If the device /dev/hde does not exist (for modern versions of Debian it usually does exist as the devices where identified at boot) you will need to create it with MAKEDEV as root:

  # cd /dev
# ./MAKEDEV hde

As a common convenience /dev/cdrom points to the physical device /dev/hde using a symbolic link:

 # ln -s /dev/hde cdrom

You can then mount any data CD-ROM:

  # mount /dev/cdrom /media/cdrom
# ...
# umount /media/cdrom

If users can not mount the CD-ROM device then they probably don’t have the right permissions. To allow general access to the CD-ROM edit /etc/fstab to add the following line.

  /dev/cdrom  /media/cdrom  auto  defaults,noauto,users,ro,nohide  0 0

Any user can then mount and unmount /media/cdrom, irrespective of who mounted it. Also note that the standard CD-ROM format is iso9660 and the auto in the above could have been this. However, as DVDs become more common using auto allows the udf format to also be recognised with no extra effort.

The GNOME mount applets allow a user to mount and unmount the CD-ROM. Make sure you unmount the CD-ROM before you physically remove the media. (For most drives the eject button is disabled while the CD is mounted.)

The various options in the /etc/fstab line above are: ro which mounts the file system as read-only; users which lets all users mount and unmount the file-system; noauto which means that the file-system is not automatically mounted at boot time; and nohide which shows hidden and associated files.

With the above entry in /etc/fstab the command line mounting of the partition becomes:

  # mount /media/cdrom

By default the CD-ROM device belongs to group disk. For audio CD access the user will need to be a member of the group to which the device belongs. But do not add users to the group disk because this will give them read/write access to raw devices for all disks meaning that they can directly read the bits off the hard disk and effectively ignore file system permissions. Instead change the Unix group of /dev/hde from disk to cdrom and add users who need access to the drive to the group cdrom:

  # chgrp cdrom /dev/hde
# adduser kayon cdrom

Next time user kayon logs on they will be in group cdrom in addition to the other groups they were already in. They will then have access to the CD-ROM device.

### 13.1.1 CD Writer as a SCSI Device

CD writing software for GNU/Linux (prior to kernel 2.6) targets SCSI devices, so you will need to install appropriate drivers so that your ATAPI IDE CD-RW (and your CD-R/DVD if you wish) pretends to be a SCSI device. It will then be identified as /dev/scd0 rather than /dev/hdd.

Turning a IDE CD-RW into a SCSI CD-RW is pretty straightforward. First ensure the appropriate kernel modules are loaded (you need sg and ide-scsi). Use the command lsmod to list the modules currently loaded in the kernel, and the commands modconf or insmod to load the modules. If you already have the drive under the control of ide-cd then you need to get rid of it (as below).

You can ensure these happen at boot time, and the appropriate dependencies between kernel modules are identified, by creating /etc/modutils/cdrw:

  #
# As suggested in CD Writing HOWTO
#
# This assumes IDE-CD is a module rather than copmiled into kernel.
#
options ide-cd ignore="hdc hdd"
alias scd0 sr_mode
pre-install sg          modprobe ide-scsi
pre-install sr_mod      modprobe ide-scsi
pre-install ide-scsi    modprobe ide-cd

Note here that we are telling the IDE CD module to ignore the disk which we want the ide-scsi module to handle. The ide-scsi module won’t touch any disks already being driven. Change the hdd to the appropriate one of hda, hdb, hdc, or hdd. To check which one to ignore look through the output of the dmesg command for the CD-RW line which identifies the driver, which on Alpine is:

  hdd: ATAPI 40X CD-ROM CD-R/RW drive, 2048kB Cache

Thus ide-cd should ignore hdd. If you want all CD drives to be SCSI (useful for some cases like cdrdao when asked to copy a disk) then don’t include either of the lines that mention ide-cd!

Now update the modules.conf file with:

  # update-modules

Finally, tell the kernel to load the modules at boot time by adding the following to /etc/modules:

  sr_mod
sg
ide-cd

You will now probably need to reboot to have the new configuration take effect. Also, don’t include ide-cd if you want all your drives recognised as SCSI.

Once set up wodim can be used to identify the SCSI device on which the CD writer sits:

For example, on Mint the device is 0,1,0. The LG CD-RW CED-8080B 1.04 on this host is identified using:

  # wodim -scanbus
scsibus0:
0,0,0 0) '_NEC    ' 'DV-5700A        ' '3.07' Removable CD-ROM
0,1,0 1) 'LG      ' 'CD-RW CED-8080B ' '1.04' Removable CD-ROM

On Velox the device is 2,0,0. The SONY CD-RW CRX140E on this host is identified using:

  # wodim -scanbus
scsibus0:
0,0,0    0) 'QUANTUM' 'ATLAS10K2-TY184L' 'DA40' Disk
scsibus2:
2,0,0  200) 'SONY' 'CD-RW  CRX140E' '1.0n' Removable CD-ROM

Alpine and Velox have DVD drives (which remain as IDE devices as /dev/hdc) and a CD-RW writer (which with the above set up becomes /dev/scd0). Mint also has two drives but both are run as SCSI devices.

On more recent kernels you may need to prefix the device with ATA:

  $wodim -scanbus dev=ATA To list the capabilities of your CD/DVD drive: $ wodim -prcap dev=ATA:1,0,0

If you are having problems with CD drives being found try adding ide-probe-mod% % % before ide-scsi in /etc/modules.

A line that someone suggested to be added to lilo.conf:

append = "apm=on apm=power-of idebus=N hdc=ide-scsi hdd=ide-scsi max_scsi_luns=1"

I’ve not used this.

Specify the default device for cdrecord in the file /etc/default/cdrecord:

  CDR_DEV=/dev/cdrom

### 13.1.2 Docking Station CD-ROM

Inco, a laptop, has a CD-ROM located in the Docking Station. You will need a recent version of the kernel (at least post 2.2.15) so that it will be recognised on boot, displaying the following message:

  CMD646: IDE controller on PCI bus 01 dev 28
CMD646: chipset revision 0x03, MultiWord DMA Force Limited
CMD646: 100% native mode on irq 10
ide2: BM-DMA at 0xfcc0-0xfcc7, BIOS settings: hde:pio, hdf:pio
ide3: BM-DMA at 0xfcc8-0xfccf, BIOS settings: hdg:pio, hdh:pio
...
hde: TOSHIBA CD-ROM XM-1802B, ATAPI CDROM drive
...
ide2 at 0xfcf8-0xfcff,0xfcf2 on irq 10
..
hde: ATAPI 24X CD-ROM drive, 128kB Cache
Uniform CDROM driver Revision: 2.56

### 13.1.3 LG CED-8080B Problems

On Mint this hardware seems to have some bad firmware. Others report a similar problem and yet others say they have no problem at all. If I knew how to obtain an update to the firmware and how to install it, no doubt it would all work! The problem is only for writing TAO. DAO seems just fine.

  # cdrecord -v speed=8 dev=0,1,0 -pad -audio -dummy *.wav
...
Track 01:   0 of  29 MB written.cdrecord:
Input/output error. write_g1: scsi sendcmd: retryable error
CDB:  2A 00 00 00 00 00 00 00 1B 00
status: 0x2 (CHECK CONDITION)
Sense Bytes: 70 00 05 00 00 00 00 0A 00 00 00 00 64 00 00 00
Sense Key: 0x5 Illegal Request, Segment 0
Sense Code: 0x64 Qual 0x00 (illegal mode for this track) Fru 0x0
Sense flags: Blk 0 (not valid)
...
cdrecord:
Input/output error. mode select g1: scsi sendcmd: retryable error
CDB:  55 10 00 00 00 00 00 00 10 00
status: 0x2 (CHECK CONDITION)
Sense Bytes: 70 00 05 00 00 00 00 0A 00 00 00 00 24 00 00 00
Sense Key: 0x5 Illegal Request, Segment 0
Sense Code: 0x24 Qual 0x00 (invalid field in cdb) Fru 0x0
Sense flags: Blk 0 (not valid) 

Bill Unruh (), posting on comp.os.linux.misc in January 2001, had the same problem with a 8080B compatible and mentioned that it works okay in DAO mode but not TAO. This is expected to be a transient problem as the driver catches up with the drive.

### 13.1.4 cdrecord Problem: Cannot … Bytes on /dev/zero

Under Debian, cdrecord version 1.10a18 was compiled with kernel version 2.4.x which has some incompatibilities with kernel version 2.2.x, resulting in an error in trying to mmap on /dev/zero.

The typical scenario is:

  # cdrecord -dummy -v dev=2,0,0 -data test.iso
Cdrecord 1.10a18 (i686-pc-linux-gnu)
TOC Type: 1 = CD-ROM
cdrecord: Invalid argument.
Cannot get mmap for 4198400 Bytes on /dev/zero. 

and again:

  # mkisofs -r cdr/ | cdrecord speed=8 dev =0,1,0 tsize=281056s -data -
Cdrecord 1.10a18 (i686-pc-linux-gnu) Copyright (C) 1995-2001 Jorg Schilling
cdrecord: Invalid argument. Cannot get mmap for 4198400 Bytes on /dev/zero. 

The solution is simply to recompile it:

  $wajig build cdrecord or $ wajig build cdrtools

Alternatively, install an older version of cdrecord that might be available on your machine in the archive of downloads:

  \$ wajig install /var/cache/apt/archive/cdrecord_3%3a1.9-1_i386.deb

Your donation will support ongoing availability and give you access to the PDF version of the book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2021 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0.