***SOLVED!*** Unable to run safe-dd on either my desktop or laptop PCs

WARNING!!
This post is LONG (sorry for that) :slight_smile:

I started this new discussion because this post will be very long. Here, I describe everything I did to test safe-dd, in great detail. Since I use Garuda Linux here, so I also included the information gathered about my desktop computer by garuda-inxi at the end, so here it all is:

Creared ~/Scripts directory.
copied safe-dd to my desktop PC.
Made it executable.
Ran lsblk without, then with the USB stick connected:

╭─ernie@Curiosity4 in ~ took 4ms
 ╰─λ lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda           8:0    0   1.8T  0 disk 
├─sda1        8:1    0   500G  0 part 
├─sda2        8:2    0 681.5G  0 part 
└─sda3        8:3    0 681.5G  0 part 
zram0       254:0    0  31.3G  0 disk [SWAP]
nvme0n1     259:0    0 931.5G  0 disk 
├─nvme0n1p1 259:1    0     2G  0 part /boot/efi
├─nvme0n1p2 259:2    0    16M  0 part 
├─nvme0n1p3 259:3    0 464.2G  0 part 
└─nvme0n1p4 259:4    0 465.3G  0 part /home
                                      /root
                                      /var/cache
                                      /var/tmp
                                      /var/log
                                      /srv
                                      /

 ╭─ernie@Curiosity4 in ~ took 13ms
 ╰─λ lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda           8:0    0   1.8T  0 disk 
├─sda1        8:1    0   500G  0 part 
├─sda2        8:2    0 681.5G  0 part 
└─sda3        8:3    0 681.5G  0 part 
sdb           8:16   1  14.6G  0 disk 
└─sdb1        8:17   1  14.6G  0 part 
zram0       254:0    0  31.3G  0 disk [SWAP]
nvme0n1     259:0    0 931.5G  0 disk 
├─nvme0n1p1 259:1    0     2G  0 part /boot/efi
├─nvme0n1p2 259:2    0    16M  0 part 
├─nvme0n1p3 259:3    0 464.2G  0 part 
└─nvme0n1p4 259:4    0 465.3G  0 part /home
                                      /root
                                      /var/cache
                                      /var/tmp
                                      /var/log
                                      /srv
                                      /

The USB stick is /dev/sdb.
I saved a copy of the post “A Safer Way to Use dd” to a text file.
I copied/pasted the text of the safe-dd script from my copy of the post to my safe-dd script to ensure I have an accurate copy here, and removed the line indents in the script file.
Downloaded the rescuezilla-2.4.2-64bit.jammy.iso file to the Downloads directory.

Using the following command to test safe-dd:
/home/ernie/Scripts/safe-dd if=/home/ernie/Downloads/rescuezilla-2.4.2-64bit.jammy.iso of-/dev/sdb

After running the command, I get the following output (same as what I get on my laptop PC):

 ╭─ernie@Curiosity4 in ~ as 🧙 
 ╰─λ /home/ernie/Scripts/safe-dd if=/home/ernie/Downloads/rescuezilla-2.4.2-64bit.jammy.iso of-/dev/sdb
bash: /home/ernie/Scripts/safe-dd: cannot execute: required file not found

Output of garuda-inxi (displays complete system information):

 ╭─ernie@Curiosity4 in ~ as 🧙 took 2s
[🔍] × garuda-inxi
System:
  Kernel: 6.10.1-zen1-1-zen arch: x86_64 bits: 64 compiler: gcc
    v: 14.1.1 clocksource: tsc avail: hpet,acpi_pm
    parameters: root=UUID=ebf2e0f9-da67-44d2-b975-a1528f5be8c1 rw
    rootflags=subvol=@ quiet loglevel=3 ibt=off iommu=pt
    initrd=@\boot\initramfs-linux-zen.img
  Desktop: KDE Plasma v: 6.1.3 tk: Qt v: N/A info: frameworks
    v: 6.4.0 wm: kwin_wayland vt: 1 dm: SDDM Distro: Garuda
    base: Arch Linux
Machine:
  Type: Desktop System: ASUS product: N/A v: N/A
    serial: <superuser required>
  Mobo: ASUSTeK model: TUF GAMING A520M-PLUS WIFI v: Rev X.0x
    serial: <superuser required> part-nu: SKU uuid: <superuser required>
    UEFI: American Megatrends v: 3405 date: 12/13/2023
CPU:
  Info: model: AMD Ryzen 5 5600X bits: 64 type: MT MCP arch: Zen 3+
    gen: 4 level: v3 note: check built: 2022 process: TSMC n6 (7nm)
    family: 0x19 (25) model-id: 0x21 (33) stepping: 2
    microcode: 0xA20120E
  Topology: cpus: 1x cores: 6 tpc: 2 threads: 12 smt: enabled cache:
    L1: 384 KiB desc: d-6x32 KiB; i-6x32 KiB L2: 3 MiB desc: 6x512 KiB
    L3: 32 MiB desc: 1x32 MiB
  Speed (MHz): avg: 3655 high: 3718 min/max: 2200/4650
    boost: enabled scaling: driver: acpi-cpufreq governor: performance
    cores: 1: 3693 2: 3385 3: 3700 4: 3700 5: 3700 6: 3700 7: 3700
    8: 3700 9: 3700 10: 3718 11: 3592 12: 3581 bogomips: 88642
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a
    ssse3 svm
  Vulnerabilities: <filter>
Graphics:
  Device-1: NVIDIA GP108 [GeForce GT 1030] vendor: Gigabyte
    driver: nvidia v: 555.58.02 alternate: nouveau,nvidia_drm
    non-free: 545.xx+ status: current (as of 2024-06; EOL~2026-12-xx)
    arch: Pascal code: GP10x process: TSMC 16nm built: 2016-2021 pcie:
    gen: 3 speed: 8 GT/s lanes: 4 ports: active: none off: HDMI-A-1
    empty: DVI-D-1 bus-ID: 08:00.0 chip-ID: 10de:1d01 class-ID: 0300
  Device-2: ARC Camera driver: snd-usb-audio,uvcvideo type: USB
    rev: 2.0 speed: 480 Mb/s lanes: 1 mode: 2.0 bus-ID: 3-2:3
    chip-ID: 05a3:9331 class-ID: 0102 serial: <filter>
  Display: wayland server: X.org v: 1.21.1.13 with: Xwayland
    v: 24.1.1 compositor: kwin_wayland driver: X: loaded: nvidia
    unloaded: modesetting,nouveau alternate: fbdev,nv,vesa
    gpu: nvidia,nvidia-nvswitch display-ID: 0
  Monitor-1: HDMI-A-1 model: Samsung LC24RG50 serial: <filter>
    built: 2021 res: 1920x1080 dpi: 92 gamma: 1.2
    size: 532x304mm (20.94x11.97") diag: 613mm (24.1") ratio: 16:9
    modes: max: 1920x1080 min: 640x480
  API: Vulkan v: 1.3.279 layers: 4 device: 0 type: discrete-gpu
    name: NVIDIA GeForce GT 1030 driver: nvidia v: 555.58.02
    device-ID: 10de:1d01 surfaces: xcb,xlib,wayland device: 1
    type: cpu name: llvmpipe (LLVM 18.1.8 256 bits)
    driver: mesa llvmpipe v: 24.1.4-arch1.2 (LLVM 18.1.8)
    device-ID: 10005:0000 surfaces: xcb,xlib,wayland
  API: EGL Message: EGL data requires eglinfo. Check --recommends.
Audio:
  Device-1: NVIDIA GP108 High Definition Audio vendor: Gigabyte
    driver: snd_hda_intel v: kernel pcie: gen: 3 speed: 8 GT/s lanes: 4
    bus-ID: 08:00.1 chip-ID: 10de:0fb8 class-ID: 0403
  Device-2: AMD Starship/Matisse HD Audio vendor: ASUSTeK
    driver: snd_hda_intel v: kernel pcie: gen: 4 speed: 16 GT/s
    lanes: 16 bus-ID: 0a:00.4 chip-ID: 1022:1487 class-ID: 0403
  Device-3: ARC Camera driver: snd-usb-audio,uvcvideo type: USB
    rev: 2.0 speed: 480 Mb/s lanes: 1 mode: 2.0 bus-ID: 3-2:3
    chip-ID: 05a3:9331 class-ID: 0102 serial: <filter>
  API: ALSA v: k6.10.1-zen1-1-zen status: kernel-api tools: N/A
  Server-1: PipeWire v: 1.2.1 status: active with: 1: pipewire-pulse
    status: active 2: wireplumber status: active 3: pipewire-alsa
    type: plugin 4: pw-jack type: plugin
    tools: pactl,pw-cat,pw-cli,wpctl
Network:
  Device-1: Realtek RTL8821CE 802.11ac PCIe Wireless Network Adapter
    vendor: AzureWave driver: rtw_8821ce v: N/A modules: rtw88_8821ce
    pcie: gen: 1 speed: 2.5 GT/s lanes: 1 port: e000 bus-ID: 06:00.0
    chip-ID: 10ec:c821 class-ID: 0280
  IF: wlp6s0 state: up mac: <filter>
  Device-2: Realtek RTL8111/8168/8211/8411 PCI Express Gigabit
    Ethernet vendor: ASUSTeK RTL8111H driver: r8169 v: kernel pcie:
    gen: 1 speed: 2.5 GT/s lanes: 1 port: d000 bus-ID: 07:00.0
    chip-ID: 10ec:8168 class-ID: 0200
  IF: enp7s0 state: down mac: <filter>
  Device-3: Realtek 802.11ax WLAN Adapter driver: rtl8852bu
    type: USB rev: 3.0 speed: 5 Gb/s lanes: 1 mode: 3.2 gen-1x1
    bus-ID: 4-3:3 chip-ID: 0bda:b832 class-ID: 0000 serial: <filter>
  IF: wlp10s0f3u3 state: up mac: <filter>
  Info: services: NetworkManager, smbd, systemd-timesyncd,
    wpa_supplicant
Bluetooth:
  Device-1: IMC Networks Bluetooth Radio driver: btusb v: 0.8
    type: USB rev: 1.1 speed: 12 Mb/s lanes: 1 mode: 1.1 bus-ID: 1-5:3
    chip-ID: 13d3:3556 class-ID: e001 serial: <filter>
  Report: rfkill ID: hci0 rfk-id: 1 state: down
    bt-service: not found rfk-block: hardware: no software: no
    address: see --recommends
Drives:
  Local Storage: total: 2.74 TiB used: 16.72 GiB (0.6%)
  SMART Message: Required tool smartctl not installed. Check
    --recommends
  ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Samsung
    model: SSD 970 EVO Plus 1TB size: 931.51 GiB block-size:
    physical: 512 B logical: 512 B speed: 31.6 Gb/s lanes: 4 tech: SSD
    serial: <filter> fw-rev: 2B2QEXM7 temp: 39.9 C scheme: GPT
  ID-2: /dev/sda maj-min: 8:0 vendor: Seagate
    model: ST2000DM008-2FR102 size: 1.82 TiB block-size:
    physical: 4096 B logical: 512 B speed: 6.0 Gb/s tech: HDD
    rpm: 7200 serial: <filter> fw-rev: 0001 scheme: GPT
  ID-3: /dev/sdb maj-min: 8:16 vendor: ASolid model: USB
    size: 14.65 GiB block-size: physical: 512 B logical: 512 B type: USB
    rev: 3.2 spd: 5 Gb/s lanes: 1 mode: 3.2 gen-1x1 tech: N/A
    serial: <filter> scheme: MBR
Partition:
  ID-1: / raw-size: 465.26 GiB size: 465.26 GiB (100.00%)
    used: 16.68 GiB (3.6%) fs: btrfs dev: /dev/nvme0n1p4 maj-min: 259:4
  ID-2: /boot/efi raw-size: 2 GiB size: 2 GiB (99.95%)
    used: 34.6 MiB (1.7%) fs: vfat dev: /dev/nvme0n1p1 maj-min: 259:1
  ID-3: /home raw-size: 465.26 GiB size: 465.26 GiB (100.00%)
    used: 16.68 GiB (3.6%) fs: btrfs dev: /dev/nvme0n1p4 maj-min: 259:4
  ID-4: /var/log raw-size: 465.26 GiB size: 465.26 GiB (100.00%)
    used: 16.68 GiB (3.6%) fs: btrfs dev: /dev/nvme0n1p4 maj-min: 259:4
  ID-5: /var/tmp raw-size: 465.26 GiB size: 465.26 GiB (100.00%)
    used: 16.68 GiB (3.6%) fs: btrfs dev: /dev/nvme0n1p4 maj-min: 259:4
Swap:
  Kernel: swappiness: 10 (default 60) cache-pressure: 100 (default)
    zswap: no
  ID-1: swap-1 type: zram size: 31.26 GiB used: 0 KiB (0.0%)
    priority: 100 comp: zstd avail: lzo,lzo-rle,lz4,lz4hc,842
    max-streams: 12 dev: /dev/zram0
Sensors:
  System Temperatures: cpu: 41.2 C mobo: N/A
  Fan Speeds (rpm): N/A
Info:
  Memory: total: 32 GiB available: 31.26 GiB used: 2.68 GiB (8.6%)
  Processes: 318 Power: uptime: 34m states: freeze,mem,disk
    suspend: deep avail: s2idle wakeups: 0 hibernate: platform
    avail: shutdown, reboot, suspend, test_resume image: 12.46 GiB
    services: org_kde_powerdevil,upowerd Init: systemd v: 256
    default: graphical tool: systemctl
  Packages: pm: pacman pkgs: 1451 libs: 430 tools: pamac,yay
    Compilers: gcc: 14.1.1 Shell: garuda-inxi default: Bash v: 5.2.26
    running-in: konsole inxi: 3.3.35
Garuda (2.6.26-1):
  System install date:     2024-07-04
  Last full system update: 2024-07-28 ↻
  Is partially upgraded:   No
  Relevant software:       snapper NetworkManager dracut nvidia-dkms
  Windows dual boot:       Probably (Run as root to verify)
  Failed units:            

I hope something IO have posted here helps other help me with this issue,

Ernie

2 Likes

That should be of=/dev/sdb

I notice that in this computer the usb drive is sdb.
It is important to always get that right.

and
check this out

I dont know how you copied the script file, but if it is a DOS text file it will not work in Linux. It has to be a Unix text file … lines end in LF, not CR LF.

To check use od -a safe-dd | more
and look at the characters ending each line

3 Likes

I’ve run shell scripts before that were polluted with DOS style CRLF chars (they usually show as ^m) and they ran successfully - YMMV…

But they are ugly - so I usually remove them with the simple dos2unix command - on Ubuntu / Debian systems : “sudo apt install dos2unix” - then fix your text file is simple :

dos2unix textfile[.txt, sh, bash]

When you install it - it also installs unix2dos - so that the LF at the end of each implied line gets replace with CRLF…

I’m surprised it’s not installed by default - it’s a MASSIVE ( sarcasm ) 55K in size. I seem to remember it was installed by default on Solaris - but you had to output to another file i.e. dos2unix textfile > texfile2…

100% - noticed that straightaway…

4 Likes

@ernie ,
Do what @daniel.m.tripp says
use dos2unix to convert your script

1 Like

I’ve done the same thing to myself more than once. It’s amazing to me that it still takes me a bit to figure out what I’ve done…again.

1 Like

You are improving my vocab… had to look up YMMV

I think if there is CRLF on the first line that makes trouble
or, if it is LFCR

1 Like

Thank you for this post Neville! It solved my issue. I installed dos2unix, ran it on my safe-dd script file, and now it works as expected:

 ╭─ernie@Traveler3 in ~ as 🧙 took 1m6s
 ╰─λ sudo /home/ernie/Scripts/safe-dd if=/home/ernie/Downloads/rescuezilla-2.4.2-64bit.jammy.iso of=/dev/sdb
Executing nice dd if=/home/ernie/Downloads/rescuezilla-2.4.2-64bit.jammy.iso of=/dev/sdb bs=4M status=progress
286+1 records in
286+1 records out
1202202624 bytes (1.2 GB, 1.1 GiB) copied, 60.3419 s, 19.9 MB/s
Finished writing and sync.

I’m not sure how the CR/LF’s got in there. IIRC, I copied the script from a web page, and pasted it into a Kate (KDE’s text editor) window, but I could be misyaken, I could have been working in Windows when I saw Rosika’s post/comment about the script. In any case, I’m very grateful for everyone’s help. Thank you Rosika, Neville, and Dan. If not for all your combined interest in helping me solve this problem, I would have given up too soon, and simply worked very carefully with dd, and what a shame that would have been, since the solution was so simple. :slight_smile:

Ernie

3 Likes

That is possibly the explanation.
Good on you for being persistant.
The up side is we all learnt a bit
Cheers
Neville

3 Likes

Isn’t that the point of It’sFOSS Community - for all of us to learn from one another, and to share what we learn?

Ernie

4 Likes

Isn’t that the point of It’sFOSS Community - for all of us to learn from one another

I am way behind you Ernie and all you knowledgeable guys but I had to find out what SMH meant in another thread.
Acronyms are becoming the bane of my life to find out what they mean.

Sorry to interrupt this thread with silliness.

2 Likes

If you care enough to post, it’s not silly (unless that’s your intent) :slight_smile:

The one thing you have to remember is that the only stupid question is the one you don’t ask. If you see an acronym you don’t understand in a post here on It’sFOSS, ask what it means. To do that, highlight the acronym, then click on “Quote” in the pop-up above the post. That will open a reply dialog, so you can post a comment, ask a question, etc.

I hope this helps,

Ernie

4 Likes

@ernie
My point was acronym’s seem to be used in a lot of forum posts, not just here but other forums too.
It seems it’s the way of today and when reading a thread I can usually suss most things but some I can’t, it’s then I google the answer or give up.
Relevant to the thread I’ll have a go but nonsensical run of the mill stuff which is presumed to know is not in my book.

I won’t be losing sleep over it.

1 Like

I had to look them up more then once that’s for sure.

3 Likes

Can I get in your boat @easyt50?
Mines sinking.

2 Likes

I’ve been there. The trick is to take things as they come. By the way, if you think I’m so far ahead of you, read through this post, and my previous one. I couldn’t get a bash script (that I didn’t write) to run successfully. I was at the point of giving up on using it, but my friends here at It’sFOSS were so interested in figuring the issue out that I just couldn’t give up on it. Now I know how simple the fix is, because at some point, I must have used Windows Notepad to create the script from it’s listing on a web page, so line feeds were converted to carriage return/line feed combinations. The carriage return characters were what were messing everything up. The thing is that carriage returns are not visible in text editors, so it was not the solution wasn’t obvious, except that someone on another forum has run into the same issue, with the same result, and when I implemented their solution (to install and run the dos2unix utility on the script file), the script worked as expected. My experience simply goes to show that sometimes, it takes the help of friends to get where we want/need to be.

When you feel as if your boat’s sinking, start swimming, and ask your friends for a life vest :slight_smile:

Ernie

5 Likes