トップ «前の日記(2010-10-22) 最新 次の日記(2010-10-24)» 編集

ヨタの日々

2001|08|09|10|11|12|
2002|01|02|03|04|05|06|07|08|09|10|11|12|
2003|01|02|03|04|05|06|07|08|09|10|11|12|
2004|01|02|03|04|05|06|07|08|09|10|11|12|
2005|01|02|03|04|05|06|07|08|09|10|11|12|
2006|01|02|03|04|05|06|07|08|09|10|11|12|
2007|01|02|03|04|05|06|07|08|09|10|11|12|
2008|01|02|03|04|05|06|07|08|09|10|11|12|
2009|01|02|03|04|05|06|07|08|09|10|11|12|
2010|01|02|03|04|05|06|07|08|09|10|11|12|
2011|01|02|03|04|05|06|07|08|09|10|11|12|
2012|01|02|03|04|05|06|07|08|09|10|11|12|
2013|01|02|03|04|05|06|07|08|09|10|11|12|
2014|01|02|03|04|05|06|07|08|09|10|11|12|
2015|01|02|03|04|05|06|07|08|09|10|11|12|
2016|01|02|03|04|05|06|07|08|09|10|11|12|
2017|01|02|03|04|05|06|07|08|09|10|11|12|
2018|01|02|03|04|05|06|07|08|09|10|11|12|
2019|01|02|03|04|05|06|07|08|09|10|11|12|
2020|01|02|03|04|05|06|07|08|09|10|11|12|
2021|01|02|03|04|05|06|07|08|09|10|11|12|
2022|01|02|03|04|05|06|07|08|09|10|11|12|
2023|01|02|03|04|05|06|07|08|12|
2024|01|02|03|04|

2010-10-23 :-)

_ [NetBSD]NetBSD カーネルをビルドしてインストールして起動したら起動しなかった

というのは今年の 1 月に起きたことなんだが今更作業した。どんだけ腰が重いのかっていう

これまでどーりに

# cd /usr/src
# ./build.sh kernel=MYKERNEL
# cd /usr/src/i386.obj/sys/arch/i386/compile/GENERIC
# make install
# reboot

などとやったらここに書いてあるこれと同じことが言われて起動しない。

When updating your kernel, remember ...

 wd0: no disk label
 no file system for wd0 (dev 0x0)
 cannot mount root, error = 79
 root device (default wd0a):

ハイパー焦った。とりあえずインストールディスク( USB メモリスティックのアレ )から起動させ、kernel だけインストール。再起動。起動した。さて

no file system modules とか言われたんだが、とりあえずインストールディスクからkernelだけインストールしなおして起動した ( miwarin )

@miwarin ffsもkernel moduleになったので、/bootを新しいのと置き換えないとroot fsが読めないのです。( tnozaki )

@tnozaki む。UPDATING 読んでます。20081122かしら ( miwarin )

@miwarin それです、あとkernelの5.99.XXが変わると/stand/${arch}/5.99.XXも変わるので、build.sh modules && cd sys/modules && make installを忘れるとはまります。( tnozaki )

UPDATING はこれ

20081122:
        On i386, various kernel options(4) in GENERIC including
        file systems have been disabled and moved into kernel modules.
        Before trying a new GENERIC kernel, you have to prepare the
        following files as well as a new GENERIC kernel:

        - build and install kernel modules from src/sys/modules

        - install the latest bootloader, which will load a module
          for the file system from which the kernel is loaded automatically

        If you have to load your kernel from a file system which is not of
        the same type as the root file system, you have to load the necessary
        file system module manually on the boot prompt or in the boot.cfg file.

_ [NetBSD][カーネルモジュール]NetBSD カーネルモジュールをビルド

When updating your kernel, remember ...

modules.tgz を展開するか src/sys/modules で make install USETOOLS=no DESTDIR=/ すりゃいいだお

と言ってる。

build.sh でもできるらしい。

Significant changes from NetBSD 5.0 to 6.0

Add a modules operation which builds kernel modules and installs them into DESTDIR. [jnemeth 20090907]

「build.sh modules すればカーネルモジュールをビルドしてインストールまでするぜ!」と言ってるんだが build.sh を見ると、ビルドしててもインストールしてるようには見えないんだけど。

buildmodules()
{
  if ! ${do_tools} && ! ${buildmoduleswarned:-false}; then
    # Building tools every time we build modules is clearly
    # unnecessary as well as a kernel.
    #
    statusmsg "Building modules without building new tools"
    buildmoduleswarned=true
  fi

  statusmsg "Building kernel modules for NetBSD/${MACHINE} ${DISTRIBVER}"
  if [ "${MKOBJDIRS}" != "no" ]; then
    make_in_dir sys/modules obj ||
        bomb "Failed to make obj in sys/modules"
  fi
  if [ "${MKUPDATE}" = "no" ]; then
    make_in_dir sys/modules cleandir
  fi
  ${runcmd} "${makewrapper}" ${parallel} do-sys-modules ||
      bomb "Failed to make do-sys-modules"

  statusmsg "Successful built kernel modules for NetBSD/${MACHINE} ${DISTRIBVER}"
}

_ [NetBSD]NetBSD を current へ

BUILDING を眺めてもいまいち手順がよく分からんのでググった。NetBSD: kernel moduleへの対応

あとこれらもちゃんと読む。あ、最初に build.sh distribution するのか...

モジュールビルド

# ./build.sh modules
 :
===> Successful build of kernel modules for NetBSD/i386 5.99.39
===> build.sh ended:      Fri Oct 22 21:58:37 JST 2010
===> Summary of results:
         build.sh command:    ./build.sh modules
         build.sh started:    Fri Oct 22 21:49:54 JST 2010
         NetBSD version:      5.99.39
         MACHINE:             i386
         MACHINE_ARCH:        i386
         Build platform:      NetBSD 5.0.1 i386
         HOST_SH:             /bin/sh
         TOOLDIR path:        /usr/src/obj/tooldir.NetBSD-5.0.1-i386
         DESTDIR path:        /usr/src/obj/destdir.i386
         RELEASEDIR path:     /usr/src/obj/releasedir
         Updated makewrapper: /usr/src/obj/tooldir.NetBSD-5.0.1-i386/bin/nbmake-i386
         Building modules without building new tools
         Building kernel modules for NetBSD/i386 5.99.39
         Successful build of kernel modules for NetBSD/i386 5.99.39
         build.sh ended:      Fri Oct 22 21:58:37 JST 2010
===> .

カーネルビルド

# ./build.sh kernel=MYKERNEL

FFS を確認

# dumpfs /dev/rwd0a | head -3
file system: /dev/rwd0a
endian  little-endian
magic   11954 (UFS1)    time    Fri Oct 22 21:20:13 2010

bootloader 書き換え

# cp /usr/obj/destdir.i386/usr/mdec/boot /
# installboot -v /dev/rwd0a /usr/obj/destdir.i386/usr/mdec/bootxx_ffsv1
File system:         /dev/rwd0a
Primary bootstrap:   /usr/obj/destdir.i386/usr/mdec/bootxx_ffsv1
Boot options:        timeout 5, flags 0, speed 9600, ioaddr 0, console pc
# mkdir /stand/i386/5.99.39
# cp -r /usr/obj/sys/modules /stand/i386/5.99.39
# reboot
# cd /usr/src
# ./build.sh distribution
# ./build.sh install=/

 :
postinstall checks passed: bluetooth ddbonpanic dhcpcd envsys fontconfig hosts iscsi motd pam pf ssh wscons x11 varrwho
postinstall checks failed: defaults gid makedev mtree named periodic rc xkb uid obsolete
To fix, run:
    /usr/src/usr.sbin/postinstall/postinstall -s '/usr/src' -d // fix defaults gid makedev mtree named periodic rc xkb uid obsolete
Note that this may overwrite local changes.
   ================================
make installworld started at:  Sat Oct 23 13:01:07 JST 2010
make installworld finished at: Sat Oct 23 13:04:57 JST 2010
===> Successful installworld to /
===> build.sh ended:      Sat Oct 23 13:04:58 JST 2010
===> Summary of results:
         build.sh command:    ./build.sh install=/
         build.sh started:    Sat Oct 23 13:01:04 JST 2010
         NetBSD version:      5.99.39
         MACHINE:             i386
         MACHINE_ARCH:        i386
         Build platform:      NetBSD 5.99.39 i386
         HOST_SH:             /bin/sh
         TOOLDIR path:        /usr/src/obj/tooldir.NetBSD-5.99.39-i386
         DESTDIR path:        /usr/src/obj/destdir.i386
         RELEASEDIR path:     /usr/src/obj/releasedir
         Updated makewrapper: /usr/src/obj/tooldir.NetBSD-5.99.39-i386/bin/nbmake-i386
         Successful installworld to /
         build.sh ended:      Sat Oct 23 13:04:58 JST 2010
===> .
# /usr/src/usr.sbin/postinstall/postinstall -s '/usr/src' -d // fix defaults gid makedev mtree named periodic rc xkb uid obsolete
# reboot

おk

% uname -a
NetBSD hitomi.area51.gr.jp 5.99.39 NetBSD 5.99.39 (MYKERNEL) #2: Fri Oct 22 20:58:00 JST 2010  root@hitomi.area51.gr.jp:/usr/obj/sys/arch/i386/compile/MYKERNEL i386

_ [NetBSD][apache][セマフォ][semaphore]apache が Result too large or too small: Cannot create SSLMutex と言って起動しなくなった

ログ

[Sat Oct 23 16:30:48 2010] [error] (34)Result too large or too small: Cannot create SSLMutex
Configuration Failed

環境

% uname -a
NetBSD hitomi.area51.gr.jp 5.99.39 NetBSD 5.99.39 (MYKERNEL) #2: Fri Oct 22 20:58:00 JST 2010  root@hitomi.area51.gr.jp:/usr/obj/sys/arch/i386/compile/MYKERNEL i386

MYKERNEL は GENERIC をコピーしただけ

apache バージョンとコンパイル時オプション

% httpd -V
Server version: Apache/2.2.16 (Unix)
Server built:   Oct 23 2010 21:14:18
Server's Module Magic Number: 20051115:24
Server loaded:  APR 1.3.9, APR-Util 1.3.10
Compiled using: APR 1.3.9, APR-Util 1.3.9
Architecture:   32-bit
Server MPM:     Prefork
  threaded:     no
    forked:     yes (variable process count)
Server compiled with....
 -D APACHE_MPM_DIR="server/mpm/prefork"
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses disabled)
 -D APR_USE_SYSVSEM_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D DYNAMIC_MODULE_LIMIT=128
 -D HTTPD_ROOT="/usr/pkg"
 -D SUEXEC_BIN="/usr/pkg/bin/suexec"
 -D DEFAULT_PIDLOG="/var/run/httpd.pid"
 -D DEFAULT_SCOREBOARD="/var/run/apache_runtime_status"
 -D DEFAULT_LOCKFILE="/var/run/accept.lock"
 -D DEFAULT_ERRORLOG="/var/log/httpd/error.log"
 -D AP_TYPES_CONFIG_FILE="etc/httpd/mime.types"
 -D SERVER_CONFIG_FILE="etc/httpd/httpd.conf"

モジュール化したもの

% httpd -l
Compiled in modules:
  core.c
  prefork.c
  http_core.c
  mod_so.c

詳細

「Result too large or too small」は semctl(2) が ERANGE を返したもよう

apache の proc_mutex.c の以下の処理

static apr_status_t proc_mutex_sysv_create(apr_proc_mutex_t *new_mutex,
                                           const char *fname)
{
    union semun ick;
    apr_status_t rv;

    new_mutex->interproc = apr_palloc(new_mutex->pool, sizeof(*new_mutex->interproc));
    new_mutex->interproc->filedes = semget(IPC_PRIVATE, 1, IPC_CREAT | 0600);

    if (new_mutex->interproc->filedes < 0) {
        rv = errno;
        proc_mutex_sysv_cleanup(new_mutex);
        return rv;
    }
    ick.val = 1;
    if (semctl(new_mutex->interproc->filedes, 0, SETVAL, ick) < 0) {    ←これ
        rv = errno;
        proc_mutex_sysv_cleanup(new_mutex);
        return rv;
    }
    new_mutex->curr_locked = 0;
    apr_pool_cleanup_register(new_mutex->pool,
                              (void *)new_mutex, apr_proc_mutex_cleanup,
                              apr_pool_cleanup_null);
    return APR_SUCCESS;
}

いちおうメッセージを確認しておく。

#include <stdio.h>
#include <sys/sem.h>
#include <errno.h>


int main( int ac, char** av)
{
        printf( "%s\n", strerror( EINVAL ) );
        printf( "%s\n", strerror( EPERM ) );
        printf( "%s\n", strerror( EACCES ) );
        printf( "%s\n", strerror( ERANGE ) );
        return 0;
}
% gcc sem.c && ./a.out
Invalid argument
Operation not permitted
Permission denied
Result too large or too small

うむ。

で、/usr/include/sys/sem.h はこう。

/*
 * Kernel implementation stuff
 */
#define SEMVMX  32767           /* semaphore maximum value */
#define SEMAEM  16384           /* adjust on exit max value */

関連しそうな sysctl の値

% sysctl -A | grep -E "(kern.ipc|sem)"
kern.posix_semaphores = 200112
sysctl: kern.ipc.sysvipc_info: the value is not available
kern.ipc.sysvmsg = 1
kern.ipc.sysvsem = 1
kern.ipc.sysvshm = 1
kern.ipc.shmmax = 265924608
kern.ipc.shmmni = 128
kern.ipc.shmseg = 128
kern.ipc.shmmaxpgs = 64923
kern.ipc.shm_use_phys = 0
kern.ipc.msgmni = 40
kern.ipc.msgseg = 2048
kern.ipc.semmni = 10
kern.ipc.semmns = 60
kern.ipc.semmnu = 30
kern.posix.semmax = 128
machdep.biosbasemem = 638

semctl(2) のマニュアルによると

[ERANGE]  cmd is equal to SETVAL or SETALL and the value to be
          set is greater than the system semaphore maximum
          value

しかし apache がセマフォをいくつに設定しようとしているのかが分からない。

_ [リッジレーサー7]リッジレーサー7

ジャクチョーGちゃんルームに入って再び skype やりながら STARNOSE + ロリ3 という流れ。rosso さんがどれだけ変態なのか分かるというものだ ( ̄口 ̄)

  • 走行距離 97656 km
  • RSGP 進行度 100.0 %
  • 名声 25602 FP
  • オンラインバトル勝利数 1028/3649