2016年12月12日月曜日

RHEL7 カーネルの うるう秒(閏秒)に関する不具合

次回の うるう秒挿入(日本時間2017年1月1日8時59分59秒)が迫ってますが、先週、新たに RHEL7 のカーネル不具合情報と修正版カーネルが公開されたので、備忘録として書いておこうと思います。

http://rhn.redhat.com/errata/RHBA-2016-2862.html
https://access.redhat.com/solutions/2766351

カーネル 3.10.0-514.2.2.el7 で修正されたようですが、すぐにアップデートできないなら、ntpd の slew モードを使っておけばよいです。または、ntpd を一時的に止めておく方法も可能。ちなみに、今回のRHEL7のカーネル不具合は、発生確率がけっこう低い (500回試して1回程度と記載されてます) ようです。
ChangeLog より抜粋です。
* Wed Nov 16 2016 Frantisek Hrbata <fhrbata@hrbata.com> [3.10.0-514.2.2.el7]
- [kernel] timekeeping: Copy the shadow-timekeeper over the real timekeeper last (Prarit Bhargava) [1395577 1344747]

■関連記事
2012年7月1日の うるう秒 調整時の ntpd の挙動観測データ

2016年10月29日土曜日

使わないデカイ rpm をリストアップして削除する方法

Windows PC のメンテナンス目的 (バックアップ等) で、CentOS 7 をインストールしてマルチブート環境を作ったのですが、SSD の割り当てをケチって 5GB のパーティションに Server with GUI オプションでインストールしました。
そうしたところ、yum update するだけでも、空きが殆どゼロになったため、不要な大きなサイズの rpm をリストアップして削除したいと思ったのでした。そのコマンドライン、備忘録です。
[root@hoge ~]# rpm -qa --qf '%{size}  %{name}-%{version}-%{release}.%{arch}\n' | sort -rn | head
149412110  firefox-45.4.0-1.el7.centos.x86_64
142763489  kernel-3.10.0-327.36.3.el7.x86_64
120273417  glibc-common-2.17-106.el7_2.8.x86_64
72282987  linux-firmware-20150904-43.git6ebf5d5.el7.noarch
68134425  texlive-cm-super-svn15878.0-38.el7.noarch
63095469  gimp-2.8.10-3.el7.x86_64
56222854  gnome-getting-started-docs-3.14.1.0.2-1.el7.noarch
49972399  kernel-doc-3.10.0-327.36.3.el7.noarch
45656942  webkitgtk3-2.4.9-5.el7.x86_64
41249234  texlive-lm-svn28119.2.004-38.el7.noarch
これで、例えば gimp が何かを、確認しながら、不要なら削除すればよいです。
[root@hoge ~]# rpm -qi gimp
Name        : gimp
Epoch       : 2
Version     : 2.8.10
Release     : 3.el7
Architecture: x86_64
Install Date: 2014年05月25日 18時00分07秒
Group       : Applications/Multimedia
Size        : 63095469
License     : GPLv3+ and GPLv3
Signature   : RSA/SHA256, 2014年04月02日 01時39分59秒, Key ID 199e2f91fd431d51
Source RPM  : gimp-2.8.10-3.el7.src.rpm
Build Date  : 2014年01月25日 08時24分39秒
Build Host  : x86-025.build.eng.bos.redhat.com
Relocations : (not relocatable)
Packager    : Red Hat, Inc. 
Vendor      : Red Hat, Inc.
URL         : http://www.gimp.org/
Summary     : GNU Image Manipulation Program
Description :
GIMP (GNU Image Manipulation Program) is a powerful image composition and
editing program, which can be extremely useful for creating logos and other
graphics for webpages. GIMP has many of the tools and filters you would expect
to find in similar commercial offerings, and some interesting extras as well.
GIMP provides a large image manipulation toolbox, including channel operations
and layers, effects, sub-pixel imaging and anti-aliasing, and conversions, all
with multi-level undo.
わたしの場合は、間違いなく使わないであろう libreoffice と java 関係を削ることで、十分な空きが確保できました。

2016年9月17日土曜日

CentOS6 + ZFS on Linux 環境での updatedb による余分なI/O負荷

ZFS on Linux を CentOS6 で動作させている環境で、cron.daily の際に updatedb がやけに動いていることを発見。
mlocate.cron を見てみたら、次のような記述になっていました。
[root@hoge ~]# cat /etc/cron.daily/mlocate.cron 
#!/bin/sh
nodevs=$(< /proc/filesystems awk '$1 == "nodev" && $2 != "zfs" { print $2 }')
renice +19 -p $$ >/dev/null 2>&1
ionice -c2 -n7 -p $$ >/dev/null 2>&1
/usr/bin/updatedb -f "$nodevs"
まさかとは思いましたが、レッドハットが ZFS に配慮しているケースもあるみたいです。mlocate の changelog から抜粋。
[root@hoge ~]# rpm -q --changelog mlocate | head -8
* Mon Jan 26 2015 Michal Sekletar <msekleta@redhat.com> - 0.22.2-6
- mlocate.db is ghost file created with non-default attrs, list them explicitly so rpm --verify doesn't report errors (#1182304)

* Wed Jan 07 2015 Michal Sekletar <msekleta@redhat.com> - 0.22.2-5
- index zfs filesystems despite the fact they are marked as nodev (#1023779)
- use more strict permissions for cron script and mark it as config (#1012534)
- add gpfs to PRUNEFS (#1168301)

[root@hoge ~]# 
対応するバグジラ(#1023779)によると、
https://bugzilla.redhat.com/show_bug.cgi?id=1023779
ZFS 領域が updatedb の対象にならないという問題があり、まず Fedora で修正され、RHEL6 にも修正が取り込まれたようです。
さらには、RHEL7 向けのバグジラ(#1304416)もオープンされています。
https://bugzilla.redhat.com/show_bug.cgi?id=1304416
こちらは、RHEL7.3 向けに Status:VERIFIED の状態、つまり、ベータに取り込まれた模様です。

レッドハットが ZFS を無視しないでくれる(つまりは、ある程度は RHEL+ZFS を利用する顧客が居るらしい?)のは、個人的にはありがたいことと思いました。
が、しかし、ZFS の倉庫領域(大量のファイルを格納している)は、updatedb 対象じゃないほうが良いです。わたしの使い方に於いては。
というわけで、
[root@hoge ~]# vi /etc/updatedb.conf 
PRUNE_BIND_MOUNTS = "yes"
PRUNEFS = "zfs 9p afs anon_inodefs auto autofs bdev binfmt_misc cgroup cifs coda configfs cpuset debugfs devpts ecryptfs exofs fuse fusectl gfs gfs2 gpfs hugetlbfs inotifyfs iso9660 jffs2 lustre mqueue ncpfs nfs nfs4 nfsd pipefs proc ramfs rootfs rpc_pipefs securityfs selinuxfs sfs sockfs sysfs tmpfs ubifs udf usbfs"
PRUNENAMES = ".git .hg .svn"
PRUNEPATHS = "/afs /media /net /sfs /tmp /udev /var/cache/ccache /var/spool/cups /var/spool/squid /var/tmp"
[root@hoge ~]#
という具合に設定しました。
[root@hoge ~]# grep mlocate /var/log/cron
...
Sep 10 03:41:09 hoge run-parts(/etc/cron.daily)[6431]: starting mlocate.cron
Sep 10 04:19:02 hoge run-parts(/etc/cron.daily)[13231]: finished mlocate.cron
Sep 11 03:48:11 hoge run-parts(/etc/cron.daily)[12147]: starting mlocate.cron
Sep 11 04:22:57 hoge run-parts(/etc/cron.daily)[18782]: finished mlocate.cron
Sep 12 03:17:06 hoge run-parts(/etc/cron.daily)[11282]: starting mlocate.cron
Sep 12 03:43:40 hoge run-parts(/etc/cron.daily)[16158]: finished mlocate.cron
Sep 13 03:22:05 hoge run-parts(/etc/cron.daily)[16992]: starting mlocate.cron
Sep 13 03:50:24 hoge run-parts(/etc/cron.daily)[22578]: finished mlocate.cron
Sep 14 03:08:05 hoge run-parts(/etc/cron.daily)[20083]: starting mlocate.cron★ここから変更後
Sep 14 03:08:22 hoge run-parts(/etc/cron.daily)[20318]: finished mlocate.cron
Sep 15 03:13:08 hoge run-parts(/etc/cron.daily)[25880]: starting mlocate.cron
Sep 15 03:13:14 hoge run-parts(/etc/cron.daily)[26074]: finished mlocate.cron
Sep 16 03:07:06 hoge run-parts(/etc/cron.daily)[29745]: starting mlocate.cron
Sep 16 03:07:09 hoge run-parts(/etc/cron.daily)[29947]: finished mlocate.cron
このように、30~40分程度動いていた updatedb が、10秒程度になり、無駄な I/O 負荷をカットできました。
人気ブログランキングへ にほんブログ村 IT技術ブログへ