Skip to content

Warm restart detection broken due to typo in /container/state path #2

Description

@c-holtermann

Bug description

The warm restart detection in /etc/cont-init.d/0-container appears to contain a typo in the state directory path.

The script currently checks:

if [ -d /contaner/state ]; then

but the actual state directory used throughout the script is:

/container/state

So the condition should presumably be:

if [ -d /container/state ]; then

Actual behavior

Because /contaner/state normally does not exist, the warm restart branch is never entered.

Instead, the script executes the else branch on every startup:

mkdir -p /container/state
echo "$(date +%s) $(date +'%Y-%m-%d %H:%M:%S %Z') - Container started" >> /container/state/startup

On my container, /container/state/startup consequently contains multiple Container started entries across restarts, for example:

1787320298 2026-08-21 13:51:38 GMT - Container started
1787320513 2026-08-21 15:55:13 CEST - Container started
1787390790 2026-08-22 11:26:30 CEST - Container started

Expected behavior

If /container/state already exists, the script should detect a warm restart and execute the corresponding cleanup/restart branch:

if [ -d /container/state ]; then
    echo "Detected Container that has been restarted - Cleaning '/container/state' files"
    ...
    echo "$(date +%s) $(date +'%Y-%m-%d %H:%M:%S %Z') - Warm restart detected" >> /container/state/restart
fi

Suggested fix

Change:

if [ -d /contaner/state ]; then

to:

if [ -d /container/state ]; then

Environment

The issue was observed in an Nfrastack-based FreeScout Docker container. The container uses /init as its entrypoint, which invokes /etc/cont-init.d/0-container.

The affected script identifies itself with:

SPDX-FileCopyrightText: © 2026 Nfrastack <code@nfrastack.com>
SPDX-License-Identifier: MIT

Note

Bug report text generated with help of ChatGPT

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions