{{tag>gentoo linux}} # lvm が warning やら fatal やらどばーっと 起動時の `dmesg` とかは別に静かにしてるんですけどね。`/etc/init.d/rsyslog restart` とかすると大騒ぎするんです。発端はこちら。 [rsyslog が udp を受信しなくなった](http://manimani.cc/blog/2017/20170405193917_rsyslog_receive_udp_issue#ちょっと戻してみよう "元記事") ## うどんワールドのログを見直す とりあえず、うどんワールド((emerge -uDN world))した時の summary.log を眺めてみると、lvm の postinst 近辺で色々と出てます。 ``` >>> Messages generated by process 18974 on 2017-04-02 16:36:08 JST for package sys-fs/lvm2-2.02.145-r2: WARN: setup It's recommended to set an empty value to the following kernel config option: CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" LOG: prepare Notice that "use_lvmetad" setting is enabled with USE="udev" in /etc/lvm/lvm.conf, which will require restart of udev, lvm, and lvmetad if it was previously disabled. QA: prepare This package has a configure.in file which has long been deprecated. Please update it to use configure.ac instead as newer versions of autotools will die when it finds this file. See https://bugs.gentoo.org/426262 for details. WARN: postinst Make sure the "lvm" init script is in the runlevels: # rc-update add lvm boot Make sure to enable lvmetad in /etc/lvm/lvm.conf if you want to enable lvm autoactivation and metadata caching. ``` ……ふむ、この kernel config はそのとおりにしてた気もするんだけど。 ゲスト側だけしかやってなかったかな。 ## 対応していきます…… ### kernel コンパイル > It's recommended to set an empty value to the following kernel config option: > CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" ``` # grep 'CONFIG_UEVENT_HELPER_PATH' /usr/src/linux/.config CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" ``` なるほど。じゃあこれは外してカーネルコンパイルしましょう。 ``` # cd /usr/src/linux # make menuconfig ``` で、[/]キーを押下して `CONFIG_UEVENT_HELPER_PATH` を検索します。 ``` Symbol: UEVENT_HELPER_PATH [=/sbin/hotplug] Type : string Prompt: path to uevent helper Location: -> Device Drivers -> Generic Driver Options (1) -> Support for uevent helper (UEVENT_HELPER [=y]) Defined at drivers/base/Kconfig:18 Depends on: UEVENT_HELPER [=y] ``` `Location` を見て、どこにあるのか確認して、言われたとおりに **set an empty value** します。 設定終わったらコンパイルします。いや最近のマシンはコンパイル早くていいですよねホント。 ``` # make -j7 && make modules_install ``` コンパイル完了したらカーネルをコピーして `grub-mkconfig` して…… ``` # mount /boot # cp /usr/src/linux/arch/x86_64/boot/bzImage /boot/kernel-4.9.6-gentoo-r1.20170406.01 # grub-mkconfig -o /boot/grub/grub.cfg ``` ### lvm, lvmetad, udev の落とし上げ > LOG: prepare > Notice that "use_lvmetad" setting is enabled with USE="udev" in /etc/lvm/lvm.conf, which will require restart of udev, lvm, and lvmetad if it was previously disabled. こんどはこれですね……ふむ。 ``` # emerge -pv lvm2 These are the packages that would be merged, in order: Calculating dependencies... done! [ebuild R ] sys-fs/lvm2-2.02.145-r2::gentoo USE="readline thin udev (-clvm) (-cman) -corosync -device-mapper-only -lvm1 -lvm2create_initrd -openais (-selinux) -static -static-libs -systemd" 0 KiB Total: 1 package (1 reinstall), Size of downloads: 0 KiB kanae boot # grep 'use_lvmetad' /etc/lvm/lvm.conf # See the use_lvmetad comment for a special case regarding filters. # This is incompatible with lvmetad. If use_lvmetad is enabled, # Configuration option global/use_lvmetad. # while use_lvmetad was disabled, it must be stopped, use_lvmetad use_lvmetad = 1 ``` `USE="udev"` で `use_lvmetad = 1` で、一応条件に一致しているみたいですね、うちの環境。でもこのあとシステムごと再起動するつもりなのでここで daemon の落とし上げはいらないか……。 ### これは……なに? > QA: prepare > This package has a configure.in file which has long been deprecated. Please update it to use configure.ac instead as newer versions of autotools will die when it finds this file. See https://bugs.gentoo.org/426262 for details. ん~ちょっとこれは置いておこう。放置w ### rc の設定 最後のこれですね。 > WARN: postinst > Make sure the "lvm" init script is in the runlevels: > rc-update add lvm boot これはもともと動いていたものなので設定済みですね。あらためて add する必要はないです。 ``` # rc-status boot Runlevel: boot hwclock [ started ] modules [ started ] lvm [ stopped ] : : ``` ## 再起動 なんだ結局対応したのは kernel config だけじゃないかっていうオチ……再起動します。 ``` # reboot ``` おやくそく。 ![ping](lvm_issue.001.png "run command") ping 返ってくるととりあえずほっとしますよねw さて結果どうでしょう!? ``` # rc-status boot Runlevel: boot hwclock [ started ] modules [ started ] lvm [ stopped ] : : ``` ……lvm が起動してませんね。(´・ω・\`) ## ただ……ちょっと気になったんですが…… > Notice that "use_lvmetad" setting is enabled with USE="udev" in /etc/lvm/lvm.conf, このあたりを調べてる時にちょっと気になったんですが、そういえば `dispatch-conf` した時にやたらと lvm.conf が更新されてたんですよね。その時は、明らかに自分でやった既存設定を潰さない程度に、新しい方の設定を適用していったんですが……あんまり既存設定を覚えてないんですが、もしかしてそこでなんか変更されたかも? ということで、ちょっと lvm.conf を見直してみました。で、引っかかったのがここ。 ``` # Configuration option devices/global_filter. # Limit the block devices that are used by LVM system components. # Because devices/filter may be overridden from the command line, it is # not suitable for system-wide device filtering, e.g. udev and lvmetad. # Use global_filter to hide devices from these LVM system components. # The syntax is the same as devices/filter. Devices rejected by # global_filter are not opened by LVM. # This configuration option has an automatic default value. # global_filter = [ "a|.*/|" ] ``` > Because devices/filter may be overridden from the command line, it is not suitable for system-wide device filtering, e.g. udev and lvmetad. ……ほう。 ということで、既存の `filter` と同じ設定を `global_filter` にも施してみました。 ``` global_filter = [ "r|/dev/sd*|", "a|/dev/md113|", "r|.*|" ] ``` **解 決 し た **。 ``` # rc-status boot Runlevel: boot hwclock [ started ] modules [ started ] lvm [ started ] ``` ちゃんと lvm も起動してます。 ## 結局なんだったのか 恐らく `/etc/init.d/rsyslog restart` とかやったときに、前提となる `boot` とかの runlevel の状態をチェックするんでしょう。で lvm が `[ stopped ]` なので上げようとするも、lvm.conf の `filter` が効いていないので /dev 配下を総なめして WARNING 出しまくり。 結局 lvm は何かに引っかかって起動せず……という流れだったのかと。 ……しょっぱいオチだなぁ。まぁ kernel config がよりあるべき姿になったということで……納得しておきましょう。