Re: tzsetup chroot

From: Xin Li <delphij_at_delphij.net>
Date: Tue, 03 Feb 2015 18:11:02 -0800
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

On 02/03/15 17:05, Nick Frampton wrote:
> We have our own FreeBSD 10.1 installation script in which we call
> tzsetup.
> 
> I'm seeing different behaviour in tzsetup between these two
> invocations:
> 
> tzsetup -C /mnt chroot /mnt /usr/sbin/tzsetup
> 
> With the -C option, no matter which time zone I select, it asks:
> 
> Does the abbreviation 'UTC' look reasonable?
> 
> Using chroot, I get the expected behaviour, e.g. selecting 
> America/New_York:
> 
> Does the abbreviation 'EST' look reasonable?
> 
> /mnt contains the contents of base.txz, so it looks like all the 
> zoneinfo files are there.

Could you please submit a bug ticket for this?

It looks like what happens is that tzsetup does not really do a
chroot(2) system call.  Instead, it simulated the effect by prefixing
all paths with the chroot environment.

The problem is that when tzsetup is going to verify your
configuration, it would use tzset(3), which does not respect the
simulated chroot effect.  When no zoneinfo data is present, everything
would be considered as UTC.

Attached is an dirty hack (ugly enough that I don't wish to commit)
that changes tzsetup to use chroot instead, which should fix the
problem.  I'm not very satisfied with it as it does chroot() before
doing init_dialog, which may well fail as the devfs is not necessarily
mounted in the chroot, and on the other hand all termcap related data
would be sourced from the chroot, which is probably an undesirable
side effect.

Cheers,
- -- 
Xin LI <delphij_at_delphij.net>    https://www.delphij.net/
FreeBSD - The Power to Serve!           Live free or die
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.1.1 (FreeBSD)

iQIcBAEBCgAGBQJU0X+zAAoJEJW2GBstM+nsfpwQAIwPBj11lzJS662RPBPQR6dB
vb3gCGJjqRANCD+Sr8EqxzPlKOcC4UiBB5Khy39lidC+d4qgGQ3Mz3qIwjCdl3Aw
KUzkFfhvspGzE25tIwsPJ3A00NjXNJGqGqcDMitfls4SdYZWzCgs+gwa3zGq+yO3
/pPMQVVhhBz2pgkqxCtznFqY9paN5lzwaOqp9HepNz1g99Q4u+KpIUI93BMcMdMD
9HtY7YQYzDCnhi4OskdIB2BrLm1NSFPMkALASTMuCplFwtyI+emYD/GzOwUF5zay
Vk4QQ33Z9G1pw6jU730kFl/FU5tps35leUYUMcgiz2CG9DTz/wFRJ4SjwD4b1NYx
35nwbrhnp5TV4g94zFfY1NejSwmCpdzq5fvSYwu73yQ+pzwqA2xjXGMwICEo95Tj
Zop/T9gU3g2Hglmz6zTe7m4EXdruFZrADlI6K6cPg/52HosSi7iLnkebwX0nClbQ
HQeCdved38nzRBDZGaJmrDebHD3Uy+qrP5dxTaDe49JZZ+lnkceqy5s+OLQb78S3
Wt9q6GgdKLwa157K74ci/T3rSnty+dJlOXlaq2Bhbru8O7GGmIcmMtsAYzI7+C0z
0cuqsI2sXvT6i/XSjt2VK0D/aQfJ0NfpWDJ6rtlAnFc0g5UBncd8MrAfWo/KOPdH
nIdamgVfmtHcglu07fBq
=0pwZ
-----END PGP SIGNATURE-----

Received on Wed Feb 04 2015 - 01:11:04 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:55 UTC