Linux unable to read its own Installation media from a MicroSD card.

Hi,

I’d like to create an Opensuse installation media.
So I downloaded the network image, and wrote it to a microsd card, that is connected to the PC via a USB card reader.

The card functions well. Under Windows, it has no problems.
However, after the install image is written to the card, my currently installed Linux (Opensuse 15.2) can’t read it.

It shows up as “/dev/sdc” under /dev

# ls -la /dev/sd*
brw-rw---- 1 root disk 8, 0 Dec 9 12:58 /dev/sda
brw-rw---- 1 root disk 8, 1 Dec 9 13:21 /dev/sda1
brw-rw---- 1 root disk 8, 16 Dec 9 12:58 /dev/sdb
brw-rw---- 1 root disk 8, 17 Dec 9 12:58 /dev/sdb1
brw-rw---- 1 root disk 8, 32 Dec 9 13:26 /dev/sdc

But fdisk says No medium found.

# fdisk /dev/sdc

Welcome to fdisk (util-linux 2.33.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

fdisk: cannot open /dev/sdc: No medium found

dmesg logs:

1648.974831] usb 1-4: new high-speed USB device number 3 using xhci_hcd
1649.148370] usb 1-4: New USB device found, idVendor=05e3, idProduct=0723, bcdDevice=94.51
1649.148372] usb 1-4: New USB device strings: Mfr=3, Product=4, SerialNumber=0
1649.148374] usb 1-4: Product: USB Storage
1649.148375] usb 1-4: Manufacturer: Generic
1649.159392] usb-storage 1-4:1.0: USB Mass Storage device detected
1649.159497] usb-storage 1-4:1.0: Quirks match for vid 05e3 pid 0723: 8000
1649.159525] scsi host10: usb-storage 1-4:1.0
1650.186857] scsi 10:0:0:0: Direct-Access Generic STORAGE DEVICE 9451 PQ: 0 ANSI: 0
1650.187148] sd 10:0:0:0: Attached scsi generic sg3 type 0
1650.466029] sd 10:0:0:0: [sdc] 7744512 512-byte logical blocks: (3.97 GB/3.69 GiB)
1650.467542] sd 10:0:0:0: [sdc] Write Protect is off
1650.467544] sd 10:0:0:0: [sdc] Mode Sense: 03 00 00 00
1650.469566] sd 10:0:0:0: [sdc] No Caching mode page found
1650.469568] sd 10:0:0:0: [sdc] Assuming drive cache: write through
1650.490451] sdc: sdc1
1650.494616] sd 10:0:0:0: [sdc] Attached SCSI removable disk
1654.942185] sd 10:0:0:0: [sdc] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
1654.942187] sd 10:0:0:0: [sdc] tag#0 Sense Key : Medium Error [current]
1654.942189] sd 10:0:0:0: [sdc] tag#0 Add. Sense: Address mark not found for id field
1654.942191] sd 10:0:0:0: [sdc] tag#0 CDB: Read(10) 28 00 00 76 2b ff 00 00 01 00
1654.942193] blk_update_request: I/O error, dev sdc, sector 7744511 op 0x0:(READ) flags 0x80700 phys_seg 1 prio class 0
1659.280067] sd 10:0:0:0: [sdc] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
1659.280070] sd 10:0:0:0: [sdc] tag#0 Sense Key : Not Ready [current]
1659.280072] sd 10:0:0:0: [sdc] tag#0 Add. Sense: Medium not present
1659.280074] sd 10:0:0:0: [sdc] tag#0 CDB: Read(10) 28 00 00 76 2b f8 00 00 01 00
1659.280076] blk_update_request: I/O error, dev sdc, sector 7744504 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
1659.280079] Buffer I/O error on dev sdc, logical block 968063, async page read

If I boot to Windows, and use partition magic delete all partitions from the card and fill all sectors with 0, then it works under Linux as well.
Until I write the installation image again.

Why would my Linux be unable to read its own installation media?

Hello and welcome to the openSUSE forums.

You write “… wrote it to a microsd card”. Can you please explain how you wrote that?

Can you please post

fdisk -l

and

lsblk -af

to get the whole picture.

Your list of /dev/sd* devices shows that there is some mass-storage hardware, but that there is no partitioning found.

Are you sure the device is still connected when that error message shows?

Oh, and for using the technique on the forums here:
There is an important, but not easy to find feature on the forums.

Please in the future use CODE tags around copied/pasted computer text in a post. It is the # button in the tool bar of the post editor. When applicable copy/paste complete, that is including the prompt, the command, the output and the next prompt.

An example is here: Using CODE tags Around your paste.

So you downloaded “https://download.opensuse.org/distribution/leap/15.2/iso/openSUSE-Leap-15.2-NET-x86_64.iso”.

How did you “write” that file to your microsd card (with dd, with cp, with imagewriter, …)? Did you receive any (error)messages during/after that writing?

Regards

susejunky

Hi,

Thank you very much for the replies.
I tried writing the image with imagewriter under Linux. I also tried it with rufus in ISO mode under windows. There were no error messages.
The device is connected. In fact it is working perfectly fine under Windows.

Here are the requested information (this time as code, thank you very much for the tip):

**#** fdisk -l
**Disk /dev/sda: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors**
Disk model: WDC WD20EZRZ-00Z
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0xbeb00428

**Device****Boot****Start****       End****   Sectors**** Size****Id****Type**
/dev/sda1        2048 3907028991 3907026944  1.8T  7 HPFS/NTFS/exFAT


**Disk /dev/sdb: 298.1 GiB, 320072933376 bytes, 625142448 sectors**
Disk model: ST320LT012-1DG14
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x535f4ec5

**Device****Boot****Start****      End****  Sectors****  Size****Id****Type**
/dev/sdb1        2048 625135615 625133568 298.1G  7 HPFS/NTFS/exFAT


**Disk /dev/nvme0n1: 232.9 GiB, 250059350016 bytes, 488397168 sectors**
Disk model: WDS250G3X0C-00SJG0                       
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x0013037e

**Device****Boot****    Start****      End****  Sectors****  Size****Id****Type**
/dev/nvme0n1p1 *         2048   1126399   1124352   549M  7 HPFS/NTFS/exFAT
/dev/nvme0n1p2        1126400 362569727 361443328 172.4G  7 HPFS/NTFS/exFAT
/dev/nvme0n1p3      362569728 484202495 121632768    58G 83 Linux
/dev/nvme0n1p4      484202496 488397167   4194672     2G 82 Linux swap / Solaris



**#** lsblk -af
NAME        FSTYPE LABEL                        UUID                                 FSAVAIL FSUSE% MOUNTPOINT
sda                                                                                                  
└─sda1      ntfs   Imasundaj2TB                 01D5FA119A7D5230                      385.8G    79% /Imasundaj2TB
sdb                                                                                                  
└─sdb1      ntfs   Backup                       01D6531089A4A820                                     
sdc                                                                                                  
sr0                                                                                                  
nvme0n1                                                                                              
├─nvme0n1p1 ntfs   Rendszer számára fenntartott 0428076428075458                                     
├─nvme0n1p2 ntfs   Rendszer                     56103A37103A1E85                                     
├─nvme0n1p3 btrfs                               158f9733-1489-4825-9460-0d9b3c3676ba   45.3G    21% /
└─nvme0n1p4 swap                                8d25ee30-2759-4bc4-aadc-d5bef30b1154                [SWAP]

In Linux you use dd to make the sdcard like this - sdx is the sdcard

dd if=openSUSE-Leap-15.2-DVD-x86_64.iso of=/dev/sdx bs=1024k status=progress

in windows 10 if you install SFU (system for unix) opensuse - it is done the same way - rufus is for windows images not Linux.

Indeed very strange. fdisk does not see it and when I hadn’t asked for the -a option in lsblk, it would not have been reported there (like the DVD device sr0, but that is logical because no DVD inside).

You say Windows makes more out of it. I have no idea about Windows, but could you tell what it detects. Partitions? File systems?

Maybe we should try some logs, like

dmesg | grep sdc

I assume others have better hints for consulting logs.

And I support the usage of dd. I know there are other tools that CAN do it correct, but you really have to be careful that they do it correct (that is without any interpretation, alteration or anything, just byte by byte). dd does just that, already for more then 40 years, copy byte for byte until the enf of file at the input side or the end of space on the output side.

Thank you everyone for the answers.
I did some troubleshooting. Wasn’t easy, as I have to alternate between Windows and Linux, and check if an action solved anything.
I tried a different microsd card. Different make, different size. It works perfectly with the same card reader in the same USB port. No errors at all.
Windows detects it perfectly. Everything is working there. Partitions are correctly detected. Contents can be read and written.

So far I determined, that if any partition is present on the card, it gives me I/O errors when Linux detects it.

   40.789182] sd 10:0:0:0: [sdc] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
   40.789184] sd 10:0:0:0: [sdc] tag#0 Sense Key : Not Ready [current]  
   40.789186] sd 10:0:0:0: [sdc] tag#0 Add. Sense: Medium not present
   40.789188] sd 10:0:0:0: [sdc] tag#0 CDB: Read(10) 28 00 00 76 2b fe 00 00 01 00
   40.789191] blk_update_request: I/O error, dev sdc, sector 7744510 op 0x0:(READ) flags 0x80700 phys_seg 1 prio class 0
   40.795045] sd 10:0:0:0: [sdc] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
   40.795047] sd 10:0:0:0: [sdc] tag#0 Sense Key : Not Ready [current]  
   40.795049] sd 10:0:0:0: [sdc] tag#0 Add. Sense: Medium not present
   40.795051] sd 10:0:0:0: [sdc] tag#0 CDB: Read(10) 28 00 00 76 2b f8 00 00 08 00
   40.795053] blk_update_request: I/O error, dev sdc, sector 7744504 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
   40.795055] Buffer I/O error on dev sdc, logical block 968063, async page read
   40.801046] sdc: detected capacity change from 3965190144 to 0

If I wipe the card (fill with zeros), then Linux detects it, it seems to be working. I can only wipe it from Windows.

  443.386195] usb 1-4: new high-speed USB device number 7 using xhci_hcd
  443.559717] usb 1-4: New USB device found, idVendor=05e3, idProduct=0723, bcdDevice=94.51
  443.559719] usb 1-4: New USB device strings: Mfr=3, Product=4, SerialNumber=0
  443.559721] usb 1-4: Product: USB Storage
  443.559721] usb 1-4: Manufacturer: Generic  
  443.569753] usb-storage 1-4:1.0: USB Mass Storage device detected
  443.569931] usb-storage 1-4:1.0: Quirks match for vid 05e3 pid 0723: 8000
  443.569959] scsi host10: usb-storage 1-4:1.0
  444.594096] scsi 10:0:0:0: Direct-Access     Generic  STORAGE DEVICE   9451 PQ: 0 ANSI: 0
  444.594396] sd 10:0:0:0: Attached scsi generic sg3 type 0
  444.879550] sd 10:0:0:0: [sdc] 7744512 512-byte logical blocks: (3.97 GB/3.69 GiB)
  444.880913] sd 10:0:0:0: [sdc] Write Protect is off
  444.880914] sd 10:0:0:0: [sdc] Mode Sense: 03 00 00 00
  444.883177] sd 10:0:0:0: [sdc] No Caching mode page found
  444.883180] sd 10:0:0:0: [sdc] Assuming drive cache: write through
  444.910945] sd 10:0:0:0: [sdc] Attached SCSI removable disk

At this point, “fdisk -l” shows the card correctly.

**Disk /dev/sdc: 3.7 GiB, 3965190144 bytes, 7744512 sectors**
Disk model: STORAGE DEVICE   
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

However if I try “fdisk /dev/sdc”, it thinks for ~10 seconds and gives an error.

**#** fdisk /dev/sdc

Welcome to fdisk (util-linux 2.33.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

fdisk: cannot open /dev/sdc: Input/output error

Error in dmesg:

  774.383121] sd 10:0:0:0: [sdc] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
  774.383124] sd 10:0:0:0: [sdc] tag#0 Sense Key : Medium Error [current]  
  774.383126] sd 10:0:0:0: [sdc] tag#0 Add. Sense: Address mark not found for id field
  774.383128] sd 10:0:0:0: [sdc] tag#0 CDB: Read(10) 28 00 00 76 2b ff 00 00 01 00
  774.383130] blk_update_request: I/O error, dev sdc, sector 7744511 op 0x0:(READ) flags 0x80700 phys_seg 1 prio class 0
  778.719896] sd 10:0:0:0: [sdc] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
  778.719898] sd 10:0:0:0: [sdc] tag#0 Sense Key : Not Ready [current]  
  778.719900] sd 10:0:0:0: [sdc] tag#0 Add. Sense: Medium not present
  778.719902] sd 10:0:0:0: [sdc] tag#0 CDB: Read(10) 28 00 00 76 2b f8 00 00 01 00
  778.719905] blk_update_request: I/O error, dev sdc, sector 7744504 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
  778.719908] Buffer I/O error on dev sdc, logical block 968063, async page read

At this point, pulling out and putting back the card reader in the same USB port seems to fix the problem.
Using the suggested dd command wrote the .iso image to the card successfully, but after that, I get the same I/O error in dmesg. And the card is again not functioning.

**#** dd if=openSUSE-Leap-15.2-NET-x86_64.iso of=/dev/sdc bs=1024k status=progress                                  
82837504 bytes (83 MB, 79 MiB) copied, 2 s, 41.4 MB/s
138+0 records in
138+0 records out
144703488 bytes (145 MB, 138 MiB) copied, 26.1462 s, 5.5 MB/s

 1125.764929]  sdc: sdc1 sdc2
 1130.117554] sd 10:0:0:0: [sdc] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
 1130.117556] sd 10:0:0:0: [sdc] tag#0 Sense Key : Medium Error [current]  
 1130.117558] sd 10:0:0:0: [sdc] tag#0 Add. Sense: Address mark not found for id field
 1130.117560] sd 10:0:0:0: [sdc] tag#0 CDB: Read(10) 28 00 00 76 2b ff 00 00 01 00
 1130.117562] blk_update_request: I/O error, dev sdc, sector 7744511 op 0x0:(READ) flags 0x80700 phys_seg 1 prio class 0
 1134.453440] sd 10:0:0:0: [sdc] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
 1134.453450] sd 10:0:0:0: [sdc] tag#0 Sense Key : Not Ready [current]  
 1134.453454] sd 10:0:0:0: [sdc] tag#0 Add. Sense: Medium not present
 1134.453459] sd 10:0:0:0: [sdc] tag#0 CDB: Read(10) 28 00 00 76 2b f8 00 00 01 00
 1134.453464] blk_update_request: I/O error, dev sdc, sector 7744504 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
 1134.453470] Buffer I/O error on dev sdc, logical block 968063, async page read

Trying to wipe from Linux at this point fails, I have to reboot into Windows to fix it again.

**#** dd if=/dev/null of=/dev/sdc bs=1024k status=progress                                  
dd: failed to open '/dev/sdc': No medium found

My guess is your sdcard to usb device is not 100% compatible with Linux. And it is giving udev the wrong info when queried.

I have about 20 different sdcard and micro sdcard to USB devices - many are flakey with larger than 16gb micro sdcards.

The best one is the one I got is from Canakit for my Raspberry Pi 4 - it is USB 3 compatible and works fine with up to 256gb micro sdcards.

Some that worked good 5 years ago don’t work fine now - I finally figured out that putting a micro sd card into a sdcard adapter gave flakey results - get a micro sd card to usb to prevent that.

Thank you for your input.
My card is 4gb. So I don’t think the size is the issue.
I guess since this is an old card, it is just starting to give up.
So it is time to retire it.

Got an old card and attached it to the machine using a ‘Genesys Logic, Inc. SDXC and microSDXC CardReader’ and a ‘SanDisk microSD adapter’:

3400G:~ # fdisk -l /dev/sdd 
Disk /dev/sdd: 7.33 GiB, 7861174272 bytes, 15353856 sectors 
Disk model: STORAGE DEVICE   
Units: sectors of 1 * 512 = 512 bytes 
Sector size (logical/physical): 512 bytes / 512 bytes 
I/O size (minimum/optimal): 512 bytes / 512 bytes 
Disklabel type: dos 
Disk identifier: 0x7c77f3ea 

Device     Boot Start      End  Sectors  Size Id Type 
/dev/sdd1        8192 15353855 15345664  7.3G  c W95 FAT32 (LBA) 
3400G:~ #

The procedure works reliably with openSUSE Tumbleweed since many years and never failed on any of the 5 machines listed in the signature.

You may check the journal for problems:

3400G:~ # journalctl -b 0 _KERNEL_SUBSYSTEM=usb _KERNEL_SUBSYSTEM=scsi
Dec 10 07:01:36 3400G kernel: usb 2-4: new SuperSpeed Gen 1 USB device number 3 using xhci_hcd
Dec 10 07:01:36 3400G kernel: usb 2-4: New USB device found, idVendor=05e3, idProduct=0743, bcdDevice= 8.28
Dec 10 07:01:36 3400G kernel: usb 2-4: New USB device strings: Mfr=3, Product=4, SerialNumber=5
Dec 10 07:01:36 3400G kernel: usb 2-4: Product: USB Storage
Dec 10 07:01:36 3400G kernel: usb 2-4: Manufacturer: Generic
Dec 10 07:01:36 3400G kernel: usb 2-4: SerialNumber: 000000000828
Dec 10 07:01:36 3400G kernel: usb-storage 2-4:1.0: USB Mass Storage device detected
Dec 10 07:01:36 3400G kernel: scsi host9: usb-storage 2-4:1.0
Dec 10 07:01:37 3400G kernel: scsi 9:0:0:0: Direct-Access     Generic  STORAGE DEVICE   0828 PQ: 0 ANSI: 6
Dec 10 07:01:37 3400G kernel: sd 9:0:0:0: Attached scsi generic sg3 type 0
Dec 10 07:01:38 3400G kernel: sd 9:0:0:0: [sdd] 15353856 512-byte logical blocks: (7.86 GB/7.32 GiB)
Dec 10 07:01:38 3400G kernel: sd 9:0:0:0: [sdd] Write Protect is on
Dec 10 07:01:38 3400G kernel: sd 9:0:0:0: [sdd] Mode Sense: 23 00 80 00
Dec 10 07:01:38 3400G kernel: sd 9:0:0:0: [sdd] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
Dec 10 07:01:38 3400G kernel: sd 9:0:0:0: [sdd] Attached SCSI removable disk


Try same things with USB thumb drive.

openSUSE hides installation media from Dolphin and other file browsers by not mounting it.
You can see your card and reformat it with GParted/KDE Partition Manager/GNOME disks utility/…