Vitruvian Penguin
knoppix

[knoppix:5373] Re: UNIONFS 問題

Date: Sun, 10 Jul 2005 23:11:19 +0900
User-agent: Wanderlust/2.8.1 (Something) Emacs/21.2 Mule/5.0 (賢木)
しち と申します。

At Fri, 01 Jul 2005 17:05:45 +0900 (JST),
Kuniyasu Suzaki <k.suzaki@xxxxxxxxxx> wrote:

> 須崎です。サブジェクトを変えました。
> OOo の既存ファイルが開かない件は UNIONFS が原因のようですね。

既にどこかで報告されているかもしれませんが、UNIONFS が原因で
init スクリプトから停止できないデーモンがあるようです。
例えば sshd

----------------------------------------
# /etc/init.d/ssh start
Starting OpenBSD Secure Shell server: sshd.
# pidof sshd
7781
# /etc/init.d/ssh stop
Stopping OpenBSD Secure Shell server: sshd.
# pidof sshd
7781
----------------------------------------

init スクリプトから呼んでいる start-stop-daemon で

     585 static int
     586 pid_is_exec(pid_t pid, const struct stat *esb)
     587 {
     588         struct stat sb;
     589         char buf[32];
     590 
     591         sprintf(buf, "/proc/%d/exe", pid);
     592         if (stat(buf, &sb) != 0)
     593                 return 0;
     594         return (sb.st_dev == esb->st_dev && sb.st_ino == esb->st_ino);
     595 }

というチェックが行われていますが、UNIONFS の場合

----------------------------------------
# pidof sshd
7781
# ll /proc/7781/exe
lrwxrwxrwx  1 root root 0 2005-07-10 21:55 /proc/7781/exe -> 
/KNOPPIX/usr/sbin/sshd
# stat {,/UNIONFS,/KNOPPIX}/usr/sbin/sshd | grep Inode
Device: eh/14d  Inode: 22972       Links: 1
Device: eh/14d  Inode: 22972       Links: 1
Device: f000h/61440d    Inode: 127988      Links: 1
----------------------------------------

となり、/usr/sbin/sshd と /KNOPPIX/usr/sbin/sshd の device と inode
が異なるのが原因だと思います。

とりあえず、以下のように init スクリプト側で --exec を使わない
ようにすると停止するようになりました。

----------------------------------------
# diff -u /etc/init.d/ssh{,.new}
--- /etc/init.d/ssh     2005-07-10 22:58:38.000000000 +0900
+++ /etc/init.d/ssh.new 2005-07-10 22:58:38.000000000 +0900
@@ -38,7 +38,7 @@
        ;;
   stop)
         echo -n "Stopping OpenBSD Secure Shell server: sshd"
-       start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/sshd.pid 
--exec /usr/sbin/sshd
+       start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/sshd.pid
         echo "."
        ;;
 
# /etc/init.d/ssh.new stop
Stopping OpenBSD Secure Shell server: sshd.
# pidof sshd

----------------------------------------

(apt-get で入れた) netatalk のように pidfile を作らないデーモンでは
--exec の代わりに --name を使えば良いようです。

----------------------------------------
# diff -u /etc/init.d/netatalk{.new,}
--- /etc/init.d/netatalk        2005-07-10 22:58:44.000000000 +0900
+++ /etc/init.d/netatalk.new    2005-07-10 22:58:44.000000000 +0900
@@ -69,16 +69,16 @@
     stop)
        echo -n "Stopping AppleTalk Daemons:"
        echo -n " afpd"; \
-       start-stop-daemon --stop --quiet --oknodo --exec /usr/sbin/afpd
+       start-stop-daemon --stop --quiet --oknodo --name afpd
 
(snip)
----------------------------------------

以下は、停止しなさそうなデーモンのリストです。

----------------------------------------
# grep -lr 'start-stop.*--stop.*--exec' /etc/init.d/
/etc/init.d/anacron
/etc/init.d/apmd
/etc/init.d/atd
/etc/init.d/bluez-utils
/etc/init.d/cupsys
/etc/init.d/freewnn-jserver
/etc/init.d/freewnn-jserver.distrib
/etc/init.d/hostapd
/etc/init.d/inetd
/etc/init.d/kerneld
/etc/init.d/klogd
/etc/init.d/nessusd
/etc/init.d/netatalk
/etc/init.d/nvtv
/etc/init.d/partimaged
/etc/init.d/portmap
/etc/init.d/pppstatus
/etc/init.d/smail
/etc/init.d/squid
/etc/init.d/ssh
/etc/init.d/sysklogd
----------------------------------------

init スクリプトを修正せずに対処するにはどうすれば良いでしょうか。

--
Atsushi SHICHI
GnuPG Fingerprint = 72CD F89C 9840 2422 48D5  F04A CE97 8697 7E72 D5FA
<Prev in Thread] Current Thread [Next in Thread>