1 |
Duncan wrote: |
2 |
> Dale posted on Thu, 07 Jan 2016 00:55:31 -0600 as excerpted: |
3 |
> |
4 |
>>> You did the first part of it, setting /etc/timezone, but didn't do the |
5 |
>>> second part, setting /etc/localtime, which is used by glibc to know |
6 |
>>> your timezone. You can either do it using the command in the handbook: |
7 |
>>> |
8 |
>>> emerge --config sys-libs/timezone-data |
9 |
>>> |
10 |
>>> ... or you can do it manually by copying the appropriate timezone file |
11 |
>>> from /usr/share/zoneinfo/ to /etc/localtime, for AZ: |
12 |
>>> |
13 |
>>> cp /usr/share/zoneinfo/America/Phoenix /etc/localtime |
14 |
>>> |
15 |
>>> (Every time you update the timezone-data package, its pkg_postinst() |
16 |
>>> runs pkg_config(), which is what that emerge call does semi-manually, |
17 |
>>> above. pkg_config in turn copies the appropriate file to /etc/localtime |
18 |
>>> based on /etc/timezone, thus updating /etc/localtime with the timezone |
19 |
>>> file from the freshly installed timezone-data package. The cp |
20 |
>>> alternative simply does that same cp manually. You can of course take |
21 |
>>> a look at the timezone-data ebuild itself to see exactly how it does |
22 |
>>> it, if you like. It does get slightly fancier with its logic, setting |
23 |
>>> factory if the timezone is invalid, not touching the localtime file if |
24 |
>>> it's a symlink instead of an actual file, etc, but basically, just does |
25 |
>>> the above under normal circumstances. =:^) |
26 |
>>> |
27 |
>> It's been a long time since I did this but isn't that supposed to be a |
28 |
>> link instead of a copy? I'm pretty sure it was a link long ago but they |
29 |
>> may have changed it. |
30 |
> Take a look at the code in timezone-data's pkg_config. It's commented |
31 |
> and easy enough to follow for those who are comfortable with bash, as |
32 |
> gentooers certainly /should/ be. =:^) |
33 |
> |
34 |
> That function (which is run as part of the handbook's installation |
35 |
> instructions) checks for a symlink and specifically assumes the user |
36 |
> knows what they are doing if it's a symlink, but defaults to a cp based |
37 |
> on the timezone set in /etc/timezone, unless /etc/localtime is a symlink. |
38 |
> |
39 |
> So a symlink should work if a user creates it manually, but the file is |
40 |
> normally copied. |
41 |
> |
42 |
> I'd guess the reason is because gentoo still tries to allow for a |
43 |
> separate /usr, which would of course mean a dead symlink in early (pre- |
44 |
> mount but for /) boot, which is when openrc tries to set the time, in |
45 |
> ordered to properly check config file modification times to see if it |
46 |
> needs to recache service ordering. Openrc then falls back to I think |
47 |
> UTC, which will likely trigger a time-skew complaint when the cache files |
48 |
> appear to be from the future (for folks in UTC-minus timezones, anyway). |
49 |
> |
50 |
> For people with /usr/share/zoneinfo/* on / (or who use an initr* that |
51 |
> mounts /usr), the symlink should work fine, and is arguably easier to |
52 |
> check, since you can just check where the symlink points instead of |
53 |
> having to diff against the zoneinfo timezone file you /think/ it should |
54 |
> be to be sure it's correct (which is what I did here, checking my own |
55 |
> system to be sure it was set that way, before posting). |
56 |
> |
57 |
> But while my /usr is on / (and I'm on systemd so that particular issue |
58 |
> wouldn't apply, but others might), I've left localtime as an actual file, |
59 |
> because that's the default solution, thus most widely tested and least |
60 |
> likely to cause additional bugs. I don't hesitate to diverge from the |
61 |
> defaults where I have some reason to prefer doing it differently, and |
62 |
> there are indeed lots of places I do just that and I sometimes see bugs |
63 |
> nobody else seems to see as a result, but here, I don't really care, so |
64 |
> I've picked my additional bug risks and don't find the need to make this |
65 |
> one of them. =:^) |
66 |
> |
67 |
|
68 |
|
69 |
I'll take your word for it because I don't do bash. I just need to |
70 |
remember that it is changed now. |
71 |
|
72 |
Dale |
73 |
|
74 |
:-) :-) |