Linux usb io error

After installing Ubuntu on a USB stick with the Ubuntu USB Startup Disk Creator (usb-creator-gtk) you might encounter an error such as the following:

After installing Ubuntu on a USB stick with the Ubuntu USB Startup Disk Creator (usb-creator-gtk) you might encounter an error such as the following:

stdin: I/O error
stdin: error 0
/init: line 1: can't open /dev/sr0: No medium found

This is actually a bug with the software and isn’t anything you’ve done wrong. It seems to be a bug that’s effecting users running Karmic, Lucid, Maverick and Natty so it’s a pretty wide spread issue.

The best way I have found to get around this issue is to install and run unetbootin to create live USBs. If you’re using linux it should be found in the usual place you can install things.

Installation:

Ubuntu/LinuxMint/Debian:

sudo apt-get install unetbootin

Fedora/OpenSuse:

sudo yum install unetbootin
Create a live USB:

To install a distro it’s pretty simple, either select it from the “Distribution” option and pick a distribution and version, UNetbootin will then actually download it and install it for you. Alternatively you can pick an Diskimage and browse for the ISO file you download (and would usually burn to a CD/DVD) and install from that. Select the USB Drive at the bottom and hit ok and it’ll install a bootloader, the system and you’ll be up and running in no time.

Persistence File:

If you wanted a persistence install which allows you to save files, settings and installed programs you’ll have to do a little manual work as it currently doesn’t support that option.

Go to http://unetbootin.sourceforge.net/diskimg/ and download one of the files (128mb.zip, 256mb.zip, or 512mb.zip) corresponding to the amount of persistent space you want (make sure the size of the persistent disk image is smaller than the free space you have on your USB drive).

You’ll then need to edit the syslinux.cfg file that was created by UNetbootin in the root of the directory (just open it with a text editor) you should see something similar to the following:

label unetbootindefault
menu label Default
kernel /ubnkern
append initrd=/ubninit file=/cdrom/preseed/ubuntu.seed boot=casper quiet splash —

So on the line that starts “appen initrd=” you’ll want to add the option of “persistent”, it should then look like the following:

NOTE: WordPress changes my double dash at the end of the last line to a single long dash, this won’t work. It’s easiest just to add the final word before the double dash in the file, do not copy and paste this in to your file. If you do, you will get more errors.

label unetbootindefault
menu label Default
kernel /ubnkern
append initrd=/ubninit file=/cdrom/preseed/ubuntu.seed boot=casper quiet splash persistent —

I added this line to all that used the “file=/cdrom/preseed/ubuntu.seed” option, since that’s the image that’s being opened and it should then change all options on the bootloader that will load the ubuntu install.

Доброго времени !

 У меня ситуация с ошибками ввода/вывода на Live USB Linux Mint 7 (Ubuntu 9.04)  воспроизводится в процессе загрузки в Persistent режиме, а не при выходе из системы. Однако,  система все же загружается в Persistent режим, но уж ооочень долго ждать приходится. (Замечу, что с дистрибутивом 8.10 такой проблемы у меня не наблюдалось. Ну а в 8.04 известная похожая проблема, так же требующая замены/фикса initrd.gz)
 Попробую вышепреведенный патч patch, если поможет — отпишусь.

New:

Собственно под спойлерами предлагается пофиксить два файла. Первый — initrd.gz, который лежит в папке casper.
Его нужно скопиорвать с флэшки/диска/образа из этой папки в папку tmp,  и выполнить следующие команды (от имени root):

cd /tmp
gunzip initrd.gz
mkdir ird
cd ird
cpio -i <../initrd
patch scripts/casper <<'EOM'
diff -Nur casper-1.152.orig/scripts/casper casper-1.152/scripts/casper
--- casper-1.152.orig/scripts/casper 2008-10-25 23:46:45.000000000 +0100
+++ casper-1.152/scripts/casper 2009-04-03 00:57:25.000000000 +0100
@@ -396,6 +396,8 @@
     mount -t ${cow_fstype} -o ${cow_mountopt} ${cowdevice} /cow || panic "Can not mount $cowdevice on /cow"

     mount -t ${UNIONFS} -o noatime,dirs=/cow=rw:$rofsstring ${UNIONFS} "$rootmnt" || panic "${UNIONFS} mount failed"
+ [ -d "${rootmnt}/cow" ] || mkdir "${rootmnt}/cow"
+ mount /cow "${rootmnt}/cow" -o move

     # Adding other custom mounts
     if [ -n "${PERSISTENT}" ]; then
@@ -592,3 +594,5 @@
     exec 2>&7 7>&-
     cp casper.log "${rootmnt}/var/log/"
 }
+
+# vi:ts=4:et:
EOM
find | cpio -H newc -o >../newird
cd ..
gzip newird


Затем надо скопировать новоиспеченный файл newird.gz на флэшку в папку casper заменив им initrd.gz.

 Чтобы пропатчить второй файл — casper, который лежит в основной файловой системе,  надо загрузиться в вашу   live persistent   систему, и выполнить такие команды (от имени root):

patch /etc/init.d/casper <<'EOM'
diff -Nur casper-1.152.orig/debian/casper.init casper-1.152/debian/casper.init
--- casper-1.152.orig/debian/casper.init 2008-10-25 23:46:45.000000000 +0100
+++ casper-1.152/debian/casper.init 2009-04-10 14:49:09.000000000 +0100
@@ -75,6 +75,17 @@
  prompt=
     fi

+ # remount cow ro
+ OPTS=`grep '^aufs / aufs ' /proc/mounts | awk '{print $4}'`
+ if [ -n "$OPTS" ]; then
+ OPTS=`echo "$OPTS" | sed -e 's/xino=.*,/noxino,/' -e
+ 's/cow=rw/cow=ro/' -e 's/^rw/ro/'`
+ mount / -no remount,$OPTS
+ mount /cow -no remount,ro
+ sync # you'd think mount would do this ..
+ sleep 5 # could probably get away with less
+ fi
+
     for path in $(which halt) $(which reboot) /etc/rc?.d /etc/default $(which stty); do
         cache_path "$path"
     done
@@ -113,3 +124,5 @@
         exit 3
         ;;
 esac
+
+# vi:ts=4:et:
EOM


  Лично у меня после применения патчей проблема осталась  :-
 Будем надеется в октябрьсом релизе разработчики вспомнят про нужды ливюэзбишнеков  :),
а пока что сделал на флэшке дуалбут на пару с Puppy ).

Hello I have an issue with one 8GB microSD card and my laptop. This isuue doesn’t appear nither with another 4GB microSD nor with my PC. This drive mounts successfully and I can even read/write smal amounts of data (like echo abc>/mnt/test or cat /mnt/test) But whan I’m trying to read/write more data after near 100 MB of exchanging IO stops and I have kernel log like below:

[94741.546395] sdd: detected capacity change from 7882145792 to 0
[94754.440920] usb 1-1.4: new high-speed USB device number 24 using ehci-pci
[94754.527157] usb-storage 1-1.4:1.0: USB Mass Storage device detected
[94754.527321] scsi14 : usb-storage 1-1.4:1.0
[94755.661145] scsi 14:0:0:0: Direct-Access     Multiple Card  Reader     1.00 PQ: 0 ANSI: 0
[94755.662273] sd 14:0:0:0: Attached scsi generic sg2 type 0
[94756.323194] sd 14:0:0:0: [sdd] 15394816 512-byte logical blocks: (7.88 GB/7.34 GiB)
[94756.324319] sd 14:0:0:0: [sdd] Write Protect is off
[94756.324337] sd 14:0:0:0: [sdd] Mode Sense: 03 00 00 00
[94756.325383] sd 14:0:0:0: [sdd] No Caching mode page found
[94756.325390] sd 14:0:0:0: [sdd] Assuming drive cache: write through
[94756.329680] sd 14:0:0:0: [sdd] No Caching mode page found
[94756.329688] sd 14:0:0:0: [sdd] Assuming drive cache: write through
[94756.331737] sd 14:0:0:0: [sdd] Device not ready
[94756.331755] sd 14:0:0:0: [sdd]  
[94756.331760] Result: hostbyte=0x00 driverbyte=0x08
[94756.331764] sd 14:0:0:0: [sdd]  
[94756.331767] Sense Key : 0x2 [current] 
[94756.331772] Info fld=0x0
[94756.331775] sd 14:0:0:0: [sdd]  
[94756.331778] <<vendor>> ASC=0xff ASCQ=0xffASC=0xff <<vendor>> ASCQ=0xff
[94756.331783] sd 14:0:0:0: [sdd] CDB: 
[94756.331786] cdb[0]=0x28: 28 00 00 00 00 00 00 00 08 00
[94756.331799] end_request: I/O error, dev sdd, sector 0
[94756.331804] Buffer I/O error on device sdd, logical block 0
[94756.333828] ldm_validate_partition_table(): Disk read failed.
[94756.333845]  sdd: unable to read partition table
[94756.337133] sd 14:0:0:0: [sdd] No Caching mode page found
[94756.337150] sd 14:0:0:0: [sdd] Assuming drive cache: write through
[94756.337156] sd 14:0:0:0: [sdd] Attached SCSI removable disk
[94770.917104] usb 1-1.4: USB disconnect, device number 24
[94771.867388] usb 1-1.4: new high-speed USB device number 25 using ehci-pci
[94771.953918] usb-storage 1-1.4:1.0: USB Mass Storage device detected
[94771.954303] scsi15 : usb-storage 1-1.4:1.0
[94773.088011] scsi 15:0:0:0: Direct-Access     Multiple Card  Reader     1.00 PQ: 0 ANSI: 0
[94773.088579] sd 15:0:0:0: Attached scsi generic sg2 type 0
[94773.750821] sd 15:0:0:0: [sdd] 15394816 512-byte logical blocks: (7.88 GB/7.34 GiB)
[94773.751929] sd 15:0:0:0: [sdd] Write Protect is off
[94773.751937] sd 15:0:0:0: [sdd] Mode Sense: 03 00 00 00
[94773.753033] sd 15:0:0:0: [sdd] No Caching mode page found
[94773.753051] sd 15:0:0:0: [sdd] Assuming drive cache: write through
[94773.757286] sd 15:0:0:0: [sdd] No Caching mode page found
[94773.757293] sd 15:0:0:0: [sdd] Assuming drive cache: write through
[94773.758674]  sdd: sdd1
[94774.167781] sd 15:0:0:0: [sdd] Device not ready
[94774.167790] sd 15:0:0:0: [sdd]  
[94774.167793] Result: hostbyte=0x00 driverbyte=0x08
[94774.167797] sd 15:0:0:0: [sdd]  
[94774.167800] Sense Key : 0x2 [current] 
[94774.167805] Info fld=0x0
[94774.167808] sd 15:0:0:0: [sdd]  
[94774.167811] <<vendor>> ASC=0xff ASCQ=0xffASC=0xff <<vendor>> ASCQ=0xff
[94774.167816] sd 15:0:0:0: [sdd] CDB: 
[94774.167818] cdb[0]=0x28: 28 00 00 ea e7 80 00 00 08 00
[94774.167830] end_request: I/O error, dev sdd, sector 15394688
[94774.167837] Buffer I/O error on device sdd, logical block 1924336
[94774.174374] sd 15:0:0:0: [sdd] No Caching mode page found
[94774.174382] sd 15:0:0:0: [sdd] Assuming drive cache: write through
[94774.174389] sd 15:0:0:0: [sdd] Attached SCSI removable disk
[94774.472959] FAT-fs (sdd1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
[94865.901809] sd 15:0:0:0: [sdd] Device not ready
[94865.901819] sd 15:0:0:0: [sdd]  
[94865.901824] Result: hostbyte=0x00 driverbyte=0x08
[94865.901828] sd 15:0:0:0: [sdd]  
[94865.901831] Sense Key : 0x2 [current] 
[94865.901838] Info fld=0x0
[94865.901841] sd 15:0:0:0: [sdd]  
[94865.901844] <<vendor>> ASC=0xff ASCQ=0xffASC=0xff <<vendor>> ASCQ=0xff
[94865.901851] sd 15:0:0:0: [sdd] CDB: 
[94865.901853] cdb[0]=0x2a: 2a 00 00 00 1a d3 00 00 9c 00
[94865.901868] end_request: I/O error, dev sdd, sector 6867
[94865.901877] Buffer I/O error on device sdd1, logical block 4819
[94865.901880] lost page write due to I/O error on sdd1
[94865.901887] Buffer I/O error on device sdd1, logical block 4820
[94865.901890] lost page write due to I/O error on sdd1
[94865.901894] Buffer I/O error on device sdd1, logical block 4821
[94865.901897] lost page write due to I/O error on sdd1
[94865.901901] Buffer I/O error on device sdd1, logical block 4822
[94865.901904] lost page write due to I/O error on sdd1
[94865.901907] Buffer I/O error on device sdd1, logical block 4823
[94865.901910] lost page write due to I/O error on sdd1
[94865.901921] Buffer I/O error on device sdd1, logical block 4824
[94865.901924] lost page write due to I/O error on sdd1
[94865.901928] Buffer I/O error on device sdd1, logical block 4825
[94865.901931] lost page write due to I/O error on sdd1
[94865.901940] Buffer I/O error on device sdd1, logical block 4826
[94865.901943] lost page write due to I/O error on sdd1
[94865.901946] Buffer I/O error on device sdd1, logical block 4827
[94865.901949] lost page write due to I/O error on sdd1
[94865.901953] Buffer I/O error on device sdd1, logical block 4828
[94865.901956] lost page write due to I/O error on sdd1
[94872.599679] fat__get_entry: 206 callbacks suppressed
[94872.599687] FAT-fs (sdb1): Directory bread(block 30046) failed
[94872.599694] FAT-fs (sdb1): Directory bread(block 30047) failed
[94872.599699] FAT-fs (sdb1): Directory bread(block 30048) failed
[94872.599703] FAT-fs (sdb1): Directory bread(block 30049) failed
[94872.599708] FAT-fs (sdb1): Directory bread(block 30050) failed
[94872.599713] FAT-fs (sdb1): Directory bread(block 30051) failed
[94872.599717] FAT-fs (sdb1): Directory bread(block 30052) failed
[94872.599721] FAT-fs (sdb1): Directory bread(block 30053) failed
[94873.313616] FAT-fs (sdb1): Directory bread(block 30046) failed
[94873.313625] FAT-fs (sdb1): Directory bread(block 30047) failed
[94897.030704] usb 1-1.4: reset high-speed USB device number 25 using ehci-pci
[94898.317675] sd 15:0:0:0: [sdd] Device not ready
[94898.317685] sd 15:0:0:0: [sdd]  
[94898.317689] Result: hostbyte=0x00 driverbyte=0x08
[94898.317693] sd 15:0:0:0: [sdd]  
[94898.317696] Sense Key : 0x2 [current] 
[94898.317702] Info fld=0x0
[94898.317706] sd 15:0:0:0: [sdd]  
[94898.317708] <<vendor>> ASC=0xff ASCQ=0xffASC=0xff <<vendor>> ASCQ=0xff
[94898.317714] sd 15:0:0:0: [sdd] CDB: 
[94898.317716] cdb[0]=0x2a: 2a 00 00 00 19 d4 00 00 35 00
[94898.317730] end_request: I/O error, dev sdd, sector 6612
[94898.317737] quiet_error: 146 callbacks suppressed
[94898.317741] Buffer I/O error on device sdd1, logical block 4564
[94898.317744] lost page write due to I/O error on sdd1
[94898.317750] Buffer I/O error on device sdd1, logical block 4565
[94898.317753] lost page write due to I/O error on sdd1
[94898.317756] Buffer I/O error on device sdd1, logical block 4566
[94898.317759] lost page write due to I/O error on sdd1
[94898.317762] Buffer I/O error on device sdd1, logical block 4567
[94898.317765] lost page write due to I/O error on sdd1
[94898.317773] Buffer I/O error on device sdd1, logical block 4568
[94898.317776] lost page write due to I/O error on sdd1
[94898.317780] Buffer I/O error on device sdd1, logical block 4569
[94898.317782] lost page write due to I/O error on sdd1
[94898.317786] Buffer I/O error on device sdd1, logical block 4570
[94898.317788] lost page write due to I/O error on sdd1
[94898.317792] Buffer I/O error on device sdd1, logical block 4571
[94898.317795] lost page write due to I/O error on sdd1
[94898.317798] Buffer I/O error on device sdd1, logical block 4572
[94898.317801] lost page write due to I/O error on sdd1
[94898.317804] Buffer I/O error on device sdd1, logical block 4573
[94898.317807] lost page write due to I/O error on sdd1
[94898.421760] sd 15:0:0:0: [sdd] Device not ready
[94898.421771] sd 15:0:0:0: [sdd]  
[94898.421775] Result: hostbyte=0x00 driverbyte=0x08
[94898.421779] sd 15:0:0:0: [sdd]  
[94898.421782] Sense Key : 0x2 [current] 
[94898.421789] Info fld=0x0
[94898.421792] sd 15:0:0:0: [sdd]  
[94898.421795] <<vendor>> ASC=0xff ASCQ=0xffASC=0xff <<vendor>> ASCQ=0xff
[94898.421802] sd 15:0:0:0: [sdd] CDB: 
[94898.421804] cdb[0]=0x2a: 2a 00 00 00 08 41 00 00 88 00
[94898.421819] end_request: I/O error, dev sdd, sector 2113

formatting of card doesn’t help.
Any idea?
Thanks.

Every time a Bulk Transfer is done for reading data a unknown error (3) occurs:
libusb: error [submit_bulk_transfer] submiturb failed error -1 errno=3

Nothing in the Lib USB documentation covers the unknown error (3) when using the Synchronous Device IO API, which suggests the error is unexpected. Below is the code used to read data from a USB device (uses the CP2102 USB to UART Bridge Controller):

fun runReadLoop(devHandle: CPointer<libusb_device_handle>?) = memScoped {
    val dataLength = 1500
    val data = allocArray<UByteVar>(dataLength)
    val endpoint = 0x81.toUByte()
    println("Running read loop...")
    // Ensure the device is ready for reading.
    libusb_reset_device(devHandle)
    while (true) {
        val readStatus = libusb_bulk_transfer(
                dev_handle = devHandle,
                endpoint = endpoint,
                timeout = 9000,
                length = dataLength,
                data = data,
                actual_length = null
        )
        processRead(data = data, dataLength = dataLength, readStatus = readStatus)
        sleep(1)
    }
}

fun processRead(data: CArrayPointer<UByteVar>, dataLength: Int, readStatus: Int) {
    val success = 0
    if (readStatus == LIBUSB_ERROR_IO) {
        fprintf(stderr, "Cannot read USB device.n")
    } else if (readStatus == success) {
        val str = data.createString(dataLength)
        println("Received Data:n$str")
    }
}

Here is the information for the device (using the lsusb command):

Bus 001 Device 008: ID 10c4:ea60 Cygnal Integrated Products, Inc. CP210x UART Bridge / myAVR mySmartUSB light
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x10c4 Cygnal Integrated Products, Inc.
  idProduct          0xea60 CP210x UART Bridge / myAVR mySmartUSB light
  bcdDevice            1.00
  iManufacturer           1 Silicon Labs
  iProduct                2 CP2102 USB to UART Bridge Controller
  iSerial                 3 0001
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           32
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              2 CP2102 USB to UART Bridge Controller
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
Device Status:     0x0000
  (Bus Powered)

Running the program on Linux Mint 19.2 (64 bit) using the Lib USB library (via the libusb-dev package v2:1.0.21-2)

Понравилась статья? Поделить с друзьями:

Читайте также:

  • Linux syntax error unexpected end of file
  • Linux socket error 24
  • Linux redirect error output
  • Linux openvpn error linux route add command failed external program exited with error status 2
  • Linux mtp error

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии