[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

writing iso file to usb stick with dd - garbled files - usb eject error?



I recall reading somewhere how to send cached writes to disk using a shell command before unplugging a usb flash drive but now I'm failing to find it. Below follows why I think I need that:


Today I installed trixie, everything worked great except for a problem I ran into preparing the installer media. I usually run:

default@debian:~$ sudo dd if=/home/default/debian-trixie-DI-rc2-amd64-netinst.iso of=/dev/sdf status=progress bs=1M
[sudo] password for default:
778+0 records in
778+0 records out
815792128 bytes (816 MB, 778 MiB) copied, 242.327 s, 3.4 MB/s
default@debian:~$ cat /etc/debian_version
12.11
default@debian:~$ dd --version
dd (coreutils) 9.1

Strangely, it did not display status updates like it used to until after it completed. The disk did not even show up in thunar until after I unplugged then plugged it back into the usb port. Next strange thing was when I mounted the finished boot media, the directory contents looked normal, but the text files - readme, changelog, etc contents were garbled.

Attempted boot, grub came up with the usual options, I selected graphical install (the default) then kernel panic, with something like "initrd contained junk"

SHA512SUM on debian-trixie-DI-rc2-amd64-netinst.iso matched so the problem lies somewhere in my writing the media

retried with:

sudo dd if=/home/default/debian-trixie-DI-rc2-amd64-netinst.iso of=/dev/sdf status=progress bs=1M conv=sync

same result


Next I performed some tests on my brand new very cheap usb 8GB flash drive = all ok.

Finally, I wrote my iso file to this flash drive using "Disk Image Writer" and everything worked like a charm. So now I wonder, what am I doing wrong with dd? I recall having a similar failure maybe two years ago. The rest of the time it just worked.


uh-oh here I found a clue... so I think this makes it seem like something wasn't finished writing when I pulled it from the usb.

sudo dmesg
[ snip ]
[40798.311928] usb 2-1.2: new high-speed USB device number 27 using xhci_hcd
[40798.416473] usb 2-1.2: New USB device found, idVendor=abcd, idProduct=1234, bcdDevice= 1.00 [40798.416491] usb 2-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[40798.416500] usb 2-1.2: Product: UDisk
[40798.416508] usb 2-1.2: Manufacturer: General
[40798.416515] usb 2-1.2: SerialNumber: 2312182347284409360901
[40798.417989] usb-storage 2-1.2:1.0: USB Mass Storage device detected
[40798.418491] scsi host7: usb-storage 2-1.2:1.0
[40799.444551] scsi 7:0:0:0: Direct-Access     General UDisk            5.00 PQ: 0 ANSI: 2
[40799.444763] sd 7:0:0:0: Attached scsi generic sg5 type 0
[40799.445225] sd 7:0:0:0: [sdf] 15728640 512-byte logical blocks: (8.05 GB/7.50 GiB)
[40799.445333] sd 7:0:0:0: [sdf] Write Protect is off
[40799.445335] sd 7:0:0:0: [sdf] Mode Sense: 0b 00 00 08
[40799.445453] sd 7:0:0:0: [sdf] No Caching mode page found
[40799.445455] sd 7:0:0:0: [sdf] Assuming drive cache: write through
[40799.446941]  sdf: sdf1 sdf2
[40799.447110] sd 7:0:0:0: [sdf] Attached SCSI removable disk
[41167.136643] usb 2-1.2: reset high-speed USB device number 27 using xhci_hcd
[41167.236475] usb 2-1.2: device firmware changed
[41167.236574] usb 2-1.2: USB disconnect, device number 27
[41167.252396] blk_print_req_error: 1324 callbacks suppressed
[41167.252405] device offline error, dev sdf, sector 1384200 op 0x1:(WRITE) flags 0x800 phys_seg 1 prio class 2
[41167.252423] buffer_io_error: 36796 callbacks suppressed
[41167.252426] Buffer I/O error on dev sdf, logical block 173025, lost async page write [41167.252625] device offline error, dev sdf, sector 1384216 op 0x1:(WRITE) flags 0x104000 phys_seg 30 prio class 2 [41167.252635] Buffer I/O error on dev sdf, logical block 173027, lost async page write
 [ deleted 7 similar lines ]
[41167.252669] Buffer I/O error on dev sdf, logical block 173035, lost async page write [41167.252707] device offline error, dev sdf, sector 1384456 op 0x1:(WRITE) flags 0x100000 phys_seg 1 prio class 2
 [ deleted 6 similar lines ]
[41167.253272] device offline error, dev sdf, sector 1385296 op 0x1:(WRITE) flags 0x100000 phys_seg 19 prio class 2
[41167.348915] ldm_validate_partition_table(): Disk read failed.
[41167.348941] Dev sdf: unable to read RDB block 0
[41167.348961]  sdf: unable to read partition table
[41167.536322] usb 2-1.2: new high-speed USB device number 28 using xhci_hcd
[41172.740486] usb 2-1.2: device descriptor read/64, error -110
[41172.948721] usb 2-1.2: New USB device found, idVendor=1e3d, idProduct=198a, bcdDevice= 1.00 [41172.948739] usb 2-1.2: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[41172.950112] usb-storage 2-1.2:1.0: USB Mass Storage device detected
[41172.950452] scsi host7: usb-storage 2-1.2:1.0
[41194.784951] usb 2-1.2: reset high-speed USB device number 28 using xhci_hcd
[41480.585883] usb 2-1.2: USB disconnect, device number 28

--
Thank You!

Titus Newswanger
Curtiss WI

Attachment: OpenPGP_0x17365CC7EC4FC3E6.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature


Reply to: