# Mender convert fails with "cannot overwrite directory"

**URL:** <https://hub.mender.io/t/mender-convert-fails-with-cannot-overwrite-directory/5360>\
**Category:** Debian family\
**Tags:** mender-convert, raspberry-pi-4\
**Created:** [November 4, 2022, 1:47pm UTC](https://hub.mender.io/t/mender-convert-fails-with-cannot-overwrite-directory/5360 "2022-11-04T13:47:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![LorenzoRuffati](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/lorenzoruffati/32/1778_2.png) [@LorenzoRuffati](https://hub.mender.io/u/LorenzoRuffati)\
**Post date:** [November 4, 2022, 1:47pm UTC](https://hub.mender.io/t/mender-convert-fails-with-cannot-overwrite-directory/5360/1 "2022-11-04T13:47:25Z")

</div>

Hi, I’m trying to convert an existing image using mender-convert for a raspberrypi4

I’m using the official image (generated using the Imager tool) and following the instructions from the Mender docs ([here](https://docs.mender.io/system-updates-debian-family/convert-a-mender-debian-image) )

However the process is failing with the following message:

```auto
mender-convert-modify has finished. Cleaning up...
2022-11-04 15:34:16 [ERROR] [mender-convert] mender-convert failed
2022-11-04 15:34:16 [DEBUG] [mender-convert-modify] When running: (./mender-convert-modify:135): run_and_log_cmd():

        sudo ln -sf /data/mender-configure work/rootfs/var/lib
        ln: work/rootfs/var/lib/mender-configure: cannot overwrite directory

2022-11-04 15:34:16 [ERROR] [mender-convert] mender-convert exit code: 1

```

I’ve tried to run the process with sudo but it doesn’t appear to be a permissions error, any idea as to what might be causing this and how to fix it?

Thank you for the help, if there’s the need for any further information I’d be happy to provide it

---

<div class="post-metadata">

**Author:** ![TheYoctoJester](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/theyoctojester/32/1444_2.png) [@TheYoctoJester](https://hub.mender.io/u/TheYoctoJester)\
**Post date:** [November 4, 2022, 2:43pm UTC](https://hub.mender.io/t/mender-convert-fails-with-cannot-overwrite-directory/5360/2 "2022-11-04T14:43:46Z")

</div>

Hi @LorenzoRuffati,

Thanks for getting in touch. So to understand the procedure. You said “existing image” and “generated by the imager tool”. What does that mean? Is it the original Raspbian image that you are starting out with? Or is it an image based on a live system that you have modified?

Greetz,  
Josef

---

<div class="post-metadata">

**Author:** ![LorenzoRuffati](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/lorenzoruffati/32/1778_2.png) [@LorenzoRuffati](https://hub.mender.io/u/LorenzoRuffati)\
**Post date:** [November 4, 2022, 3:27pm UTC](https://hub.mender.io/t/mender-convert-fails-with-cannot-overwrite-directory/5360/3 "2022-11-04T15:27:55Z")

</div>

Sorry for the confusion, here’s the process:

1. Use imager to flash a raspberry pi OS image (configured with WiFi, SSH etc)
2. Boot it with raspberry pi 4, modify some settings using raspi-config and install some programs
3. Use DD to get an image file (if I understand the terminology this should be called a golden image)
4. Attempt and fail to convert the golden image as shown in the mender-convert tutorial

---

<div class="post-metadata">

**Author:** ![oleorhagen](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/oleorhagen/32/297_2.png) [@oleorhagen](https://hub.mender.io/u/oleorhagen)\
**Post date:** [November 8, 2022, 1:26pm UTC](https://hub.mender.io/t/mender-convert-fails-with-cannot-overwrite-directory/5360/4 "2022-11-08T13:26:18Z")

</div>

Hello @LorenzoRuffati are you still having issues, or were you able to resolve them?

---

<div class="post-metadata">

**Author:** ![LorenzoRuffati](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/lorenzoruffati/32/1778_2.png) [@LorenzoRuffati](https://hub.mender.io/u/LorenzoRuffati)\
**Post date:** [November 8, 2022, 2:33pm UTC](https://hub.mender.io/t/mender-convert-fails-with-cannot-overwrite-directory/5360/5 "2022-11-08T14:33:37Z")

</div>

The issue did disappear but I haven’t isolated the solution.

In order of what I believe is the most likely answer it could be any combination of the following:

1. Increase boot partition size
2. Increase whole disk size
3. Reduce the partition size on the raspberry pi before dd-ing to the golden image (I was getting an error about overlapping partition tables)
4. Run mender-convert in an ext4 partition instead of zfs (seriously doubt it’s this)
5. Rnning all the operations as root (really really doubt it’s this)

---

<div class="post-metadata">

**Author:** ![oleorhagen](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/oleorhagen/32/297_2.png) [@oleorhagen](https://hub.mender.io/u/oleorhagen)\
**Post date:** [November 10, 2022, 10:34am UTC](https://hub.mender.io/t/mender-convert-fails-with-cannot-overwrite-directory/5360/6 "2022-11-10T10:34:30Z")

</div>

I’m glad it works now.

Please let us know if you figure out what was going on, or if the issue re-appears.
