CD/DVD Packet Writing

I am trying to setup CD/DVD packet writing. I’ve followed various sets of instructions I’ve found online. The udftools package is installed, but I can’t get any of it to work. Most sources say setup is done automatically by /etc/init.d/udftools but there is no such file on my system. I’ve tried the following:

sudo modprobe pktcdvd

lsmod | grep ‘pktcdvd’
pktcdvd 36864 0
cdrom 61440 2 sr_mod,pktcdvd

sudo mknod /dev/pktcdvd0 b 97 0

sudo pktsetup /dev/pktcdvd0 /dev/sr0
open packet device: No such device or address

Some sources say make block special files in /dev/ to use with pktsetup, others say just make a regular directory. I tried it both ways. With a directory is says ioctl: Inappropriate ioctl for device. According to most instructions I’ve found, it seems to be fairly straightforward and simple, but I can’t get anything to work. Shouldn’t this work someway?

Am looking at this.
BTW - did you consider using genisoimage as described in this article?
http://unix.stackexchange.com/questions/107883/creating-udf-image-in-linux

My early guess is that you pointed to /dev/sr0 which is already mounted, and that you need to unmount before you can re-mount as pktcdvd target device.

TSU

FYI - The contents of udftools which also reveals the setup utility you’re looking for

rpm -ql udftools/usr/bin/cdmrw
/usr/bin/cdrwtool
/usr/bin/mkudffs
/usr/bin/**pktsetup**
/usr/bin/udffsck
/usr/bin/wrudf
/usr/share/doc/packages/udftools
/usr/share/doc/packages/udftools/AUTHORS
/usr/share/doc/packages/udftools/ChangeLog
/usr/share/doc/packages/udftools/LICENSE.GPL-3.0
/usr/share/doc/packages/udftools/README
/usr/share/man/man1/cdrwtool.1.gz
/usr/share/man/man8/mkudffs.8.gz
/usr/share/man/man8/pktsetup.8.gz

sudo pktsetup /dev/pktcdvd0 /dev/sr0
open packet device: No such device or address

Try removing that 0 from pktcdvd0,
Should read

pktsetup /dev/pktcdvd/ /dev/sr0

TSU

Thank you TSU for your suggestions. I took the zero off the packet device name, no change. I used mknod and I have

ls -l /dev/pktcdvd*
brw-rw-rw- 1 root cdrom 97, 0 May 30 14:48 /dev/pktcdvd

I do

pktsetup /dev/pktcdvd /dev/sr0
open packet device: No such device or address

I used mount command, and /dev/sr0 is not mounted.

I suspect something is broken in the packet driver somewhere. Probably a misconfiguration but I can’t find where. I did read somewhere about adding lines to a udev rules file, and I tried that as well. I’ve also tried sudo with everything and still doesn’t work.

Okay I’ve made some progress. I found this page: http://www.g-loaded.eu/2005/11/10/packet-writing-on-cdrw-and-dvdrw-media/ and followed the instructions there. However, when I try to use cdrwtool to format a disc, it seems to blank the disc okay, then when it tries to write the UDF filesystem to disc it reports “wait_cmd: Input/output error Command failed:”. In dmesg it has “Logical block address out of range” for sr0. I also tried mkudffs but it always says “trying to change type of multiple extents”.

When I insert a disc with UDF and files already on it, that I used on a Windows PC, it mounts automatically as read only:

/dev/sr0 on /run/media/user/INCD type udf (ro,nosuid,nodev,relatime,uid=1000,gid=100,iocharset=utf8,uhelper=udisks2)

If I unmount it then try to remount read-write:

mount -t udf -o rw,noatime,nodiratime /dev/pktcdvd/pktcdvd0 /media/cdvdrw
mount: /dev/pktcdvd/pktcdvd0: can’t read superblock

If I change rw to ro then it mounts successfully.

Depending on what your needs are,

Here’s a completely different approach,
Maybe the following provides what you want, writing to a loop device mounting a writable ISO file?


# dd if=/dev/zero of=~/file.iso bs=1MiB count=10
# losetup --find --show ~/file.iso /dev/loop0
# mkisofs /dev/loop0
# mount /dev/loop0 /mnt

Of course, this example mounts a 10MB ISO file which can be burned to optical media if you wish.
You can modify the size and format that backing file any file system you wish, I created a wiki page that describes all supported file systems and various alternative supported commands at a glance
https://en.opensuse.org/User:Tsu2/loop_devices

TSU

Thank you TSU for your suggestion. What I really want to do is use a CD-RW disc like a floppy disk. I had done that before on a computer running Windows using a program called Nero InCD. Supposedly this can be done on Linux as well.

I have made a little more progress. I successfully mounted one disc read/write. I suspect that some of the discs I was trying to mount may have been formatted as UDF 2.50 for which Linux currently has no write support. I don’t know how to find out what UDF version is on each disc. When putting the discs back into a computer running Windows which would not mount on the Linux box, the listed files were a set of small HTML files that InCD puts on the discs instead of the files I had saved on the discs. Windows reported that one of the discs was corrupt.

The point at which I am stuck now is that I cannot format any disc with UDF. I’m using CD-RW discs. Here’s what I try:

cdrwtool -d /dev/sr0 -q
using device /dev/sr0
512KB internal buffer
setting write speed to 12x
wait_cmd: Bad address
Command failed: bb 00 ff ff 08 40 00 00 00 00 00 00 - sense 00.00.00
set speed

cdrwtool -b full -d /dev/sr0
setting speed to 12
full blank
using device /dev/sr0
512KB internal buffer
setting write speed to 12x

mkudffs /dev/sr0
trying to change type of multiple extents

I’ve tried to format used CD-RW discs and new ones, and I can’t get a successful format on anything. I think on one attempt there were no errors reported but when I ran ‘file -s /dev/sr0’ it just said ‘data’ instead of UDF.

dmesg:

 9735.284423] sr 2:0:0:0: [sr0] tag#5 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
 9735.284426] sr 2:0:0:0: [sr0] tag#5 Sense Key : Illegal Request [current] 
 9735.284427] sr 2:0:0:0: [sr0] tag#5 Add. Sense: Logical block address out of range
 9735.284429] sr 2:0:0:0: [sr0] tag#5 CDB: Read(10) 28 00 00 00 00 00 00 00 01 00
 9735.284429] blk_update_request: I/O error, dev sr0, sector 0
 9735.296522] sr 2:0:0:0: [sr0] tag#6 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
 9735.296524] sr 2:0:0:0: [sr0] tag#6 Sense Key : Illegal Request [current] 
 9735.296525] sr 2:0:0:0: [sr0] tag#6 Add. Sense: Logical block address out of range
 9735.296526] sr 2:0:0:0: [sr0] tag#6 CDB: Read(10) 28 00 00 00 00 00 00 00 01 00
 9735.296527] blk_update_request: I/O error, dev sr0, sector 0
 9735.296528] Buffer I/O error on dev sr0, logical block 0, async page read
 9735.304475] sr 2:0:0:0: [sr0] tag#7 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
 9735.304477] sr 2:0:0:0: [sr0] tag#7 Sense Key : Illegal Request [current] 
 9735.304478] sr 2:0:0:0: [sr0] tag#7 Add. Sense: Logical block address out of range
 9735.304479] sr 2:0:0:0: [sr0] tag#7 CDB: Read(10) 28 00 00 00 00 00 00 00 01 00
 9735.304480] blk_update_request: I/O error, dev sr0, sector 0
 9735.304481] Buffer I/O error on dev sr0, logical block 0, async page read
 9735.312425] sr 2:0:0:0: [sr0] tag#8 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
 9735.312427] sr 2:0:0:0: [sr0] tag#8 Sense Key : Illegal Request [current] 
 9735.312428] sr 2:0:0:0: [sr0] tag#8 Add. Sense: Logical block address out of range
 9735.312429] sr 2:0:0:0: [sr0] tag#8 CDB: Read(10) 28 00 00 00 00 00 00 00 01 00
 9735.312430] blk_update_request: I/O error, dev sr0, sector 0
 9735.312431] Buffer I/O error on dev sr0, logical block 0, async page read
 9735.320536] sr 2:0:0:0: [sr0] tag#9 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
 9735.320538] sr 2:0:0:0: [sr0] tag#9 Sense Key : Illegal Request [current] 
 9735.320539] sr 2:0:0:0: [sr0] tag#9 Add. Sense: Logical block address out of range
 9735.320540] sr 2:0:0:0: [sr0] tag#9 CDB: Read(10) 28 00 00 00 00 00 00 00 01 00
 9735.320541] blk_update_request: I/O error, dev sr0, sector 0
 9735.320542] Buffer I/O error on dev sr0, logical block 0, async page read
 9735.328452] sr 2:0:0:0: [sr0] tag#10 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
 9735.328454] sr 2:0:0:0: [sr0] tag#10 Sense Key : Illegal Request [current] 
 9735.328455] sr 2:0:0:0: [sr0] tag#10 Add. Sense: Logical block address out of range
 9735.328456] sr 2:0:0:0: [sr0] tag#10 CDB: Read(10) 28 00 00 00 00 00 00 00 01 00
 9735.328457] blk_update_request: I/O error, dev sr0, sector 0
 9735.328458] Buffer I/O error on dev sr0, logical block 0, async page read
 9735.336461] sr 2:0:0:0: [sr0] tag#11 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
 9735.336463] sr 2:0:0:0: [sr0] tag#11 Sense Key : Illegal Request [current] 
 9735.336464] sr 2:0:0:0: [sr0] tag#11 Add. Sense: Logical block address out of range
 9735.336465] sr 2:0:0:0: [sr0] tag#11 CDB: Read(10) 28 00 00 00 00 00 00 00 01 00
 9735.336466] blk_update_request: I/O error, dev sr0, sector 0
 9735.336467] Buffer I/O error on dev sr0, logical block 0, async page read
 9735.344566] sr 2:0:0:0: [sr0] tag#12 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
 9735.344568] sr 2:0:0:0: [sr0] tag#12 Sense Key : Illegal Request [current] 
 9735.344569] sr 2:0:0:0: [sr0] tag#12 Add. Sense: Logical block address out of range
 9735.344570] sr 2:0:0:0: [sr0] tag#12 CDB: Read(10) 28 00 00 00 00 00 00 00 01 00
 9735.344571] blk_update_request: I/O error, dev sr0, sector 0
 9735.344572] Buffer I/O error on dev sr0, logical block 0, async page read
 9735.352489] sr 2:0:0:0: [sr0] tag#13 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
 9735.352491] sr 2:0:0:0: [sr0] tag#13 Sense Key : Illegal Request [current] 
 9735.352492] sr 2:0:0:0: [sr0] tag#13 Add. Sense: Logical block address out of range
 9735.352493] sr 2:0:0:0: [sr0] tag#13 CDB: Read(10) 28 00 00 00 00 00 00 00 01 00
 9735.352494] blk_update_request: I/O error, dev sr0, sector 0
 9735.352495] Buffer I/O error on dev sr0, logical block 0, async page read
 9735.364595] sr 2:0:0:0: [sr0] tag#14 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
 9735.364597] sr 2:0:0:0: [sr0] tag#14 Sense Key : Illegal Request [current] 
 9735.364598] sr 2:0:0:0: [sr0] tag#14 Add. Sense: Logical block address out of range
 9735.364599] sr 2:0:0:0: [sr0] tag#14 CDB: Read(10) 28 00 00 00 00 00 00 00 01 00
 9735.364600] blk_update_request: I/O error, dev sr0, sector 0
 9735.364601] Buffer I/O error on dev sr0, logical block 0, async page read
 9735.372523] Buffer I/O error on dev sr0, logical block 0, async page read

If I can format discs with UDF then I might be able to get things working.

A Quick and Dirty solution probably would be to use a big app like k3b, last I used it (long ago) it could erase and reformat an optical disk and I <think> also identified the UDF version (only maybe).

So, your overall objective can be broken down into individual problems…

  • Format the optical disk for writing if needed
  • Mount the disk to access

When you have suitable prepared media ready, you can use the loop mount commands I gave you to access the disk.

Personally, I would opt for writing to a file over writing directly to an optical disk always… because of the immense difference in performance throughput and zero hardware issues. All you need is disk space. As I described, if your ultimate objective is to burn to optical disk, it’d be trivial to burn an ISO once it has been created.

TSU