Debian をインストールする

Debian LS410D

だいたい材料は揃ったので Debian を インストールする。

これまでの手順と大きく変わるのは、 initrd の中を書き換える処理。
これまでは loop デバイスでマウントして書き換えていたのを、
cpio で展開して書き換えないといけない。

手作業でインストールするか、
ハックキットのインストーラを修正してインストールするか
を考えたが、今後の事も考え、後者にする。

準備

まずは、 準備(LS-XHL, LS-VL の場合)に準じて進める。

標準ファームに root でログインできるようにする

標準ファームで起動

ログイン

時計を合わせる

[root@LS410D06E ~]# date
Sat Aug 17 11:25:57 JST 2013
[root@LS410D06E ~]#
合ってる

ハックキットのファイルを置く

6/28 版のインストーラとアーカイブを置く
[root@LS410D06E ~]# cd /mnt/disk1/share/hackkit/
[root@LS410D06E hackkit]# ls -al
total 100476
drwxrwxrwx    2 nobody   nogroup         72 Aug 17 11:27 ./
drwxrwxrwx    4 root     root            41 Aug 17 11:26 ../
-rwxrw-rw-    1 nobody   nogroup      18712 Jun 28 15:04 hackkit_wheezy_130628.sh*
-rwxrw-rw-    1 nobody   nogroup  102865354 Jun 28 15:02 hackkit_wheezy_130628.tar.gz*
[root@LS410D06E hackkit]#

インストールする HDD の準備

Seagete の 250GB ST3250310AS を USB で接続する。
Aug 17 11:33:25 LS410D06E user.info kernel: usb 1-1: new high-speed USB device number 2 using ehci_marvell
Aug 17 11:33:25 LS410D06E user.info kernel: scsi2 : usb-storage 1-1:1.0
Aug 17 11:33:26 LS410D06E user.notice kernel: scsi 2:0:0:0: Direct-Access     ViPowER  VP-89118(SD1)    2.10 PQ: 0 ANSI: 4
Aug 17 11:33:26 LS410D06E user.notice kernel: sd 2:0:0:0: [sdb] 488397168 512-byte logical blocks: (250 GB/232 GiB)
Aug 17 11:33:26 LS410D06E user.notice kernel: sd 2:0:0:0: [sdb] Write Protect is off
Aug 17 11:33:26 LS410D06E user.debug kernel: sd 2:0:0:0: [sdb] Mode Sense: 21 00 00 00
Aug 17 11:33:26 LS410D06E user.err kernel: sd 2:0:0:0: [sdb] No Caching mode page present
Aug 17 11:33:26 LS410D06E user.err kernel: sd 2:0:0:0: [sdb] Assuming drive cache: write through
Aug 17 11:33:26 LS410D06E user.err kernel: sd 2:0:0:0: [sdb] No Caching mode page present
Aug 17 11:33:26 LS410D06E user.err kernel: sd 2:0:0:0: [sdb] Assuming drive cache: write through
Aug 17 11:33:26 LS410D06E user.info kernel: usb 1-1: USB disconnect, device number 2
Aug 17 11:33:26 LS410D06E user.info kernel: sd 2:0:0:0: [sdb] Unhandled error code
Aug 17 11:33:26 LS410D06E user.info kernel: sd 2:0:0:0: [sdb]  Result: hostbyte=0x01 driverbyte=0x00
Aug 17 11:33:26 LS410D06E user.info kernel: sd 2:0:0:0: [sdb] CDB: cdb[0]=0x28: 28 00 00 00 00 00 00 00 08 00
Aug 17 11:33:26 LS410D06E user.err kernel: end_request: I/O error, dev sdb, sector 0
Aug 17 11:33:26 LS410D06E user.err kernel: Buffer I/O error on device sdb, logical block 0
Aug 17 11:33:26 LS410D06E user.info kernel:  sdb: unable to read partition table
Aug 17 11:33:26 LS410D06E user.notice kernel: sd 2:0:0:0: [sdb] READ CAPACITY failed
Aug 17 11:33:26 LS410D06E user.info kernel: sd 2:0:0:0: [sdb]  Result: hostbyte=0x01 driverbyte=0x00
Aug 17 11:33:26 LS410D06E user.notice kernel: sd 2:0:0:0: [sdb] Sense not available.
Aug 17 11:33:26 LS410D06E daemon.err ata_id[11447]: HDIO_GET_IDENTITY failed for '/dev/sdb': Invalid argument
Aug 17 11:33:26 LS410D06E user.notice kernel: sd 2:0:0:0: [sdb] Write cache: enabled, read cache: disabled, supports DPO and FUA
Aug 17 11:33:26 LS410D06E user.notice kernel: sd 2:0:0:0: [sdb] Attached SCSI disk
Aug 17 11:33:26 LS410D06E user.notice kernel: sd 2:0:0:0: [sdb] Synchronizing SCSI cache
Aug 17 11:33:26 LS410D06E user.info kernel: sd 2:0:0:0: [sdb]  Result: hostbyte=0x01 driverbyte=0x00
Aug 17 11:33:26 LS410D06E daemon.err udevd[2476]: symlink '../../sdb' '/dev/disk/by-path/platform-ehci_marvell.0-usb-0:1.udev-tmp' failed: Not a directory
Aug 17 11:33:27 LS410D06E local0.info kernelmon: cmd=ioerr sdb READ 0 1
Aug 17 11:33:27 LS410D06E local0.info kernelmon: cmd=ioerr sdb READ 0 2
Aug 17 11:33:28 LS410D06E local0.info kernelmon: cmd=ioerr sdb READ 0 3
Aug 17 11:33:29 LS410D06E user.info kernel: usb 1-1: new high-speed USB device number 3 using ehci_marvell
Aug 17 11:33:29 LS410D06E user.info kernel: scsi3 : usb-storage 1-1:1.0
Aug 17 11:33:30 LS410D06E user.notice kernel: scsi 3:0:0:0: Direct-Access     ViPowER  VP-89118(SD1)    2.10 PQ: 0 ANSI: 4
Aug 17 11:33:30 LS410D06E user.notice kernel: sd 3:0:0:0: [sdb] 488397168 512-byte logical blocks: (250 GB/232 GiB)
Aug 17 11:33:30 LS410D06E user.notice kernel: sd 3:0:0:0: [sdb] Write Protect is off
Aug 17 11:33:30 LS410D06E user.debug kernel: sd 3:0:0:0: [sdb] Mode Sense: 21 00 00 00
Aug 17 11:33:30 LS410D06E user.err kernel: sd 3:0:0:0: [sdb] No Caching mode page present
Aug 17 11:33:30 LS410D06E user.err kernel: sd 3:0:0:0: [sdb] Assuming drive cache: write through
Aug 17 11:33:30 LS410D06E user.err kernel: sd 3:0:0:0: [sdb] No Caching mode page present
Aug 17 11:33:30 LS410D06E user.err kernel: sd 3:0:0:0: [sdb] Assuming drive cache: write through
Aug 17 11:33:30 LS410D06E user.info kernel: usb 1-1: USB disconnect, device number 3
Aug 17 11:33:30 LS410D06E user.info kernel: sd 3:0:0:0: [sdb] Unhandled error code
Aug 17 11:33:30 LS410D06E user.info kernel: sd 3:0:0:0: [sdb]  Result: hostbyte=0x01 driverbyte=0x00
Aug 17 11:33:30 LS410D06E user.info kernel: sd 3:0:0:0: [sdb] CDB: cdb[0]=0x28: 28 00 00 00 00 00 00 00 08 00
Aug 17 11:33:30 LS410D06E user.err kernel: end_request: I/O error, dev sdb, sector 0
Aug 17 11:33:30 LS410D06E user.err kernel: Buffer I/O error on device sdb, logical block 0
Aug 17 11:33:30 LS410D06E daemon.err ata_id[11635]: HDIO_GET_IDENTITY failed for '/dev/sdb': Invalid argument
Aug 17 11:33:30 LS410D06E user.info kernel:  sdb: unable to read partition table
Aug 17 11:33:30 LS410D06E user.notice kernel: sd 3:0:0:0: [sdb] READ CAPACITY failed
Aug 17 11:33:30 LS410D06E user.info kernel: sd 3:0:0:0: [sdb]  Result: hostbyte=0x01 driverbyte=0x00
Aug 17 11:33:30 LS410D06E user.notice kernel: sd 3:0:0:0: [sdb] Sense not available.
Aug 17 11:33:30 LS410D06E user.err kernel: sd 3:0:0:0: [sdb] No Caching mode page present
Aug 17 11:33:30 LS410D06E user.err kernel: sd 3:0:0:0: [sdb] Assuming drive cache: write through
Aug 17 11:33:30 LS410D06E user.notice kernel: sd 3:0:0:0: [sdb] Attached SCSI disk
Aug 17 11:33:31 LS410D06E daemon.err udevd[2476]: symlink '../../sdb' '/dev/disk/by-path/platform-ehci_marvell.0-usb-0:1.udev-tmp' failed: Not a directory
Aug 17 11:33:31 LS410D06E local0.info kernelmon: cmd=ioerr sdb READ 0 1
Aug 17 11:33:32 LS410D06E local0.info kernelmon: cmd=ioerr sdb READ 0 2
Aug 17 11:33:32 LS410D06E local0.info kernelmon: cmd=ioerr sdb READ 0 3
なんかこれが繰り返し繰り返し実行されている

(1) /mnt/usbdisk1 に自動的にマウントされた場合はアンマウントします。

[root@LS410D06E hackkit]# mount
rootfs on / type rootfs (rw)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,nosuid,relatime,size=10240k,nr_inodes=62267,mode=755)
/dev/sda2 on / type ext3 (rw,relatime,errors=continue,barrier=1,data=writeback)
tmpfs on /tmp type tmpfs (rw,relatime)
/dev/ram1 on /mnt/ram type tmpfs (rw,relatime,size=15360k)
devpts on /dev/pts type devpts (rw,relatime,gid=5,mode=620)
/dev/sda1 on /boot type ext3 (rw,relatime,errors=continue,barrier=1,data=writeback)
usbfs on /proc/bus/usb type usbfs (rw,relatime)
/dev/disk1_6 on /mnt/disk1 type xfs (rw,noatime,attr2,usrquota,grpquota)
[root@LS410D06E hackkit]# df
Filesystem                Size      Used Available Use% Mounted on
udev                     10.0M         0     10.0M   0% /dev
/dev/sda2                 4.7G    836.6M      3.6G  18% /
tmpfs                   249.0M     25.9M    223.1M  10% /tmp
/dev/ram1                15.0M    104.0K     14.9M   1% /mnt/ram
/dev/sda1               968.8M    223.4M    745.3M  23% /boot
/dev/disk1_6            916.7G    161.8M    916.6G   0% /mnt/disk1
[root@LS410D06E hackkit]#
特にマウントされた様子もない

(2) sdb にパーティションを切ります。

[root@LS410D06E hackkit]# parted -s /dev/sdb print
Model: ViPowER VP-89118(SD1) (scsi)
Disk /dev/sdb: 250GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start   End     Size    Type     File system     Flags
 1      32.3kB  255MB   255MB   primary  ext3
 2      255MB   2311MB  2056MB  primary  xfs
 3      2311MB  2575MB  263MB   primary  linux-swap(v1)
 4      2575MB  250GB   247GB   primary  xfs

[root@LS410D06E hackkit]#
パーティションを消す
[root@LS410D06E hackkit]# parted -s /dev/sdb rm 4
[root@LS410D06E hackkit]# parted -s /dev/sdb rm 3
[root@LS410D06E hackkit]# parted -s /dev/sdb rm 2
[root@LS410D06E hackkit]# parted -s /dev/sdb rm 1
[root@LS410D06E hackkit]# parted -s /dev/sdb print
Model: ViPowER VP-89118(SD1) (scsi)
Disk /dev/sdb: 250GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start  End  Size  Type  File system  Flags

[root@LS410D06E hackkit]# fdisk -l /dev/sdb

Disk /dev/sdb: 250.1 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders, total 488397168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000c85ae

   Device Boot      Start         End      Blocks   Id  System
[root@LS410D06E hackkit]#
パーティションを設定する。
[root@LS410D06E hackkit]# parted -s /dev/sdb mklabel gpt
[root@LS410D06E hackkit]# parted -s /dev/sdb mkpart primary ext3 0 1024M
Warning: The resulting partition is not properly aligned for best performance.
[root@LS410D06E hackkit]# parted -s /dev/sdb mkpart primary xfs 1024MB 6144MB
[root@LS410D06E hackkit]# parted -s /dev/sdb mkpart primary linux-swap 6144MB  7168MB
[root@LS410D06E hackkit]# parted -s /dev/sdb mkpart primary xfs 7168MB 250GB
[root@LS410D06E hackkit]# parted -s /dev/sdb print
Model: ViPowER VP-89118(SD1) (scsi)
Disk /dev/sdb: 250GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name     Flags
 1      17.4kB  1024MB  1024MB               primary
 2      1024MB  6144MB  5119MB               primary
 3      6144MB  7168MB  1024MB               primary
 4      7168MB  250GB   243GB                primary

[root@LS410D06E hackkit]#

インストール

時計を合わせる

[root@LS410D06E hackkit]# date
Sat Aug 17 11:49:14 JST 2013
[root@LS410D06E hackkit]#
さっき、確認した。

カスタマイズ

hackkit_config を作る
[root@LS410D06E hackkit]# cat hackkit_config
ADDRESS=192.168.2.57
HOSTNAME=ls410d
GATEWAY=192.168.2.96
NAMESERVER=192.168.1.5
[root@LS410D06E hackkit]#

インストーラの修正

ここでインストーラを修正する
[root@LS410D06E hackkit]# cp hackkit_wheezy_130628.sh hackkit_wheezy_130817.sh
[root@LS410D06E hackkit]# vi hackkit_wheezy_130817.sh
	:
[root@LS410D06E hackkit]# diff -u hackkit_wheezy_130628.sh hackkit_wheezy_130817.sh
--- hackkit_wheezy_130628.sh
+++ hackkit_wheezy_130817.sh
@@ -34,6 +34,7 @@

 RAID=no
 LOCALDISK=no
+INITRD=loop

 #======================================================================
 # 各パーティションのフォーマット(RAID 機以外)
@@ -676,7 +677,7 @@
 #---------------------------------------------------------
 # edit_initrd

-edit_initrd() {
+edit_initrd_loop() {
        echo editing initrd ...

        dd if=$MOUNTPOINT/boot/initrd.buffalo of=$MOUNTPOINT/boot/initrd.gz bs=64 skip=1
@@ -749,6 +750,53 @@
        rm -f $MOUNTPOINT/boot/initrd.gz
 }

+
+edit_initrd_cpio() {
+       echo editing initrd ...
+
+       dd if=$MOUNTPOINT/boot/initrd.buffalo of=$MOUNTPOINT/boot/initrd.gz bs=64 skip=1
+       echo gunziping $MOUNTPOINT/boot/initrd.gz ...
+       gunzip $MOUNTPOINT/boot/initrd.gz
+       if [ ! -d /tmp/root ]
+       then
+               mkdir /tmp/root || exit
+       fi
+
+       cd /tmp/root
+       cat /$MOUNTPOINT/boot/initrd | cpio -idv
+
+       cat > /tmp/root/init <<EOF
+#!/bin/sh
+
+export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
+
+echo "---- in hackkit init ---"
+
+exit 0
+EOF
+       chmod 755 /tmp/root/init
+       find . -depth -print | cpio  -ov > /$MOUNTPOINT/boot/initrd
+
+       echo gziping $MOUNTPOINT/boot/initrd ... wait 5 minutes
+       gzip $MOUNTPOINT/boot/initrd || exit
+
+       chmod 755 $WORK/mkimage
+       chown root.root $WORK/mkimage
+
+       $WORK/mkimage -A ARM -O Linux -T ramdisk -C gzip -a 0x00000000 -e 0x00000000 -n initramfs -d $MOUNTPOINT/boot/initrd.gz $MOUNTPOINT/boot/initrd.buffalo
+
+       rm -f $MOUNTPOINT/boot/initrd.gz
+}
+
+edit_initrd() {
+       if [ "$INITRD" = "loop" ]
+       then
+               edit_initrd_loop
+       else
+               edit_initrd_cpio
+       fi
+}
+
 #---------------------------------------------------------
 # umount_boot

@@ -833,6 +881,11 @@
 0x00000016)
        MACHINE=LSVL
        ;;
+0x0000001A)
+       MACHINE=LS410D
+       INITRD=cpio
+       ;;
+
 0x00003002)
        MACHINE=LSWSGL

[root@LS410D06E hackkit]#

[root@LS410D06E share]# mkdir initrd.buffalo
[root@LS410D06E share]# cd initrd.buffalo/
[root@LS410D06E initrd.buffalo]# dd if=/boot/initrd.buffalo of=/tmp/initrd.gz bs=64 skip=1
185731+1 records in
185731+1 records out
[root@LS410D06E initrd.buffalo]# gunzip /tmp/initrd.gz
[root@LS410D06E initrd.buffalo]# cat /tmp/initrd | cpio -idv
.
usr
usr/lib
usr/lib/libreadline.so.6.2
usr/lib/libstdc++.so.6.0.16-gdb.py
	:
こんなトコロか、、、

インストール

[root@LS410D06E hackkit]# sh hackkit_wheezy_130817.sh
PRODUCTID = 0x0000001A
MACHINE LS410D
formating hard drive ...
mke2fs 1.42.4 (12-June-2012)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
62720 inodes, 249995 blocks
12499 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=260046848
8 block groups
32768 blocks per group, 32768 fragments per group
7840 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376

Allocating group tables: done
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done

meta-data=/dev/sdb2              isize=256    agcount=4, agsize=312448 blks
         =                       sectsz=512   attr=2, projid32bit=0
data     =                       bsize=4096   blocks=1249792, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0
log      =internal log           bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
Setting up swapspace version 1, size = 1000444 KiB
no label, UUID=728073ea-61be-4b1b-86af-6a20518b96c8
meta-data=/dev/sdb4              isize=256    agcount=4, agsize=14824896 blks
         =                       sectsz=512   attr=2, projid32bit=0
data     =                       bsize=4096   blocks=59299584, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0
log      =internal log           bsize=4096   blocks=28954, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
mounting root file system ...
extracting hackkit archive ...
./
./srv/
./media/
	:
www
www/cgi-bin
www/cgi-bin/resume.cgi
www/cgi-bin/query.cgi
52829 blocks
cpio: invalid option -- 'o'
BusyBox v1.19.4 (2013-07-04 21:49:51 JST) multi-call binary.

Usage: cpio [-dmvu] [-F FILE] [-ti] [EXTR_FILE]...

Extract or list files from a cpio archive

Main operation mode:
        -t      List
        -i      Extract EXTR_FILEs (or all)
        -d      Make leading directories
        -m      Preserve mtime
        -v      Verbose
        -u      Overwrite
        -F FILE Input (-t,-i,-p) or output (-o) file

gziping /mnt/disk1/debinst/boot/initrd ... wait 5 minutes
Image Name:   initramfs
Created:      Sat Aug 17 12:30:38 2013
Image Type:   ARM Linux RAMDisk Image (gzip compressed)
Data Size:    20 Bytes = 0.02 kB = 0.00 MB
Load Address: 0x00000000
Entry Point:  0x00000000
unmount /boot ...
[root@LS410D06E hackkit]# 
ん?busybox な cpio に -o オプションがないってか??

最初のログイン可能にする以外は、 他に Linux PC がなくても 標準ファームの LinkStation で セルフ作業できるようにしてきたが、、、
さすがにこれはクリアできないか??



LS410D

楽天市場
Amazon


/proc を見る
ハックの記録
LinkStation/玄箱 をハックしよう

Debian をインストールする(2)

ツイート Tweet to @yasunari_y @yasunari_yをフォロー

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