ArtifactInstall_leave script is not executed (no such file or directory)

Hello community -

I’m building a mender artifact as follows:

mender-artifact write rootfs-image -f release.ext4 -n "v1.0" -o "v1.0.mender" -t dm1 -script ArtifactInstall_Leave_00 -script ArtifactInstall_Enter_10

But when performing the upgrade I see this in the output:

DEBU[0005]/home/charles-chang/mender-client-src/installer/installer.go:175 github.com/mendersoftware/mender/installer.ReadHeaders.func3() Installer: Processing script: ArtifactInstall_Enter_10

DEBU[0005]/home/charles-chang/mender-client-src/installer/installer.go:175 github.com/mendersoftware/mender/installer.ReadHeaders.func3() Installer: Processing script: ArtifactInstall_Leave_00

DEBU[0005]/home/charles-chang/mender-client-src/installer/installer.go:205 github.com/mendersoftware/mender/installer.ReadHeaders() Installer: Successfully read artifact [name: 1.0.2.33sp2-downgrade; version: 3; compatible devices: [dm1]]

…

DEBU[0039]/home/charles-chang/mender-client-src/statescript/executor.go:90 github.com/mendersoftware/mender/statescript.Launcher.getTimeout() statescript: The timeout for executing scripts is not defined; using default of 1h0m0s seconds

INFO[0039]/home/charles-chang/mender-client-src/statescript/executor.go:386 github.com/mendersoftware/mender/statescript.Launcher.ExecuteAll() Executing script: ArtifactInstall_Enter_10

DEBU[0039]/home/charles-chang/mender-client-src/client/client.go:186 github.com/mendersoftware/mender/client.(*ReauthorizingClient).reconstructRequest() Connecting to server http://127.0.0.1:38179

DEBU[0039]/home/charles-chang/mender-client-src/app/proxy/proxy.go:307 github.com/mendersoftware/mender/app/proxy.(*proxyControllerInner).doHttpRequest() Request: "" "" "https" "hosted.mender.io" "/api/devices/v1/deployments/device/deployments/01864f49-0223-40d5-a030-3cdb31ece3fe/status"

DEBU[0039]/home/charles-chang/mender-client-src/client/client_status.go:90 github.com/mendersoftware/mender/client.(*StatusClient).Report() Status reported, response 204 No Content

INFO[0039]/home/charles-chang/mender-client-src/statescript/executor.go:266 github.com/mendersoftware/mender/statescript.execute() Collected output (stderr) while running script /var/lib/mender/scripts/ArtifactInstall_Enter_10

Printed from ArtifactInstall_Enter_10

---------- end of script output

…

DEBU[0040]/home/charles-chang/mender-client-src/statescript/executor.go:90 github.com/mendersoftware/mender/statescript.Launcher.getTimeout() statescript: The timeout for executing scripts is not defined; using default of 1h0m0s seconds

INFO[0040]/home/charles-chang/mender-client-src/statescript/executor.go:386 github.com/mendersoftware/mender/statescript.Launcher.ExecuteAll() Executing script: ArtifactInstall_Leave_00

ERRO[0040]/home/charles-chang/mender-client-src/app/state.go:268 github.com/mendersoftware/mender/app.(*updateState).HandleError() transient error: error executing leave script for update-install state: error running leave state script(s) for ArtifactInstall state: statescript: error executing 'ArtifactInstall_Leave_00': -1 : fork/exec /var/lib/mender/scripts/ArtifactInstall_Leave_00: no such file or directory

INFO[0040]/home/charles-chang/mender-client-src/app/mender.go:511 github.com/mendersoftware/mender/app.transitionState() State transition: update-install [ArtifactInstall] -> rollback [ArtifactRollback]

DEBU[0040]/home/charles-chang/mender-client-src/app/mender.go:527 github.com/mendersoftware/mender/app.transitionState() Transitioning to error state

Why am I getting a “no such file or directory” error?

Okay… found the issue…

File has incorrect line endings … dox2unix resolved it.

Hi @erezst,

Thanks a lot for sharing, this will be helpful to others!

Greetz,
Josef