Gentoo Archives: gentoo-dev

From: Mike Gilbert <floppym@g.o>
To: Gentoo Dev <gentoo-dev@l.g.o>
Subject: Re: [gentoo-dev] timezone configuration - why copying, not symlinking /etc/localtime ?
Date: Mon, 22 Mar 2021 02:49:41
Message-Id: CAJ0EP42qapT8hpt1ZZnQGsEMBYykZgxJWHL4oe_Z1ATyLq2cbA@mail.gmail.com
In Reply to: [gentoo-dev] timezone configuration - why copying, not symlinking /etc/localtime ? by "Andreas K. Huettel"
1 On Sat, Mar 20, 2021 at 11:37 AM Andreas K. Huettel
2 <dilfridge@g.o> wrote:
3 >
4 > Hi all,
5 >
6 > why do we *copy* the timezone file to /etc/localtime, instead of symlinking it like everyone else?
7 >
8 > 1) Our handbook recommends:
9 >
10 > echo "Europe/Brussels" > /etc/timezone
11 > emerge --config sys-libs/timezone-data
12 >
13 > which is effectively doing
14 >
15 > echo "Europe/Brussels" > /etc/timezone
16 > cp -f /usr/share/zoneinfo/Europe/Brussels /etc/localtime
17 >
18 > 2) Most other distros seem to just do
19 >
20 > ln -sf /usr/share/zoneinfo/Europe/Brussels /etc/localtime
21 >
22 > and use the link content as timezone name (this is also what is required by systemd).
23 >
24 > Does anyone remember the reason for 1) ? Or is that lost in history?
25
26 I think the most obvious reason would be to support late-mounting of
27 /usr, after the system clock has been reset with a UTC offset on boot.
28 To make this work, the /etc/localtime file would need to be available
29 when the hwclock init script runs.
30
31 These days, I suspect there are not many users running systems with a
32 hardware clock in local time, and a separate /usr filesystem, and no
33 initramfs to mount /usr early.
34
35 I created a PR to adjust the logic in timezone-data to promote
36 symlinks for new installs, while keeping regular files in place for
37 existing users.
38
39 https://github.com/gentoo/gentoo/pull/20050
40
41 If we added some logic to detect if /usr is a separate filesystem, we
42 could possibly be even more aggressive about this. But I'm not sure I
43 want to rock the boat that much in one commit.