LS-GL:debian のインストール:再現(3)


左から、
  • debian をインストールした HDD + USB アダプタ

  • 標準ファームをインストールした実験用 HDD + S-ATA アダプタ

  • LS-GL 本体

  • HDD の下でファンを回している。

    debootstrap を実行してできあがった /mnt/debinst/ を / にして セットアップを行う。

    / にする

    root@UDE:~# cd /mnt/debinst
    root@UDE:/mnt/debinst# ls
    bin         dev         home        lost+found  proc        sbin        tmp         var
    boot        etc         lib         mnt         root        sys         usr
    root@UDE:/mnt/debinst# rm -fr bin/ boot/ dev/ etc/ home/ lib/ proc/ root/ sbin/ sys/ tmp/ usr/ var/
    root@UDE:/mnt/debinst# mv mnt yyy
    root@UDE:/mnt/debinst# cd yyy/debinst/
    root@UDE:/mnt/debinst/yyy/debinst# mv * ../..
    root@UDE:/mnt/debinst/yyy/debinst# cd /
    root@UDE:/# rm -fr /mnt/debinst/yyy
    root@UDE:/# chroot /mnt/debinst/
    sh-2.05b#
    
    Unix/Linux System システムからの Debian GNU/Linux のインストール を参考にセットアップを進める。

    fstab の作成

    /proc , / , /boot をマウントするようにする。
    とりあえず作って、後からきれいに整形する
    sh-2.05b# echo proc /proc proc defaults 0 0 > /etc/fstab
    sh-2.05b# echo /dev/sda2 / ext3 defaults 0 1 >> /etc/fstab
    sh-2.05b# echo /dev/sda1 /boot ext3 defaults 0 2 >> /etc/fstab
    sh-2.05b# cat /etc/fstab
    proc /proc proc defaults 0 0
    /dev/sda2 / ext3 defaults 0 1
    /dev/sda1 /boot ext3 defaults 0 2
    sh-2.05b#
    

    ネットワークの設定

    sh-2.05b# echo auto lo >> /etc/network/interfaces
    sh-2.05b# echo iface lo inet loopback >> /etc/network/interfaces
    sh-2.05b# echo auto eth0 >> /etc/network/interfaces
    sh-2.05b# echo iface eth0 inet dhcp >> /etc/network/interfaces
    sh-2.05b# cat /etc/network/interfaces
    # Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or
    # /usr/share/doc/ifupdown/examples for more information.
    auto lo
    iface lo inet loopback
    auto eth0
    iface eth0 inet dhcp
    sh-2.05b#
    

    base-config の実行

    sh-2.05b# /usr/sbin/base-config new
    Configuring the base system...
    Debian Configuration
                   lqqqqqu Debian base system configuration tqqqqqqk
                   x This is the base system configuration menu.   x
                   x                                               x
                   x Choose the next step in the install process:  x
                   x                                               x
                   x      Display introductory message             x
                   x      Configure the keyboard                   x
                   x      Configure timezone                       x
                   x      Set up users and passwords               x
                   x      Set the hostname                         x
                   x      Configure and enable ppp                 x
                   x      Configure apt                            x
                   x      Select and install packages              x
                   x      Configure the Mail Transfer Agent        x
                   x      Finish configuring the base system       x
                   x      Execute a shell                          x
                   x                                               x
                   x                                               x
                   x           Ok                Cancel            x
                   x                                               x
                   mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj
    

    Configure timezone

    Is the hardware clock set to GMT? には、No
    TimeZone として、Asia → Tokyo を選択

    Set up users and passwords

    Root password を2入力
    normal user account を作成する

    Set the hostname

    ホスト名をセットする

    Configure and enable ppp

    パス

    Configure apt

    http で Japan → 近そうなサーバを指定する
    Testing apt sources...
    Get:1 http://ftp2.jp.debian.org testing/main Packages [5192kB]
    Get:2 http://ftp2.jp.debian.org testing/main Release [80B]
    Fetched 5192kB in 4m58s (17.4kB/s)
    Reading Package Lists... Done
    Get:1 http://ftp2.jp.debian.org testing/main Sources [1594kB]
    	:
    
    Add another apt source? はとりあえず No
    Use security updates from security.debian.org? はもちろん Yes

    Select and install packages

    Reading Package Lists... Done
    Building Dependency Tree... Done
    The following extra packages will be installed:
      libc6 tzdata
    Suggested packages:
      locales glibc-doc
    The following NEW packages will be installed:
      mdetect tzdata
    The following packages will be upgraded:
      libc6
    1 upgraded, 2 newly installed, 0 to remove and 110 not upgraded.
    Need to get 4166kB of archives.
    After unpacking 1094kB of additional disk space will be used.
    Get:1 http://ftp2.jp.debian.org testing/main tzdata 2006g-2 [311kB]
    Get:2 http://ftp2.jp.debian.org testing/main libc6 2.3.6.ds1-4 [3838kB]
    Get:3 http://ftp2.jp.debian.org testing/main mdetect 0.5.2.1 [16.9kB]
    Fetched 4166kB in 3m11s (21.7kB/s)
    Selecting previously deselected package tzdata.
    (Reading database ... 7495 files and directories currently installed.)
    Unpacking tzdata (from .../tzdata_2006g-2_all.deb) ...
    Replacing files in old package libc6 ...
    Preparing to replace libc6 2.3.2.ds1-22sarge4 (using .../libc6_2.3.6.ds1-4_arm.deb) ...
    
    Name Service Switch update in the C Library: pre-installation question.
    
    Running services and programs that are using NSS need to be restarted,
    otherwise they might not be able to do lookup or authentication any more.
    The installation process is able to restart some services (such as ssh or
    telnetd), but other programs cannot be restarted automatically.  One such
    program that needs manual stopping and restart after the glibc upgrade by
    yourself is xdm - because automatic restart might disconnect your active
    X11 sessions.
    
    Known packages that need to be stopped before the glibc upgrade are:
            xdm kdm gdm postgresql xscreensaver
    
    This script did not detect any installed services which need to be
    stopped.
    
    If you want to interrupt the upgrade now and continue later, please
    answer No to the question below.
    
    Do you want to upgrade glibc now? [Y/n] y
    
    Unpacking replacement libc6 ...
    Setting up tzdata (2006g-2) ...
    Current default timezone: 'Asia/Tokyo'.
    Local time is now:      Fri Sep  1 21:09:10 JST 2006.
    Universal Time is now:  Fri Sep  1 12:09:10 UTC 2006.
    Run 'tzconfig' if you wish to change it.
    
    Setting up libc6 (2.3.6.ds1-4) ...
    Checking for services that may need to be restarted...done.
    
    Selecting previously deselected package mdetect.
    (Reading database ... 7512 files and directories currently installed.)
    Unpacking mdetect (from .../mdetect_0.5.2.1_arm.deb) ...
    Setting up mdetect (0.5.2.1) ...
    Reading Package Lists... Done
    Building Dependency Tree... Done
    Package read-edid is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source
    E: Package read-edid has no installation candidate
    
    Choose software to install: はとりあえず何も指定せず Ok
    Reading Package Lists... Done
    Building Dependency Tree
    Initializing package states... Done
    Reading task descriptions... Done
    
    There was a problem installing the selected software には、 とりあえず Ok

    Finish configuring the base system

    Thank you for choosing Debian! では Ok

    locale の設定

    sh-2.05b# apt-get install locales
    Reading Package Lists... Done
    Building Dependency Tree... Done
    The following packages will be REMOVED:
      base-config
    The following NEW packages will be installed:
      locales
    0 upgraded, 1 newly installed, 1 to remove and 110 not upgraded.
    Need to get 3953kB of archives.
    After unpacking 8483kB of additional disk space will be used.
    Do you want to continue? [Y/n] y
    	:
    
    Locales to be generated: には、 ja_JP.EUC-JP EUC-JP と ja_JP.UTF-8 UTF-8 とを選択する
    Default locale for the system environment: は、もちろん None
    (Reading database ... 7518 files and directories currently installed.)
    Removing base-config ...
    Selecting previously deselected package locales.
    (Reading database ... 7410 files and directories currently installed.)
    Unpacking locales (from .../locales_2.3.6.ds1-4_all.deb) ...
    Setting up locales (2.3.6.ds1-4) ...
    Generating locales (this might take a while)...
      ja_JP.EUC-JP... done
      ja_JP.UTF-8... done
    eneration complete.
    
    sh-2.05b#
    
    dpkg-reconfigure locales は必要なし。

    以上で、 Unix/Linux System システムからの Debian GNU/Linux のインストール に書いてあることは終わり。
    exit して chroot 環境を抜ける。

    sh-2.05b# exit
    exit
    root@UDE:~#
    

    /boot

    /dev/sda1(今は sdb1)に /boot のファイルをコピーする
    root@UDE:~# mount /dev/sdb1 /mnt/debinst/boot
    root@UDE:~# (cd /boot ; tar cf - .)|(cd /mnt/debinst/boot; tar xvf -)
    .
    ./lost+found
    ./u-boot.buffalo
    ./hddrootfs.buffalo.updated.done
    ./uImage.buffalo
    ./initrd.buffalo
    ./conf_save.tgz
    root@UDE:~#
    
    あちゃぁ。lost+found までコピーしてもた。

    linuxrc 対応

    initrd の linuxrc のチェックで EM モードにならないよう、 チェックをすり抜ける設定をする。
    root@UDE:~# cd /mnt/debinst/etc/
    root@UDE:/mnt/debinst/etc# date > rootfs_ok
    root@UDE:/mnt/debinst/etc# cp /etc/linkstation_release .
    root@UDE:/mnt/debinst/etc# > rootfs_booting
    root@UDE:/mnt/debinst/etc# > hddrootmode
    root@UDE:/mnt/debinst/etc#
    
    rootfs_ok は boot の都度作らないといけないので、 /sbin/setup.sh で実行する
    root@UDE:/mnt/debinst/etc# echo 'date > /etc/rootfs_ok' > ../sbin/setup.sh
    root@UDE:/mnt/debinst/etc# chmod +x ../sbin/setup.sh
    

    linuxrc のコピーは?

    linuxrc でいくつかコピーしているファイルが だぶっていないか確認する
    root@UDE:/mnt/debinst# ls etc/initrd_ver
    ls: etc/initrd_ver: No such file or directory
    root@UDE:/mnt/debinst# ls usr/local/bin/exec_libbuffalo
    ls: usr/local/bin/exec_libbuffalo: No such file or directory
    root@UDE:/mnt/debinst# ls usr/local/bin/kernelmon_exec.sh
    ls: usr/local/bin/kernelmon_exec.sh: No such file or directory
    root@UDE:/mnt/debinst# ls usr/local/bin/imhere.sh
    ls: usr/local/bin/imhere.sh: No such file or directory
    root@UDE:/mnt/debinst# ls usr/local/bin/lcd_error_man.sh
    ls: usr/local/bin/lcd_error_man.sh: No such file or directory
    root@UDE:/mnt/debinst# ls usr/local/bin/libbuffalo
    ls: usr/local/bin/libbuffalo: No such file or directory
    root@UDE:/mnt/debinst# ls usr/local/bin/set_time.sh
    ls: usr/local/bin/set_time.sh: No such file or directory
    root@UDE:/mnt/debinst# ls usr/local/bin/shutdown.sh
    ls: usr/local/bin/shutdown.sh: No such file or directory
    root@UDE:/mnt/debinst# ls etc/init.d/bootcomplete.sh
    ls: etc/init.d/bootcomplete.sh: No such file or directory
    root@UDE:/mnt/debinst# ls etc/init.d/checkroot.sh
    etc/init.d/checkroot.sh
    root@UDE:/mnt/debinst#
    
    あちゃ。つづき。
    root@UDE:/mnt/debinst# ls etc/init.d/clientUtil_servd.sh
    ls: etc/init.d/clientUtil_servd.sh: No such file or directory
    root@UDE:/mnt/debinst# ls etc/init.d/create_devlink.sh
    ls: etc/init.d/create_devlink.sh: No such file or directory
    root@UDE:/mnt/debinst# ls etc/init.d/develop.sh
    ls: etc/init.d/develop.sh: No such file or directory
    root@UDE:/mnt/debinst# ls etc/init.d/diskmon.sh
    ls: etc/init.d/diskmon.sh: No such file or directory
    root@UDE:/mnt/debinst# ls etc/init.d/ftpd.sh
    ls: etc/init.d/ftpd.sh: No such file or directory
    root@UDE:/mnt/debinst# ls etc/init.d/kernelmon.sh
    ls: etc/init.d/kernelmon.sh: No such file or directory
    root@UDE:/mnt/debinst# ls etc/init.d/logtag
    ls: etc/init.d/logtag: No such file or directory
    root@UDE:/mnt/debinst# ls etc/init.d/micon_setup.sh
    ls: etc/init.d/micon_setup.sh: No such file or directory
    root@UDE:/mnt/debinst# ls etc/init.d/miconmon.sh
    ls: etc/init.d/miconmon.sh: No such file or directory
    root@UDE:/mnt/debinst# ls etc/init.d/networking.sh
    ls: etc/init.d/networking.sh: No such file or directory
    root@UDE:/mnt/debinst# ls etc/init.d/procps.sh
    etc/init.d/procps.sh
    root@UDE:/mnt/debinst# cd etc/init.d/
    root@UDE:/mnt/debinst# ls restore_config.sh sethostname.sh sendsigs.sh shutdown_start.sh syslog.sh umount_disk.sh
    ls: restore_config.sh: No such file or directory
    ls: sethostname.sh: No such file or directory
    ls: sendsigs.sh: No such file or directory
    ls: shutdown_start.sh: No such file or directory
    ls: syslog.sh: No such file or directory
    ls: umount_disk.sh: No such file or directory
    root@UDE:/mnt/debinst/etc/init.d#
    
    やっぱり linuxrc はじゃま。 なんとかせな。

    とりあえず、上書きされてしまうファイルはセーブしておく

    root@UDE:/mnt/debinst/etc/init.d# cp checkroot.sh checkroot.sh.orig
    root@UDE:/mnt/debinst/etc/init.d# cp procps.sh procps.sh.orig
    

    getty

    シリアルコンソール(ttyS0)に login を出す。
    root@UDE:/mnt/debinst/etc# mv inittab inittab.orig
    root@UDE:/mnt/debinst/etc# cp inittab.orig inittab
    root@UDE:/mnt/debinst/etc# vi inittab
    	:
    	:
    root@UDE:/mnt/debinst/etc# diff -c inittab.orig inittab
    *** inittab.orig        Wed Jan  5 09:29:41 2005
    --- inittab     Fri Sep  1 22:01:30 2006
    ***************
    *** 51,57 ****
      # Note that on most Debian systems tty7 is used by the X Window System,
      # so if you want to add more getty's go ahead but skip tty7 if you run X.
      #
    ! 1:2345:respawn:/sbin/getty 38400 tty1
      2:23:respawn:/sbin/getty 38400 tty2
      3:23:respawn:/sbin/getty 38400 tty3
      4:23:respawn:/sbin/getty 38400 tty4
    --- 51,58 ----
      # Note that on most Debian systems tty7 is used by the X Window System,
      # so if you want to add more getty's go ahead but skip tty7 if you run X.
      #
    ! #1:2345:respawn:/sbin/getty 38400 tty1
    ! 1:2345:respawn:/sbin/getty -L ttyS0 115200 vt100
      2:23:respawn:/sbin/getty 38400 tty2
      3:23:respawn:/sbin/getty 38400 tty3
      4:23:respawn:/sbin/getty 38400 tty4
    root@UDE:/mnt/debinst/etc#
    

    ブート

    そろそろブートしてみるか。
    	:
    	:
    -- CopyFromInitrdToHdd --
    cp: /etc/init.d/develop.sh: No such file or directory
    checking local disk....
    fsck 1.27 (8-Mar-2002)
    e2fsck 1.27 (8-Mar-2002)
    /dev/ls_disk1_1: clean, 16/50200 files, 74657/200780 blocks
    done
    kjournald starting.  Commit interval 5 seconds
    EXT3 FS on sda2, internal journal
    EXT3-fs: mounted filesystem with ordered data mode.
    VFS: Mounted root (ext3 filesystem).
    Trying to move old root to /initrd ... okay
    Freeing init memory: 112K
    INIT: version 2.86 booting
    /etc/init.d/rcS: line 7: /etc/default/buffalo: No such file or directory
    System time was Fri Sep  1 13:11:20 UTC 2006.
    Setting the System Clock using the Hardware Clock as reference...
    System Clock set. System local time is now Fri Sep  1 22:11:21 JST 2006.
    Cleaning up ifupdown...done.
    Checking all file systems...
    fsck 1.37 (21-Mar-2005)
    /dev/sda1: clean, 16/50200 files, 74657/200780 blocks
    Setting kernel variables ...
    ... done.
    Mounting local filesystems...
    kjournald starting.  Commit interval 5 seconds
    EXT3 FS on sda1, internal journal
    EXT3-fs: mounted filesystem with ordered data mode.
    /dev/sda1 on /boot type ext3 (rw)
    Cleaning /tmp /var/run /var/lock.
    Running 0dns-down to make sure resolv.conf is ok...done.
    Setting up networking...done.
    Setting up IP spoofing protection: rp_filter.
    Configuring network interfaces...Internet Software Consortium DHCP Client 2.0pl5
    Copyright 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.
    All rights reserved.
    
    Please contribute if you find this software useful.
    For info, please visit http://www.isc.org/dhcp-contrib.html
    
    eth0: link down
    Listening on LPF/eth0/00:16:01:35:06:7a
    Sending on   LPF/eth0/00:16:01:35:06:7a
    Sending on   Socket/fallback/fallback-net
    DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 5
    eth0: link up<5>, full duplex<5>, speed 100 Mbps<5>
    DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 13
    DHCPOFFER from 192.168.1.30
    DHCPOFFER from 192.168.1.2
    DHCPOFFER already seen.
    DHCPREQUEST on eth0 to 255.255.255.255 port 67
    DHCPACK from 192.168.1.2
    bound to 192.168.1.38 -- renewal in 10800 seconds.
    done.
    
    Setting the System Clock using the Hardware Clock as reference...
    System Clock set. Local time: Fri Sep  1 22:11:34 JST 2006
    
    Initializing random number generator...done.
    Recovering nvi editor sessions... done.
    INIT: Entering runlevel: 2
    Starting system log daemon: syslogd.
    Starting kernel log daemon: klogd.
    Starting MTA: exim4.
    Starting internet superserver: inetd.
    Starting deferred execution scheduler: atd.
    Starting periodic command scheduler: cron.
    
    Debian GNU/Linux 3.1 ude ttyS0
    
    ude login: root
    Password:
    Linux ude 2.6.12.6-arm1 #75 Sun Jun 11 14:33:24 JST 2006 armv5tejl GNU/Linux
    
    The programs included with the Debian GNU/Linux system are free software;
    the exact distribution terms for each program are described in the
    individual files in /usr/share/doc/*/copyright.
    
    Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
    permitted by applicable law.
    ude:~#
    
    アーサム!


    LS-GL:debian のインストール:再現(2)
    ハックの記録
    LinkStation/玄箱 をハックしよう

    LS-GL:debian:突然固まった

    Copyright (C) 2006 Yasunari Yamashita. All Rights Reserved.
    yasunari @ yamasita.jp 山下康成@京都府向日市