voyage-mpd-0.9.1のインストール備忘録
HOME BACK

はじめに

Voyage MPD (music player daemon)の最新版であるvoyage-mpd-0.9.1がリリースされたので、「Voyage MPD Starter Kit の導入」で入手したALIX3D2のCFディスクを最新版に入れ替えてみることにする。

インストール準備

インストールするためにはx86系のPCが必要である。
筆者はAtomオンボードのMini-ITX M/B(intel D945GCLF2)を使用し、このintel D945GCLF2とLAN接続したWin7PCからSSHで操作した。
intel D945GCLF2は基本的にはSSHクライアントのTera TermによりWin7PCから操作するが、ディスプレーとキーボードを接続しておくと何かと便利である。
先ず、voyage-mpd-0.9.1の[LiveCD]であるvoyage-mpd-0.9.1.isoをダウンロードする。
このisoファイルをWin32 Disk Imagerを使用してUSBメモリー(1GB)へ格納するが、 拙サイトにもこれに関して解説してある。

今回は4GB CFディスクにvoyage-mpd-0.9.1をインストールするわけであるが、4GB CFディスクはCF-SATA変換ボードに装着し、intel D945GCLF2のSATAポートに接続しておく。

voyage-mpd-0.9.1.isoを格納したブート用USBメモリー(1GB)をPCのUSBポートに挿入し、PCのBIOSでUSBメモリーからブートするように設定する。

[写真]
左はブート用USBメモリー(1GB)、右はCF-SATA変換ボード(KRHK-CF2.5SATA)とCFディスク(4GB)

インストール

インストール用PC(intel D945GCLF2)にディスプレー、キーボード、LANケーブル(DHCP)を接続し、ブート用USBメモリーをUSBポートに挿入しブートさせ、 id:root pass:voyageでログインする。

Debian GNU/Linux voyage tty1
voyage login : root
Password : voyage

その後、ifconfigでDHCPで割り当てられたIPを確認するが、筆者の場合は192.168.0.107であることがわかる。

root@voyage:~# ifconfig
eth0 Link encap:Ethernet HWaddr 00:1c:c0:b4:c4:86
inet addr:192.168.0.107 Bcast:192.168.0.255 Mask:255.255.255.0

インストール用PC(intel D945GCLF2)にディスプレー、キーボードを接続しなくても DHCPで割り当てられたIPが推測できれば、Win7PC(SSHクライアント)から直接、アクセスできる。
これ以降の作業は全てWin7PC(SSHクライアント)から行うが、反対に全ての作業をインストール用PC(intel D945GCLF2)に接続したディスプレー、キーボードで行うことも可能である。

dmesgコマンドでデバイスの状況を調べる。

root@voyage:~#dmesg
[ 0.970325] scsi 2:0:0:0: Direct-Access ATA CF Card 4GB Ver6 PQ: 0 ANSI: 5
[ 0.970921] sd 2:0:0:0: [sda] 7806960 512-byte logical blocks: (3.99 GB/3.72 GiB)
[ 0.971158] sd 2:0:0:0: [sda] Write Protect is off
[ 0.971167] sd 2:0:0:0: [sda] Mode Sense: 00 3a 00 00
[ 0.971253] sd 2:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or F UA
[ 0.973402] sda: sda1

dmesgの結果から変換ボードに装着したCFカードは sda: sda1であることが分かった。

★インストール用のディレクトリーの作成
root@voyage:~# mkdir /tmp/root
root@voyage:~# mount -o loop /lib/live/mount/medium/live/filesystem.squashfs /tmp/root
root@voyage:~# cd /tmp/root
root@voyage:/tmp/root# mkdir /tmp/cf

★パーテーションの設定、フォーマット
スクリプトを使用して、このCFカード(/dev/sda)にパーテーションを設定し、ext2でフォーマットするが、このスクリプトはかなり強力なのでデバイス名を間違えたりすると非常に危険なので注意する必要がある。
root@voyage:/tmp/root# /usr/local/sbin/format-cf.sh /dev/sda
Press ENTER to continue to format flash memory on /dev/sda
root@voyage:/tmp/root#

★インストールの開始
フォーマットが完了したので、いよいよインストールを実行する。
順次、質問に答えていくが、ほとんどはデフォルトのままでOKである。

root@voyage:/tmp/root# /usr/local/sbin/voyage.update
What would you like to do?
1 - Create new Voyage Linux disk
2 - Update existing Voyage configuration
3 - Exit
(default=1 [Create new Voyage Linux disk]):

some mandatory options are unset, please enter them interactively
Where is the Voyage Linux distribution directory?
(default=/tmp/root):

What would you like to do?
1 - Specify Distribution Directory
2 - Select Target Profile - this overwrites current settings
3 - Select Target Disk
4 - Select Target Bootstrap Loader
5 - Configure Target Console
6 - Partition and Create Filesystem
(default=2 [Select Target Profile - this overwrites current settings]):

Please select Voyage profile:
1 - Keep existing settings
2 - 4501
3 - 4511/4521
4 - 4801
5 - 5501
6 - 6501
7 - ALIX
8 - Generic PC
9 - Notebook (pcmcia)
10 - WRAP
(default=7 [ALIX]):

What would you like to do?
1 - Specify Distribution Directory
2 - Select Target Profile - this overwrites current settings
3 - Select Target Disk
4 - Select Target Bootstrap Loader
5 - Configure Target Console
6 - Partition and Create Filesystem
(default=3 [Select Target Disk]):

Partitions information
major minor #blocks name
8 0 3903480 sda
8 1 3895762 sda1
8 16 1003519 sdb
8 17 85984 sdb1
7 0 75864 loop0
7 1 75864 loop1
Which device accesses the target disk [/dev/hde]? /dev/sda
[今回は変換ボードに装着したCFディスクにインストールするので/dev/sdaとする。]

Which partition should I use on /dev/sda for the Voyage system [1]?

Device information for /dev/sda1
device fs_type label mount point UUID
---------------------------------------------------------------------------------------------------
/dev/sda1 ext2 VOYAGE_FS (not mounted) 94b54b90-6518-4e08-9604-b43181de8847

Where can I mount the target disk [/tmp/cf]?

What would you like to do?
1 - Specify Distribution Directory
2 - Select Target Profile - this overwrites current settings
3 - Select Target Disk
4 - Select Target Bootstrap Loader
5 - Configure Target Console
6 - Partition and Create Filesystem
(default=4 [Select Target Bootstrap Loader]):

Which loader do you want (grub or lilo) [grub]?

Which partition is used for bootstrap [1]?

What would you like to do?
1 - Specify Distribution Directory
2 - Select Target Profile - this overwrites current settings
3 - Select Target Disk
4 - Select Target Bootstrap Loader
5 - Configure Target Console
6 - Partition and Create Filesystem
(default=5 [Configure Target Console]):

Select terminal type:
1 - Serial Terminal
2 - Console Interface
(default=1 [Serial Terminal]): 2
[2 - Console Interface を選択する。]

What would you like to do?
1 - Specify Distribution Directory
2 - Select Target Profile - this overwrites current settings
3 - Select Target Disk
4 - Select Target Bootstrap Loader
5 - Configure Target Console
6 - Partition and Create Filesystem
(default=6 [Partition and Create Filesystem]):

What shall I do with your Flash Media?
1 - Partition Flash Media and Create Filesystem
2 - Use Flash Media as-is
(default=1 [Partition Flash Media and Create Filesystem]): 2
[2 - Use Flash Media as-is を選択する。]

What would you like to do?
1 - Specify Distribution Directory
2 - Select Target Profile - this overwrites current settings
3 - Select Target Disk
4 - Select Target Bootstrap Loader
5 - Configure Target Console
6 - Partition and Create Filesystem
(default=7 [Copy Distribution to Target]):

Configuration details:
----------------------

Distribution directory: /tmp/root

Disk/Flash Device: /dev/sda
Installation Partition: /dev/sda1
Bootstrap Partition: /dev/sda1

Will be mounted on: /tmp/cf

Target system profile: ALIX
Target console: standard

Bootstrap installer: grub
Bootstrap partition: /dev/sda1

OK to continue (y/n)? y
[設定はOKなので y(yes) とする。]

Ready to go ....
Copying files .... done

Removing pcmcia from update-rc.d
update-rc.d: using dependency based boot sequencing
Removing dnsmasq.pxe.conf in /etc/dnsmasq.more.conf
Reconfiguring resolvconf
Updating /etc/hosts
Installing grub
Copy grub files from /tmp/cf to /tmp/cf/boot/grub
Setting up grub under chroot /tmp/cf
copyfiles.sh script completed

What would you like to do?
1 - Specify Distribution Directory
2 - Select Target Profile - this overwrites current settings
3 - Select Target Disk
4 - Select Target Bootstrap Loader
5 - Configure Target Console
6 - Partition and Create Filesystem
(default=8 [Exit]):

/usr/local/sbin/voyage-install.sh: .voyage-install.conf: Read-only file system
/usr/local/sbin/voyage-install.sh: test.conf: Read-only file system
root@voyage:/tmp/root#

プロンプトがroot@voyage:/tmp/root#に戻ったらインストール完了である。
ブート用USBメモリー(1GB)を抜いて再起動する。
root@voyage:/tmp/root# reboot

その他の設定

★vi の変更を保存
root@voyage:~# remountrw

★日本時刻を設定
root@voyage:~# dpkg-reconfigure tzdata
Asia → Tokyo を選ぶ

★ .bashrc の編集
root@voyage:~# vi ./.bashrc
以下の行を追記する。
remountrw
mpd -kill
/etc/init.d/mpd start-create-dbremountrw

★IP アドレスの固定化
筆者はアドレスを192.168.0.80、ルーターは192.168.0.1とした。
root@voyage:~# vi /etc/network/interfaces
iface eth0 inet static
address 192.168.0.80
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
dns-nameservers 192.168.0.1

★ntpdateによる時刻の自動修正
筆者の環境ではルーター(192.168.0.1)がかなり正確な時刻をもっているので、起動後、自動的に時刻合わせをするためにcrontabを編集した。
root@voyage:~#crontab -e
# m h dom mon dow command
#*/5 * * * * ( /etc/init.d/voyage-sync sync )
@reboot /usr/sbin/ntpdate 192.168.0.1

しかし、これについてはntpdateのバグによるトラブルが発生したので、dateコマントで時刻を修正する方法に改めた。
@reboot date -s "$(wget -S "http://www.google.com/" 2>&1 | grep -E '^[[:space:]]*[dD]ate:' | sed 's/^[[:space:]]*[dD]ate:[[:space:]]*//' | head -1l | awk '{print $1, $3, $2, $5 ,"GMT", $4 }' | sed 's/,//')"
#@reboot /usr/sbin/ntpdate 192.168.0.1

MPD等の設定

ALIXで使用する場合、/etc/mpd.confはデフォルトのままでOKである。
別のPCの場合も、BIOSで内蔵Audioを[OFF]に設定しておけば、/etc/mpd.confはデフォルトのままで、問題ないと思われる。
mpd.confのALSA outputの部分をチェックしてみるとdsd_usbがサポートされているようである。
# An example of an ALSA output:
#
audio_output {
type "alsa"
name "My ALSA Device"
device "hw:0,0"
# format "44100:16:2" optional
# mixer_device "default" optional
# mixer_control "PCM" optional
# mixer_index "0" optional
dsd_usb "yes"
}
#

筆者は自作NASを使用しているので/etc/fstabに以下を記述した。
//192.168.0.95/Music /music cifs username=root,password=samba,uid=mpd,file_mode=0644,dir_mode=0755,iocharset=utf8 0 0

次は / に music ディレクトリーを作りマウントし、/var/lib/mpd/musicへリンクする。
# mkdir /music
# mount -a
# ln -s /music /var/lib/mpd/music

おわりに

パーテーションの設定、フォーマット用のスクリプトは危険な代物のようであるが便利である。

voyage-mpd-0.9.1の uname -a と mpd -V の結果を以下に示す。
# uname -a
Linux voyage 3.8.13-voyage #1 SMP Wed May 22 13:36:11 HKT 2013 i686 GNU/Linux

# mpd -V
mpd (MPD: Music Player Daemon) 0.18~git

HOME BACK

Last Update 26/Nov/2013 by mac