[Pkg-opt-media-team] Bug#794868: dvd+rw-tools: Burn failure of growisofs on DVD-R[W] with write type DAO
Thomas Schmitt
scdbackup at gmx.net
Fri Aug 7 12:59:38 UTC 2015
Package: dvd+rw-tools
Version: 7.1-11
Severity: important
Tags: patch upstream
Dear Maintainer,
This bug wastes DVD-R media. Frontends K3B and cdw trigger it.
Discovered by Honza Horak <hhorak at redhat.com> in april 2012.
https://lists.debian.org/cdwrite/2012/04/msg00010.html
It shows up only on contemporary kernels. 2.6. was immune.
Eike Lantzsch experiences it on Stretch (testing).
I can reproduce it on Jessie 8.1. See thread
https://lists.debian.org/debian-user/2015/08/msg00138.html
----------------------------------------------------------------
How to reproduce:
Burn an image of a size that is not divisible by 32 KB to DVD-R[W]
with write type DAO:
growisofs -use-the-force-luke=dao \
-Z /dev/sr1=debian-7.4.0-mips-netinst.iso
This yields a slightly mislead error message:
216236032/216250368 (100.0%) @0.0x, remaining 0:00 RBU 0.1% UBU 100.0%
:-[ WRITE at LBA=19c70h failed with SK=0h/ASC=00h/ACQ=03h]: Input/output error
:-( write failed: Input/output error
and an unreadable medium.
Eike Lantzsch sees in system logs:
Aug 3 08:55:37 lxcl01 kernel: [244027.061869] sr 5:0:0:0: [sr0] unaligned transfer
I see (on Jessie's vanilla kernel 3.16):
Aug 7 00:04:27 ts6 kernel: [4444491.622938] sr 3:0:0:0: [sr1] CDB:
Aug 7 00:04:27 ts6 kernel: [4444491.622941] Write(10): 2a 00 00 01 9c 70 00 00 07 00
Aug 7 00:04:27 ts6 kernel: [4444491.622976] ata4: hard resetting link
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=755466
shows the preconditions (DVD-R DAO, not 32 KB aligned) but
there the medium was readable afterwards.
This difference might depend on burner drive and/or bus hardware.
----------------------------------------------------------------
Diagnosis:
The cause is that the last SCSI command WRITE(10) of the burn
tells the correct number of blocks (less than 16), but in the
API struct sg_io_hdr of ioctl(SG_IO), component .dxfer_len
is set to 16.
Old kernels obviously interpreted the WRITE(10) CDB, whereas
newer kernels at least partly rely on sg_io_hdr.dxfer_len.
This leads to error indication Key B, ASC 0, ASCQ 0 presented
in sense code format "Descriptor" (SPC-3 4.5.2.1, table 13)
rather than in format "Fixed" (SPC-3 4.5.3, table 26).
growisofs does only expect "Fixed" and thus picks the wrong
bytes from the sense code string to show them in the error
message.
-------------------------------------------------------------------
Remedy for the wrong last WRITE transaction:
-------------------------------------------------------------------
--- growisofs_mmc-7.1-11.cpp 2015-08-07 13:07:52.000000000 +0200
+++ growisofs_mmc.cpp 2015-08-07 14:06:31.375597960 +0200
@@ -540,7 +540,7 @@ ssize_t poor_mans_pwrite64 (int fd,const
// own higher HZ value and disrespects the user-land one.
// Sending them down as milliseconds is just safer...
//
- if (!(errcode=cmd.transport (WRITE,(void *)buff,size)))
+ if (!(errcode=cmd.transport (WRITE,(void *)buff,nbl*2048)))
break;
//--- WRITE failed ---//
-------------------------------------------------------------------
With the patch applied, the burn run succeeds, the medium is
readable, and diff detects no alterations.
This remedy for the final WRITE transaction is part of Fedora
since april 2012:
http://pkgs.fedoraproject.org/cgit/dvd+rw-tools.git/commit/?id=981ab65695e09f778bdb9d256e78dc8537fe1a4a
correcting a first try of a remedy
http://pkgs.fedoraproject.org/cgit/dvd+rw-tools.git/commit/?id=8d3deadb30c071cc9aafd277b6b903791ab048dc
----------------------------------------------------------------
Remedy for the wrong error code display:
----------------------------------------------------------------
--- transport-7.1-11.hxx 2015-08-07 13:07:52.000000000 +0200
+++ transport.hxx 2015-08-07 13:43:02.759592641 +0200
@@ -70,7 +70,12 @@ inline long getmsecs()
#ifndef FATAL_START
#define FATAL_START(er) (0x80|(er))
#endif
-#define ERRCODE(s) ((((s)[2]&0x0F)<<16)|((s)[12]<<8)|((s)[13]))
+#define ERRCODE_FIXED(s) ((((s)[2]&0x0F)<<16)|((s)[12]<<8)|((s)[13]))
+#define ERRCODE_DESCR(s) ((((s)[1]&0x0F)<<16)|((s)[2]<<8)|((s)[3]))
+#define ERRCODE(s) ((s)[0] == 0x70 || (s)[0] == 0x71 ? \
+ ERRCODE_FIXED(s) : \
+ ((s)[0] == 0x72 || (s)[0] == 0x73 ? \
+ ERRCODE_DESCR(s) : 0))
#define SK(errcode) (((errcode)>>16)&0xF)
#define ASC(errcode) (((errcode)>>8)&0xFF)
----------------------------------------------------------------
The error message on my Debian 8.1, burner LG GH24NSC0,
SATA of mainboard ASUS P9D WS, is then correctly reported:
:-[ WRITE at LBA=19c70h failed with SK=Bh/NO ADDITIONAL SENSE INFORMATION]: Input/output error
Something which one could look up in e.g.
https://en.wikipedia.org/wiki/Key_Code_Qualifier
other than the fantasy error triple
SK=0h/ASC=00h/ACQ=03h
(Of course, i see the error only if the remedy for DAO is not
applied.)
-------------------------------------------------------------------
Side note about dash (see also https://wiki.debian.org/DashAsBinSh):
When manually running "make" after apt-get source dvd+rw-tools,
i see the error message
/bin/sh: 1: [: 1000: unexpected operator
which stems from a bashism in Makefile.m4
minus_o:=$(shell [[ `id -u` == 0 ]] && echo "-o root")
I propose this more portable alternative
minus_o:=$(shell test `id -u` = 0 && echo "-o root")
-------------------------------------------------------------------
Have a nice day :)
Thomas
-- System Information:
Debian Release: 8.1
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 3.16.0-4-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages dvd+rw-tools depends on:
ii genisoimage 9:1.1.11-3
ii growisofs 7.1-11
ii libc6 2.19-18
ii libgcc1 1:4.9.2-10
ii libstdc++6 4.9.2-10
dvd+rw-tools recommends no packages.
Versions of packages dvd+rw-tools suggests:
ii cdrskin 1.3.2-1.1
-- no debconf information
More information about the Pkg-opt-media-team
mailing list