Bug? Convert a raw disk image in MacOS fails (mktemp: illegal option -- p)


I am trying to convert a raw disk image using MacOS. I followed the instructions on Convert a Mender Debian image | Mender documentation

I’m unclear about

Use the mender-convert container image
Run mender-convert from inside the container with your desired options, e.g.

When I run MENDER_ATRIFACT_NAME=my_release-1 ./docker-mender-convert --disk-image input/golden-0.1.img --config configs/raspberrypi4_config I’m getting the following error:

mktemp: illegal option -- p
usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
       mktemp [-d] [-q] [-u] -t prefix 

What did I miss?

Thank you very much for your help!

Hi @BSBoatia

This simply means that the convertion script is run in a container, which is what is done when you do docker-mender-convert, like you have done above.

I would think the error stems from here:

This is the -p option on linux:

 -p DIR, --tmpdir[=DIR]
              interpret TEMPLATE relative to DIR; if DIR is not specified, use $TMPDIR if set, else /tmp.  With this option, TEM‐
              PLATE must not be an absolute name; unlike with -t, TEMPLATE may contain slashes, but mktemp creates only the final

To make the tempdir locate in the current directory.

If you can provide me with the Mac OS option, then I will fix this right now for you :slight_smile:

Thanks @oleorhagen, your input was very helpful. There doesn’t necessarily seem an equivalent to -p on OS-X. However, replaced the line with

WORK_DIR=$(mktemp -d 2>/dev/null || mktemp -d -t 'mytmpdir')

which Im copied from https://newbedev.com/fix-or-alternative-for-mktemp-in-os-x

and it’s doing the trick.

1 Like