LANDISKをDebian化する

ログインする

  • Cygwinからtelnetしようとすると,PATHによってはWindowsのGUIアプリのtelnetを呼ぶことがある
  • 適当なtelnetクライアント,PuTTYとかPoderosaを使うのが良い

ログイン後

sh-2.05b# w
11:04:50 up 13880 days, 11:04,  0 users,  load average: 0.08, 0.02, 0.01
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT

という感じ.

シェル

  • /bin/bash があるので,とりあえずそれにしてみると良い

環境整備

 # cd /mnt/hda5/landisk
 # mkdir dpkg
 # cd dpkg
 # touch status
 # mkdir updates
 # touch available
 # mkdir info
 # ln -s /mnt/hda5/landisk/dpkg /var/lib/dpkg
 
 # mkdir /mnt/hda5/landisk/apt
 # ln -s /mnt/hda5/landisk/apt /var/lib/apt
 # mkdir /mnt/hda5/landisk/apt-cache
 # ln -s /mnt/hda5/landisk/apt-cache /var/cache/apt
 # cd /var/lib/apt
 # mkdir lists
 # cd lists
 # touch lock
 # mkdir partial
 # cd /var/cache/apt
 # mkdir archives
 # cd archives
 # mkdir partial

した.

上記のコマンド入力例のうち、ln -sではじまる行については、/etc/init.d/rc.localの末尾に追加します。

とあるが,Poderosa からの接続では,vi/vimのターミナルコントロールがうまくいかない.

 # TERM=vt100
 # export TERM

したらうまくいった.なお/etc/init.d/rc.localはファイルシステムがread-only. どうしよう./etc/mtab で rw に書き換えるか…….

sh-2.05b# mount -o remount,rw,noatime /

した.

sh-2.05b# mount
rootfs on / type rootfs (rw)
/dev/root on / type ext3 (rw,noatime)

おk!

apt-get

# apt-get update

あとパッケージ拾ってくるのをjaistにする.

 # cat /etc/apt/sources.list
#deb http://ftp2.jp.debian.org/debian/ sarge main

deb ftp://ftp.jaist.ac.jp/pub/Linux/Debian/ sarge main
deb ftp://ftp2.jp.debian.org/debian/ sarge main


deb-src ftp://ftp.jaist.ac.jp/pub/Linux/Debian/ sarge main
deb-src ftp://ftp2.jp.debian.org/debian/ sarge main
deb-src ftp://ftp.jp.debian.org/debian/ sarge main
deb-src ftp://ftp.debian.org/debian/ sarge main

rc.local

こんな感じでどうか.

 sh-2.05b# cat /etc/init.d/rc.local
 #! /bin/sh
 #
 # rc.local

PATH=/sbin:/bin:/usr/sbin:/usr/bin

 # Load drivers
mount -o remount -w %root% / &>/dev/null
/usr/local/sbin/leddrv_load
 #/usr/local/sbin/buzdrv_load
/usr/local/sbin/btndrv_load
 # mount -o remount,noatime -r %root% / &>/dev/null #read-onlyでマウントしなおすのをやめる

 # Daemons
/usr/local/bin/buttond
/usr/local/bin/usbhdmng


 # Set WakeOnLan
 #WOL=$(grep -w "wol" /etc/landisk/conffiles/config-network | awk '{print $2}')
 #if [ "${WOL}" != "" ]; then
 #        /usr/sbin/ethtool -s eth0 wol ${WOL}
 #fi

 # Set spindown
 #/home/LANDISK/scripts/setspindown hda "${SPINDOWN}"
                                 
 # LED Bright.(1 or 2 or 4)
 #LEDBRIGHT=$(grep -w "ledbrightness" /etc/landisk/conffiles/config-system | awk -F  "\t" '{print $2}')
 #/usr/local/bin/ledcont bright "${LEDBRIGHT}"

echo '$$' > /var/lock/lanicn/.boot-done
echo 'Starting hotplug:'
 #touch /var/log/HDLhotplug.log
/usr/local/bin/hotplug --enable >& /dev/null
if /usr/local/bin/hotplug boot >& /dev/null; then
    echo 'hotplug done.'
    HOTPLUG=0
else
    echo 'hotplug error.'
    HOTPLUG=1
fi

 # Boot check.
if [ -f /var/run/dhclient.eth0.pid ]; then
   # Boot success.
   logger -p daemon.info -t dhclient 'DHCP success'
   DHCP=0
else
   if [ -f /var/run/dhclient.eth0.leases ]; then
        # dhclient fail.
        logger -p daemon.info -t dhclient 'DHCP fail'
        DHCP=1
   else
        # static IP mode
        DHCP=0
   fi
fi

if [ $((${HOTPLUG} | ${DHCP})) -eq 0 ]; then
    /usr/local/bin/ledcont stson
 #    /usr/local/bin/buzcont 1 100 1
else
    /usr/local/bin/ledcont errfastblink
 #    /usr/local/bin/buzcont 10 50 3
fi

 #/usr/sbin/telnetd -l /bin/sh
/usr/sbin/telnetd -l /bin/sh
rm -f /var/lock/lanicn/led_buzzer >& /dev/null

 #End

 # mount start
ln -s /mnt/hda5/landisk/dpkg /var/lib/dpkg
ln -s /mnt/hda5/landisk/apt /var/lib/apt
ln -s /mnt/hda5/landisk/apt-cache /var/cache/apt

しかし hda5 は残り少ないな.99MBぐらいしか残ってないぞ.hda6を使おう.13GBもあれば足りるだろう.

 # cd /mnt/hda5
 # cp -pR landisk/ /mnt/hda6
 # rm  /var/lib/dpkg  /var/lib/apt /var/cache/apt
 # ln -s /mnt/hda6/landisk/dpkg /var/lib/dpkg
 # ln -s /mnt/hda6/landisk/apt /var/lib/apt
 # ln -s /mnt/hda6/landisk/apt-cache /var/cache/apt

として

 # cat /etc/init.d/rc.local
(中略)
 #  mount start
ln -s /mnt/hda6/landisk/dpkg /var/lib/dpkg
ln -s /mnt/hda6/landisk/apt /var/lib/apt
ln -s /mnt/hda6/landisk/apt-cache /var/cache/apt

としておいた.

apt依存関係

インストールの前に、まず、/etc/apt/sources.listを書き換える。

landisk:/# cat /etc/apt/sources.list
deb http://ftp2.jp.debian.org/debian/ sarge main

次に、前述のページに書かれているパッケージをダウンロードする。

landisk:/# apt-get -d install libc6 libdb1 gcc-3.3-base libstdc++5 dpkg

最初は、依存関係に問題があって、aptではインストールできない。前述のページの通り、依存関係のチェックではねられてしまう。まずは、/var/lib/dpkg/statusを書き換えて、libc6をインストールしていることにしてから、dpkgで、以下のような順番でインストールを行なった。

  1. libgcc1_1%3a3.4.3-13sarge1_arm.deb
  2. libncurses5_5.4-4_arm.deb
  3. gcc-3.3-base_1%3a3.3.5-13_arm.deb
  4. libstdc++5_1%3a3.3.5-13_arm.deb
  5. dpkg_1.10.28_arm.deb
  6. libc6_2.3.2.ds1-22sarge5_arm.deb

ここまでインストールできれば、あとは、なんでもあり。

  • しかしダウンロードしたファイルがどこにあるか分からなかった.
  • /var/cache/apt/archives にある
  • あとは dpkg -i で入れれば良い.上記ページの%3a とかはそのまま.

とりあえず /var/lib/dpkg/status を

Package: libc6
Status: install ok installed
Priority: required
Section: base
Version: 2.3.2.ds1-22sarge6

と書いてごまかして見たが,だめだ.

 # dpkg -i libc6_2.3.2.ds1-22sarge6_arm.deb 
dpkg: parse error, in file `/var/lib/dpkg/status' near line 44 package `dpkg':
 missing version

と言われた.どうやってごまかせばいいんだ. そうか,dpkgのバージョンがないんだな.

Version: 1.10.28

を追加してみた.リトライ

# dpkg -i libc6_2.3.2.ds1-22sarge6_arm.deb 
(Reading database ... 
dpkg: serious warning: files list file for package `dpkg' missing, assuming package has no files currently installed.

dpkg: serious warning: files list file for package `libc6' missing, assuming package has no files currently installed.
15 files and directories currently installed.)
Preparing to replace libc6 2.3.2.ds1-22sarge6 (using libc6_2.3.2.ds1-22sarge6_arm.deb) ...
Unpacking replacement libc6 ...
dpkg: dependency problems prevent configuration of libc6:
 libc6 depends on libdb1-compat; however:
  Package libdb1-compat is not configured yet.
dpkg: error processing libc6 (--install):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 libc6

だめだなあ.dpkg -i dpkg はどうだ.

 # dpkg -i dpkg_1.10.28_arm.deb 
dpkg: regarding dpkg_1.10.28_arm.deb containing dpkg, pre-dependency problem:
 dpkg pre-depends on dselect
  dselect is not installed.
dpkg: error processing dpkg_1.10.28_arm.deb (--install):
 pre-dependency problem - not installing dpkg
Errors were encountered while processing:
 dpkg_1.10.28_arm.deb
  • dselect 先じゃないとだめなのか.libdb1 から入れてみるか.
# dpkg -i libdb1-compat_2.1.3-7_arm.deb 

(Reading database ... dpkg: serious warning: files list file for package `dpkg' missing, assuming package has no files currently installed. 2067 files and directories currently installed.) Preparing to replace libdb1-compat 2.1.3-7 (using libdb1-compat_2.1.3-7_arm.deb) ... Unpacking replacement libdb1-compat ... dpkg: dependency problems prevent configuration of libdb1-compat:

libdb1-compat depends on libc6 (>= 2.2.5-13); however:
 Package libc6 is not configured yet.

dpkg: error processing libdb1-compat (--install):

dependency problems - leaving unconfigured

Errors were encountered while processing:

libdb1-compat

やっぱ libc6 入ってないとだめなんじゃん...

sh-2.05b# apt-get -q upgrade
Reading Package Lists...
Building Dependency Tree...
The following packages have been kept back:
  dpkg
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
2 not fully installed or removed.
Need to get 0B of archives.
After unpacking 0B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up libdb1-compat (2.1.3-7) ...

Setting up libc6 (2.3.2.ds1-22sarge6) ...
Current default timezone: 'Asia/Tokyo'.
Local time is now:      Wed Apr  9 22:34:26 JST 2008.
Universal Time is now:  Wed Apr  9 13:34:26 UTC 2008.
Run 'tzconfig' if you wish to change it.

W: Couldn't stat source package list http://debian.dodes.org sid/main Packages (/var/lib/apt/lists/debian.dodes.org_debian_dists_sid_main_binary-arm_Packages) - stat (2 No such file or directory)
W: Couldn't stat source package list http://debian.dodes.org sid/non-free Packages (/var/lib/apt/lists/debian.dodes.org_debian_dists_sid_non-free_binary-arm_Packages) - stat (2 No such file or directory)
W: Couldn't stat source package list http://debian.dodes.org sid/contrib Packages (/var/lib/apt/lists/debian.dodes.org_debian_dists_sid_contrib_binary-arm_Packages) - stat (2 No such file or directory)
W: You may want to run apt-get update to correct these problems

まあしかし入ったっぽいぞ.

 # less /var/lib/dpkg/status
Package: libdb1-compat
Status: install ok installed
Priority: required
Section: oldlibs
Installed-Size: 116
Maintainer: Colin Watson <cjwatson@debian.org>
Architecture: arm
Source: db1-compat
Version: 2.1.3-7
Replaces: libc6 (<< 2.2.5-13), libc6.1 (<< 2.2.5-13), libc0.3 (<< 2.2.5-13)
Depends: libc6 (>= 2.2.5-13)
Description: The Berkeley database routines [glibc 2.0/2.1 compatibility]
 libdb is a library for manipulating database files, developed at Berkeley.
 .
 It supports three kinds of file formats:
  * btree. A representation of a sorted, balanced tree structure.
  * hashed. An extensible, dynamic hashing scheme.
  * UNIX file oriented. A byte stream file with fixed or variable length
    records.
 .
 This library exists for compatibility with applications built against
 glibc 2.0 or 2.1. There is intentionally no corresponding development
 package. Do not link new applications against this library!

Package: libgcc1
Status: install ok installed
Priority: required
Section: libs
Installed-Size: 148
Maintainer: Debian GCC maintainers <debian-gcc@lists.debian.org>
Architecture: arm
Source: gcc-3.4 (3.4.3-13sarge1)
Version: 1:3.4.3-13sarge1
Depends: libc6 (>= 2.3.2.ds1-21)
Description: GCC support library
 Shared version of the support library, a library of internal subroutines
 that GCC uses to overcome shortcomings of particular machines, or
 special needs for some languages.

Package: dpkg
Status: install ok installed
Priority: required
Section: base
Version: 1.10.28

Package: libc6
Status: install ok installed
Priority: required
Section: base
Installed-Size: 13660
Maintainer: GNU Libc Maintainers <debian-glibc@lists.debian.org>
Architecture: arm
Source: glibc
Version: 2.3.2.ds1-22sarge6
Replaces: ldso (<= 1.9.11-9), timezone, timezones, gconv-modules, libtricks, netkit-rpc
, netbase (<< 4.0), libc6-dev (<< 2.3.2.ds1-14)
Provides: glibc-2.3.2.ds1-22sarge6
Depends: libdb1-compat
Suggests: locales, glibc-doc
Conflicts: strace (<< 4.0-0), libnss-db (<= 2.2-6.1.1), timezone, timezones, gconv-modu
les, libtricks, libc6-doc, netkit-rpc, wine (<< 0.0.20031118-1), cyrus-imapd (<< 1.5.19
-15)
Description: GNU C Library: Shared libraries and Timezone data
 Contains the standard libraries that are used by nearly all programs on
 the system. This package includes shared versions of the standard C library
 and the standard math library, as well as many others.
 Timezone data is also included.

そんで dpkg を改めて入れ直しだ.

 # apt-get install dpkg
Reading Package Lists... Done
Building Dependency Tree... Done
The following extra packages will be installed:
  dselect libncurses5 libstdc++5
The following NEW packages will be installed:
  dselect libncurses5 libstdc++5
The following packages will be upgraded:
  dpkg
1 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 0B/2600kB of archives.
After unpacking 7717kB of additional disk space will be used.
Do you want to continue? [Y/n] y
E: Cannot get debconf version. Is debconf installed?
Selecting previously deselected package libncurses5.
(Reading database ... 
dpkg: serious warning: files list file for package `dpkg' missing, assuming package has no files currently installed.
2073 files and directories currently installed.)
Unpacking libncurses5 (from .../libncurses5_5.4-4_arm.deb) ...
Selecting previously deselected package libstdc++5.
Unpacking libstdc++5 (from .../libstdc++5_1%3a3.3.5-13_arm.deb) ...
Selecting previously deselected package dselect.
Unpacking dselect (from .../dselect_1.10.28_arm.deb) ...
Setting up libncurses5 (5.4-4) ...

Setting up libstdc++5 (3.3.5-13) ...

Setting up dselect (1.10.28) ...
(Reading database ... 
dpkg: serious warning: files list file for package `dpkg' missing, assuming package has no files currently installed.
2151 files and directories currently installed.)
Preparing to replace dpkg 1.10.28 (using .../archives/dpkg_1.10.28_arm.deb) ...
Unpacking replacement dpkg ...
Setting up dpkg (1.10.28) ...
  • libncurses5, libstdc++5, dselect あたりも入ったようだ.これでOKかな?
 # dpkg -l
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name            Version         Description
+++-===============-===============-==============================================
ii  dpkg            1.10.28         Package maintenance system for Debian
ii  dselect         1.10.28         a user tool to manage Debian packages
ii  gcc-3.3-base    3.3.5-13        The GNU Compiler Collection (base package)
ii  libc6           2.3.2.ds1-22sar GNU C Library: Shared libraries and Timezone d
ii  libdb1-compat   2.1.3-7         The Berkeley database routines [glibc 2.0/2.1 
ii  libgcc1         3.4.3-13sarge1  GCC support library
ii  libncurses5     5.4-4           Shared libraries for terminal handling
ii  libstdc++5      3.3.5-13        The GNU Standard C++ Library v3
  • 大丈夫っぽいね

なんか login のインストールが,base-passwd でいろいろ uid を変えそうだったので止める.

# apt-get install screen
# apt-get install jless

なぞしたよ.

 # apt-get install ssh
Reading Package Lists... Done
Building Dependency Tree... Done
The following extra packages will be installed:
  adduser libssl0.9.7 libwrap0 zlib1g
Suggested packages:
  perl-modules ssh-askpass xbase-clients
Recommended packages:
  tcpd
The following NEW packages will be installed:
  adduser libssl0.9.7 libwrap0 ssh zlib1g
0 upgraded, 5 newly installed, 0 to remove and 1 not upgraded.
Need to get 1473kB of archives.
After unpacking 3797kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 ftp://ftp.jaist.ac.jp sarge/main adduser 3.63 [98.2kB]
Get:2 ftp://ftp.jaist.ac.jp sarge/main libwrap0 7.6.dbs-8 [27.1kB]
Get:3 ftp://ftp.jaist.ac.jp sarge/main zlib1g 1:1.2.2-4.sarge.2 [66.7kB]
Get:4 ftp://ftp.jaist.ac.jp sarge/main libssl0.9.7 0.9.7e-3sarge5 [607kB]
Get:5 ftp://ftp.jaist.ac.jp sarge/main ssh 1:3.8.1p1-8.sarge.6 [673kB]
Fetched 1473kB in 10s (147kB/s)
Preconfiguring packages ...
Selecting previously deselected package adduser.
(Reading database ... 3522 files and directories currently installed.)
Unpacking adduser (from .../archives/adduser_3.63_all.deb) ...
Selecting previously deselected package libwrap0.
Unpacking libwrap0 (from .../libwrap0_7.6.dbs-8_arm.deb) ...
Selecting previously deselected package zlib1g.
Unpacking zlib1g (from .../zlib1g_1%3a1.2.2-4.sarge.2_arm.deb) ...
Selecting previously deselected package libssl0.9.7.
Unpacking libssl0.9.7 (from .../libssl0.9.7_0.9.7e-3sarge5_arm.deb) ...
Selecting previously deselected package ssh.
Unpacking ssh (from .../ssh_1%3a3.8.1p1-8.sarge.6_arm.deb) ...
Setting up adduser (3.63) ...

Setting up libwrap0 (7.6.dbs-8) ...

Setting up zlib1g (1.2.2-4.sarge.2) ...

Setting up libssl0.9.7 (0.9.7e-3sarge5) ...

Setting up ssh (3.8.1p1-8.sarge.6) ...
Creating SSH2 RSA key; this may take some time ...
Creating SSH2 DSA key; this may take some time ...
adduser: The GID 65534 does not exist.
dpkg: error processing ssh (--configure):
 subprocess post-installation script returned error exit status 1
Errors were encountered while processing:
 ssh
E: Sub-process /usr/bin/dpkg returned an error code (1)

このエラーでぐぐると

つぎー。sshを入れる。

adduser: The GID 65534 does not exist.

こんなエラーでとまる。

で、no titleを参考に

# addgroup --gid 65534 nogroup

これで

# apt-get install ssh

でOK。

らしい.ということで

 # addgroup --gid 65534 nogroup
 # apt-get install ssh

で解決した.

Last modified: 2009-01-22 Attached files total: 6MB