Unable to use packet-writing on CDROM with udftools
Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
So.. This is as much relevant stuff as I can find about packet-writing, packet-written disc reading, and mounting/using such discs in Linux.
So far I haven't gotten much accomplished while trying to do any of this on my Slackware 2.6.20 system. Udftools installed fine, but much of the files referenced in the Ubuntu tutorial above are not present on my system. I have the binaries that were created by compiling the tool-kit, but that's it. I can't get them to do very much, and the man pages, lol, they're not much better than they would be if they were empty.
I have an MSI8352M(CR-52M) CDR/RW 52x32x52x which is packet-writing capable; I also have all the needed support in my kernel.
Since switching to Slackware from WinXP, I haven't looked back, and don't regret the switch at all; I don't miss anything. However I *do* have a CD-RW here, formatted like a floppy, that with Windoze I could use just like a floppy, read/write/delete from etc. With Linux, I can mount it UDF & RO, but can't write to it.
I'd like to, and I bet I'm not the only one.
So, does anyone have any updated info on this subject, or is aware of anyone working on this, or anyone who is currently successfully writing packet-style to CD-R/RW's under Linux?
Thanks a lot for your input!
Sasha
Last edited by GrapefruiTgirl; 03-28-2007 at 09:22 AM.
Reason: Solved problem(s); 'unable' is now 'ABLE'
OK... So I still have my udf-formatted CD-RW, made with Windoze, which I used to use like a floppy.
When I finally figured out how to mount it in Linux, I was at least able to read the stuff on it, even though I couldn't write to it.
Since then, I at some point put something onto the disk, using windows, which was supposed to be auto-bootable.. This means there is an AUTORUN.INF file, another little file of some sort, and a bunch of html-type files which went along with whatever the application is.
Here's the problem now: when I mount the disk in Linux, all I can see on it are the files associated with the autorun application. I can no longer see all the other files and folders that I put onto the disk BEFORE putting that stupid autorun thing there.
If I stick the CD into a Windows machine, they're all there, just like normal, and I can access everything; folders, files, all there.
Anyone know what I have to do to or with this CD so that I can access the rest of the stuff on the disk? Special mounting?? Or maybe go on Windows and delete the AUTORUN file??
Any suggestions welcome, while I am still working on it.
Thanks!
UPDATE: When I mount it, I can mount it as either UDF, or iso9660. Looking at the device info, it claims to be mounted as iso9660 with Joliet Level 3.
Last edited by GrapefruiTgirl; 03-25-2007 at 10:50 PM.
I've had abou the same experience with udf formated disks you've had. I can get it working, but very, very slow. I attempted to re-format some DVD-RAM disks to fat32, which worked with windows ok, but I got a lot of corrupted and/or 0-byte files in linux. Have had a lot of problems with files dissapearing, or corrupted, and can't delete, open, copy, etc.
I know that UDF format is still considered experimental, but it would be nice if it was "function and experimental" (ha ha)
I read your post earlier, and read the links that you have plus did a google search to see what else I could find out. It seems that the key for both of our problems is a fully functional UDF file system. The closest I've come so far is with a 32-bit install of SuSE 10.2. Nearly fully functional DVD-RAM. With 64-bit, very slow. Change udf to fat32, and bad files. All of this with an internal Lite-on drive. Swap to an usb connected Sony drive, can read them just fine, can't write at all. 32-bit or 64-bit.
A couple of other threads here. Still not much help. One thing that I've tried that didn't really help me, but might be worth a try for you, is format a disk as udf 1.5 instead of 2.0. In my case, it actually wrote a little slower.
Guess this isn't really much help, but maybe someone else will get an idea that'll help with one or both problems.
Hi Chuck, and thankyou for adding the links and for taking an interest here.
I did examine the threads you posted there, and found both to be interesting, but as you suggested, not likely to solve much, as those users as well as you and I are still getting nowhere.
As to the second link, I got the exact same IOCTL error as the OP did when trying to use pktsetup and udftools to create the packet-device link to my CDRW drive. It was IOCTL: Bad Argument/Invalid Argument or something very similar.
I don't have a DVD-Writer or DVD-RAM device of any kind, only a DVD-ROM, so I cannot add anything as far as the DVD issues.
However, if I can figure out how, I will try your suggestion of formatting a CDRW disc as UDF (several versions of UDF if I'm able to) and see how that disc behaves as far as mounting, reading and writing. Seems to me utterly useless to be able to format a disc just fine, but then not be able to put anything on it.. That's just plain dumb. (UDF-formatting is not a proprietary MS invention, right?? Or am I wrong there...)
I am still farting around with the R/RW floppy-CD I already have, as mentoned in my second post, but I may just give up and go to the Windows machine and grab my files off of it and use a tonne of 3.5" diskettes to move the stuff to my Linux machine. Then I'll start trying to format this RW floppy-CD under Linux as stated in my last paragraph..
I haven't yet tried 'formatting' any CD's at all under Linux, however I did BURN a Bootable ISO the other day using cdrecord, with complete success. First time's a charm, isn't that what 'they' say?
Take care all, and thank you for continued input or useful links.
Sasha
Here's how I formatted the blank CD-RW disc using cdrwtool which comes
with the udftools 1.0.3b package
Code:
Sasha(root)# cdrwtool -d /dev/hdb -q -b full -v 0x0102 -t 4 -l 3
using device /dev/hdb
full blank
udf version set to 0x0102
setting speed to 4
border type: 3
1905KB internal buffer
setting write speed to 4x
Settings for /dev/hdb:
Fixed packets, size 32
Mode-2 disc
I'm going to do a quick setup of /dev/hdb. The disc is going to be
blanked and formatted with one big track. All data on the device will
be lost!! Press CTRL-C to cancel now.
ENTER to continue.
Initiating quick disc blank
Disc capacity is 295264 blocks (590528KB/576MB)
Formatting track
start=0, blocks=16, type=RESERVED
start=16, blocks=3, type=VRS
start=19, blocks=237, type=USPACE
start=256, blocks=1, type=ANCHOR
start=257, blocks=31, type=USPACE
start=288, blocks=32, type=PVDS
start=320, blocks=32, type=LVID
start=352, blocks=32, type=STABLE
start=384, blocks=1024, type=SSPACE
start=1408, blocks=293568, type=PSPACE
start=294976, blocks=31, type=USPACE
start=295007, blocks=1, type=ANCHOR
start=295008, blocks=160, type=USPACE
start=295168, blocks=32, type=STABLE
start=295200, blocks=32, type=RVDS
start=295232, blocks=31, type=USPACE
start=295263, blocks=1, type=ANCHOR
Writing UDF structures to disc
Quick setup complete!
root@darkstarSSI:/home/Sasha#
SUCCESS! It's formatted as UDF v1.0.2 with about 576MB free.
Ok, up till now, with the exception of a failed experiment a week or so ago, I have been using the 'pktsetup' tool, the one that comes with 'udftools 1.0.3b' to attempt to create the packet-writing device (making my CD-R/RW drive WRITABLE), but all attempts return either of: IOCTL: function not implemented
IOCTL: permission denied
IOCTL: Inappropriate ioctl for device
OR I ended up with a weird thingy in /dev/pktcdvd which was neither a block nor character device and had permissions of --W S-- ---
So... Pretty discouraging. I found a whack more pages of kernel patches, blogs, email-threads, etc, where everyone is trying all sorts of slight variations on the instructions that come with
udftools, and I have tried everything at least a few times.
The working solution for me, to creating the packet-writing-device node in /dev is the following script by Thomas Maier, which I got a week or so ago from one of those sites I have been to lately, but didn't do anything useful when I first tried it (the aforementioned failed experiment).
( Thank you Thomas Maier!! Best regards! )
The script:
Code:
#!/usr/bin/bash
######################################################################
#####
##
# Linux pktcdvd Module Control Script
# Uses pktcdvd sysfs interface.
# Copyright (C) 2006 Thomas Maier <balagi@justmail.de>
# May be copied or modified under the terms of the GNU General
# Public License.
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as published
# by the Free Software Foundation;
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
######################################################################
#####
PKTCDVD_DIR="/sys/class/pktcdvd"
PKTDEV_DIR="/dev/pktcdvd"
usage()
{
echo "pktcdvd control script Version 1.0.0" >&2
echo "Copyright (C) 2006 Thomas Maier <balagi@justmail.de>"
>&2
echo "usage:" >&2
echo " # add new packet device for block device." >&2
echo " # a device node is created: /dev/pktcdvd/<pktname>" >&2
echo " pktcdvd -a pktname blkdev" >&2
echo " # remove a packet device" >&2
echo " pktcdvd -r pktname|pktmajor:pktminor" >&2
echo " # show packet device stat infos" >&2
echo " pktcdvd -i pktname|pktmajor:pktminor" >&2
echo " # set write congestion marks for packet device" >&2
echo " pktcdvd -C pktname|pktmajor:pktminor on [off]" >&2
echo " # print write congestion marks for packet device" >&2
echo " pktcdvd -c pktname|pktmajor:pktminor" >&2
echo " # print device mapping" >&2
echo " pktcdvd -m" >&2
}
exiterr()
{
[ -n "$1" ] && echo "error: $1" >&2
exit 1
}
usage_error()
{
usage
exiterr
}
# device file to device id (major:minor)
dev_to_id()
{
if [[ "$1" == *:* ]] ; then
echo "$1"
return 0
elif [ -b "$1" ] ; then
/bin/ls -l "$1" \
| awk '{print $5 ":" $6}' | tr -d ','
return 0
fi
return 1
}
# device file, device id or pktcdvd device name
# to packet device id (major:minor)
to_pktdev_id()
{
typeset name="$1"
typeset devid=""
if [ -b "$PKTDEV_DIR/$name" ] ; then
devid="$(dev_to_id "$PKTDEV_DIR/$name")"
else
devid="$(dev_to_id "$name")"
fi
[ -z "$devid" ] && exiterr "can not get device id for $name"
echo "$devid"
}
to_pkt_name()
{
typeset pktdev="$1"
typeset pktdevid
pktdevid="$(to_pktdev_id "$pktdev")" || exit 1
typeset pktname="$(awk '$2=="'"$pktdevid"'" {print $1}'
"$PKTCDVD_DIR/device_map" )"
[ -z "$pktname" ] && exiterr "device $pktdev is not an active
pktcdvd device"
echo "$pktname"
}
to_pkt_sdir()
{
typeset name
name="$(to_pkt_name "$1")" || exit 1
echo "$PKTCDVD_DIR/$name"
}
check_root()
{
[ ! -w "$PKTCDVD_DIR/add" ] && exiterr "permission denied"
}
if [[ $# != 0 && ! -d "$PKTCDVD_DIR" ]] ; then
exiterr "pktcdvd module not loaded or no sysfs available"
fi
case "$1" in
-a)
(( "$#" != 3 )) && usage_error
pktname="$2"
blkdev="$3"
blkdevid="$(dev_to_id "$blkdev")" || exiterr "not a block
device: $blkdev"
pktdev="$PKTDEV_DIR/$pktname"
m="$(grep " $blkdevid\$" "$PKTCDVD_DIR/device_map")"
[ -n "$m" ] && exiterr "device $blkdev already mapped to: $m"
check_root
echo "$blkdevid" >"$PKTCDVD_DIR/add" || exiterr "unable to add
new pktcdvd device"
pktdevid="$(awk '$3=="'"$blkdevid"'" {print $2}'
"$PKTCDVD_DIR/device_map" )"
[ -z "$pktdevid" ] && exiterr "can not add new pktcdvd device"
pktsysn="$(awk '$3=="'"$blkdevid"'" {print $1}'
"$PKTCDVD_DIR/device_map" )"
rm -f "$pktdev" "$PKTDEV_DIR/$pktsysn"
mkdir -p "$PKTDEV_DIR" || exiterr
major="$(echo "$pktdevid" | cut -f 1 -d ':')"
minor="$(echo "$pktdevid" | cut -f 2 -d ':')"
mknod "$PKTDEV_DIR/$pktsysn" b "$major" "$minor" \
|| exiterr "failed to make device node
"$PKTDEV_DIR/$pktsysn" for $major:$minor"
chmod 644 "$PKTDEV_DIR/$pktsysn"
# create hard link, so dev_to_id() can resolve it!
[[ "$pktsysn" != "$pktname" ]] && ln -f "$PKTDEV_DIR/$pktsysn"
"$pktdev"
echo "ok: $pktdev ($pktsysn [$pktdevid] -> $blkdev
[$blkdevid])"
;;
-r)
(( "$#" != 2 )) && usage_error
pktdev="$2"
pktdevid="$(to_pktdev_id "$pktdev")" || exit 1
pktsysn="$(awk '$2=="'"$pktdevid"'" {print $1}'
"$PKTCDVD_DIR/device_map" )"
[ -z "$pktsysn" ] && exiterr "device $pktdev is not an active
pktcdvd device"
check_root
echo "$pktdevid" >"$PKTCDVD_DIR/remove" \
|| exiterr "unable to remove pktcdvd device $pktdev
($pktdevid)"
fgrep " $pktdevid " "$PKTCDVD_DIR/device_map" >/dev/null \
&& exiterr "unable to remove pktcdvd device $pktdev
($pktdevid) or device busy"
# use the inode number of $pktsysn to remove all names of the
device
inode="$(/bin/ls -i1 "$PKTDEV_DIR/$pktsysn" 2>/dev/null | awk
'{print $1}')"
[ -n "$inode" ] && find "$PKTDEV_DIR" -follow -inum "$inode"
-exec rm {} \;
;;
-i)
(( "$#" != 2 )) && usage_error
pktdev="$2"
sdir="$(to_pkt_sdir "$pktdev")" || exit 1
for i in stat write_queue ; do
( cd "$sdir" && for f in "$i"/* ; do
v="$(cat "$f" 2>/dev/null)"
[ "$?" = 0 ] && echo "$f: $v"
done )
done
exit "$?"
;;
-C)
(( "$#" < 3 )) && usage_error
pktdev="$2"
valon="$3"
valoff="$4"
sdir="$(to_pkt_sdir "$pktdev")/write_queue" || exit 1
check_root
echo "$valon" >"$sdir/congestion_on"
[ -n "$valoff" ] && echo "$valoff" >"$sdir/congestion_off"
echo "off=$(cat "$sdir/congestion_off") on=$(cat
"$sdir/congestion_on")"
;;
-c)
(( "$#" != 2 )) && usage_error
pktdev="$2"
sdir="$(to_pkt_sdir "$pktdev")/write_queue" || exit 1
echo "off=$(cat "$sdir/congestion_off") on=$(cat
"$sdir/congestion_on")"
;;
-m)
(( "$#" != 1 )) && usage_error
cat "$PKTCDVD_DIR/device_map"
exit "$?"
;;
*)
usage_error
;;
esac
exit 0
What I did:
Stick this script somewhere and CHMOD it to executable.
Get yourself root priveleges. And then:
Code:
bash-3.1$ ./packet_script -a funnyname /dev/hdb
error: permission denied
bash-3.1$ su
Password: *********************
bash-3.1# ./packet_script -a funnyname /dev/hdb
ok: /dev/pktcdvd/funnyname (pktcdvd0 [254:0] -> /dev/hdb [3:64])
bash-3.1#
Success #2 The packet device-node has been created, linked to my
CDROM drive /dev/hdb, and another node called pktcdvd0 was also made
for some reason. OK.
Now, mounting it:
Code:
sh-3.1# mount /dev/pktcdvd/funnyname /media/cdrom -o rw
sh-3.1# mount
/dev/hda5 on / type ext2 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
usbfs on /proc/bus/usb type usbfs (rw,devgid=10,devmode=0666)
/dev/pktcdvd/funnyname on /media/cdrom type udf (rw)
Next, I tried writing to it, but got a permission denied or disk-full
error. I CHMOD'd both new device-nodes in /dev/pktcdvd/ to 0777 and
changed their GROUP to CDROM, of which I (user) am a member, and also
CHMOD'd the mount-point to 0777 (yeah, kinda loose permissions, but I
wanted to make it as easy as possible for this crazy stuff to work..
I'll try tightening it up later.)
So, I saved this very file you're reading, to the CD, and
Woooohoooooo!!! It saved, and I jumped up and down!!
I haven't tried deleting stuff from the disc (frankly I don't care if it deletes at the moment, and I haven't tested whether the device nodes will be persistent over a reboot, but
I figure they should be. If not for whatever reason, I'll run this script from /etc/rc.d/rc.local during boot.
Problem solved I can even mount my Windoze-made floppy-CD! Yay!
Finally, I made a desktop device-link to the packetwriter-node. Here's the /etc/fstab entries; the first one is to mount a CD the usual way, with one desktop device link, and the second line is to mount a CDRW for writing, using a second desktop device link:
I hope others can make use of this info; if I can be of any help to anyone still having trouble getting this to work, feel free to contact me---my email's in my profile!
Last edited by GrapefruiTgirl; 03-29-2007 at 07:26 PM.
Awsome. Sounds like you have a real handle on this. I'm going to go through the same steps you did there, and try this tonite when I get home. Maybe that'll click something for me on my DVD-RAM issue. Even if I don't get that working, the packet-writing with CDRW disks would be a step forward.
Thanks for posting back your solution. I'm sure it will help me too.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.