LoginSignup
6
1

More than 3 years have passed since last update.

Nervesで出続けるtzdataのエラーを止めた

Last updated at Posted at 2020-06-11

Nervesを使って時間をあつかうプログラムを書いていた場合、RinLogger.attachしてログを表示した際にtzdataの書き込みエラーが表示される場合があります。

たちが悪いのが、n秒に一回書き込みしようとしてエラーが出るのでログがとても見づらくなります。

エラーの例

Nerves(RinLogger.attach)
07:44:10.633 [error] GenServer :tzdata_release_updater terminating
** (File.Error) could not write to file "/srv/erlang/lib/tzdata-1.0.3/priv/latest_remote_poll.txt": read-only file system
    (elixir 1.10.2) lib/file.ex:1050: File.write!/3
    (tzdata 1.0.3) lib/tzdata/data_loader.ex:44: Tzdata.DataLoader.last_modified_of_latest_available/1
    (tzdata 1.0.3) lib/tzdata/release_updater.ex:81: Tzdata.ReleaseUpdater.loaded_tzdata_matches_remote_last_modified?/0
    (tzdata 1.0.3) lib/tzdata/release_updater.ex:42: Tzdata.ReleaseUpdater.poll_for_update/0
    (tzdata 1.0.3) lib/tzdata/release_updater.ex:19: Tzdata.ReleaseUpdater.handle_info/2
    (stdlib 3.12.1) gen_server.erl:637: :gen_server.try_dispatch/4
    (stdlib 3.12.1) gen_server.erl:711: :gen_server.handle_msg/6
    (stdlib 3.12.1) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Last message: :check_if_time_to_update
State: []

解決方法1(確認済み)

config/target.exsファイルに次の行を追記すればエラーがでなくなりました。

config/target.exs
config :tzdata, :data_dir, "/data/tzdata"

解決方法2(未確認)

このような方法もあるようですが、こちらは未確認でdisabledにした時の副作用がきになるところ。

config/config.exs
config :tzdata, :autoupdate, :disabled
6
1
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
1