Previous Next Contents

2. Prepare your Linux-box for writing CD-ROMs

Before November 1997, the software for Linux didn't support ATAPI cd-writers. As a result, the current release of the HOWTO concentrates on dealing with SCSI devices.

The good news is, that dealing with ATAPI devices is much easier and you can still use this HOWTO if you just forget about the "generic SCSI devices". To find out how to address ATAPI devices you can issue the command cdrecord -scanbus.

Future versions of this HOWTO will contain more details of dealing with ATAPI cd-writers.

2.1 Set up the hardware

Shut down your computer, switch it off and hook CD writer to the SCSI-bus.

Make sure the SCSI-bus is properly terminated and choose a free SCSI-ID for the writer. Look at the Linux SCSI-HOWTO if you're not sure. If you're completly clueless, ask an expert.

Switch the power on again and check the messages that the BIOS of the SCSI-controller prints immediatly after switching the power on. If it doesn't recognize you writer, go back to step (b). You should see a message like

missing picture; has anyone a screenshot of it?

2.2 A note on writing CDs under Linux

In contrast to other rumors, the Linux-kernel does _not_ require a patch in order to write to CDs. Although the file drivers/scsi/scsi.c from the kernel-sources contains the lines

case TYPE_ROM:
 SDpnt->writeable = 0;

this does only mean that that CDs and WORMs are not writeable through the standard-devices /dev/sda-/dev/sdh - which is ok.

Instead of using these devices the writing of CDs is done through the so called generic SCSI-devices which permit nearly everything - even writing to CDs.

2.3 Create the generic devices

The Linux SCSI-HOWTO says about generic SCSI-devices:

The Generic SCSI device driver provides an interface for sending SCSI commands to all SCSI devices - disks, tapes, CDROMs, media changer robots, etc.

Speaking of the generic devices as interfaces means that they provide an alternate way of accessing SCSI-hardware than through the standard devices.

This alternate way is required because the standard devices are designed to read data block-wise from a disk, tape or cd-rom. Compared to this, driving a cd-writer (or a scanner) is more exotic, e.g commands to position the laser must be transmitted. To have a clean (and therefore fast) implementation of standard-devices, all such exotic actions must be done through the generic SCSI devices.

As everthing can be done to SCSI-hardware through the generic devices they are not fixed to a certain purpose - therefore the name generic.

Goto the /dev-directory and check for generic SCSI devices; ls-command should show sga-sgh:

bash> cd /dev
bash> ls -l sg*
crw-------   1 root   sys     21,   0 Jan  1  1970 sga
crw-------   1 root   sys     21,   1 Jan  1  1970 sgb
crw-------   1 root   sys     21,   2 Jan  1  1970 sgc
crw-------   1 root   sys     21,   3 Jan  1  1970 sgd
crw-------   1 root   sys     21,   4 Jan  1  1970 sge
crw-------   1 root   sys     21,   5 Jan  1  1970 sgf
crw-------   1 root   sys     21,   6 Jan  1  1970 sgg
crw-------   1 root   sys     21,   7 Jan  1  1970 sgh

If you don't have those device-files then create them by using the /dev/MAKEDEV-script:

bash> cd /dev/
bash> ./MAKEDEV sg

Now the device-files should show up.

2.4 Enable usage of the generic SCSI and loopback devices

The Linux-kernel needs a module that lends it the ability to deal with generic SCSI devices. If your running kernel has this feature, it should be listed in the pseudo-file /proc/devices:

bash> cat /proc/devices
Character devices:
 1 mem
 2 pty
 3 ttyp
 4 ttyp
 5 cua
 7 vcs
21 sg          <----- stands for "SCSI Generic device"

30 socksys

Block devices:
 2 fd
 7 loop        <----- we even can use the loop-devices
 8 sd
11 sr          <----- stands for "SCSI cd-Rom"

Maybe you have to issue the commands insmod sg, insmod loop or insmod sr_mod to load the modules into the kernel. Check again after you've tried this.

If one of them doesn't succeed, you must re-configure your kernel and re-compile it.

bash> cd /usr/src/linux
bash> make config

* Additional Block Devices
Loopback device support (CONFIG_BLK_DEV_LOOP) [M/n/y/?] M

* SCSI support
SCSI support (CONFIG_SCSI) [Y/m/n/?] Y
* SCSI support type (disk, tape, CD-ROM)
SCSI disk support (CONFIG_BLK_DEV_SD) [Y/m/n/?] Y
SCSI tape support (CONFIG_CHR_DEV_ST) [M/n/y/?] M
SCSI CD-ROM support (CONFIG_BLK_DEV_SR) [M/n/y/?] M
SCSI generic support (CONFIG_CHR_DEV_SG) [M/n/y/?] M

ISO9660 cdrom filesystem (CONFIG_ISO9660_FS) [Y/m/n/?] M

Please note that I omitted the not-so-important questions.

2.5 Build and install the kernel

If you have questions regarding to this the Linux Kernel-HOWTO is the suggested reading. Furthermore your Linux-distribution should ship with some documentation about this issue.

Hint: while re-compiling, you can continue with steps 2.7-2.9

2.6 Reboot the computer for the changes to take effect.

Don't panic if the Linux-kernel prints the messages faster than you can read them, at least the initialization of SCSI-devices can be re-displayed with the command dmesg:

scsi0 : NCR53c{7,8}xx (rel 17)
scsi : 1 host.
scsi0 : target 0 accepting period 100ns offset 8 10.00MHz
scsi0 : setting target 0 to period 100ns offset 8 10.00MHz

  Vendor: FUJITSU   Model: M1606S-512        Rev: 6226
  Type:   Direct-Access                      ANSI SCSI
Detected scsi disk sda at scsi0, channel 0, id 0, lun 0

  Vendor: NEC       Model: CD-ROM DRIVE:84   Rev:  1.0a
  Type:   CD-ROM                             ANSI SCSI
Detected scsi CD-ROM sr0 at scsi0, channel 0, id 4, lun 0

scsi : detected 1 SCSI disk total.
SCSI device sda: hdwr sector= 512 bytes. Sectors= 2131992

Shown above is only that part of the initialization-messages that report the detection of physically present SCSI-devices.

2.7 Create loopback devices

Goto the /dev-directory and check for loopback devices. It's not critical if you don't have those devices, but it's convenient if you do (see 3.5). If you already have them, the ls-command should show loop0-loop7:

bash> cd /dev
bash> ls -l loop*
brw-rw----   1 root  disk    7,   0 Sep 23 17:15 loop0
brw-rw----   1 root  disk    7,   1 Sep 23 17:15 loop1
brw-rw----   1 root  disk    7,   2 Sep 23 17:15 loop2
brw-rw----   1 root  disk    7,   3 Sep 23 17:15 loop3
brw-rw----   1 root  disk    7,   4 Sep 23 17:15 loop4
brw-rw----   1 root  disk    7,   5 Sep 23 17:15 loop5
brw-rw----   1 root  disk    7,   6 Sep 23 17:15 loop6
brw-rw----   1 root  disk    7,   7 Sep 23 17:15 loop7

If you don't have those device-files, then create them by using the /dev/MAKEDEV-script:

bash> cd /dev/
bash> ./MAKEDEV loop

The last command only succeeds if you have the loop-module in your kernel (see 2.4 for handling of modules). If insmod loop does not help, you must wait until the new kernel is properly installed (see 2.5).

2.8 Get the user-software for burning CDs

Command line utilities

The following package is required to generate prototypes of CD-Rs: (mkisofs) (mkhybrid)

Depending on the model of your cd-writer (see 1.3), one of the following software for writing prototypes to CD-Rs is required: (cdrecord) (cdwrite)

Please use the nearest mirrors of these ftp-Servers or get them from a CD.

Be absolutly sure you have version 2.0 of cdwrite or newer. No older version and especially no beta-versions will work properly! Don't trust the man-page of (old) mkisofs which states you need version 1.5 of cdwrite.

For information about ports of cdwrite to Irix and AIX visit the URL

If you are using a kernel prior to release 2.0.31, you may want to patch mkisofs to get along a bug in the Linux filesystem code. The Debian-Distribution ships a patch for release 1.05 of mkisofs (1.11 should work, too) of mkisofs that adds the option '-K' to it (see 3.4); it's available from

This patch is only necassary if you want to mount the CD-image via the loopback-device (see 3.5.).

A graphical user interface (optional)

X-CD-Roast is full X based CD-Writer-Program, and it is the successor of the cdwtools-0.93. It's available from

Currently X-CD-Roast is based on a patched version of cdwrite-2.0 and thus comes with exactly the same features (see 1.4). Future versions may be based on the alternate cdrecord software.

Previous Next Contents