superg / redumper

Low level CD dumper utility
GNU General Public License v3.0
200 stars 18 forks source link

seek failed #43

Closed Tatsh closed 1 year ago

Tatsh commented 1 year ago

This is with build 128, the last I can run. The file in question does not look to have changed much. Any ideas?

redumper cd --drive=/dev/sr0 --force-split --retries=250 --image-path=/home/tatsh/cd-recovery/redumper-forced/d995580-- --verbose
redumper v2023.05.02 build_LOCAL [May  2 2023, 17:44:49]

command line: redumper cd --drive=/dev/sr0 --force-split --retries=250 --image-path=/home/tatsh/cd-recovery/redumper-forced/d995580-- --v
erbose

*** COMMAND: cd
drive path: /dev/sr0
drive: HL-DT-ST - BD-RE WH16NS60 (revision level: 1.02, vendor specific: NM00100SIK9PH7MJ032)
drive configuration: GENERIC (read offset: +6, C2 shift: 0, pre-gap start: -135, read method: BE_CDDA, sector order: DATA_C2_SUB)
image path: /home/tatsh/cd-recovery/redumper-forced/d995580--
image name: dump_230506_203025_devsr0

disc TOC:
  track 1 {  data }
    index 01 { LBA:      0, MSF: 00:02:00 }
  track A {  data }
    index 01 { LBA:   1680, MSF: 00:24:30 }

dump started
[LBA:    519] C2 error (bits:   29, data crc: 045EDF04, C2 crc: 2F566601)
[100%] LBA:   1680/1680, errors: { SCSI: 0, C2: 1, Q: 16 }
dump complete (time: 5s)

media errors:
  SCSI: 0
  C2: 1
  Q: 16

drive path: /dev/sr0
drive: HL-DT-ST - BD-RE WH16NS60 (revision level: 1.02, vendor specific: NM00100SIK9PH7MJ032)
drive configuration: GENERIC (read offset: +6, C2 shift: 0, pre-gap start: -135, read method: BE_CDDA, sector order: DATA_C2_SUB)
image path: /home/tatsh/cd-recovery/redumper-forced/d995580--
image name: dump_230506_203025_devsr0
refine started
[LBA:    519] correction success
[100%] LBA:    519/1680, errors: { SCSI: 0, C2: 0, Q: 16 }
refine complete (time: 0s)

media errors:
  SCSI: 0
  C2: 0
  Q: 16

image path: /home/tatsh/cd-recovery/redumper-forced/d995580--
image name: dump_230506_203025_devsr0
warning: incomplete dump detected, using available dump size
scan started
protection: N/A
scan complete (time: 0s)

image path: /home/tatsh/cd-recovery/redumper-forced/d995580--
image name: dump_230506_203025_devsr0
correcting Q... done

final TOC:
  track 1 {  data }
    index 00 { LBA: [  -150 ..     -1], length:    150, MSF: 00:00:00-00:24:28 }
    index 01 { LBA: [     0 ..   1678], length:   1679, MSF: 00:02:00-00:24:28 }
  track A {  data }
    index 00 { LBA: [  1679 ..   1679], length:      1, MSF: 00:24:29-00:24:29 }
    index 01 { LBA:   1680, MSF: 00:24:30 }

warning: TOC / QTOC mismatch, nonexistent track in QTOC (track: A)

final QTOC:
  track 1 {  data }
    index 00 { LBA: [  -150 ..     -1], length:    150, MSF: 00:00:00-00:24:28 }
    index 01 { LBA: [     0 ..   1678], length:   1679, MSF: 00:02:00-00:24:28 }

analysis started
analysis complete (time: 2s)

data disc detected, track offset statistics:
  LBA: [  -135 ..   1679], count:   1815, sample offset:    -79386

non-zero  TOC sample range: [   -88200 ..   +987252]
non-zero data sample range: [    +9402 ..   +987834]
Universal Hash (SHA-1): dca000272f5004cbf0103d799f6eb24f137743a7

disc write offset: -6

warning: incomplete pre-gap (session: 1, unavailable: 15/150)
error: seek failed {/var/tmp/portage/app-cdr/redumper-128/work/redumper-build_128/file_io.cc:62}
superg commented 1 year ago

ASUS needs some work. This situation happens when not enough data was extracted from cache.

Tatsh commented 1 year ago

Because of issues building the latest without obtaining a copy of Clang 17, would you consider providing a Docker image?

superg commented 1 year ago

There are no building issues, even github actions can build it easily: https://github.com/superg/redumper/blob/main/.github/workflows/cmake.yml, see "Customize Software (Linux)" step there.

Tatsh commented 1 year ago

The issue for me is in my providing of a package (ebuild) where Gentoo does not provide a stable or keyworded Clang/LLVM 17. And then at the same time, your binaries will not run unless I have libc++ installed:

~/Downloads/redumper-2023.05.02_build145-Linux/bin
 $ ./redumper
./redumper: error while loading shared libraries: libc++.so.1: cannot open shared object file: No such file or directory
superg commented 1 year ago

Static embedding of libc++ is non trivial task, I would do an experiment a bit later but for now it will remain dynamic. In general, the Linux binary build I provide is more a special case, usually people build it from sources. Ideally I should provide deb and rpm that depends on everything that is needed but I just have no time for maintaining distro packages.

Meanwhile, can you try building with clang 15 or 16? There are two things I rely on, C++ modules and std::format. Modules should be available with 15 and std::format implementation is in libc++ but I'm unsure of version.

Tatsh commented 1 year ago

Well, I was finally able to run it in Docker:

FROM ubuntu

RUN apt-get update && apt-get -y install ca-certificates gpg software-properties-common wget
RUN wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key > /etc/apt/trusted.gpg.d/apt.llvm.org.asc && \
    wget -qO- https://apt.kitware.com/keys/kitware-archive-latest.asc | gpg --dearmor - > /usr/share/keyrings/kitware-archive-keyring.gpg && \
    add-apt-repository --yes 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy main' && \
    echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ jammy main' | tee /etc/apt/sources.list.d/kitware.list >/dev/null && \
    apt-get update
RUN rm -f /usr/share/keyrings/kitware-archive-keyring.gpg && apt-get -y install kitware-archive-keyring cmake
RUN apt-get -y install clang-17 lldb-17 lld-17 clang-tools-17 libc++-17-dev libc++abi-17-dev && \
    ln -s /usr/lib/llvm-17/lib/clang/17 /usr/lib/llvm-17/lib/clang/17.0.0 && \
    ln -s /usr/lib/llvm-17/lib/libc++experimental.a /usr/lib/x86_64-linux-gnu
RUN wget http://mirrors.kernel.org/ubuntu/pool/universe/n/ninja-build/ninja-build_1.11.1-1_amd64.deb && \
    dpkg -i ninja-build_1.11.1-1_amd64.deb

WORKDIR /
RUN wget https://github.com/superg/redumper/archive/refs/tags/build_145.tar.gz && \
    tar xvf build_145.tar.gz

RUN mkdir /build
WORKDIR /build
ENV CXX=clang++-17
RUN cmake -G Ninja -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo -Wno-dev \
    -DREDUMPER_VERSION_BUILD=145 /redumper-build_145 && \
    ninja
CMD /build/redumper

docker build -t redumper . of course.

Run with docker run -t --privileged --device=/dev/sr0:/dev/sr0 -v ./out:/out redumper /build/redumper.

Happy to contribute this to the repository with changes.

With the latest I still get incomplete pre-gap randomly with the WH16NS60.

redumper v2023.05.08 build_145 [May  8 2023, 04:22:40]

command line: /build/redumper

*** COMMAND: cd
drive path: /dev/sg2
drive: HL-DT-ST - BD-RE WH16NS60 (revision level: 1.02, vendor specific: NM00100SIK9PH7MJ032)
drive configuration: GENERIC (read offset: +6, C2 shift: 0, pre-gap start: -135, read method: BE_CDDA, sector order: DATA_C2_SUB)
image path: .
image name: dump_230508_043020_devsg2

disc TOC:
  track 1 {  data }
    index 01 { LBA:      0, MSF: 00:02:00 }
  track A {  data }
    index 01 { LBA:  79745, MSF: 17:45:20 }

dump started
[100%] LBA:  79745/79745, errors: { SCSI: 0, C2: 0, Q: 492 }
dump complete (time: 77s)

media errors:
  SCSI: 0
  C2: 0
  Q: 492

image path: .
image name: dump_230508_043020_devsg2
warning: incomplete dump detected, using available dump size
scan started
protection: N/A
scan complete (time: 0s)

image path: .
image name: dump_230508_043020_devsg2
correcting Q... done

final TOC:
  track 1 {  data }
    index 00 { LBA: [  -150 ..     -1], length:    150, MSF: 00:00:00-17:45:18 }
    index 01 { LBA: [     0 ..  79743], length:  79744, MSF: 00:02:00-17:45:18 }
  track A {  data }
    index 00 { LBA: [ 79744 ..  79744], length:      1, MSF: 17:45:19-17:45:19 }
    index 01 { LBA:  79745, MSF: 17:45:20 }

warning: TOC / QTOC mismatch, nonexistent track in QTOC (track: A)

final QTOC:
  track 1 {  data }
    index 00 { LBA: [  -150 ..     -1], length:    150, MSF: 00:00:00-17:45:18 }
    index 01 { LBA: [     0 ..  79743], length:  79744, MSF: 00:02:00-17:45:18 }

analysis started
analysis complete (time: 5s)

data disc detected, track offset statistics:
  LBA: [  -134 ..  79745], count:  79880, sample offset:    -78810

non-zero  TOC sample range: [   -88200 .. +46889472]
non-zero data sample range: [    +9390 .. +46801842]
Universal Hash (SHA-1): 102c9439531d298a5accaca82422aff7c38a1a65

disc write offset: -18

warning: incomplete pre-gap (session: 1, unavailable: 16/150)
error: seek failed

Has the code changed significantly here? In the past I was not getting the issue. Probably around build 50 or so. Compared to my Plextor the WH16NS60 reads fewer errors on my worst discs. So for data-only discs where I am not sending the information to Redump it's generally the one I want to use.

With the Plextor things work as expected with the latest version.

superg commented 1 year ago

You will always get incomplete pre-gap with ASUS (Mediatek based) drives. The only drive known today that can read lead-in / full pre-gap without modification is Plextor. Glad it works for you. I expect redumper development to be bumpy this year. Once I finish my major changes, it should be more stable and straightforward to use.

Tatsh commented 1 year ago

Can you add an option to ignore the incomplete pre-gap error with the ASUS? For most data discs I am not concerned with keeping it.

The thing too about Redumper that is great is that it is one of the only tools to read the disc without stopping due to an I/O error like dd does. dd_rescue/ddrescue are both very unreliable or extremely slow. Sometimes I just want to read the disc as is without caring about what is lost, to get as much as can be recovered easily. So in these cases I am not concerned with a 'complete' dump. Nice if it can happen but not necessary.

Tatsh commented 1 year ago

I'll accept for now that ASUS drives are not working with the current version. Will use Plextor for now and possibly go to a prior version that did work for ASUS.

superg commented 1 year ago

I don't think we are on the same page here. ASUS drives are working exactly as they were for the previous redumper versions as well as for the latest, nothing changed there. The situation with seek failed you've encountered sometimes pops up and that depend on the disc write offset and some other factors. Old redumper versions also have this issue.