Postgres FATAL: invalid value for parameter "TimeZone": "Europe/Kyiv"

Postgres container will not initiate the Nextcloud database because of Timezone error
psql: error: ... FATAL: invalid value for parameter "TimeZone": "Europe/Kyiv"

A workaround is to keep the nextcloud-aio-mastercontainer and remove all the other AiO containers and their PVs. And start them again with some other TZ.

The problem and the workaround are for Nextcloud AiO setup inside docker container environment. However can be adopted for any other Nextcloud implementation

Most *nix OSes still have an outdated timezone lists. So the AiO setup wizard statement " You can get valid values by looking at the ā€˜TZ database nameā€™ column of this list: click here." is a kind of misleading. IANA had updated the TZ data for Ukrainian cities years ago, but it takes time to propagate. Keep reporting, keep pushing though! ā€œBoritesia - poboreteā€ :wink: (c)

Workaround steps:

  1. Login to https://<your-nc-domain.tld>:8443/containers
  2. Stop containers
  3. Keep the nextcloud-aio-mastercontainer and remove all the other AiO containers and their PVs
  4. If your server is to be multinational, use UTC +0 and save the hassle :smiley: . Or else, change timezone to some capital with the same TZ (and same DST!!!) as yours. For Ukraine/Kyiv it can be Helsinki, Tallinn, Riga, Vilnius, Chisinau, Bucharest, Sofia*, Athens.
  5. Refresh the AiO page!
  6. AiO will find out that the containers are missing and will offer something like: ā€œ:warning: Container updates are available ā€¦ Start and update containersā€, which in these very case means to initiate new containers and PVs for them
  7. Check the database container logs - they should look much better now :slight_smile:
  8. Be patient - it may take a long time for main Nextcloud container to initiate. (follow the logs :person_in_lotus_position: )

:warning::warning::warning: be very careful and think twice if you are adopting thise workaround for a running Nextcloud with your data inside :warning::warning::warning:

Database TZ error log:

The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.utf8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /var/lib/postgresql/data ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... UTC
creating configuration files ... ok
running bootstrap script ... ok
sh: locale: not found
2022-08-12 07:30:27.247 UTC [30] WARNING:  no usable system locales were found
performing post-bootstrap initialization ... ok
initdb: warning: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.
syncing data to disk ... ok


Success. You can now start the database server using:

    pg_ctl -D /var/lib/postgresql/data -l logfile start

waiting for server to start....2022-08-12 07:30:33.560 UTC [36] LOG:  starting PostgreSQL 14.4 on aarch64-unknown-linux-musl, compiled by gcc (Alpine 11.2.1_git20220219) 11.2.1 20220219, 64-bit
2022-08-12 07:30:33.576 UTC [36] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2022-08-12 07:30:33.605 UTC [37] LOG:  database system was shut down at 2022-08-12 07:30:31 UTC
2022-08-12 07:30:33.625 UTC [36] LOG:  database system is ready to accept connections
 done
server started
2022-08-12 07:30:33.834 UTC [46] FATAL:  invalid value for parameter "TimeZone": "Europe/Kyiv"
psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL:  invalid value for parameter "TimeZone": "Europe/Kyiv"
2022-08-12 07:30:33.871 UTC [50] FATAL:  database "nextcloud_database" does not exist
pg_dump: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL:  database "nextcloud_database" does not exist
waiting for server to shut down....2022-08-12 07:30:33.877 UTC [36] LOG:  received fast shutdown request
2022-08-12 07:30:33.886 UTC [36] LOG:  aborting any active transactions
2022-08-12 07:30:33.889 UTC [36] LOG:  background worker "logical replication launcher" (PID 43) exited with exit code 1
2022-08-12 07:30:33.890 UTC [38] LOG:  shutting down
2022-08-12 07:30:33.959 UTC [36] LOG:  database system is shut down
 done
server stopped

Hmā€¦ Does Europe/Kiev work?

Itā€™s a rhetorical question since 2014 at least. Too much pain and anger in it. Not a place to discuss.

1 Like

I only wanted to suggest this as a workaround