archinstall
archinstall copied to clipboard
Timezone is not being set correctly
Time is always set to UTC
We might need to create a forced symlink to /etc/localtime
Tested on tag v2.2.0
- Set the timezone eg: Asia/Kolkata
- chroot after installation, verify /etc/localtime, reboot and verify
- Timezone is set to UTC irrespective of choice at the installer prompt
Check, I remember I used to unlink the target (/etc/localtime) before setting it, that might have gotten lost somewhere.
Check, I remember I used to unlink the target (/etc/localtime) before setting it, that might have gotten lost somewhere.
Update - unlink is present, it's still not working, tried adding the force flag in ln, did not work
Check, I remember I used to unlink the target (/etc/localtime) before setting it, that might have gotten lost somewhere.
Update - unlink is present, it's still not working, tried adding the force flag in ln, did not work
What's the symptom? Or how can we confirm that this is an issue?
Check, I remember I used to unlink the target (/etc/localtime) before setting it, that might have gotten lost somewhere.
Update - unlink is present, it's still not working, tried adding the force flag in ln, did not work
What's the symptom? Or how can we confirm that this is an issue?
- Set the timezone eg: Asia/Kolkata
- chroot after installation, verify /etc/localtime, reboot and verify
- Timezone is set to UTC irrespective of choice at the installer prompt
Perfect, I'll also take a look at it and see what's going on.
Relevant code in the user_interaction library file:
def ask_for_a_timezone():
while True:
timezone = input('Enter a valid timezone (examples: Europe/Stockholm, US/Eastern) or press enter to use UTC: ').strip().strip('*.')
if timezone == '':
timezone = 'UTC'
if (pathlib.Path("/usr") / "share" / "zoneinfo" / timezone).exists():
return timezone
else:
log(
f"Specified timezone {timezone} does not exist.",
level=logging.WARNING,
fg='red'
)
And here's where we set it: https://github.com/archlinux/archinstall/blob/2731f82d0fd51e87c9c4454a25e1e01f2ae077cf/archinstall/lib/installer.py#L192-L212
I'm wondering if we should swap arch-chroot in favor for archinstall.Boot() and set this via timedatectl instead (required systemd/dbus). I suspect it's this call that is unreliable because of potential mounts by arch-chroot or something: https://github.com/archlinux/archinstall/issues/533#L205
I can see /etc/localtime is linked to ../usr/share/zoneinfo/UTC (notice it's starting with ..) after the reboot after install. I have configured to use NTP (I think guided.py can add an option to use systemd-timesyncd).
By the way, you don't need to use arch-chroot to create a symbolic link, ln -s /usr/share/zoneinfo/{zone} {self.target}/etc/localtime is ok.
By the way, you don't need to use arch-chroot to create a symbolic link,
ln -s /usr/share/zoneinfo/{zone} {self.target}/etc/localtimeis ok.
I believe that's what I used to do, not sure why I added the arch-chroot there. Just adds complexity hehe. Will re-work that in a bit.
@Torxed I checked the installed version and the time seems to be set correctly
@Torxed I think we can close this