Checkmk | sed: -e expression #1, char 26: unknown option to `s' after deployment

Update:

I was able to get it working with container restarts by creating a very barebones compose file:

services:
  monitoring:
    image: checkmk/check-mk-raw:2.4.0p7
    container_name: monitoring
    ports:
      - "8080:5000"
      - "8000:8000"
    volumes:
      - ./monitoring:/omd/sites
      - /etc/localtime:/etc/localtime:ro
    tmpfs:
      - /opt/omd/sites/cmk/tmp:uid=1000,gid=1000
    restart: always
    stdin_open: true
    tty: true

Will report back if I find any issues, but seemingly something in my previous compose/deployment was causing this issue? Really not sure.

Going to implement this into our Ansible tooling for deployment and see how goes.

@Bazooka6267 I was able to use the config you posted as well.

This hit me and I tracked it down, and created this account to answer. It has to do with the sed in entrypoint.sh in the container. It uses _ as a separator:

    sed -i -E "s_^TZ=.*_TZ=\"${TZ}\"_" "/opt/omd/sites/$CMK_SITE_ID/etc/environment"

and it breaks if you have a _ in your timezone, like America/New_York or America/Los_Angeles and probably others.

I was using Los_Angeles and switched to PST8PDT (had to edit that environment file manually) and that fixed it.

That would explain why it happens across versions for some people, and never for others, and only in the container release.

4 Likes

@marmoset have you by change opened an issue for this?

@rdeselle07 I have not

Just logging in to say thank you @marmoset for debugging this! Testing out checkmk and ended up here after the first container restart. :grinning_face_with_smiling_eyes:

I was able to reproduce this bug as of container version checkmk/check-mk-raw:2.4.0-2025.11.20. The fix was to change the container environment variables to pass TZ=America/PST8PDT instead of TZ=America/Los_Angeles, like you said.

Much appreciated!

2 Likes

FWIW, this problem is still there as of the date of this post.

Running 2.3.0p42 RAW under the latest Docker/Docker Compose and Ubuntu server 25.04.

Changing time zone from America/New_York to US/Eastern did the trick.

However, now Apache does not seem to be starting. :grimacing:

@aa777888 — regarding Apache not starting after the TZ change: US/Eastern is a legacy alias in the IANA timezone database that links to America/New_York (see IANA tz Theory file). These aliases can behave unexpectedly in container environments. Try EST5EDT instead. To debug the Apache issue, exec into your container and check with omd status which component is failing. If only Apache is affected, see also this related thread as you know and the Checkmk KB article on Apache troubleshooting.

relevant sections are “Names of time zone rules”, ~ Line 126–138 :

Older versions of this package used a different naming scheme, and these older names are still supported. See the file ‘backward’ for most of these older names (e.g., ‘US/Eastern’ instead of ‘America/New_York’).

and directly after:

Older versions of this package defined legacy names that are incompatible with the first rule of location names, but which are still supported. These legacy names are mostly defined in the file ‘etcetera’. Also, the file ‘backward’ defines the legacy names ‘GMT0’, ‘GMT-0’, ‘GMT+0’ and ‘Canada/East-Saskatchewan’, and the file ‘northamerica’ defines the legacy names ‘EST5EDT’, ‘CST6CDT’, ‘MST7MDT’, and ‘PST8PDT’.

Hi Bernd,

The Apache issue was operator error on my part. However, the time zone bug remains.

Cheers,

aa

1 Like

Hi all!
I have created a ticket regarding the time zone issue.
@marmoset thank you so much for your investigation!

3 Likes