📜 ⬆️ ⬇️

Tzdata update for Russia (system and java in Ubuntu / Debian, as well as in MySQL)

Foreword


As many remember, this year a law was passed, in connection with which the time zones changed in Russia from October 26, 2014. Of course, right after the law was adopted, I put a reminder in the calendar at the beginning of October, “be sure to update tzdata”. What was my surprise when I did not find tzdata updates in debian and ubuntu. I decided to wait a little longer, stumbled upon open bugs in distributions (Ubuntu # 1377813 , # 1371758 , Debian # 761267 ). Colleagues strongly reminded of the need for updates, but the maintainers did not respond. In order not to arrange a hijacking by the end of the month, I decided to assemble the packages and upgrade manually. It is important to note that information about zones in some software, for example, in MySQL, will need to be updated manually. This is followed by a short manual.

Ubuntu 12.04 / 14.04, Debian 7


By the time I decided to compile updates, a debut wheezy and almost immediately a package of 2014h appeared in ubuntu utopic, so I just took tzdata_2014h-2.dsc, tzdata_2014h.orig.tar.gz, tzdata_2014h-2.debian.tar.xz and assembled without much change.

Put compilers:

apt-get install devscripts dpkg-dev debhelper build-essential 

')
Unpacked the source:

 dpkg-source -x tzdata_2014h-2.dsc cd tzdata-2014h 


I put the dependencies, corrected the version and collected:

 apt-get install default-jre-headless rdfind symlinks dch -i dpkg-buildpackage -rfakeroot cd ../ 


It remains to install:

 dpkg -i tzdata*deb 


Ubuntu 10.04, Debian 6


The algorithm for old distributions is practically the same, the only difference is that the rdfind package is not in the distribution. The easiest way was to collect it.

Sources were taken in debian packages.debian.org/wheezy/rdfind , dependencies are installed, and a deb package is built.

 dpkg-source -x rdfind_1.3.1-1.dsc apt-get install nettle-dev cd rdfind-1.3.0/ dpkg-buildpackage -rfakeroot cd ../ dpkg -i rdfind*deb 


MySQL update



  UPD: Does not work if time_zone = SYSTEM.
 Solution without restarting - SET GLOBAL time_zone = 'Europe / Moscow';  or 
  SET GLOBAL time_zone = '+03: 00', if the tables are not updated;


After updating the system tzdata, you need to get the tzinfo for MySQL script from the bundle:

 mysql_tzinfo_to_sql /usr/share/zoneinfo > /tmp/tzinfo-mysql-2014h-2.sql 


Further, this file is uploaded to MySQL. Connect as root, for example:

 mysql --defaults-file=/etc/mysql/debian.cnf 


Select the base, encoding and file:

 use mysql set names utf8; source /tmp/tzinfo-mysql-2014h-2.sql 


At the time of the writing of this post, the ubuntu maintainers probably responded to my letter in ubuntu-devel-discuss and pushed the updates into the proposed. Probably, in the coming days, tzdata updates will arrive from the official repositories, but MySQL will still need to be updated manually.

UPD. For OpenJDK, updates will be delivered along with system updates, and for Sun / Oracle Java you need to use the “proprietary” utility .

UPD2. Instructions from Ernillew , how to configure the proposed: habrahabr.ru/post/240937/#comment_8080009 .

UPD3. In trusty appeared 2014i, which includes the previous changes and new for Belarus.
"Tzdata" versions published in Ubuntu

As of 2014-10-23 09:31 +0400 (info from launchpad.net/ubuntu/+source/tzdata/+bugs )

 Trusty-security (2014i-0ubuntu0.14.04): main/libs Trusty-updates (2014i-0ubuntu0.14.04): main/libs Precise-security (2014i-0ubuntu0.12.04): main/libs Precise-updates (2014i-0ubuntu0.12.04): main/libs Lucid-security (2014i-0ubuntu0.10.04): main/libs Lucid-updates (2014i-0ubuntu0.10.04): main/libs Utopic-proposed (2014i-0ubuntu0.14.10): main/libs Trusty-proposed (2014i-0ubuntu0.14.04): main/libs Precise-proposed (2014i-0ubuntu0.12.04): main/libs Lucid-proposed (2014i-0ubuntu0.10.04): main/libs Utopic (2014h-2): main/libs Trusty (2014b-1): main/libs Precise (2012b-1): main/libs Lucid (2010i-1): main/libs 


UPD4. For PHP in some configurations you may need

 pecl install timezonedb echo "extension=timezonedb.so" > /etc/php5/conf.d/timezonedb.ini # ,     pecl upgrade timezonedb 

Source: https://habr.com/ru/post/240937/


All Articles