cdrecord burning and 2.6.10 

Newsgroups:  gmane.linux.debian.user
Date:        Sun, 27 Mar 2005 08:05:48 -0600

Alan Chandler wrote:

>>I have a strange problem with cdrecord (2.0+a34-2) and kernel 2.6.10.
>>
>>I boot with append="hdc=ide-scsi apm=on" and have in /etc/modules:
>>ide-scsi
>
> 2.6 does not need ide-scsi.  There have been slow improvements to the ide-cd
> module which maybe part of your issue
>
> Just take off the append for hdc, and the use /dev/hdc as your device in
> cdrecord. (and you may have to install module ide-cd)

Indeed, works like a charm. Thank you!

Hugo Vanwoerkom

do I need to have ide-scsi loaded for 2.6 kernels? 

Newsgroups:  gmane.linux.debian.user
Date:        Thu, 14 Jul 2005 14:09:19 -0500
>I googled around but there is not an affirmative answer. People seem to
>loading/unloading ide-scsi module by trial and error until their cdrom
>starts working. My question is, is it needed at all for 2.6 kernel?

I currently run 2.6.8 on a desktop machine with a 48x Lite-On burner, and do not use ide-scsi. I believe it is no longer the recommended way to do things.

cdrecord and cdrdao both work fine here with the ATAPI interface. I think K3B works as well, but it's been a long, long time since I used it, and I'm not sure if that was after i switched from 2.4.

Steve Block

sg0 or sr0 

Translated from http://lists.suse.com/archive/suse-linux/2000-Aug/0305.html

DATE: August 02 2000

> > > white someone that/dev/sg0 is?
> >
> > one of the possibilities stands in for SCS industrial union Eric, and is
> > scsi cdrom to respond (e.g. when burning a CDR). The other one
> > possibility is/dev/scd0. You know also a DEVICE on that
> > in each case different left (however ask only one of both;)
>
> brings me on the question: Why my scsi DEVICES are called
>/dev/sr0 and/dev/sr1?

Oh. Hups. Property/dev/srX with/dev/sgX confounds.

Thus again (this time correctly):

/dev/srX =/dev/scdX = Scsi cdrom (blockly oriented, to read, also via scsi emulation ide scsi.

/dev/sgX = SCSI Generic Charakterorientert(!), to write of CDR(W)s

# l /dev/sg0 /dev/sr0 /dev/scd0
crw r -- r -- 1 root disk 21, 0 July 23 1999/dev/sg0
^
br -- r -- r -- 1 root disk 11, 0 July 23 1999/dev/sr0
br -- r -- r -- 1 root disk 11, 0 July 23 1999/dev/scd0
^

David Haller

CD BURNERS-IDE 

http://www.linux-sxs.org/hardware/ide.html

AUTHORS: Jordan (original version, unknown Caldera system) Kevin O'Gorman (for RedHat 6.1 and Caldera 2.4) Jon Kosbab (for step 8 and some updating tips)

Updated Dec. 28, 2001 Tested on:

2.4, 3.1 6.x, 7.x

Caldera 2.4, 3.1; RedHat 6.1. 7.0

These Steps assume you have only one CD device, and that's your cdr or cdrw CD burner, and that if it is known by a symbolic link, that link is /dev/cdrom. If you have more, it should not be too hard to determine how to modify these Steps. For instance, I (Kevin O'Gorman) have two on the machine where I tested these steps; they are known by the symbolic links /dev/cdrom and /dev/cdrw, and I followed these steps replacing /dev/cdrom with /dev/cdrw.

  1. Make sure your cdr/cdrw is working as an ide device, i.e. can you mount it when there's a cd in it; if so you're ready to move on to the next step.

  2. Edit your configuration file. This will depend on how you boot Linux.

    If you use LILO, edit /etc/lilo.conf so that under your present boot section you have

    append = "hd?=ide-scsi"

    (where the question mark is replaced with the drive designation of the CD-R or CD-RW drive, for example for the common arrangement where it's the secondary master ide device you would have hdc=ide-scsi). If there's already an append line there, just add this to it. Save the lilo.conf you just edited and then type: /sbin/lilo (on a root command line).

    On the other hand, if you use GRUB (which is what COL2.4 & RH7.2 and higher uses by default), you add

    hd?=ide-scsi

    to the kernel line in your menu.lst file. Note that there are no quotation marks, and the word "append" does not appear. You do not need to run GRUB for this to take effect; GRUB knows where this file is and reads it every time it boots.

    Either way, your loader is now set up to pass that hd?=ide-scsi string to the kernel, which is where it is interpreted.

  3. Reboot. Your cdr/cdrw is now treated as a SCSI device, the only kind of device that the CD burning software understands. However, for your other things to continue to work, you must change configuration files so that those other things know about this new arrangement. You HAVE to reboot before step 5, or else some of the modules won't load (on newer kernels).

  4. Identify the device you will be using for the SCSI device. If you are using Caldera, or are using a recent version of the xcdroast program, it will be of the form /dev/sr?, probably /dev/sr0. That's because the DEV package of Caldera creates these devices and so does xcdroast. On the other hand, if you're using RedHat without xcdroast, you'll find devices of the form /dev/scd?, and you'll probably use /dev/scd0. These are created by the dev (not uppercase) package of Redhat. Aren't distributions wonderful? In any case, these instructions are written as if you're using xcdroast, so they assume you're using /dev/sr0.

    All of this is different if you're running DEVFS, so beware, however…

    Whatever your system uses, you'll find that the device number (shown by ls -lad /dev) is 11,0. If you're on a RedHat system and you want to follow along, you can create the device yourself by the command:

    # mknod /dev/sr0 b 11 0
    # mknod /dev/sr1 b 11 1
     etc...

    If your /dev is bare of these device entries for some reason, you can make them wholesale by executing the script

    test `whoami` = 'root' || echo "Only root can execute the commands."
    cd /dev/
    umask -S u=rwx,g=rwx,o-rwx
    [ -f loop0 ] \
         || ./MAKEDEV loop \
         || for i in 0 1 2 3 4 5 6 7; do mknod loop$i b 7 $i; done
    [ -f sg0 -o -f sga ] \
         || ./MAKEDEV sg \
         || for i in 0 1 2 3 4 5 6 7; do mknod sg$i  c 21 $i; done
  5. Examine your /etc/fstab, finding the line for /mnt/cdrom. If this line contains /dev/hd?, where the ? mark is a digit, change this hd? to sr?, where sr? represents the scsi cdrom number. On a computer where the cdr is /dev/hdc and there is no other scsi cdrom or cdr, you would change the /dev/hdc to /dev/sr0. Use any text editor to make this change.

    If instead the line contains /dev/cdrom, you should find that /dev/cdrom is a symbolic link to an IDE device. Change the link to point to the appropriate scsi cdrom device. On a computer where the cdr is /dev/hdc and there is no other scsi cdrom or cdr, you would enter the following commands (as root):

    # rm /dev/cdrom
    # ln -s /dev/sr0 /dev/cdrom
  6. Ensure the following modules are either built into the kernel, or else loaded and set to load at startup.

    scsi_mod
    sg
    sr_mod
    ide-scsi

    For Caldera systems, you can load the modules using COAS and set them to load at startup, or else edit /etc/modules/default so that it includes these modules.

    For RedHat 6.1, only modules sg and ide-scsi need to be loaded; the others are built into the default kernel. Also for RH 6.1, to have these modules loaded at startup, create or edit the file /etc/rc.d/rc.modules so that it contains the lines

    #!/bin/sh
    /sbin/modprobe sg
    /sbin/modprobe ide-scsi

    and make this file executable (mode 755); it will be called automatically by the script /etc/rc.d/rc.sysinit.

    RedHat 7.0 is similar, but the file is /etc/rc.modules, i.e. it's been promoted up in the directory tree.

  7. Put a cd in the burner and try to mount it; if it mounts your're well on your way to completion. Now it's time to read the cdrecord and mkisofs docs, or better yet look at the various front-ends for these programs, some of which are listed here. My (Kevin O'Gorman) own favorite is xcdroast, which is included with Caldera 2.3 and 2.4, and easily found for RedHat. Apparently, jgrignon preferred gcombust. Suit yourself.

  8. Instructions on creating a desktop icon so that it can be auto-mounted One thing I had to do was edit /etc/am.d/localdev and insert this line:

    cdrw        addopts:=utimeout=10

    I had installed my burner under Webmin as an additional ISO9660 cd-rom that wouldn't be mounted at bootup (and not a read-only device). By doing this and adding the above line to localdev, the time to boot up is reduced. If you just create the icon without editing the file then an error comes up saying something like "could not access /auto/cdrw. File does not exist or access denied." If the cd you insert has an autorun.sh file it will still auto-mount.

cdrecord: Cannot open '/dev/sg0' 

http://freshmeat.net/projects/cdrdao/

> I fail to use cdrdao, please help.
> here is my command:
> cdrdao copy --device 1,1,0 --driver generic-mmc --source-device 1,0,0 --source-driver generic-mmc --on-the-fly --simulate --speed 8 -v 3 --eject
>
> and i saw this:
> ERROR: Cannot open SCSI device '1,1,0': Cannot open '/dev/sg0'
> ERROR: Please use option '--device bus,id,lun', e.g. --device 0,6,0
> ERROR: Cannot setup device 1,1,0.
>
> how to solve this problem?
> I have a cdrom at /dev/scd0(/dev/hdc)
> and a cd-writer at /dev/scd1(/dev/hdd)
> with ide-scsi emulator.
> This work well on x-cd-roast.
> The parameters 1,0,0 and 1,1,0 and given
> by cdrecord -scanbus.
>
> Is that "Cannot open '/dev/sg0'" the problem?
> Should I try to make a link to /dev/sg0
> (/dev/scd0 -> /dev/sg0)?

Here is the fix to this problem.

As root, at /dev, run "MAKEDEV sg"

This will recreate the sg devices.

Worked for me under Debian 3.0

Robert Sheehy

cdrecord: Cannot open '/dev/sg0' 

try it with root first. If it works, then it is the node attribute problem.

tong

documented on: 2005.01.30

cdrecord: Cannot open '/dev/pg*' 

Fresh install of Sarge. Have tried two different DVD/CD writers (Sony and Lite-on).

Trying to get cdrecord going but I get the following error when I run "cdrecord -scanbus"

cdrecord: No such file or directory. Cannot open '/dev/pg*'. Cannot open SCSI driver.

Thought it might need the "append hdc=ide-scsi" fix. Sarge installed with grub so I edited the /boot/menu.lst file with guidance from google to look like…

title           Debian GNU/Linux, kernel 2.4.25-1-386
root            (hd0,0)
kernel          /vmlinuz-2.4.25-1-386 root=/dev/hda3 ro hdc=ide-scsi
initrd          /initrd.img-2.4.25-1-386
savedefault
boot

Not positive that is correct, but it seems to have worked as I see the following with dmesg: scsi0 : SCSI host adapter emulation for IDE ATAPI devices

Gary Hodges

cdrecord: Cannot open '/dev/pg*' 

> Trying to get cdrecord going but I get the following error when I run
> "cdrecord -scanbus"
>
> cdrecord: No such file or directory. Cannot open '/dev/pg*'. Cannot
> open SCSI driver.

Sometimes it takes resorting to posting to find the answers…

>From <http://www-106.ibm.com/developerworks/linux/library/l-cdburn.html>[]

In /etc/modules add "ignore=hdc" to the ide-cd line, e.g.

ide-cd ignore=hdc

In /boot/grub/menu.lst at the end of the kernel line add

hdc=scsi

It all worked fine after doing this.

Gary Hodges

NB, this uses the ide scsi emulation interface.

cdrecord: Cannot open '/dev/pg*' 

> Thought it might need the "append hdc=ide-scsi" fix.  Sarge installed
> with grub so I edited the /boot/menu.lst file with guidance from google
> to look like...

Looks ok to me, for grub I have: kernel …. hda=ide-scsi this is on Krud FC1

> At this point I'm mostly stuck.  I'll keep googling but maybe someone
> here has a suggestion.

cat /proc/scsi/scsi shows the recognized SCSI devices, eg.:

Host: scsi0 Channel: 00 Id: 00 Lun: 00

If the file empty your cd isn't recognized.

You can also check /proc/sys/dev/cdrom/info. If it has a column named sr0 then this is the first CD-ROM device. I have /dev/scd0 as the frist cd (krud fc1), it might be /dev/sr0 on other distributions.

To see what cdrecord thinks the device is capable of do:

cdrecord -checkdrive dev=0,0,0

Get the dev values from cdrecord -scanbus. Unless you have real SCSI controllers and devices, 0,0,0 is probably the right spec

The -checkdrive output will tell you if cdrecord sees the drive and knows how to use it.

Lee Woodworth

disk drive 

check drive 
$ cdrecord -checkdrive
scsidev: '0,0,0'
scsibus: 0 target: 0 lun: 0
Linux sg driver version: 3.1.25
Using libscg version 'schily-0.8'.
Device type    : Removable CD-ROM
Version        : 0
Response Format: 2
Capabilities   :
Vendor_info    : 'SONY    '
Identifikation : 'CD-RW  CRX195E1 '
Revision       : 'ZYS5'
Device seems to be: Generic mmc CD-RW.
Using generic SCSI-3/mmc   CD-R/CD-RW driver (mmc_cdr).
Driver flags   : MMC-3 SWABAUDIO BURNFREE FORCESPEED
Supported modes: TAO PACKET SAO SAO/R96P SAO/R96R RAW/R16 RAW/R96P RAW/R96R
drive capabilities 
# -prcap Print the drive capabilities for SCSI-3/mmc compliant drives
% cdrecord -prcap
     scsidev: '0,0,0'
scsibus: 0 target: 0 lun: 0
Linux sg driver version: 3.1.25
Using libscg version 'schily-0.8'.
Device type    : Removable CD-ROM
Version        : 0
Response Format: 2
Capabilities   :
Vendor_info    : 'SONY    '
Identifikation : 'CD-RW  CRX195E1 '
Revision       : 'ZYS5'
Device seems to be: Generic mmc CD-RW.
Drive capabilities, per MMC-3 page 2A:
Does read CD-R media
Does write CD-R media
Does read CD-RW media
Does write CD-RW media
Does not read DVD-ROM media
Does not read DVD-R media
Does not write DVD-R media
Does not read DVD-RAM media
Does not write DVD-RAM media
Does support test writing
Does read Mode 2 Form 1 blocks
Does read Mode 2 Form 2 blocks
Does read digital audio blocks
Does restart non-streamed digital audio reads accurately
Does support Buffer-Underrun-Free recording
Does read multi-session CDs
Does read fixed-packet CD media using Method 2
Does not read CD bar code
Does read R-W subcode information
Does not return R-W subcode de-interleaved and error-corrected
Does read raw P-W subcode data from lead in
Does return CD media catalog number
Does return CD ISRC information
Does support C2 error pointers
Does not deliver composite A/V data
Does play audio CDs
Number of volume control levels: 255
Does support individual volume control setting for each channel
Does support independent mute setting for each channel
Does not support digital output on port 1
Does support digital output on port 2
Does not send digital data LSB-first
Does not set LRCK high for left-channel data
Does not have valid data on falling edge of clock
Length of data in BCLKs: 16
Loading mechanism type: tray
Does support ejection of CD via START/STOP command
Does not lock media on power up via prevent jumper
Does allow media to be locked in the drive via PREVENT/ALLOW command
Is not currently in a media-locked state
Does not support changing side of disk
Does not have load-empty-slot-in-changer feature
Does not support Individual Disk Present feature
Maximum read  speed:  2112 kB/s (CD  12x, DVD  1x)
Current read  speed:  2112 kB/s (CD  12x, DVD  1x)
Maximum write speed:  5632 kB/s (CD  32x, DVD  4x)
Current write speed:  5632 kB/s (CD  32x, DVD  4x)
Rotational control selected: CLV/PCAV
Buffer size in KB: 1984
Copy management revision supported: 0
Number of supported write speeds: 10
Write speed # 0:  7040 kB/s CLV/PCAV (CD  40x, DVD  5x)
Write speed # 1:  5632 kB/s CLV/PCAV (CD  32x, DVD  4x)
Write speed # 2:  4224 kB/s CLV/PCAV (CD  24x, DVD  3x)
Write speed # 3:  3520 kB/s CLV/PCAV (CD  20x, DVD  2x)
Write speed # 4:  2816 kB/s CLV/PCAV (CD  16x, DVD  2x)
Write speed # 5:  2112 kB/s CLV/PCAV (CD  12x, DVD  1x)
Write speed # 6:  1760 kB/s CLV/PCAV (CD  10x, DVD  1x)
Write speed # 7:  1408 kB/s CLV/PCAV (CD   8x, DVD  1x)
Write speed # 8:   704 kB/s CLV/PCAV (CD   4x, DVD  0x)
Write speed # 9:   352 kB/s CLV/PCAV (CD   2x, DVD  0x)

Kernel drivers 

$ lsmod | grep -Ei 'scsi|ide|cd'
ide-scsi                8464   1
scsi_mod               85312   3  [sg sd_mod ide-scsi]
ide-cd                 27936   0
cdrom                  25056   0  [ide-cd]
ide-detect               288   0  (autoclean) (unused)
ide-disk               12512  12  (autoclean)
ide-core               94108  12  (autoclean) [ide-scsi ide-cd ide-detect sis5513 ide-disk]

Set default CD 

set CDR_DEVICE in /etc/cdrecord.conf.

The CDR_DEVICE may either hold a device identifier that is suitable to the open call of the SCSI transport library or a label in the file /etc/cdrecord.conf that allows to identify a specific drive on the system.

Set environment variable CDR_DEVICE will over write above setting. (Also true for CDR_SPEED)

Burning CDs on Linux 

http://www-106.ibm.com/developerworks/linux/library/l-cdburn.html

Linux SCSI emulation adventures 

Use either an IDE/ATAPI or SCSI CD writer if you can. Parallel port interface is a horrid kluge asking for trouble, and USB drives are slow. Neither is well-supported in Linux (although you might have better luck with the newer USB 2.0 drives).

IDE/ATAPI drives, which are the most common, need a bit of tweaking to work. So, what happens if cdrecord shows no drives configured? To check, type this: $ cdrecord -scanbus

If it displays your CD-RW drive (see Burning the disk, below), you can skip most of this section, although you might want to skim through anyway for your own information.

Linux uses a SCSI emulation subsystem, so IDE/ATAPI CD-writers need compatibility drivers. If there is a CD-ROM and a CD-R/RW on the same PC, both need to use the ide-scsi pseudo device driver to enable copying disks. There is no downside to using the SCSI emulation on a CD-ROM; it will work just the same; only the name will change. Depending on your particular flavor of Linux, the drive designation will change from something like /dev/cdrom0, or /dev/hdc, to /dev/scd0 (see Table 1 for a list of IDE/ATAPI device names).

Table 1. IDE/ATAPI device names

Name Device
hda IDE bus/connector 0 master device
hdb IDE bus/connector 0 slave device
hdc IDE bus/connector 1 master device
hdd IDE bus/connector 1 slave device

To find drives on your system, type:

$ dmesg | grep '^hd.:'
hda: IBM-DTLA-305020, ATA DISK drive
hdb: TOSHIBA DVD-ROM SD-M1202, ATAPI CD/DVD-ROM drive
hdc: LITE-ON LTR-24102B, ATAPI CD/DVD-ROM drive
hda: 40188960 sectors (20577 MB) w/380KiB Cache, CHS=2501/255/63, UDMA(66)

Most modern Linuxes come with the SCSI emulation already compiled into the kernel:

$ locate ide-scsi.o
/lib/modules/2.4.19/kernel/drivers/scsi/ide-scsi.o

If your system does not have this, you'll have to compile it into your kernel. That is way too big a subject for this wee article, so please see Resources (it's not hard, when you know how).

You'll need to edit two text files to configure the system to use the ide-scsi driver. The first is /etc/modules.conf (in Debian, /etc/modules). My system has a CD-ROM and CD-R/RW drive, hdb and hdc. Add these lines to /etc/modules.conf (or /etc/modules) using values appropriate for your system:

ide-cd ignore=\"hdb hdc\"
ide-scsi

By default, the IDE subsystem claims all ATA devices for its own, so the ignore line enables the SCSI subsystem to grab both the CD-R/RW and CD-ROM.

Next, edit the configuration file for your bootloader, GRUB or LILO. For LILO users, add the following to the end of lilo.conf:

append="hdb=ide-scsi"
append="hdc=ide-scsi"

For GRUB users, add the following to /etc/grub.conf (or in Debian, /boot/grub/menu.lst) at the end of the kernel line:

hdb=scsi hdc=scsi

Now reboot and verify that it has loaded:

$ lsmod

This will return a long list; look for ide-scsi.

Cannot open SCSI driver 

To: debian-user@lists.debian.org
Date: Thu, 12 Jun 2003 13:27:33 -0400
> Trying to get my cd writer to run.  After installing cdrecord, I
> tried:
>
> cdrecord -scanbus
> Cdrecord 1.10 (i686-pc-linux-gnu) Copyright (C) 1995-2001 J\u9c0eg Schilling
> cdrecord: No such file or directory. Cannot open SCSI driver.
> cdrecord: For possible targets try 'cdrecord -scanbus'. Make sure you
> are root.

The first few entries on a Google search for "cd writer linux" are targeted at Red Hat, but they make clear that it's SCSI emulation, through the ide-scsi kernel module, that you're after.

This document, aimed at Debian users, should help you:

http://newbiedoc.sourceforge.net/peripherals/cdrw.html

Chris Metzler

Cannot open SCSI driver 

> This document, aimed at Debian users, should help you:
>
> http://newbiedoc.sourceforge.net/peripherals/cdrw.html[]

Thanks, it did. I only needed to insert an

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

line in lilo.conf. I haven't tested it, but it is responding to 'cdrecord -scanbus'.