Results 1 to 8 of 8

Thread: Scanimage script fails

  1. #1
    Join Date
    Aug 2008
    Location
    Mexico and Sweden
    Posts
    1,280

    Default Scanimage script fails

    Under openSUSE 13.2 I wrote this script for simple scanning...

    Code:
    #!/bin/bash
    
    for i in $(seq --format=%003.f 1 150); do
      echo Prepare page $i and press Enter
      read
      scanimage -v --format=tiff --mode 'Gray'  --resolution 300 -x 215 -y 297  >scan-$i.tiff
    
    
    done
    It worked consistently. When I copied it to 42.1 the first scan works but then it fails on the second scan and third scan..

    Code:
    :~> scanion-g.sh
    Prepare page 001 and press Enter
    
    scanimage: scanning image of size 2536x3507 pixels at 8 bits/pixel
    scanimage: acquiring gray frame
    scanimage: min/max graylevel value = 5/255
    scanimage: read 8893752 bytes in total
    Prepare page 002 and press Enter
    
    *** Error in `scanimage': double free or corruption (!prev): 0x0000000000edcb50 ***
    ======= Backtrace: =========
    /lib64/libc.so.6(+0x7275f)[0x7f002455e75f]
    /lib64/libc.so.6(+0x77fce)[0x7f0024563fce]
    /lib64/libc.so.6(+0x78ce6)[0x7f0024564ce6]
    /usr/lib64/sane/libsane-genesys.so.1(sanei_genesys_send_gamma_table+0x258)[0x7f0023356908]
    /usr/lib64/sane/libsane-genesys.so.1(sane_genesys_start+0x181)[0x7f0023322811]
    scanimage[0x402607]
    /lib64/libc.so.6(__libc_start_main+0xf5)[0x7f002450db05]
    scanimage[0x403b84]
    ======= Memory map: ========
    00400000-0040b000 r-xp 00000000 08:02 272270                             /usr/bin/scanimage
    0060a000-0060b000 r--p 0000a000 08:02 272270                             /usr/bin/scanimage
    0060b000-0060c000 rw-p 0000b000 08:02 272270                             /usr/bin/scanimage
    00ece000-00eef000 rw-p 00000000 00:00 0                                  [heap]
    7f00228ee000-7f0022904000 r-xp 00000000 08:02 1061087                    /lib64/libgcc_s.so.1
    7f0022904000-7f0022b03000 ---p 00016000 08:02 1061087                    /lib64/libgcc_s.so.1
    7f0022b03000-7f0022b04000 r--p 00015000 08:02 1061087                    /lib64/libgcc_s.so.1
    7f0022b04000-7f0022b05000 rw-p 00016000 08:02 1061087                    /lib64/libgcc_s.so.1
    7f0022b05000-7f0022b06000 ---p 00000000 00:00 0  
    7f0022b06000-7f0023306000 rw-p 00000000 00:00 0                          [stack:6925]
    7f0023306000-7f0023375000 r-xp 00000000 08:02 540546                     /usr/lib64/sane/libsane-genesys.so.1.0.24
    7f0023375000-7f0023575000 ---p 0006f000 08:02 540546                     /usr/lib64/sane/libsane-genesys.so.1.0.24
    7f0023575000-7f0023576000 r--p 0006f000 08:02 540546                     /usr/lib64/sane/libsane-genesys.so.1.0.24
    7f0023576000-7f0023587000 rw-p 00070000 08:02 540546                     /usr/lib64/sane/libsane-genesys.so.1.0.24
    7f0023587000-7f002358a000 rw-p 00000000 00:00 0  
    7f002358a000-7f0023591000 r-xp 00000000 08:02 1050811                    /lib64/librt-2.19.so
    7f0023591000-7f0023790000 ---p 00007000 08:02 1050811                    /lib64/librt-2.19.so
    7f0023790000-7f0023791000 r--p 00006000 08:02 1050811                    /lib64/librt-2.19.so
    7f0023791000-7f0023792000 rw-p 00007000 08:02 1050811                    /lib64/librt-2.19.so
    7f0023792000-7f00237a5000 r-xp 00000000 08:02 408337                     /usr/lib64/libudev.so.1.4.0
    7f00237a5000-7f00239a4000 ---p 00013000 08:02 408337                     /usr/lib64/libudev.so.1.4.0
    7f00239a4000-7f00239a5000 r--p 00012000 08:02 408337                     /usr/lib64/libudev.so.1.4.0
    7f00239a5000-7f00239a6000 rw-p 00013000 08:02 408337                     /usr/lib64/libudev.so.1.4.0
    7f00239a6000-7f0023aa6000 r-xp 00000000 08:02 1050805                    /lib64/libm-2.19.so
    7f0023aa6000-7f0023ca5000 ---p 00100000 08:02 1050805                    /lib64/libm-2.19.so
    7f0023ca5000-7f0023ca6000 r--p 000ff000 08:02 1050805                    /lib64/libm-2.19.so
    7f0023ca6000-7f0023ca7000 rw-p 00100000 08:02 1050805                    /lib64/libm-2.19.so
    7f0023ca7000-7f0023cbf000 r-xp 00000000 08:02 1050815                    /lib64/libpthread-2.19.so
    7f0023cbf000-7f0023ebe000 ---p 00018000 08:02 1050815                    /lib64/libpthread-2.19.so
    7f0023ebe000-7f0023ebf000 r--p 00017000 08:02 1050815                    /lib64/libpthread-2.19.so
    7f0023ebf000-7f0023ec0000 rw-p 00018000 08:02 1050815                    /lib64/libpthread-2.19.so
    7f0023ec0000-7f0023ec4000 rw-p 00000000 00:00 0  
    7f0023ec4000-7f0023edb000 r-xp 00000000 08:02 397355                     /usr/lib64/libusb-1.0.so.0.1.0
    7f0023edb000-7f00240da000 ---p 00017000 08:02 397355                     /usr/lib64/libusb-1.0.so.0.1.0
    7f00240da000-7f00240db000 r--p 00016000 08:02 397355                     /usr/lib64/libusb-1.0.so.0.1.0
    7f00240db000-7f00240dc000 rw-p 00017000 08:02 397355                     /usr/lib64/libusb-1.0.so.0.1.0
    7f00240dc000-7f00240e7000 r-xp 00000000 08:02 413349                     /usr/lib64/libieee1284.so.3.2.2
    7f00240e7000-7f00242e6000 ---p 0000b000 08:02 413349                     /usr/lib64/libieee1284.so.3.2.2
    7f00242e6000-7f00242e7000 r--p 0000a000 08:02 413349                     /usr/lib64/libieee1284.so.3.2.2
    7f00242e7000-7f00242e8000 rw-p 0000b000 08:02 413349                     /usr/lib64/libieee1284.so.3.2.2
    7f00242e8000-7f00242eb000 r-xp 00000000 08:02 1050773                    /lib64/libdl-2.19.so
    7f00242eb000-7f00244ea000 ---p 00003000 08:02 1050773                    /lib64/libdl-2.19.so
    7f00244ea000-7f00244eb000 r--p 00002000 08:02 1050773                    /lib64/libdl-2.19.so
    7f00244eb000-7f00244ec000 rw-p 00003000 08:02 1050773                    /lib64/libdl-2.19.so
    7f00244ec000-7f002468a000 r-xp 00000000 08:02 1050813                    /lib64/libc-2.19.so
    7f002468a000-7f002488a000 ---p 0019e000 08:02 1050813                    /lib64/libc-2.19.so
    7f002488a000-7f002488e000 r--p 0019e000 08:02 1050813                    /lib64/libc-2.19.so
    7f002488e000-7f0024890000 rw-p 001a2000 08:02 1050813                    /lib64/libc-2.19.so
    7f0024890000-7f0024894000 rw-p 00000000 00:00 0  
    7f0024894000-7f00248bf000 r-xp 00000000 08:02 413594                     /usr/lib64/libsane.so.1.0.24
    7f00248bf000-7f0024abe000 ---p 0002b000 08:02 413594                     /usr/lib64/libsane.so.1.0.24
    7f0024abe000-7f0024abf000 r--p 0002a000 08:02 413594                     /usr/lib64/libsane.so.1.0.24
    7f0024abf000-7f0024ac0000 rw-p 0002b000 08:02 413594                     /usr/lib64/libsane.so.1.0.24
    7f0024ac0000-7f0024ac2000 rw-p 00000000 00:00 0  
    7f0024ac2000-7f0024ae3000 r-xp 00000000 08:02 1060005                    /lib64/ld-2.19.so
    7f0024cb1000-7f0024cb7000 rw-p 00000000 00:00 0  
    7f0024ce0000-7f0024ce2000 rw-p 00000000 00:00 0  
    7f0024ce2000-7f0024ce3000 r--p 00020000 08:02 1060005                    /lib64/ld-2.19.so
    7f0024ce3000-7f0024ce4000 rw-p 00021000 08:02 1060005                    /lib64/ld-2.19.so
    7f0024ce4000-7f0024ce5000 rw-p 00000000 00:00 0  
    7ffdeb6ca000-7ffdeb6eb000 rw-p 00000000 00:00 0                          [stack]
    7ffdeb7f5000-7ffdeb7f7000 r--p 00000000 00:00 0                          [vvar]
    7ffdeb7f7000-7ffdeb7f9000 r-xp 00000000 00:00 0                          [vdso]
    ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
    /home/ion/bin/scanion-g.sh: line 3:  6924 Aborted                 scanimage -v --format=tiff --mode 'Gray' --resol
    ution 300 -x 215 -y 297 > scan-$i.tiff
    Prepare page 003 and press Enter
    
    scanimage: no SANE devices found
    Prepare page 004 and press Enter
    
    
    This is far above my ability to unravel. If anyone can give me a hint as to what I should look for I will be most appreciative.

  2. #2
    Join Date
    Jun 2008
    Location
    Auckland, NZ
    Posts
    20,181
    Blog Entries
    1

    Default Re: Scanimage script fails

    I'm assuming that if you run the command manually more than once the same error will result after the first attempt
    Code:
    scanimage -v --format=tiff --mode 'Gray'  --resolution 300 -x 215 -y 297  > foo.tiff
    A possible regression with the sane-genesys backend IMO, and so a bug report might be needed. Review this troubleshooting guide

    https://en.opensuse.org/SDB:Configur...28Debugging.29

    Try installing/using simple-scan for multi-page scanning and see if that behaves any differently (although I assume not)

    https://opensource.com/life/14/8/3-t...-linux-desktop


  3. #3
    Join Date
    Aug 2008
    Location
    Mexico and Sweden
    Posts
    1,280

    Default Re: Scanimage script fails

    Quote Originally Posted by deano_ferrari View Post
    I'm assuming that if you run the command manually more than once the same error will result after the first attempt
    Code:
    scanimage -v --format=tiff --mode 'Gray'  --resolution 300 -x 215 -y 297  > foo.tiff

    Your assumption is correct. The scanner needs to be unplugged and re-plugged for it to work.


    A possible regression with the sane-genesys backend IMO, and so a bug report might be needed. Review this troubleshooting guide

    https://en.opensuse.org/SDB:Configur...28Debugging.29

    Try installing/using simple-scan for multi-page scanning and see if that behaves any differently (although I assume not)

    https://opensource.com/life/14/8/3-t...-linux-desktop

    I installed simple-scan. I can scan several images, but when I terminate the application it will not start again until I unplug and re-plug the scanner. It tells me no scanners are available. I can live with that for the time being and will follow up on the troubleshooting guide.

    Thanks for the suggestion.

  4. #4
    Join Date
    Jun 2008
    Location
    Auckland, NZ
    Posts
    20,181
    Blog Entries
    1

    Default Re: Scanimage script fails

    Hi ionmich. Just in case it's relevant, is thhis the same computer that was previously running openSUSE 13.2? I was just wondering if perhaps this might be related to the underlying USB drivers/hardware, (rather than the user-space sane-genesys driver). Is the scanner attached to a USB 2.0 or 3.0 port? Check kernel output when scanner device is first attached. Open a terminal and execute
    Code:
    dmesg --follow
    then attach the scanner. The relevant output can be copy/pasted here. There have been some reports of XHCI behaviour responsible for strange issues with scanners and printers.

    FWIW, a possible workaround to the issue you reported here is to reset the USB bus in the script as described here
    http://askubuntu.com/questions/27847...-for-each-scan
    http://askubuntu.com/questions/645/h...e-command-line


    If your diagnostics lead you to think the issue is due to the SANE backend rather than a low-level USB issue, then it needs to get reported here
    http://www.sane-project.org/bugs.html

    Some bug reports that might be worth reviewing
    https://bugs.launchpad.net/ubuntu/+s...s/+bug/1184699
    https://bugzilla.opensuse.org/show_bug.cgi?id=897855

  5. #5
    Join Date
    Aug 2008
    Location
    Mexico and Sweden
    Posts
    1,280

    Default Re: Scanimage script fails

    Quote Originally Posted by deano_ferrari View Post
    Hi ionmich. Just in case it's relevant, is this the same computer that was previously running openSUSE 13.2?
    No.

    Is the scanner attached to a USB 2.0 or 3.0 port?
    USB 2.0

    Check kernel output when scanner device is first attached. Open a terminal and execute
    Code:
    dmesg --follow
    then attach the scanner. The relevant output can be copy/pasted here. There have been some reports of XHCI behaviour responsible for strange issues with scanners and printers.
    Code:
    [ 2240.268724] usb 1-1: new high-speed USB device number 3 using xhci_hcd
    [ 2240.398474] usb 1-1: New USB device found, idVendor=04a9, idProduct=1909
    [ 2240.398486] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
    [ 2240.398493] usb 1-1: Product: CanoScan
    [ 2240.398499] usb 1-1: Manufacturer: Canon
    Further investigation and report later.

  6. #6
    Join Date
    Jun 2008
    Location
    Auckland, NZ
    Posts
    20,181
    Blog Entries
    1

    Default Re: Scanimage script fails

    The output suggests a high USB 2.0 (high speed) device connected to a USB 3.0 host controller (using xhci_hcd driver). If your BIOS allows, you might try enabling 'Legacy USB Support', then check behaviour again. Alternatively, does your computer have a mixture of USB 2.0 and 3.0 ports available perhaps?
    Last edited by deano_ferrari; 08-May-2016 at 12:54.

  7. #7
    Join Date
    Aug 2008
    Location
    Mexico and Sweden
    Posts
    1,280

    Default Re: Scanimage script fails

    Quote Originally Posted by deano_ferrari View Post
    The output suggests a high USB 2.0 (high speed) device connected to a USB 3.0 host controller (using xhci_hcd driver). If your BIOS allows, you might try enabling 'Legacy USB Support', then check behaviour again. Alternatively, does your computer have a mixture of USB 2.0 and 3.0 ports available perhaps?
    Some more diagnosis finally, and some vital information missing from my posts. Likely due to jet lag.


    1. The script I wrote that worked with 13.2 resides on an older machine (possibly only USB2 hardware) in another country 12 hours flying away.
    2. The reason I wrote the script was because Xsane and other applications took a long time to start due to long warmup time.
    3. The scanner it worked with is an older Epson.
    4. The scanner I am using here and now is a Canon Lide 110.
    5. Xsane, which is excellent in my opinion, no longer requires warmup and is fully functional. No reason not to use it.

    Just because I am old and resistant to change is no reason to waste other people's time with unneeded questions. Many thanks for all the thought and help you provided.

  8. #8
    Join Date
    Jun 2008
    Location
    Auckland, NZ
    Posts
    20,181
    Blog Entries
    1

    Default Re: Scanimage script fails

    All good

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •