debian lennyの入ったOpenblocks600にsqueezeをインストール

投稿者: | 2011年7月24日
Pocket

はじめに

Openblocks600/Rにlennyを入れて運用していましたが、最近どうも調子が悪いので、これを機会にsqueeze化したいと思います。現在、特に公開サーバで使っているわけでもなく移行などは考えなくて良いため、一からsqueezeをインストールしたいと思います。

目次

  1. CFを出荷時の状態にする
  2. 出荷状態からdebian squeezeをインストール

サーバ環境

製品名 OpenBlockS 600/R
CPU 600MHz(AMCC PowerPC 405EX)
メモリ 1GB(DDR2 SDRAM)
ストレージ 8GB(Compact Flash)

CFを出荷時の状態にする

まず「CFを出荷時の状態にする方法」(この手順のままではうまくいきませんでしたので少し修正する必要あり)で初期化してから、OpenBlockS OpenBlockS 600 (OBS600/RAP) のOpenBlockS 600D(OBS600D/5)化(lennyのところをsqueezeに読み替える必要あり)という手堅い方法でいきたいと思います。

「OpenBlockS 600D – 5.0から6.0へのアップグレード」の手順を少し変えればいけそうですが、Openblocks600/Rなのでやめておきました。

適当なUSBメモリ を用意し、フォーマットを行う

USBメモリが/dev/sdbと認識されている前提で説明します。

OBS-ACT:/# mke2fs -j /dev/sdb1
mke2fs 1.41.3 (12-Oct-2008)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
979200 inodes, 3915772 blocks
195788 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4009754624
120 block groups
32768 blocks per group, 32768 fragments per group
8160 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 22 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

ボリュームラベルを設定する

OBS-ACT:/# e2label /dev/sdb1 MSF

USBメモリに必要なデータを保存

半自動でのインストールで実施したいと思います。mget msf_init.shとobs600_20090930-01_nojava.tgzの二つのファイルが必要になります。

OBS-ACT:/# mount /dev/sdb1
kjournald starting.  Commit interval 5 seconds
EXT3 FS on sdb1, internal journal
EXT3-fs: mounted filesystem with ordered data mode.

OBS-ACT:/# df -h
Filesystem          サイズ  使用  残り 使用% マウント位置
/dev/sda1             7.4G  1.4G  5.7G  19% /
tmpfs                 507M     0  507M   0% /lib/init/rw
udev                   10M  2.6M  7.5M  26% /dev
tmpfs                 507M     0  507M   0% /dev/shm
/dev/sdb1              15G  166M   14G   2% /mnt

OBS-ACT:/# cd mnt
OBS-ACT:/mnt# mkdir msf
OBS-ACT:/mnt# cd msf
OBS-ACT:/mnt/msf# ftp ftp.plathome.co.jp
Connected to download.plathome.co.jp.
220 ProFTPD 1.3.1 Server (ftp.plathome.co.jp) [::ffff:219.106.247.89]
Name (ftp.plathome.co.jp:user001): anonymous
331 Anonymous login ok, send your complete email address as your password
Password:メールアドレスを適当に入力
230 Anonymous access granted, restrictions apply
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> cd pub/OBS600/misc/factory_cf/
250 CWD command successful
ftp> ls
200 PORT command successful
150 Opening ASCII mode data connection for file list
-rw-rw-r--   1 ftp      ftp           756 Oct  9  2009 msf_init.sh
-rw-rw-r--   1 ftp      ftp      34626932 Oct  9  2009 obs600_20090930-01_nojava.tgz
226 Transfer complete
ftp> mget msf_init.sh obs600_20090930-01_nojava.tgz
mget msf_init.sh? y
200 PORT command successful
150 Opening BINARY mode data connection for msf_init.sh (756 bytes)
226 Transfer complete
756 bytes received in 0.00 secs (1318.4 kB/s)
mget obs600_20090930-01_nojava.tgz? y
200 PORT command successful
150 Opening BINARY mode data connection for obs600_20090930-01_nojava.tgz (34626932 bytes)
226 Transfer complete
34626932 bytes received in 13.16 secs (2569.6 kB/s)

インストールの実行

shutdown -h nowして落とした後、電源投入してみましたが元のdebianで立ち上がってしまいました。

スクリプト確認

半自動のため何が起きているか良く分からないので、スクリプトの中身を確認します。

OBS-ACT:/mnt/msf# cat msf_init.sh

#!/bin/bash


PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin
export PATH


if grep 'root=LABEL=/' /proc/cmdline ; then
        # CFをルートデバイスにしているときは、ラムディスク起動に変更
        flashcfg -c initrd
        reboot
fi


runled

# インストールするイメージファイルを決める
osfile=obs600_20090930-01_nojava.tgz


# CFのデバイス名を調べる
case `findfs LABEL=MSF` in
/dev/sda*)
        cf=/dev/sdb
        ;;
/dev/sdb*)
        cf=/dev/sda
        ;;
esac



# CFの初期化

fdisk $cf <<_FDISK
o
n
p
1


a
1
w
_FDISK

mke2fs -L PKG -b 4096 -j ${cf}1


mkdir /tmp/mnt

mount ${cf}1 /tmp/mnt

echo -n "Extract $osfile ... "
tar --numeric-owner -xpzf $osfile -C /tmp/mnt
echo "done"

umount /tmp/mnt

shutdown -h now

fdiskが入っていなかったのでそれが怪しいとにらみ、gnu-fdiskをaptitudeでインストールして再度確認します。

OBS-ACT:/mnt/msf# aptitude install gnu-fdisk

念のためスクリプトに実行権限も与えておきます。

OBS-ACT:/mnt/msf# chmod 755 msf_init.sh

そして再度shutdown -h nowして落とした後、電源投入してみましたが、またしても元のdebianで立ち上がってしまいました。

そこで、起動スクリプトの内容で手動実施してみることにします。

手動でインストールの実行

ルートデバイスの確認

OBS-ACT:~# grep 'root=LABEL=/' /proc/cmdline
ramdisk_size=8192 root=LABEL=/ rootdelay=15 console=ttyS0,115200

CFになっています。スクリプトでは、CFをルートデバイスにしているときは、ラムディスク起動に変更とありますので実行します。

OBS-ACT:~# flashcfg -c initrd
Change 1st U-Boot environment area
Change 2nd U-Boot environment area
Boot device change to initrd

次はrebootすることになっているので実施します。

OBS-ACT:~# reboot

Broadcast message from root@OBS-ACT (ttyS0) (Sat Jul 23 13:43:14 2011):

The system is going down for reboot NOW!
INIT: Sending processe


・・・


[prepare_namespace] Finished executing flashcfg
Freeing unused kernel memory: 148k init
INIT: version 2.86 booting
/dev/ram0 on / type ext2 (rw)
kjournald starting.  Commit interval 5 seconds
EXT3-fs: mounted filesystem with ordered data mode.

Command (m for help): Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): Command action
   e   extended
   p   primary partition (1-4)
Partition number (1-4): First cylinder (1-974, default 1): Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-974, default 974): Using default value 974

Command (m for help): Partition number (1-4):
Command (m for help): The partition table has been altered!

Calling ioctl() to re-read partition table.
sd 0:0:0:0: [sda] 15649200 512-byte hardware sectors: (8.01 GB/7.46 GiB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Assuming drive cache: write through
 sda: sda1
sd 0:0:0:0: [sda] 15649200 512-byte hardware sectors: (8.01 GB/7.46 GiB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Assuming drive cache: write through
 sda: sda1
Syncing disks.
mke2fs 1.39 (29-May-2006)
Filesystem label=PKG
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
979200 inodes, 1955905 blocks
97795 blocks (5.00%) reserved for the super user
First data block=0
60 block groups
32768 blocks per group, 32768 fragments per group
16320 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 20 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
kjournald starting.  Commit interval 5 seconds
EXT3 FS on sda1, internal journal
EXT3-fs: mounted filesystem with ordered data mode.
Extract obs600_20090930-01_nojava.tgz ... done
INIT: Sending p/etc/rc.shutdown: line 30: kill: (55) - No such process

Unmounting remote filesystems...
Sending all processes the TERM signal...
Sending all processes the KILL signal...
Deactivating swap partitions...
Saving random seed to a temporary file...
Saving the system time to hardware clock...
Remounting root filesystem read-only...
Unmounting local filesystems...
Flushing filesystem buffers...
Bye...
System halted.
System Halted, OK to turn off power

手動でCFの初期化から実施しようと考えていましたが、立ち上がり時にスクリプトが実行されました。半自動化手順ではラムディスク起動に変更する必要があったようです。

再度スクリプトが走らないようにUSBを抜いてから電源を投入します。


省略

adding interface aliases: .
Disable Ignore receive icmp broadcast.
Disable IP forwarding.
Starting system logger.
/etc/rc: line 84:   139 Terminated              /usr/sbin/syslogd $syslogd_flags
nothing was mounted
creating runtime link editor directory cache.
clearing /tmp
updating motd.
Setting kernel variables
Starting microserver daemons: pshd runled.
Starting standard daemons: cron.
Starting network daemons: portmap dhcpdInternet Systems Consortium DHCP Server V3.1.2p1
Copyright 2004-2009 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/
Wrote 0 leases to leases file.
Listening on LPF/eth1/00:0a:85:04:82:ff/192.168.254/24
Sending on   LPF/eth1/00:0a:85:04:82:ff/192.168.254/24
Sending on   Socket/fallback/fallback-net
 inetd.
Starting local daemons:.
NET: Registered protocol family 10
lo: Disabled Privacy Extensions
ADDRCONF(NETDEV_UP): eth0: link is not ready
ADDRCONF(NETDEV_UP): eth1: link is not ready

gzip: stdin: decompression OK, trailing garbage ignored
Change 1st U-Boot environment area
Change 2nd U-Boot environment area
Boot device change to initrd
Starting application manager...
  collectd ... ok
  lighttpd ... ok
Sat Jul 23 13:51:51 JST 2011

Welcome to SSD/Linux 0.5
obs600.example.org login:

SSD/Linuxで立ち上がりました。初期化に成功したようです。初期ID/PW=root/rootでログインしてみます。

obs600.example.org login: root
Password:
obs600[1]#
obs600[1]#
obs600[1]#
obs600[2]# cat /proc/cmdline
root=/dev/ram rootdelay=15 console=ttyS0,115200
obs600[3]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/ram0             126M   33M   88M  27% /
/dev/sda1             7.4G  281M  6.7G   4% /usr/pkg

RAMディスクモードで立ち上がっていました。続けてDebian squeezeをインストールします。

出荷状態からdebian squeezeをインストール

OpenBlockS OpenBlockS 600 (OBS600/RAP) のOpenBlockS 600D(OBS600D/5)化を参考にインストールします。

事前準備

OpenBlockS 600D - リリース情報から最新ファイル(uImage.initrd.squeeze)を落としてきます。

そしてUSBメモリにuImage.initrd.squeezeを保存しておき、OpenblocksにてUSBメモリをマウントしてCFにコピーします。

obs600[15]# mount -t ext3 /dev/sdb1 /mnt
kjournald starting.  Commit interval 5 seconds
EXT3 FS on sdb1, internal journal
EXT3-fs: mounted filesystem with ordered data mode.
obs600[16]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/ram0             126M   33M   88M  27% /
/dev/sda1             7.4G  281M  6.7G   4% /usr/pkg
/dev/sdb1              15G  241M   14G   2% /mnt
obs600[17]# cd /mnt
obs600[18]# ls
lost+found  msf  uImage.initrd.squeeze
obs600[19]# cp uImage.initrd.squeeze /
obs600[20]# cd /
obs600[21]# ls
bin  etc   lib      lost+found  proc  sbin  tmp                    usr
dev  home  linuxrc  mnt         root  sys   uImage.initrd.squeeze  var

ユーザーエリアを初期化

obs600[22]# flashcfg -s /dev/null
Save files to FlashROM
*
done
obs600[23]# flashcfg -S /dev/null
Save files to FlashROM
*
done

Debian ファームウェアの書き込み

obs600[25]# flashcfg -f uImage.initrd.squeeze
Load boot image to FlashROM
**************************************************
**************************************************
**************************************************
**************************************************
**************************************************
**************************************************
***************************************
done

再起動と立ち上がり確認

obs600[26]#reboot


・・・


Debian GNU/Linux 6.0 squeeze ttyS0

squeeze login: root
Password:root
unionfs: new lower inode mtime (bindex=0, name=log)
Linux squeeze 2.6.29 #1 Wed Mar 9 15:31:38 JST 2011 ppc

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.
root@squeeze:~#
root@squeeze:~#
root@squeeze:~#
root@squeeze:~# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/ram0             155M  101M   47M  69% /
udev                   10M   80K   10M   1% /dev
tmpfs                  64M  4.0K   64M   1% /dev/shm
tmpfs                 384M  172K  384M   1% /.rw
unionfs               384M  172K  384M   1% /etc
unionfs               384M  172K  384M   1% /bin
unionfs               384M  172K  384M   1% /home
unionfs               384M  172K  384M   1% /lib
unionfs               384M  172K  384M   1% /sbin
unionfs               384M  172K  384M   1% /usr
unionfs               384M  172K  384M   1% /var
unionfs               384M  172K  384M   1% /root
unionfs               384M  172K  384M   1% /opt
root@squeeze:~# 

無事立ち上がりましたが、RAMディスクモードになっているので、CF併用モードに変更します。

CF併用モードへの変更

OpenBlockS 600D - 最初に行うことを参考にCF併用モードに変更します。

fdiskによるパーティション設定

root@squeeze:~# fdisk /dev/sda
Warning: Could not determine physical sector size for /dev/sda.
Using the logical sector size (512).
GNU Fdisk 1.2.4
Copyright (C) 1998 - 2006 Free Software Foundation, Inc.
This program is free software, covered by the GNU General Public License.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

Using /dev/sda
Command (m for help): o
Command (m for help): n
Partition type
   e   extended
   p   primary partition (1-4)
p
First cylinder  (default 0cyl):
Last cylinder or +size or +sizeMB or +sizeKB  (default 973cyl):
Command (m for help): w
Information: Don't forget to update /etc/fstab, if necessary.


Writing all changes to /dev/sda.

mke2fsによるフォーマット

root@squeeze:~# mke2fs -j -L DEBIAN /dev/sda1
mke2fs 1.41.12 (17-May-2010)
warning: Unable to get device geometry for /dev/sda1
Filesystem label=DEBIAN
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
489600 inodes, 1955905 blocks
97795 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2004877312
60 block groups
32768 blocks per group, 32768 fragments per group
8160 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 39 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

再起動

root@squeeze:~# reboot

Broadcast message from root@squeeze (ttyS0) (Sat Jul 23 14:30:40 2011):

The system is going down for reboot NOW!


・・・


Debian GNU/Linux 6.0 squeeze ttyS0

squeeze login: root
Password:
unionfs: new lower inode mtime (bindex=0, name=log)
Linux squeeze 2.6.29 #1 Wed Mar 9 15:31:38 JST 2011 ppc

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.
root@squeeze:~#
root@squeeze:~#
root@squeeze:~#
root@squeeze:~# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/ram0             155M  101M   47M  69% /
udev                   10M   68K   10M   1% /dev
tmpfs                  64M  4.0K   64M   1% /dev/shm
/dev/sda1             7.4G  146M  6.9G   3% /.rw
unionfs               7.4G  146M  6.9G   3% /etc
unionfs               7.4G  146M  6.9G   3% /bin
unionfs               7.4G  146M  6.9G   3% /home
unionfs               7.4G  146M  6.9G   3% /lib
unionfs               7.4G  146M  6.9G   3% /sbin
unionfs               7.4G  146M  6.9G   3% /usr
unionfs               7.4G  146M  6.9G   3% /var
unionfs               7.4G  146M  6.9G   3% /root
unionfs               7.4G  146M  6.9G   3% /opt

CFの容量が8Gなので、うまくいったようです。

参考文献

「CFを出荷時の状態にする方法」

OpenBlockS OpenBlockS 600 (OBS600/RAP) のOpenBlockS 600D(OBS600D/5)化

「OpenBlockS 600D - 5.0から6.0へのアップグレード」

OpenBlockS 600D - 最初に行うこと

Pocket

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です