Failed to set timezone: Invalid argument – timedatectl in Kali Linux
0 reputation · 21 Jun 2020, 00:52 UTC
0 reputation · 21 Jun 2020, 00:52 UTC
Kali Linux uses timedatectl to manage system time and time‑zone settings. When a user supplies a non‑existent zone identifier, the command returns the error message Failed to set timezone: Invalid argument and exits with a non‑zero status.
In a standard live boot, any successful timezone change (e.g., timedatectl set-timezone America/New_York) is not retained after a reboot because the live overlay treats /etc/localtime as volatile. The error condition for invalid zones is generated by the systemd‑timedated D‑Bus interface before it attempts to update the symlink.
It remains unclear whether Kali should enable a persistent overlay for timezone settings by default in live mode, or leave it to users to manually activate persistence via persistence.conf. This choice impacts how users can reliably set regional time zones for time‑sensitive operations.
timedatectl reject non‑existent zone identifiers with the specific error Failed to set timezone: Invalid argument?persistence.conf?timedatectl rejects a timezone with Failed to set timezone: Invalid argument because the identifier you supplied does not exist in the IANA timezone database. The check happens inside the systemd-timedated D-Bus service before anything touches /etc/localtime, so the error is a validation failure, not a permission or filesystem problem. Separately, on a Kali live boot, even a successful timezone change vanishes at reboot because the live overlay treats /etc/localtime as volatile — that is expected behavior, not a bug.
When you run timedatectl set-timezone Some/Zone, systemd-timedated looks up the identifier under /usr/share/zoneinfo. If no matching file exists, the service returns an invalid-argument error over D-Bus and timedatectl prints the message and exits non-zero. Nothing is modified. Common triggers:
america/new_york fails; America/New_York works).US/Eastern Standard Time or EST5EDT-style guesses that aren't in the database.tzdata installation where the zoneinfo tree is incomplete.Verify the identifier before setting it:
timedatectl list-timezones | grep -i york
sudo timedatectl set-timezone America/New_York
timedatectl showIf a zone you expect is missing from the list, reinstall tzdata (sudo apt install --reinstall tzdata) rather than forcing the symlink by hand.
In a standard Kali live session the root filesystem is a read-only base plus a RAM-backed overlay. /etc/localtime is a symlink into /usr/share/zoneinfo, and the updated symlink lives only in the volatile overlay. Reboot, and you're back to the default (typically UTC). This applies to every live change, not just timezones.
There is no documented Kali option that persists /etc/localtime without configuring persistence — that is the designed mechanism. The workflow:
persistence on the USB drive (the Kali docs walk through this with fdisk/mkfs.ext4).persistence.conf. The broad option is / union, which persists the whole filesystem including /etc/localtime. If you want a narrower scope, add a bind entry covering /etc instead — but be careful: malformed persistence.conf syntax can silently disable persistence entirely, losing all changes.sudo timedatectl set-timezone Europe/London.timedatectl show should report the same Timezone= value, and ls -l /etc/localtime should point at the right zoneinfo file.For one-off live sessions, a boot parameter or a startup script that runs timedatectl set-timezone (or sets the TZ environment variable for the tools that need it) is a pragmatic alternative. Note that TZ only affects processes that read it — system services and logs still follow /etc/localtime.
Exact persistence.conf entry syntax and boot-menu wording vary slightly across Kali releases; check the current Kali persistence documentation for your version before rebuilding the partition. The validation behavior and the volatile-overlay explanation above are stable across systemd-based Kali releases.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.