SSブログ

'last reboot'の実行結果が正しくない [Linux]

[ソフトウェアのバージョン]
・systemd 215-17+deb8u4 (on Debian 8)
・systemd-219-19.el7_2.11.x86_64 (on CentOS 7)

1. 発生事象


'last reboot' の実行結果が正しくない。

・開始時刻のみが 9 時間進んだ時刻となる。

# 実際の出力 -- 時間の逆行が発生
reboot   system boot  3.16.0-4-686-pae Wed Jul 27 10:00 - 01:14  (-8:-45)
reboot   system boot  3.10.0-229.20.1. Sat Jul 23 09:12 - 00:18  (-8:-53)

# 補正(開始時刻を 9 時間遅らせる)後の出力
reboot   system boot  3.16.0-4-686-pae Wed Jul 27 01:00 - 01:14  (00:14)
reboot   system boot  3.10.0-229.20.1. Sat Jul 23 00:12 - 00:18  (00:06)


(補足)
・ハードウェアクロック(RTC) にローカルタイムを設定している。
・Debian 7、CentOS 6 では発生しない。
・Debian 7、CentOS 6 の last コマンドを使用しても状況は変わらない。
 /var/log/wtmp に保存されている値の問題である。
・reboot 以外では発生しない。


2. 原因


(1) systemd のバグとの情報がある。


RTC へのローカルタイムの設定に完全には応できていない。

(補足)
timedatectl コマンドでもその旨のワーニングが出力される。

# timedatectl status
...
 RTC in local TZ: yes
...

Warning:
The system is configured to read the RTC time in the local time zone. This
mode can not be fully supported. It will create various problems with time
zone changes and daylight saving time adjustments. The RTC time is never
updated, it relies on external facilities to maintain it. If at all
possible, use RTC in UTC by calling 'timedatectl set-local-rtc 0'.


(2) systemd は RTC に UTC を設定することを前提としている。


3. 対処方法


下記の理由により、今回は何もしない。

・'last reboot' の実行結果以外では問題は発生しない。
・'hwclock --systohc' の実行により、RTC を更新できる。
・Windows をマルチブートの対象としている。
 Windows では、RTC へのローカルタイムの設定を想定している。
 また、UTC への変更が可能かどうか、変更した場合の影響範囲が不明である。


4. 追記


(1) runlevel 行で代用可能である。


'last -x' を実行し、reboot 行の直前の runlevel 行を参照する。
・時間の逆行は発生しない。



nice!(10)  コメント(0)  トラックバック(0) 
共通テーマ:パソコン・インターネット

nice! 10

コメント 0

コメントを書く

お名前:[必須]
URL:
コメント:
画像認証:
下の画像に表示されている文字を入力してください。

※ブログオーナーが承認したコメントのみ表示されます。

トラックバック 0

この広告は前回の更新から一定期間経過したブログに表示されています。更新すると自動で解除されます。