Disk-imager usage explained

Hi,

Could someone explain how to use disk-imager ?

  1. Download latest dietpi image for (zero w)
  2. flash sd card
  3. plug into raspberry pi zero w
  4. dietpi setup has done it’s magic
  5. sudo shutdown

Now I want to create image file from my system

Dipa

Connect your SD card to another Linux box or VM and ran the imager to create a compressed image file.

Created VM and connected SD card to it and run the script.
=> [FAILED] You must export or pass G_GITOWNER and G_GITBRANCH to the script

Could you explain steps little bit more detailed

NAME LABEL SIZE RO TYPE MOUNTPOINT
sdb 28,9G 0 disk
├─sdb1 128M 0 part /media/parallels/75DE-42E3
└─sdb2 28,8G 0 part /media/parallels/dbc7e15d-65fb-4aa3-a603-96fe97e3a6bd

Filesystem Size Used Avail Use% Mounted on
/dev/sdb1 127M 55M 73M 43% /media/parallels/75DE-42E3
/dev/sdb2 29G 2,6G 25G 10% /media/parallels/dbc7e15d-65fb-4aa3-a603-96fe97e3a6bd

Looks like the script fails in the first step, when checking if there is a file /boot/dietpi/func/dietpi-globals which is not the case on your system.

imager script
if [[ -f '/boot/dietpi/func/dietpi-globals' ]]
	then
		. /boot/dietpi/func/dietpi-globals
	else
		[[ $G_GITOWNER && $G_GITBRANCH ]] || { echo '[FAILED] You must export or pass G_GITOWNER and G_GITBRANCH to the script'; exit 1; }
		curl -sSf "https://raw.githubusercontent.com/$G_GITOWNER/DietPi/$G_GITBRANCH/dietpi/func/dietpi-globals" -o /tmp/dietpi-globals || exit 1
		# shellcheck disable=SC1091
		. /tmp/dietpi-globals
		G_EXEC_NOHALT=1 G_EXEC rm /tmp/dietpi-globals
		[[ $(</etc/debian_version) =~ ^('12.'|'bookworm/sid'$) ]] && G_DISTRO=7 || G_DISTRO=6 # Ubuntu Jammy comes with "bookworm/sid"
	fi

What exactly did you do, step by step?

  1. Created linux vm in mac’s parallels environment
  2. Attached SD card to USB reader and “pointed” that to VM
  3. Ran the imager
  4. Copied the error message that imager produced [FAILED] You must export or pass G_GITOWNER and G_GITBRANCH to the script
  5. Write topic into this forum

Modified the script:

if [[ -f '/media/parallels/75DE-42E3/dietpi/func/dietpi-globals' ]]
then
	. /media/parallels/75DE-42E3/dietpi/func/dietpi-globals
else

=> works now.

Thanks everyone.

Dietpi-imager definately needs more detailed instructions how to use. (ran the imager is not enough information)

The problem is that you mounted it to another path as in the original image.
By default /dietpi/func/dietpi-globals would be in /boot but you mounted it to /media/parallels/75DE-42E3/ in your VM.
So normally it is enough to just run the imager, this is actually the first time I see this error here in the forum.

It depends on the vm system. Parallels mount SD in that location.

you simply can export the variable for G_GITOWNER and G_GITBRANCH. No need to mount or modify thinks. By default, we expect a DietPi image. However, going to export both variable is working same way. And this is exactly the error message.

So an

export G_GITOWNER
export G_GITBRANCH

before executing the script would do the trick, maybe we should really add this to the docs?!

@StephanStS would it make sense to describe the usage of such scripts more in detail?

I always ran dietpi-imager on a DietPi host system, also in a Proxmox or in a Virtualbox VM. But I never did it in Parallels. That’s why it always worked at me.
(Nice story: This script was the reason to intense my work within DietPi :slight_smile: )

I wonder whether a description in the docs would be the path to go, or a blog post. I have no 100% opinion.
But a description would be helpful.

BTW: Does the script already generate .xz or our “old” .7z file?
Maybe, @MichaIng we should rework the script and also check for runability in Parallels.

it’s not about Parallels. It’s about DietPi system or not. You can run the script on Ubuntu or Debian same way. And the script is exactly designed for this purpose to be able to download our dietpi-globals on nonDietPi systems. Just need to export the 2 variable and have some packages preinstalled like curl or whiptail.

Maybe we could set some default values if no variable exist and add some package checks upfront.

1 Like

I.e.

  • Make tool run on plain debian
  • Describe usage in DietPi docu
  • Optional: Generate Blog post