Setting up a CD-R or CDRW drive on an IDE PC

Chris Lale

          chrislale@users.sourceforge.net
        

Revision History
Revision 1.014th August 2002Revised by: CTL
Initial release
Revision 1.128th August 2002Revised by: CTL
Modified in response to comments. New sections added: "Checklist" and "Where to find out more".
Revision 1.231st August 2002Revised by: CTL
Modified in response to comments.

Table of Contents
1. About this article
1.1. Copyright information
1.2. Bugs, errors and mistakes
1.3. Spelling, punctuation and grammar
2. Preparing for the installation
2.1. System requirements
2.2. CD (re-)writer drive details
2.3. SCSI emulation
2.4. Text editor
2.5. The adduser and deluser utilities
3. Changing the kernel
3.1. Precautions
3.2. Installing the new kernel
3.3. If things go wrong
4. Installing the basic software
5. Setting up scsi emulation
5.1. Installing the ide-scsi module in the kernel
5.2. Checking that the kernel is running ide-scsi
5.3. Modifying the lilo.conf file
6. Using the cd writer for the first time
6.1. Configuring cdrecord
6.2. Testing the cd (re-)writer
6.3. Making your CD (re-)writer available as a device
6.4. Burning a test CD
7. Adding a front end for X
7.1. X-CD-Roast
7.2. cdrtoaster
7.3. gcombust
7.4. GnomeToaster
8. Checklist
9. Where to find more information

1. About this article


2. Preparing for the installation


3. Changing the kernel

You can skip this section if you can detect the ide-scsi module using lsmod (see SCSI emulation in the previous section). Otherwise, you must install a kernel with the ide-scsi module. The pre-compiled kernel images are supplied as .deb packages on the official CDROMs. A safe choice is kernel-image-2.2.20.


3.1. Precautions


3.2. Installing the new kernel

You can check which pre-compiled kernels are available using apt-cache.

athlon:/home/chris# apt-cache pkgnames | grep kernel-image | more

A good choice is to install "kernel-image-2.2.20", because it includes the "ide-scsi" module. Use apt-get to start the installation process.

athlon:/home/chris# apt-get install kernel-image-2.2.20
A new kernel has been installed at /boot/vmlinuz-2.2.20
Would you like to create a boot floppy now? [No] 

Enter y if you would like to create a boot floppy, and follow the instructions.

Would you like to create a boot floppy now? [No] y

Now you need to install a boot block. This makes your system bootable from the hard drive. If Debian is the only operating system on your PC, you can probably accept the default answers. If you have other operating systems and a boot manager other than lilo you must be careful not to install a boot block in the mbr nor to make your Linux root partition active.

My system has other operating systems on /dev/hda1, /dev/hda2 and /dev/hda5. The Linux swapspace is on /dev/hda6 and the Debian root is on hda7. My boot manager expects to boot Debian Linux from partition /dev/hda7. This is what I have to enter:

Install a boot block using the existing /etc/lilo.conf [Yes] n
Wipe out your old LILO configuration and make a new one? [No] y
Do you wish to set up Linux to boot from the hard disk? [Yes] y
Install a partition boot block on partition /dev/hda7? [Yes] y
Make /dev/hda7 the active partition? [Yes] n

You should be able to work out your needs by looking at this listing. See /usr/share/doc/mbr/README and documents in /usr/share/doc/lilo for more details


4. Installing the basic software

Burning a disc is a two-part process. First you must make a disc image using mkisofs. Then you use cdrecord to burn the image onto your recordable CDROM disc. Use apt-get to install both packages. You must install these packages before you set up SCSI emulation, otherwise you will not be able to read the packages from your CDROM drive(s). This is because your CDROM drive(s) will not be recognised until they are re-configured for the emulated SCSI bus.

athlon:/home/chris# apt-get install cdrecord mkisofs

During the installation of cdrecord you are asked whether you want cdrecord to be installed SUID root. This allows users in group "cdrom" to burn CDs. This makes sense on a personal desktop PC. You can change this configuration later using dpkg-reconfigure cdrecord.

Do you want /usr/bin/cdrecord to be installed SUID root? yes

If you do this, don't forget to make yourself a member of group "cdrom". To add user "chris" you would enter:

athlon:/home/chris# adduser chris cdrom

(This may not take effect until after a reboot. Any user can check which groups they belong to using the command groups.)


5. Setting up scsi emulation

5.1. Installing the ide-scsi module in the kernel

Install the ide-scsi module by running modconf.

athlon:/home/chris# modconf
scsi   Drivers for SCSI controller cards and classes of SCSI device Ok
ide-scsi   - SCSI emulation support OK
Install this module in the kernel? Yes
Enter Command-Line Arguments (leave blank) Ok
Installation succeeded
Please press ENTER when you are ready to continue. <enter>
Exit   Finished. Return to previous menu. Ok
Exit   Finished. Return to previous menu. Ok
athlon:/home/chris#

5.3. Modifying the lilo.conf file

You need to modify "lilo.conf" so that Linux recognises your CD (re-)writer drive as a SCSI drive. You can use any text editor, but I have given detailed instructions for emacs.

If you are working in a terminal window, you must invoke emacs from the terminal prompt (not from the desktop menu). This is so that you retain root privileges during editing.

athlon:/home/chris# emacs /etc/lilo.conf

My lilo.conf looked like this (but it may contain comment lines too):

boot=/dev/hda7
root=/dev/hda7
compact
install=/boot/boot.b
map=/boot/map
vga=normal
delay=20
image=/vmlinuz
label = Linux
read-only

Under the line beginning with "root=", add this line (substituting for block device "hdc" if necessary):

append="hdc=ide-scsi max_scsi_luns=1"

Save the file and exit using these commands:

<F10> f s
<F10> f e

It should now look something like this:

boot=/dev/hda7
root=/dev/hda7
append="hdc=ide-scsi max_scsi_luns=1"
compact
install=/boot/boot.b
map=/boot/map
vga=normal
delay=20
image=/vmlinuz
label = Linux
read-only

The new settings will not take effect until you run lilo and reboot.

Warning

Do not forget to run LILO after making these changes.

athlon:/home/chris# lilo
athlon:/home/chris# shutdown -r now

After rebooting, login and use dmesg to look at the lines near the end of the start-up messages. Check that your "SCSI" CDROM has been detected, and that it has changed from "hdx" to "scx" . Mine was changed from "hdc" to "sc0".

athlon:/home/chris# dmesg
scsi0 : SCSI host adapter emulation for IDE ATAPI devices
scsi : 1 host.
  Vendor: PHILIPS   Model: CDRW1610A         Rev: P1.4
  Type:   CD-ROM                             ANSI SCSI revision: 02
Detected scsi CD-ROM sr0 at scsi0, channel 0, id 0, lun 0
sr0: scsi3-mmc drive: 40x/40x writer cd/rw xa/form2 cdda tray

You are now ready to test the cd writer.


6. Using the cd writer for the first time

6.1. Configuring cdrecord

Use cdrecord -scanbus to check the SCSI id of your cd writer on the SCSI bus. If there are no other "SCSI" devices, the SCSI id should be 0,0,0.

athlon:/home/chris# cdrecord -scanbus
Cdrecord 1.10 (i686-pc-linux-gnu) Copyright (C) 1995-2001 Jörg Schilling
Using libscg version 'schily-0.5'
scsibus0:
	0,0,0	  0) 'PHILIPS ' 'CDRW1610A       ' 'P1.4' Removable CD-ROM
	0,1,0	  1) *
	0,2,0	  2) *
	0,3,0	  3) *
	0,4,0	  4) *
	0,5,0	  5) *
	0,6,0	  6) *
	0,7,0	  7) *

You need this information when you edit /etc/default/cdrecord. The /etc/default/cdrecord file contains defaults that are used if no command line option or environment are present.

athlon:/home/chris# emacs /etc/default/cdrecord

This is the listing of etc/default/cdrecord for my 8x speed Philips CDRW1610A with a 2MB buffer. (I have been conservative here. The drive reports 8MB, but the packaging states 2MB. The drive is advertised to write at 10x, but has been measured at 8x by "Roxio Easy CD Creator" in Windows 98.)

# The default device, if not specified elsewhere
#
CDR_DEVICE=philips

# 
# The default speed, if not specified elsewhere
#
CDR_SPEED=8

# 
# The default FIFO size if, not specified elsewhere
#
CDR_FIFOSIZE=2m

#
# The following definitions allow abstract device names.
# They are used if the device name does not contain the
# the characters ',', ':', '/' and '@'
#
# drive name	device	speed	fifosize driveropts
#
philips=		0,0,0	8	2	""

Save the file and exit using these commands:

<F10> f s
<F10> f e

6.2. Testing the cd (re-)writer

Put a non-blank data CD in the drive to test that you can read from the drive. Enter the following command, substituting for the SCSI id "0,0,0" if necessary:

athlon:/home/chris# cdrecord dev=0,0,0 -v -toc | more

This command prints the table of contents to the screen. The first few lines should look something like this:

Cdrecord 1.10 (i686-pc-linux-gnu) Copyright (C) 1995-2001 Jörg Schilling
TOC Type: 1 = CD-ROM
Using libscg version 'schily-0.5'
atapi: 1
Device type    : Removable CD-ROM
Version        : 0
Response Format: 1
Vendor_info    : 'PHILIPS '
Identifikation : 'CDRW1610A       '
Revision       : 'P1.4'
Device seems to be: Generic mmc CD-RW.
Using generic SCSI-3/mmc CD-R driver (mmc_cdr).

6.3. Making your CD (re-)writer available as a device

If the CD (re)writer is your only CDROM drive, you need to make it available as "/dev/cdrom". Then you will be able to read your distribution CDs again. If it is your second CDROM drive, you need to make it available as a different device, for example "/dev/cdrw".


6.3.1. Making the CD (re-)writer available as the only CDROM drive

Skip this section if your CD (re)writer is your second CDROM drive, and go on to making a second CDROM drive available

You need to get rid of the current (non-functional) ide "/dev/cdrom", and replace it with a symlink to the emulated SCSI "/dev/scd0".

athlon:/home/chris# cd /dev

Rename "cdrom" rather than deleting it.

athlon:/dev# mv cdrom cdrom.old

Create the symlink to "scd0".

athlon:/dev# ln -s scd0 cdrom

That's it! Now test that you can read from /cdrom again. Put a data CD in the drive. Then:

athlon:/dev# mount /cdrom
athlon:/dev# ls /cdrom
athlon:/dev# umount /cdrom

6.3.2. Making the CD (re-)writer available as an additional CDROM drive available

Skip this section if your CD (re)writer is your only CDROM drive. You should have carried out the instructions for making a single CDROM drive available. You need to create a new device ("/dev/cdrw", for example), and create a symlink to the emulated SCSI device "/dev/scd0".

athlon:/home/chris# cd /dev

Create the symlink to "scd0".

athlon:/dev# ln -s scd0 cdrw

The symlink does not point to anything yet. You need to set up a directory for the mount point:

athlon:/dev# cd /
athlon:/# mkdir cdrw

Now modify /etc/fstab:

athlon:/# emacs /etc/fstab

Look for the existing cdrom line:

/dev/cdrom	/cdrom		iso9660	ro,user,noauto		0	0

Add a line for cdrw underneath using identical parameters.

/dev/cdrw	/cdrw		iso9660	ro,user,noauto		0	0

Your fstab should look something like this:

# /etc/fstab: static file system information.
#
# <file system>	 <mount point>	 <type>	 <options>		 <dump>	 <pass>
/dev/hda7	/		ext2	errors=remount-ro	0	1
/dev/hda6	none		swap	sw			0	0
proc		/proc		proc	defaults		0	0
/dev/fd0	/floppy		auto	user,noauto		0	0
/dev/cdrom	/cdrom		iso9660	ro,user,noauto		0	0
/dev/cdrw	/cdrw		iso9660	ro,user,noauto		0	0

That's it! Now test that you can read from /cdrom and /cdrw. Put a data CD in each drive in turn. Then:

athlon:/# mount /cdrom
athlon:/# ls /cdrom
athlon:/# umount /cdrom

athlon:/# mount /cdrw
athlon:/# ls /cdrw
athlon:/# umount /cdrw

7. Adding a front end for X

You can now install a package like "X-CD-Roast" which runs in the X-window system.


8. Checklist

  1. Check the speed and buffer memory size of your cd (re-)writer drive.

  2. Check that the ide-scsi module is available for your kernel. If not, install a kernel that does have the module.

  3. Check that you have a text editor (eg emacs) available from the command line, and the adduser package.

  4. Install the packages cdrecord and mksisofs. Give any non-root users access to cdrecord and mkisofs by adding them to group src.

  5. Set up SCSI emulation using modconf. Modify the /etc/lilo.conf file and run lilo.

  6. Configure cdrecord and test it.

  7. Set up a block device Configure /dev/cdrom if the cd (re-)writer is your only CDROM drive, or /dev/cdrw of it is an additional CDROM drive.

  8. Make a test recording.

  9. Optional: add a front end for X.


9. Where to find more information

Documents in /usr/share/doc/lilo/ including /usr/share/doc/lilo/Manual.txt.gz

/usr/share/doc/mbr/README.

The manpage for adduser.

The manpage for mkisofs.

The manpage for cdrecord.

"APT HOWTO" at http://www.debian.org/doc/manuals/apt-howto/index.en.html.