8

I run dd to create bootable Ubuntu but it won't make it bootable. Instead it returns instantly without creating anything as I see. When I point partition, sda1 it writes data to it but the usb won't boot the system. Also sudo fdisk -l does not list the usb but lsblk does. How to make bootable usb with dd?


[I] ➜ uname --all
Linux artpc 5.3.7-arch1-1-ARCH #1 SMP PREEMPT Fri Oct 18 00:17:03 UTC 2019 x86_64 GNU/Linux

~ 
[I] ➜ lsblk
NAME          MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda             8:0    1  14.7G  0 disk  
└─sda1          8:1    1  14.7G  0 part  
nvme0n1       259:0    0   477G  0 disk  
├─nvme0n1p1   259:1    0   680M  0 part  /boot
├─nvme0n1p2   259:2    0 475.3G  0 part  
│ └─cryptroot 254:0    0 475.3G  0 crypt /
└─nvme0n1p4   259:3    0   990M  0 part  

~ 
[I] ➜ sudo fdisk -l
[sudo] password for art: 
Disk /dev/nvme0n1: 476.96 GiB, 512110190592 bytes, 1000215216 sectors
Disk model: KXG60ZNV512G NVMe TOSHIBA 512GB         
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: gpt
Disk identifier: 246817B2-7F93-4723-8F53-B499C07511A3

Device             Start        End   Sectors   Size Type
/dev/nvme0n1p1      2048    1394687   1392640   680M EFI System
/dev/nvme0n1p2   1394688  998158335 996763648 475.3G Linux filesystem
/dev/nvme0n1p4 998158336 1000185855   2027520   990M Windows recovery environment


Disk /dev/mapper/cryptroot: 475.29 GiB, 510326210560 bytes, 996730880 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

~ took 5s 

~ 
[N] ➜ sudo dd if=/home/art/Downloads/TriblerDownloads/ubuntu-19.10-desktop-amd64.iso of=/dev/sda bs=4M status=progress 
587+1 records in
587+1 records out
2463842304 bytes (2.5 GB, 2.3 GiB) copied, 0.728635 s, 3.4 GB/s

~ 
[I] ➜ pgrep dd -l
# No dd here.

Update, dmesg:

[167395.353737] usb 2-1: new SuperSpeed Gen 1 USB device number 8 using xhci_hcd
[167395.376079] usb 2-1: New USB device found, idVendor=8564, idProduct=1000, bcdDevice=11.00
[167395.376084] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[167395.376088] usb 2-1: Product: Mass Storage Device
[167395.376091] usb 2-1: Manufacturer: JetFlash
[167395.376094] usb 2-1: SerialNumber: 25KD7JEKLN6J409K
[167395.379692] usb-storage 2-1:1.0: USB Mass Storage device detected
[167395.380037] scsi host3: usb-storage 2-1:1.0
[167396.745065] scsi 3:0:0:0: Direct-Access     JetFlash Transcend 16GB   1100 PQ: 0 ANSI: 6
[167396.746488] sd 3:0:0:0: [sda] 30851072 512-byte logical blocks: (15.8 GB/14.7 GiB)
[167396.747105] sd 3:0:0:0: [sda] Write Protect is off
[167396.747111] sd 3:0:0:0: [sda] Mode Sense: 43 00 00 00
[167396.747634] sd 3:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[167396.751767]  sda: sda1
[167396.754816] sd 3:0:0:0: [sda] Attached SCSI removable disk

Usb type: USB 3.1 Gen 1 port. It is Dell Latitude 5401.

Tried two USB flash drives. Both does not work.

Update 2.

 ls -l /dev/sda*
-rw-r--r-- 1 root root 2463842304 Nov  2 16:48 /dev/sda
brw-rw---- 1 root disk       8, 1 Nov  2 17:03 /dev/sda1
1
  • 1
    also go through your tmpfs instances and set appropriate size limits. if you have several tmpfs, each allowed to take 50% of RAM, if you fill up two (or three, if you have swap) your machine might crash since OOM killer can't free tmpfs stuff. for /dev something like 10M is plenty and dd would have errored out with no space left. Commented Nov 2, 2019 at 15:20

2 Answers 2

19

You've got a file as /dev/sda not a device, so when you write to /dev/sda you're overwriting the file. With your NVMe disk this explains why writing speed is so high.

Remove the file /dev/sda, unplug and replug the USB stick. Check that /dev/sda is now a block device (first character from ls -l is b) rather than a file (first character -), like this:

brw-rw---- 1 root disk       8, 0 Nov  2 17:03 /dev/sda
brw-rw---- 1 root disk       8, 1 Nov  2 17:03 /dev/sda1

How did this happen? It's possible you first tried to write to the device before it had been plugged in, so the device node hadn't yet been created. Thereafter the presence of the file prevented the device from being created.

0
1

Use a tool to create a USB boot drive

Instead of cloning with dd, the 'Disk Destroyer', you can use a tool to create a USB boot drive. With a tool

  • you avoid this problem: to create a regular file, where there should be a block device.

  • and even more important: you decrease the risk of overwriting valuable data by writing to the wrong device.

The cloning method is reliable, but it really helps with a tool to identify and select the correct target device.

  • In Ubuntu there is the
    • Ubuntu Startup Disk Creator
  • in many Linux distros you can use

    • Disks alias gnome-disks or
    • mkusb
  • In Windows you can clone with

  • In MacOS you can use the extracting tool

    • Unetbootin - there are versions for Linux and Windows too.
7
  • Both MacOS and Windows have GUI tools for this.
    – WGroleau
    Commented Nov 2, 2019 at 22:28
  • 1
    @WGroleau, You are right :-) The tools that I listed are GUI tools. There are other similar tools, but I know these tools (that they work and are rather easy to use). Please let us know which tools you use for this purpose and similar tasks.
    – sudodus
    Commented Nov 2, 2019 at 23:09
  • 1
    MacOS comes with diskutil as well as dd and other typical Unix shell commands. But it also wraps some of those in Apple’s own GUI, Disk Utility. I’m retired, and it’s been five years since I used Windows but I remember the Format command in the main GUI, and one that I had to access from device manager. The latter allowed mounting, dismounting, and adjusting partitions. I never heard of the ones you mentioned, so I guessed they were either DOS or third-party.
    – WGroleau
    Commented Nov 2, 2019 at 23:23
  • @WGroleau, Rufus, Win32 Disk Imager and Unetbootin are 'third party'. Each of them is developed and maintained by a person or small group since years and I think many people know them and use them. It is obvious where the Ubuntu Startup Disk Creator and gnome-disks belong. mkusb is third party. It uses zenity in GUI mode, dialog in TUI mode and can be run in plain text mode too (for example in a linux server without any bells and whistles).
    – sudodus
    Commented Nov 3, 2019 at 0:04
  • In that case, you have a good answer, but it would be better if it included the tools that come with the O.S.
    – WGroleau
    Commented Nov 3, 2019 at 5:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .