# Mender logs misleading message when trying to execute an update module with erroneous hashbang

**URL:** <https://hub.mender.io/t/mender-logs-misleading-message-when-trying-to-execute-an-update-module-with-erroneous-hashbang/4627>\
**Category:** General Discussions\
**Tags:** update-modules, mender-client\
**Created:** [February 16, 2022, 10:00pm UTC](https://hub.mender.io/t/mender-logs-misleading-message-when-trying-to-execute-an-update-module-with-erroneous-hashbang/4627 "2022-02-16T22:00:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![francoislefebvre](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/francoislefebvre/32/1238_2.png) [@francoislefebvre](https://hub.mender.io/u/francoislefebvre)\
**Post date:** [February 16, 2022, 10:00pm UTC](https://hub.mender.io/t/mender-logs-misleading-message-when-trying-to-execute-an-update-module-with-erroneous-hashbang/4627/1 "2022-02-16T22:00:22Z")

</div>

I noticed that an error in the module script hash bang executable path logs the error as if the module script does not exist, when it is the executable that does not exist.

I don’t know if this is a bug or a limitation of the way scripts are called.

For example, I have an update module called `docker-compose` where the executable had changed. The error I got was:

```auto
Feb 16 16:14:42 linux mender[5648]: time="2022-02-16T16:14:42-05:00" level=error msg="Module could not be executed: fork/exec /usr/share/mender/modules/v3/docker-compose: no such file or directory"

```

…suggesting the update module is non existent, while it is.

Thanks,

---

<div class="post-metadata">

**Author:** ![eystein](https://avatars.discourse-cdn.com/v4/letter/e/e5b9ba/32.png) [@eystein](https://hub.mender.io/u/eystein)\
**Post date:** [February 22, 2022, 10:17pm UTC](https://hub.mender.io/t/mender-logs-misleading-message-when-trying-to-execute-an-update-module-with-erroneous-hashbang/4627/2 "2022-02-22T22:17:46Z")

</div>

Hello @francoislefebvre ,

So you’re saying that the file does exist, is executable but misses a hashbang?

In that case I believe the error should be something else (exec format error or something similar).

@oleorhagen perhaps you know?

---

<div class="post-metadata">

**Author:** ![francoislefebvre](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/francoislefebvre/32/1238_2.png) [@francoislefebvre](https://hub.mender.io/u/francoislefebvre)\
**Post date:** [February 23, 2022, 2:35pm UTC](https://hub.mender.io/t/mender-logs-misleading-message-when-trying-to-execute-an-update-module-with-erroneous-hashbang/4627/3 "2022-02-23T14:35:38Z")

</div>

- The script exists and has execute permissions
- Hashbang is declared but the path to the executable is wrong (executable does not exist)

---

<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:** [February 24, 2022, 12:15pm UTC](https://hub.mender.io/t/mender-logs-misleading-message-when-trying-to-execute-an-update-module-with-erroneous-hashbang/4627/4 "2022-02-24T12:15:09Z")

</div>

The error is directly returned from the Golang exec lib:

`https://pkg.go.dev/os/exec`, so there is not that much we can do around the returned error here.

However, some better logging prior to this error message would probably help.

We do have this debug log:

```auto
	log.Debugf("Calling module: %s Download %s", mod.programPath, payloadPath)

```

Would having this at the `info` level be acceptable @francoislefebvre, or do you think more effort is needed?

---

<div class="post-metadata">

**Author:** ![francoislefebvre](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/francoislefebvre/32/1238_2.png) [@francoislefebvre](https://hub.mender.io/u/francoislefebvre)\
**Post date:** [February 24, 2022, 3:28pm UTC](https://hub.mender.io/t/mender-logs-misleading-message-when-trying-to-execute-an-update-module-with-erroneous-hashbang/4627/5 "2022-02-24T15:28:18Z")

</div>

Yeah, that’s what I thought.

After some search, it seems like this message stems from the OS itself and is somewhat [well recognized](https://unix.stackexchange.com/questions/27054/bin-bash-no-such-file-or-directory) as a problem with the shebang line.

And since appending the OS/golang error message is quite useful, I think we can leave it like that. We learn every day!

Thanks for your help.
