tags: Linux

My Homebrewed IPTV transmitter(gen.4)

Hi, there. Long time no see. I’ve spending super-hard time to work, unfortunatelly. Recently, I’m so lucky to have some private time, so decide to write some code to transmit TV to Kodi.

history #1(Gen.1 transmitter,around 2000-2005)

Its so long time from I had disconnected terrestrial tv cable from my display and connect into IPTV box. My first experience is Sony’s “Location Free TV( https://en.wikipedia.org/wiki/LocationFree_Player )”. It’s proprietary product and limited in order to view programs via special software (and, it worked only on windows of cource !). I remember that my father had worked in Korea and I had told him to use this and he pleased to view Japanese TV in Korea. It’s one of my happy memory. At that time(and even now !), Japanese TV company was so much nervous about people transcode TV program into IP datagram and send to other location outside of his home. There was some reason to do such thing. There was a lot of tech-native and rogue young guys rip a lot of TV programs and movies and shared through P2P softwares(such as Winny, Share, and so on). That was difinitely a challenge to existing authorities, and people were afraid of their bothered behavior. Authorities tried to limit their challenge using every means, and finally nuked and wiped them practically. IPTV was also disappeared from the market in a form that involved collateral.

history #2(Gen.2, 2010-2014)

I had so tired about japanese closed product so much and switched almost all equipment to linux box including my home TV. Japanese homebrew hardware vendor Earthsoft( https://earthsoft.jp/ ) released PT1 which can receive and decode terrestrial and can be save as raw binary file into computer. It was landsliding phenomenon among tech savvies in Japan and tried to hack aboud. Currently japanese terrestrial broadcast is encrypted with MULTI2 protocol( https://ja.wikipedia.org/wiki/MULTI2 ) and cannot be decryted in simple way, but there is some decrypting software made by volunteer hacker with legal decrypting key(B-CAS card. This is sold with legal device.). (Note: There is a lot of discussion to decript terrestrial with legal key and homebrewed software) I won’t write detail, but purchased PT3(3rd gen Earthsoft’s terrestrial receiver) and connect them up into a linux box. I’ve sent decoded stream to gstreamer and forward to other linux box. I’ve finally succeed to view live TV at outside in adition inside of my home ! I’ve written transmitter and receiver using perl and it worked so good. Disclaimer: All of my terrestrial stream is decrypted using legal key and legal equipment.

history #3(Gen.3, 2014-2017)

Gstreamer is complete suite about media handling, but have some nervousness to treat transport stream. So gstreamer missed to catch media stream from trancoded terrestrial stream which includes some other information other than media stream itself. So, I’ve switched gstreamer into ffmpeg. I’ve modified my transmitter and receiver in order to fit ffmpeg. Ffmpeg did its job nicely. I’ve added additonal feature ffmpeg can transcode transpote stream into H.264 in case of narrow bandwith connection. This feature was so nice when I went business trip and want to view my subscribed TV channel.

Now(Gen.4, 2017-)

I’ve switched my linux box into Raspberry Pi 3 and Kodi. Kodi is sweat software to handle personal media content. Kodi also has smart controller works on android smartphone. Kodi also has feature to handle realtime TV stream and network video stream service such as YouTube in addition to saved media content. I’ve rewritten again my transmitter Kodi can receive stream in proper way. Kodi can receive realtime TV as HTTP live streaming(HLS) and I’ve hacked my transmitter to work as HLS server. My transmitter can reply my subscribed channels and realtime media stream along with HLS manner. Source code is here( https://github.com/mkiuchi/epgrec-kodi-backend ). Now, I can see my tv in my home and outside, I can have my smart remote controller, and low-powered receiver !

Conclusion

IPTV for terrestrial is niche. Almost all people view authorized network tv such as Hulu, NetFlix, dTV, and so on. Additinaly, people spent their times in SNSs and tons of CGMs. So demand for transport terrestrial into IPTV gonna be still niche, I think. But I’m happy, for now.

TAP TST10 and munin

powerload-day

TAP-TST10 is most cheapest power consumption monitoring device currently in Japan. I’ve evaluated and find some pros and cons.

The Device

SANWA Supply sells valious device around daily consumer computing use in Japan and sells “Watt Checker” series in order to measure power consumption of your digital device such as your laptop computer and in-house servers. You can just see current value using most of devices, can send it out to other computer via USB cable using TAP-TST10 and it costs about $50 in the street in contrast to other devices which costs about $200. So I gonna try to connect them and see some. Some good guy archived linux box to identify TAP-TST10.(link) I’ve written some wrapper script for munin-node and it works fine.

Pros

Cheapest power measurement device which have USB output connection among Japan.

Cons

Undisclosed protocol for USB connection. There is some failure when you connect.

Comments

Most of Japanese devices around power measurement have poor and insufficiently disclosed function and expensive. It needs to be improved.

Make your own script with systemd

Recent linux system uses systemd instead of SysV init. So you cannot use /etc/rc.local for your housekeeping script with systemd, I’ve tried to migrate my own script with systemd environment. Here is my example which works one time per system startup.

1. make your own script(example: /root/synchome.sh

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/sh
#
# my home directory
#
DAT=`date`
echo "script start $DAT" > /root/log
BKF=`find /mnt/nfs/flyback/flyback -mindepth 1 -maxdepth 1|grep -v lock|sort|tail -1`
# wait until autofs mount is ready
while [ "$BKF" = "" ]; do
   BKF=`find /mnt/nfs/flyback/flyback -mindepth 1 -maxdepth 1|grep -v lock|sort|tail -1`
done
if [ -d $BKF ] ; then
   DIRPRFX="/home/mkiuchi/"
   BKF=$BKF$DIRPRFX
   echo "source directory $BKF" >> /root/log
   rsync -auvz --delete --ignore-errors $BKF $DIRPRFX >> /root/log 2>&1
   # clean chromium lock file
   if [ -L "/home/mkiuchi/.config/chromium/SingletonLock" ]; then
     echo "found chromium lockfile" >> /root/log
     rm -f /home/mkiuchi/.config/chromium/SingletonLock
   fi
else
   echo "backupfile not found. aborted." >> /root/log
   exit
fi

DAT=`date`
echo "script end $DAT" >> /root/log

2. make configuration file for systemd(example: /root/synchome.service)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
[Unit]
Description=Home Directory Synchronization
Require=autofs.service
After=autofs.service

[Service]
Type=oneshot
ExecStart=/root/synchome.sh
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

3. chmod 755 /root/synchome.sh

4. cd /etc/systemd/system ; ln -s /root/synchome.service .

5. systemctl daemon-reload

I cannot determine how to identify the work of systemd, so my own script writes own log.

Sense temparature and humidity at your home

Long time no see. What’s up ? I’ve been working hard for about a year and have no time to write blog. Here is old story but I’ve not written yet.

You always take some attension about tomorrows weather and current temparature and humidity roughly. “Today is cold”, “Today is dry”, “Today is moist”…and so on. When you know temparature and humidity correctly, your feeling go more clear ? Of course, it gonna be cheap. OK, here is my trial. My budget doesn’t exceed over $200.

I’ve decided to use Strawberry Linux’s USBRH-FG sensor. You can buy it from this URL «http://strawberry-linux.com/catalog/items?code=52002>>. It costs about $50. Here is the photo if USBRH-FG.

I’ve decided to measure outside temparature and humidity, so USBRH should go into outside and should be resistant from rain, wind, and sunlight in order to take correct measure. Here is diagram about my installation. USBRH is installed into weather resistant case and its output is converted into Cat5 cable. It doesn’t mean that output of USBRH is converted to TCP/IP. It’s absolutely USB protocol which runs inside of Cat5 cable. Cat5 cable is also weak against outside weather, so I’ve covered Cat5 cable with ordinary PVC pipe.

I’ve decided to connect my server and USBRH device with USB expander in order to connect between inside of my home and outside. USB cable cannot extend more than 5 meter, so I’ve bought usb expander and connect about 20m between USBRH device and server, and it costs about $60. Here is photo of usb expander.

Here is a part of my installation. I’ve bought some weather proof case to be installed at nearest home depot. I’ve set USBRH with some small box and punched some small holes in order for outside air and moisture to go through into box moderately.

OK, here is software turn. I’ve installed USBRH linux driver into my server from here ( http://green-rabbit.sakura.ne.jp/usbrh/ ). It shows current temparature and humidity like this. Unit of temparature is celsius.

# cat /proc/usbrh/0/status
t:23.42 h:67.38

I’ve also installed munin ( http://munin-monitoring.org/ ) in order to store sensed data and see log-term movement of temparature and humidity. I’ve written some plugin for munin to work with USBRH sensor.

#!/bin/sh
# -*- sh -*-

: << =cut

=head1 NAME

Plugin for USBRH - Plugin to measure USBRH device's temparature and humidity. 

=head1 NOTES

Especially the average and max values on the bigger graphs (yearly) can be interesting.

=head1 AUTHOR

Contributed by Mitsutoshi Kiuchi

=head1 LICENSE

GPLv2

=head1 MAGIC MARKERS

 #%# family=auto
 #%# capabilities=autoconf

=cut

. /usr/share/munin/plugins/plugin.sh

MODEL="USBRH"

if [ "$1" = "autoconf" ]; then
    echo yes
    exit 0
fi

if [ "$1" = "config" ]; then

    echo graph_title "$MODEL outside"
    echo 'graph_args --base 1000 -l 0 '
    echo 'graph_scale no'
    echo 'graph_vlabel Celsius'
    echo 'graph_category sensors'
    echo 'usbrht.label temparature'
    echo 'usbrhh.label humidity'
    print_warning load
    print_critical load
    exit 0
fi

TEMP=`cat /proc/usbrh/0/temperature`
RH=`cat /proc/usbrh/0/humidity`
echo "usbrht.value $TEMP"
echo "usbrhh.value $RH"

and, here is sample output.

Wow, it’s good looking.

Samba Winbind Trial Log

In the past and UNIX world, people who want aggregate authentication repository always used NIS. Several company and guys still may use NIS now, I heard from some colleague. We UNIX people can use LDAP for centralized authentication. Old days, all of company worker were walking around UNIX sysadmin, but now many of them live in Windows world and uses Active Directory for authentication and UNIX people have to fit them to AD. Thanks to desired samba community, we can use winbind and UNIX server can talk to AD, join itself to AD-forrest and user who is not registered in local authentication can log in UNIX server. I tried to create test environment similar to real world, and confirmed that my Linux box can talk AD server. I will write how-to for other people who want to try. 1. Environment

  • Windows Server: I’ve tried Windows Server 2008.
  • Linux Box: (also I’ve tried) Scientific Linux 6.0 (x86_64).
  1. Install Windows Server, create Active Directory repository, and create user account for test

First, I installed Windows Server 2008 into my test box. After I installed Windows Server 2008, I created Active Directory. If you haven’t experienced how to create AD, please see my screenshot below.

After the installation, you will see the welcome window. Please choose “Add Role” link.

You’ll see welcome window of “Add Role”. Click Next.

You can choice the role what you want. Choose “Active Directory Domain Service”, and click Next. (You may doubt whether you should also install “DNS Server”. As notification says, you have not to install DNS Server in this time. After the installation of Active Directory Domain Service, you will configure Active Directory forrest. In this configuration, configuration wizard asks whether you install DNS server or not.)

After the installation, you will have to reboot server. After reboot, launch dcpromo.exe.

This is welcome window of dcpromo.exe. I’ve chosen “Detailed installation mode”.

In the Windows world, there is some security setting for contemporary client such as Windows Vista and Windows 7. Unfortunately I have not enough knowledge about these security setting, so I chose “Windows 2003” level of security because I suspect that may sysadmin is now using Windows Server 2003 in the real world…

Make new AD-forest.

Specify the name for new AD forest. This name will be the part of FQDN. Each hostname under this AD will be ..

Specify the name for NetBIOS. I don’t know enough knowledge about NetBIOS, but many people says that you should specify same name as forest name.

Specify the level of function for this forest. I chose “Windows 2003” as I wrote just before.

Specify the option for this installation. I chose “DNS Server” because I’ve heard that AD must be worked with DNS. Some guru may know how to work AD without DNS, but I will obey the major myth…

You may see some warning which related to DNS tier. If you have some AD in your network, you may see no warning.

Specify the location for each log. I leaved them default.

Specify the password for “Directory service recovery mode”. If you want to do without your joy, I recommend not to forget.

Installation finished. I rebooted at this point. Machine start to work as Active Directory server.

After the reboot, I created user account for testing.

  1. Install Scientific Linux

As client machine, I installed Scientific Linux 6.0 (x86_64). I included samba packages.

  1. Create /etc/samba/smb.conf

Edit /etc/samba/smb.conf to suit for Active Directry server. I wrote like this.

[global] workgroup = <NetBIOS’s domain name> password server = realm = security = domain idmap backend = tdb idmap uid = 10000-19999 idmap gid = 10000-19999 idmap config : backend = rid idmap config : range = 20000 - 29999 template shell = /bin/bash winbind use default domain = yes winbind offline logon = false dos charset = CP932 unix charset = UTF-8 display charset = UTF-8 You may add sharing option like this.

[nas] path = /home/nas writable = yes 5. Join Linux box to AD forrest

Now, You can join your linux client to Active Directory forest. Issue this command.

net ads join -U Administrator password: <Domain Administrator’s password> You may experience that net command failed to add client’s host name to DNS service. When you experienced, you should add your linux client to DNS manually.

  1. test authentication and see shared file system

You can access shared file system which linux client serves. When you asked user name and password, try them which you’ve set to AD. If everything goes good, you will see shared file system.

  1. using AD authentication for SSH

In addition to share file system, you can use user name and password which you’ve set to AD to some other authentication such as ssh.

First, you have to install winbindd.

yum -y install samba-winbind Next, modify /etc/nsswitch.conf

passwd: files winbind shadow: files winbind group: files winbind Finally, start winbindd service.

chkconfig winbindd on # service winbindd start If you have good experience about system-config-authentication, it may be good to use it. ( I think it is just a little bit confusing… )

Sharing NFSv4 between solaris server and linux client

When you’ve mount NFSv4 filesystem from linux client to solaris server, you may experience user and group goes “nobody”.

First, check proper export setting.

1
share -F nfs -o rw,sec=sys,root=@xxx.xxx.xxx.xxx/24 /filesystem

According to man page of share_nfs, you have to specify proper security and hostname or range of ip address. If you want to set it to ip address, do not forget to set “@” in front of ip address. Otherwise these character is identified as hostname. Again, read man page of share_nfs carefully !

Next, check /etc/idmapd.conf in client.

1
2
[General]
Domain = mydomain

You may set your domain name, I think.

Finally, check the service setting. You also have to proper setting for mount.

1
2
3
rpcbind        	0:off	1:off	2:on	3:on	4:on	5:on	6:off
rpcgssd        	0:off	1:off	2:off	3:on	4:on	5:on	6:off
rpcidmapd      	0:off	1:off	2:off	3:on	4:on	5:on	6:off

Enjoy.

ustreamの録画スクリプトを公開します

公益に資すると思いますのでustreamを見ることができない人、インターネット環境に容易にアクセスできない方に映像を届けることができるように、ustreamの録画スクリプトを公開します。 ダウンロード当初の目的を果たしたと思いますのでダウンロードは停止しました。欲しい方はメールでご連絡ください 使用するためには以下のperlモジュールをインストールしてください。 * utf8

  • Encode
  • Data::Dumper
  • LWP::Simple また以下のコマンドを使用できるようにしてください * rtmpdump 内部でuStreamのDeveloper IDに紐づくAPI keyが入っていますが、そのまま利用いただいて構いません。ただしDeveloper APIの利用は1日に5000回に制限されていますので、可能な限りDeveloper登録をして、API keyを取得し、スクリプト内部のAPI keyを書き換えてください。 uStreamのDeveloper登録は以下のURLから行うことができます http://developer.ustream.tv/home スクリプトについてご不明な点は私までメールいただければできる限り対応します。

今日は自宅サーバにUPSを取り付けた

残念ながら地震の影響で福島原発を含む東京電力の発電能力がかなり低下してしまうようだ。対策を見ていると、どうも近々に復旧の見込みは無いようで、電力が足りないことが長期間続くことになる。政府が節電の呼びかけとともに、輪番停電を実施することを予告している。 確かに節電はやりたい。被災された方には心からお見舞いしたいし、時間の許す限り貢献したいと思う。人によってはこんな時に自宅サーバなんてもってのほかという人もいるだろう。でも現時点で家の中の全てのデータ、メール、インフラの制御を全て自宅サーバにやらせている俺としてはサーバは可能な限り落としたくないものだ。なのでUPSを買って、停電時には自動的にシャットダウンし、復電時には自動的に稼働を開始することにした。 UPSはCyberPower社のBackup CR900(型番: CP900SW JP)を買った。ヨドバシカメラで22,000円程度。出力も540Wと値段にしては非常に大きい。Linuxに対応していることも選択のポイントであった。ただ、実際に試験していると100Wほどの負荷であるのにバッテリの減衰は思った以上に速い。10分保てば御の字、といったところ。それでもその間に正しくシャットダウンし電源を停止すれば、データは守られる。 電源の接続自体はなんのことはない。ソフトウェアはホームページからLinux(32bit/64bitあり)をダウンロードすることができる。俺の場合はtarballをダウンロードしCentOS5.5に入れた。USBケーブルでUPSとサーバを接続する。特に問題なく動作する。(素晴らしい!) UPS運用のキモは自動シャットダウンと復電後の自動起動だと思う。各ハードウェアのBIOS設定(復電時に自動的に電源を入れるようにする)、各VMの起動、起動後のサービス動作確認など、スクリプトを作り込み細かな調整をして何度も試験すべき。最終的に電源を抜いて正常シャットダウン、電源を刺して各サービスまで含めて正常起動するようスクリプトを作り込んだ。停電時、サービス復旧時にはSMSでiPhoneにメールも飛ぶようにした。 こちらの準備はOKだ。いざ停電のある世界へ!

Google Authenticatorで2段階認証を行うことができるらしい

それ、Gentooだとどうなる?: Google Authenticatorを使ってLinuxのログイン(PAM)で二段階認証を試す nunnun’s weblog:Google Authenticatorで2段階認証を行う [Debian] こんどやってみよ

今日はkvmの仮想マシンのバックアップ方法を確認した

先週kvmマシンのHDDがクラッシュし、OS+3つのVMを再インストールするはめになった。毎回やるのもダルいので、せめてVMは一発復旧させたいなあといろいろ調べて、なんか確立したっぽいので以下にメモ。 一応我が家はこれで動いているようですがat your own riskでお願いします。復元できなかったりなんか不具合あっても責任取れません ### バックアップ方法

VMを静止した状態で、設定ファイル、メモリイメージ、仮想ディスクをコピーしておけばいい。ディスクイメージの種類はrawでも、qcow2でもいい。具体的なコマンドにすると以下のような感じ

virsh dumpxml > # virsh save # cp ### リストア方法

OSインストール後以下のような感じにする

cp # virsh define # virsh restore いろいろ調べたけど、kvmの場合Live Backupはできないみたいなんだよね・・・。もちろんVMの中でバックアップ動かすのはありだけど。なんかダルいし。花粉症だし。

今日はflybackのバックアップを整理するスクリプトを作った

flybackはとっても便利だ。少ない容量で大量の期間のバックアップを作成することができる。通常バックアップというと、フルバックアップと差分バックアップで、1週間に一度フル、毎日差分、となると、1週間(7日)のバックアップを維持しようとすると、バックアップ元の2.6倍くらいの容量を確保しておく(異論あるかもしれない。俺は職場でそんなふうに教えられた)ようなところが、同じ容量でより多くの、しかも完全なバックアップを持つことができる。 マイコミジャーナル:あのTime MachineをLinuxで? - バックアップツール「FlyBack」が登場 上の記事を読んでFlybackを使い始めてはや3、4年になるが、確かにより頻繁にバックアップでき、より長期間保存できる。今の所バックアップ元をホームディレクトリ(約3G)、バックアップ先を250Gに指定しているが、ほぼ15〜20ヶ月ほどの2時間ごとのバックアップにさかのぼることができる。しかもどの地点にも更新されていないものも含めて全てのファイルがあり、cpコマンドやtarコマンドなどで簡単にリストアすることができる。すごい。 ただ唯一の欠点は、過去のバックアップの削除は完全に手動になってしまう所。更新されていないファイルはハードリンクになるので、削除しても削除しても容量が減らず、どこまで削除していいかわからないので、今まではえいやで2、3ヶ月まとめて削除していた。ただFlybackのインスパイヤ元のTimemachineはその辺りも考慮されていて、過去のバックアップは適宜間引いて残すようにしている。過去1ヶ月のものは1日おき、それ以前は1週間おき、という感じに。 やっぱりFlybackでも同じことをしたいなあというのが動機。 で、作った。perlスクリプト(ダウンロード)。 注意事項:ある程度テストはしていますが完全に動作する保証はありません。あなたの大切なバックアップが消えても何ら責任は取れません。未実装の機能が若干あります。 cronから実行することを想定してます。コマンドパスはOpenIndiana想定なので環境に合わせて適宜変えていただきたい。Perlモジュールについては各自なんとかしていただきたい。Flyback使ってる人が何人いるのかわからないけど、誰かが便利だなあと思ってくれるとうれしい。

今日はLinuxのCUPSプリントサーバをAirPrintサーバにして、iPhoneからAirPrintで印刷するとPDFファイルが生成されるようにしてみた

ほぼここ(Ryan Finnie’s Blog: AirPrint and Linux)の邦訳になってしまうけど、やってみて、動いたのでやり方を書く。環境はCentOS5.5。 ### 1. まずcups-pdfをインストールする。

rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm # yum -y install cups-pdf 後で使うのでavahi-daemonも入ってなかったら入れておく。

2. CUPSサーバをネットワーク共有するようにして、印刷できる所まで確認する

iptables使っている場合は631/tcp, 631/udpを解放してアクセスできるようにする

/etc/cups/cupsd.confを編集して、ローカルホスト以外からアクセスできるようにする。編集箇所は赤字で記述。

# “$Id: cupsd.conf.in 7199 2008-01-08 00:16:30Z mike $” # # Sample configuration file for the Common UNIX Printing System (CUPS) # scheduler. See “man cupsd.conf” for a complete description of this # file. # MaxLogSize 2000000000 # Log general information in error_log - change “info” to “debug” for # troubleshooting… LogLevel info # Administrator user group… SystemGroup sys root # Only listen for connections from the local machine. # Listen localhost:631 Listen saba.mydomain:631 Listen /var/run/cups/cups.sock # Show shared printers on the local network. Browsing On BrowseOrder allow,deny # (Change ‘@LOCAL’ to ‘ALL’ if using directed broadcasts from another subnet.) BrowseAllow @LOCAL # Default authentication type, when authentication is required… DefaultAuthType Basic # Restrict access to the server… Order allow,deny Allow 192.168.1.0/24 # Restrict access to the admin pages… <Location /admin> Encryption Required Order allow,deny Allow 192.168.1.0/24 # Restrict access to configuration files… <Location /admin/conf> AuthType Default Require user @SYSTEM Order allow,deny Allow 192.168.1.0/24 できたらcupsを動かして、管理ページが見えるか確認。

chkconfig cups on # service cups start http://saba.mydomain:631/をブラウザで開いて、以下のような管理ページが見えればOK。

ターミナルに戻って、CUPS管理ページが使うSSL証明書を作成する。どうも本来は自動的に作成されるみたいだけど、CentOSのデフォルトでは作成しようとしてハングアップしてしまうみたい。ここを参照して、以下のような感じに作成した。

openssl req -new -x509 -keyout /etc/cups/ssl/server.key -out /etc/cups/ssl/server.crt -days 365 -nodes -config /etc/pki/tls/openssl.cnf Generating a 1024 bit RSA private key ..++++++ ………………..++++++ writing new private key to ‘/etc/cups/ssl/server.key’ —– You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter ‘.’, the field will be left blank. —– Country Name (2 letter code) [GB]:JP State or Province Name (full name) [Berkshire]:Tongking Locality Name (eg, city) [Newbury]:Setaganya Organization Name (eg, company) [My Company Ltd]:orenocompany Organizational Unit Name (eg, section) []: Common Name (eg, your name or your server’s hostname) []:saba.mydomain Email Address []:root@saba.mydomain 再度ブラウザに戻って、プリンタを作成していなければ作成する。最終的に以下のような感じになっていればいいと思う。デフォルトプリンタにするかどうかは関係ないっぽい。

ここまでできたら他のPCから印刷できるかどうか確認する。ここではMac(Mac OS X 10.6.6)を使った。

3. AirPrint対応のプリンタを作成する

ここまででCUPSで作成したプリンタをPCで共有できるようになったので、そのプリンタをiPhoneのAirPrint対応にする。

AirPrintはマルチキャストDNS(mDNS。BonjourとかAvahiとか)でプリンタを発見するようだ。CUPSもAvahi経由でmDNS経由でプリンタとして見えてはいるが、そのままではAirPrintが見つけてくれないので、若干設定を追加してやる必要がある。

まずはmDNSで見えるプリンタの情報を取得するために、avahi-discoverを使う。CentOSの場合はavahi-toolsを入れれば使えるようになる。

yum -y install avahi-tools で、avahi-discoverを起動する。Xのウィンドウが出てくる。

avahi-discover

eth0 IPv4 -> local -> Internet Printer の下に、作成したプリンタがある。これをクリックする。

表示が変わるが、これだと後で加工しにくいので、ターミナルに出ている文字の方を使う。以下のような感じ。(適宜改行を入れてます)

Service data for service ‘CUPS-PDF Printer @ saba.mydomain’ of type ‘_ipp._tcp’ in domain ’local’ on 2.0: Host cups.local (192.168.2.5), port 631, TXT data: [ ‘org.freedesktop.Avahi.cookie=3326001564’, ‘pdl=application/pdf,application/postscript,application/vnd.cups-raster,application/octet-stream,image/png’, ‘Duplex=T’, ‘Color=T’, ‘Binary=T’, ‘Transparent=T’, ‘printer-type=0x301E’, ‘printer-state=3’, ‘product=(PostScript Printer)’, ’note=saba.mydomain’, ’ty=Generic PostScript Printer Foomatic/Postscript (recommended)’, ‘rp=printers/pdfprinter’, ‘qtotal=1’, ’txtvers=1’] 上記の出力を参考にして、/etc/avahi/services/<名前>.serviceを作る。<名前>の部分はなんでもいい。以下のような感じ。

注意点としては

  • txt-recordを書く順番はavahi-discoverの出力順の逆
  • txt-recordの最後にURF=noneを入れる

service avahi-daemon restart そうしたらiPhoneからプリンタが見えてるかどうか確認して、印刷!

Enjoy!

今日でkvm環境への移行が完了した

いままでOpenSolaris+VirtualBox環境でやってたけど、2個以上VM立てると時計が進まなくなったりしてたので、ストレージはOpenIndiana、いろんなサーバはCentOS,KVMでやってみることにして、今日ほぼ元の状態まで戻した。KVM超いい。3つほどVM立ててもメモリぜんぜん食わないし時計はちゃんと進むし.iSCSIでやってみたかったけどなんかよくわかんないので今後の課題かな・・・。あとはOpenIndianaでSambaがちゃんと動けばパフォーマンスもいいのでちょっと動向をウォッチしつつとりあえず放置かなあ・・・。

それにしてもscreenコマンドが便利過ぎる

いままではnohup command > log 2>&1 &とかしてたけど、screenコマンドを思い切って使い始めてからあっというまに手放せなくなった。出かける時には[Ctrl]+[a],[d]でデタッチしておいて、帰ってきたらscreen -rで元の画面を呼び出せる。超便利。 @IT: ターミナルを切り替えて使えるscreenコマンドとは

flybackは過去のバックアップを消すのがめちゃくちゃ時間がかかる

きっかけはバックアップ先のzfsボリュームがフルになったので、昔のものを減らそうかなと、rm -rf ./2009とかしたら3日経っても終わらないorz。別にそんなに大層なほどやってないんだけどなファイル数30,000弱、ディレクトリ数3,000弱のホームディレクトリなんだが。2009年8月〜2009年12月の毎日2時間に1回なんで、12305(30000 or 3000)で5,400万ファイル(ほとんどがハードリンク)、540万ディレクトリか。rmのパフォーマンスが悪いだけなんだろうか?

今日はリポジトリサーバが壊れた

LVMでディスク全体を追加して再起動したらLV再構成できず起動してこなくなった。現在データ修復中。I/O Intensiveな作業はどうしても待ち時間が多くなる。しょうがないからバイトヘルでもするか。 ・・・そういえばzfsってその辺のメタデータ管理ってどこでやってるんだ?と調べたら、vdevの先頭とお尻に4つ書かれるようだ(PDF注意)。パーティションテーブルはいじってないと。やっぱzfsがいいなあ。

ネットワークの帯域幅を計測するのはNetPIPEがいいみたい

pingpongよりもいいらしい。よくわかんないけど結構使っている人も多いようだ。CentOSならdagリポジトリに入ってるのでインストールも簡単。 使い方は、まず受信(?)側で # NPtcp としておいて、送信(?)側で # NPtcp -h <受信側ホスト名> とすればいい。だららっと出力が出る。こんな感じ。両方ともギガイーサだから900Mbpsでるんだな。普段こんな帯域お目にかかったことがないけど。 Send and receive buffers are 16384 and 87380 bytes (A bug in Linux doubles the requested buffer sizes) Now starting the main loop 0: 1 bytes 1355 times –> 0.10 Mbps in 72.74 usec 1: 2 bytes 1374 times –> 0.21 Mbps in 72.76 usec 2: 3 bytes 1374 times –> 0.31 Mbps in 72.93 usec (中略) 121: 8388605 bytes 3 times –> 890.35 Mbps in 71882.16 usec 122: 8388608 bytes 3 times –> 890.15 Mbps in 71898.33 usec 123: 8388611 bytes 3 times –> 890.33 Mbps in 71883.49 usec

今日はkickstartでxenカーネルを入れるようにした

だんだん本題に入りつつある。先日作成したkickstartファイルを編集して、インストール時にxenカーネルを入れるようにする。起動時にど のカーネルで上がるようにするかは明示していないが、xenカーネルしかインストールしなければxenカーネルで上がってくるようだ。以下 kickstartファイル。赤字が変更部分。 # cat /var/www/html/ks_cent54.cfg # Kickstart file automatically generated by anaconda. install #cdrom url –url http://172.16.0.1/dist repo –name=released –baseurl=http://172.16.0.1/dist repo –name=ore –baseurl=http://172.16.0.1/ore lang en_US.UTF-8 #keyboard jp106 keyboard us network –device eth0 –bootproto dhcp #rootpw –iscrypted $1$.DqY.ln7$yOJvWGbmFjuU6aiPwF9KA0 rootpw password firewall –enabled –port=22:tcp authconfig –enableshadow –enablemd5 selinux –disabled timezone Asia/Tokyo bootloader –location=mbr –driveorder=hda # The following is the partition information you requested # Note that any partitions you deleted are not expressed # here so unless you clear all partitions first, this is # not guaranteed to work clearpart –all –drives=sda part /boot –fstype ext3 –size=100 –ondisk=sda part pv.2 –size=0 –grow –ondisk=sda volgroup VolGroup00 –pesize=32768 pv.2 logvol swap –fstype swap –name=LogVol01 –vgname=VolGroup00 –size=768 –grow –maxsize=1536 logvol / –fstype ext3 –name=LogVol00 –vgname=VolGroup00 –size=1024 –grow %packages @admin-tools @base @core @development-libs @development-tools @editors @ftp-server @java @java-development @legacy-network-server @legacy-software-development @legacy-software-support @mail-server @network-server @ruby @server-cfg @system-tools @text-internet @web-server @smb-server -kernel -kernel-PAE kernel-xen kmod-atl1e-xen xen libvirt virt-manager keyutils kexec-tools trousers fipscheck device-mapper-multipath perl-Convert-ASN1 imake audit

今日は細かいところを整理してみた(my homebrewed cluster part.4)

前回でだいたいできたけど、今日は細かいところを少し整理した。 やること 2.
2. IPアドレスを固定で振りたい。IPアドレスのアサイン自体はDHCPサーバでやりたいけど、MACアドレス見て固定で割り付けたい。DHCPサーバにあと登録していないMACアドレスからのDHCP要求は無視するようにしたい 4. PXEブート時に放っておいたらローカルのHDDから起動するようにしたい。そうするとOS配布用サーバを生かしたままクライアントを起動しても起動時間が少し長くなるだけでオッケイになるので。前回の宿題事項だったので。

じゃあ逝ってみようか! 1.DHCPサーバでIPアドレスを固定する

/etc/dhcpd.confで設定する。赤字が該当部分。

cat /etc/dhcpd.conf ddns-update-style interim; ignore client-updates; deny unknown-clients; # ここで登録していないMACアドレスからの要求は拒否する・・・と思う。多分。 default-lease-time 21600; max-lease-time 43200; allow booting; allow bootp; subnet 172.16.0.0 netmask 255.255.0.0 { # — default gateway option routers 172.16.0.1; option subnet-mask 255.255.0.0; range 172.16.10.1 172.16.10.254; default-lease-time 21600; max-lease-time 43200; host cluster0_1 { hardware ethernet 0:26:18:d2:85:72; fixed-address 172.16.10.1; } host cluster0_2 { hardware ethernet 0:26:18:d2:85:82; fixed-address 172.16.10.2; } host cluster0_3 { hardware ethernet 0:26:18:d2:85:9c; fixed-address 172.16.10.3; } class “pxeclients” { match if substring(option vendor-class-identifier, 0, 9) = “PXEClient”; next-server 172.16.0.1; filename “linux-install/pxelinux.0”; } } 書いたらservice dhcpd restartでdhcpdを再起動。登録していないMACからのIP割当要求はこんなかんじにignoreしていた。/var/log/messages抜粋。3行目は他のDHCPサーバ(Opensolaris上のDHCPサーバ。192.168.2.12。)が要求に答えている様子、なのかな?

Jan 31 21:51:28 localhost dhcpd: DHCPDISCOVER from 00:1b:63:34:e5:58 via eth1: unknown client Jan 31 21:51:29 localhost dhcpd: DHCPDISCOVER from 00:1b:63:34:e5:58 via eth1: unknown client Jan 31 21:51:30 localhost dhcpd: DHCPREQUEST for 192.168.2.35 (192.168.2.12) from 00:1b:63:34:e5:58 via eth1: ignored (not authoritative). 2.PXEブート時に放っておいたらローカルのHDDから起動するようにしたい

前回うまくいかなかったところを直した。結果で言うと、localbootじゃなくて、chain.c32を使えばいいみたい。まずchain.c32を/tftpbootにコピーする。

cp /usr/lib/syslinux/chain.c32 /tftpbot/linux-install 以下修正した/tftpboot/linux-install/pxelinux.cfg/defaultの内容。赤字が修正部分。

cat default default local timeout 100 prompt 1 display msgs/boot.msg F1 msgs/boot.msg F2 msgs/general.msg F3 msgs/expert.msg F4 msgs/param.msg F5 msgs/rescue.msg F7 msgs/snake.msg label local # localboot 1 # chain.c32 hd# [partition_no]と指定する。partition_noを省略するとMBRが呼び出されるみたい kernel chain.c32 append hd0 label 0 # localboot 1 kernel chain.c32 append hd0 label 1 kernel CentOS4.5/vmlinuz #append initrd=CentOS4.5/initrd.img ramdisk_size=8419 method=http://172.16.0.1/dist ip=dhcp append initrd=CentOS4.5/initrd.img ramdisk_size=8419 ksdevice=eth0 ks=http://172.16.0.1/ks_cent54.cfg devfs=nomount ip=dhcp 3.報告書作成


これこれ

4.脳内反省会

次にいこうかもうちょっといろいろ周辺を整理しようか悩む・・・。やるとすれば、DNS, NTPを追加で立てるべきかな・・・。あと192.168.2.x〜172.16.x.xを透過的に通すようにすべきか・・・。う〜ん。

今日はベニヤサーバにOSを入れてみた(my homebrewed cluster part.2)

  1. 今日はOSを入れるぜ

前回まででハードウェアは大体組めた。現状は以下のような構成になっている。

draw100104-1

まずはCentOSでpxeboot&kickstartでOSのインストールをできるだけ省力化しようと努力してみた。

  1. インストールサーバの準備

2.1. CentOS5.4をVirtualBox上の仮想サーバとして作る

Macbookから、“ssh -X user@opensolaris"としてログインし、VirtualBoxを起動してXをMacbookに飛ばしてくる。Mac超便利!とりあえずディスクサイズは最大20GBの可変サイズで作成。

作成後は一旦シャットダウン。ネットワークデバイスをブリッジ接続にしてブート。

2.2. インストール用リポジトリを展開する

インストールできたら、インストールに使用したDVDから、ネットワークインストール用に内容をコピーする。

mount -o ro /dev/cdrom /media/cdrom # mkdir -p /var/www/html/dist # cd /media/cdrom # tar cf - . | ( cd /var/www/html/dist ; tar xvf - ) ブラウザからhttp://virtualserver/dist/で内容が見れることを確認。

2.3. TFTPサーバを構成する

Red Hat(CentOS)にはsystem-config-netbootというGUIツールで比較的容易にTFTPサーバを構成できるツールがあるのでこれを使ってみる。

yum –disablerepo=* –enablerepo=c5-media install system-config-netboot* で、インストールしたら"system-config-netboot"で起動。

sc100104-1

“Network Install"を選択。

sc100104-2

[Operating system identifier], [Description]には識別可能な文字列 [Select protocol for installation]は"HTTP” [kickstart]は(とりあえず今は)空欄 [Server IP Address]にはHTTPサーバのIPアドレス(この場合は172.16.0.1)※OKボタンを押した時点でここにHTTPで到達可能なようにしておくこと。 [Location]はDocumentRootからの相対アドレス

を書く。で、OK。

次はクライアント側。

sc100104-3

ここはクライアント側のIPアドレスだけ入れてOK。

できあがったtftpdの設定は以下のようになっている。

cat /tftpboot/linux-install/pxelinux.cfg/default default local timeout 100 prompt 1 display msgs/boot.msg F1 msgs/boot.msg F2 msgs/general.msg F3 msgs/expert.msg F4 msgs/param.msg F5 msgs/rescue.msg F7 msgs/snake.msg label local localboot 1 label 0 localboot 1 label 1 kernel nodeA/vmlinuz append initrd=nodeA/initrd.img ramdisk_size=8419 method=http://172.16.0.1/dist ip=dhcp ここにある"nodeA/vmlinuz”, “nodeA/initrd.img"はそれぞれ”/tftpboot/linux-install"からの相対パスになっている。

2.4. DHCPサーバを構成する

次にDHCPサーバを構成する。まずはインストール。

yum –disablerepo=* –enablerepo=c5-media install dhcp # cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf cp: overwrite `/etc/dhcpd.conf’? y /etc/dhcpd.confを編集する。赤字部分がpxebootに関係する部分。

ddns-update-style interim; ignore client-updates; allow booting; allow bootp; default-lease-time 21600; max-lease-time 43200; subnet 172.16.0.0 netmask 255.255.0.0 { option routers 172.16.0.1; option subnet-mask 255.255.0.0; range 172.16.10.1 172.16.10.254; default-lease-time 21600; max-lease-time 43200; class “pxeclients” { match if substring(option vendor-class-identifier, 0, 9) = “PXEClient”; next-server 172.16.0.1; filename “linux-install/pxelinux.0”; } } ここまできたら、dhcpdとtftpdを動かす。

chkconfig dhcpd on # /etc/init.d/dhcpd start # chkconfig tftp on # chkconfig xinetd on # /etc/init.d/xinetd restart クライアント側は事前にPXE起動できるようBIOS設定しておく。キーボード、ネットワークケーブル、VGAモニタをつけて電源を入れる。以下のような画面が出れば成功。[1]キーをタイプして"nodeA"のブートプロセスに移行する。

cimg1358

ただしこのままブートプロセスを進めると、以下のように通常のインストールになってしまうので、次はkickstartの設定を追加する。

cimg1359

2.5. kickstartファイルを用意する

kickstartファイルはインストールサーバをインストールした時に/rootにできているanaconda-ks.cfgをベースに少し変更する。赤字部分が変更したところ。

Kickstart file automatically generated by anaconda. install #cdrom url –url http://172.16.0.1/dist lang en_US.UTF-8 keyboard jp106 network –device eth0 –bootproto dhcp #rootpw –iscrypted $1$J1wcQuxw$sfIj335v9EAHSm1Kct9UU1 rootpw password firewall –enabled –port=22:tcp authconfig –enableshadow –enablemd5 selinux –disabled timezone Asia/Tokyo bootloader –location=mbr –driveorder=hda # The following is the partition information you requested # Note that any partitions you deleted are not expressed # here so unless you clear all partitions first, this is # not guaranteed to work #clearpart –all –drives=hda clearpart –all –drives=sda part /boot –fstype ext3 –size=100 –ondisk=sda part pv.2 –size=0 –grow –ondisk=sda volgroup VolGroup00 –pesize=32768 pv.2 logvol swap –fstype swap –name=LogVol01 –vgname=VolGroup00 –size=768 –grow –maxsize=1536 logvol / –fstype ext3 –name=LogVol00 –vgname=VolGroup00 –size=1024 –grow %packages @admin-tools @base @core @dns-server @development-libs @development-tools @editors @ftp-server @java @java-development @legacy-network-server @legacy-software-development @legacy-software-support @mail-server @network-server @ruby @server-cfg @system-tools @text-internet @web-server @smb-server keyutils kexec-tools trousers fipscheck device-mapper-multipath perl-Convert-ASN1 imake audit で、これを/var/www/html以下におく。

mv ks_cent54.cfg /var/www/html # chmod 644 /var/www/html/ks_cent54.cfg で、/tftpboot/linux-install/pxelinux.cfg/defaultを編集する。赤字が変更部分。

default local timeout 100 prompt 1 display msgs/boot.msg F1 msgs/boot.msg F2 msgs/general.msg F3 msgs/expert.msg F4 msgs/param.msg F5 msgs/rescue.msg F7 msgs/snake.msg label local localboot 1 label 0 localboot 1 label 1 kernel nodeA/vmlinuz # append initrd=nodeA/initrd.img ramdisk_size=8419 method=http://172.16.0.1/dist ip=dhcp append initrd=nodeA/initrd.img ramdisk_size=8419 ksdevice=eth0 ks=http://172.16.0.1/ks_cent54.cfg devfs=nomount ip=dhcp これで変更はおわり。クライアント側をもう一度起動してみる。

  1. じゃあクライアントにインストールしてみる→失敗する訳だがorz

で、クライアントを起動してみると、kickstartファイルの読み込みに失敗する。(ハードウェアの構成によってはここで読み込める人もいるかもしれない。その人はここで終わり。Enjoy!)

cimg1361

で、[Alt]+[F4]キーでログを見てみると、ネットワークデバイスドライバが読み込めていないのでネットワークに繫げられていないことがわかる。

そういえば前回、ネットワークカードの設定をしながら「これってAtherosのネットワークチップなんだ・・・」と思っていたが。で、マザーボード(P5KPL-AM EPL)のメーカーAsusのホームページを見てみると、Linux用にドライバが用意されている。おお!これ組み込めばいいんじゃね?となる。

  1. ネットワークドライバをpxebootで使用するinitrd.imgに追加する

以下さらっと書いてますがかなり試行錯誤しました・・・。

まずASUSのページからダウンロードしたドライバをインストールサーバにおいて、展開する。

mac$ scp LinuxDrivers.zip root@instserver:/root root@instserver’s password: LinuxDrivers.zip 100% 4586KB 4.5MB/s 00:01 mac$ ssh root@instserver root@instserver’s password: Last login: Mon Jan 4 22:53:51 2010 from mac # ls anaconda-ks.cfg install.log install.log.syslog LinuxDrivers.zip # unzip LinuxDrivers.zip 展開先のディレクトリに移動し、ドライバをmakeする。本来は不要なmake installまでやってるが、ここで変更される内容を後で参照するため。もしかしたらmake installしなくてもいい方法があるのかもしれないがよくわかんない。

cd LinuxDrivers/Lan/src # make make -C /lib/modules/2.6.18-164.el5/build SUBDIRS=/root/LinuxDrivers/Lan/src modules make[1]: Entering directory /usr/src/kernels/2.6.18-164.el5-i686' CC [M] /root/LinuxDrivers/Lan/src/at\_main.o CC [M] /root/LinuxDrivers/Lan/src/at\_hw.o CC [M] /root/LinuxDrivers/Lan/src/at\_param.o CC [M] /root/LinuxDrivers/Lan/src/at\_ethtool.o CC [M] /root/LinuxDrivers/Lan/src/kcompat.o LD [M] /root/LinuxDrivers/Lan/src/atl1e.o Building modules, stage 2. MODPOST CC /root/LinuxDrivers/Lan/src/atl1e.mod.o LD [M] /root/LinuxDrivers/Lan/src/atl1e.ko make[1]: Leaving directory /usr/src/kernels/2.6.18-164.el5-i686’ # make install make -C /lib/modules/2.6.18-164.el5/build SUBDIRS=/root/LinuxDrivers/Lan/src modules make[1]: Entering directory /usr/src/kernels/2.6.18-164.el5-i686' Building modules, stage 2. MODPOST make[1]: Leaving directory /usr/src/kernels/2.6.18-164.el5-i686’ gzip -c ../atl1e.7 > atl1e.7.gz # remove all old versions of the driver find /lib/modules/2.6.18-164.el5 -name atl1e.ko -exec rm -f {} ; || true find /lib/modules/2.6.18-164.el5 -name atl1e.ko.gz -exec rm -f {} ; || true install -D -m 644 atl1e.ko /lib/modules/2.6.18-164.el5/kernel/drivers/net/atl1e/atl1e.ko /sbin/depmod -a || true install -D -m 644 atl1e.7.gz /usr/share/man/man7/atl1e.7.gz man -c -P’cat > /dev/null’ atl1e || true # 次にpxebootで使われるinitrd.imgをほどく。

cd /tftpboot/linux-install/nodeA/ # mkdir initrd # cd initrd # zcat ../initrd.img | cpio -i -c # ls bin dev etc init modules proc sbin selinux sys tmp var # さらにmodules以下にある、各ファイルに変更をくわえる。 まずはドライバ本体(atl1e.ko)をmodules.cgzアーカイブにくわえる。

cd modules # ls module-info modules.alias modules.cgz modules.dep pci.ids # mkdir modulesdir # cd modulesdir # zcat ../modules.cgz | cpio -idv # ls 2.6.18-164.el5 # cd 2.6.18-164.el5/i686/ # cp /root/LinuxDrivers/Lan/src/atl1e.ko . # chmod 744 atl1e.ko # cd ../.. # find .| cpio -c -o | gzip -c9 > ../modules.cgz 27112 blocks # cd .. # rm -rf ./modulesdir # 次に、module-info, modules.alias, modules.dep, pci.idsの各ファイルに適切なエントリを追加する。何が適切かってのは参照するところがあるので以下参照。

まずはmodule-info。赤字が追加内容。インデントのスペースは実際にはタブです。追加の3行目はどんな文字でもいいのかもしれない。よくわかんない。

(前略) ata_piix scsi “Intel PIIX/ICH ATA controllers” atl1e eth “Atheros Gigabit Ethernet” atmel_cs eth “Atmel at76c50x 802.11 PCMCIA wireless ethernet” (後略) 次にmodules.alias。まずは追加する内容を以下のように確認する。赤字部分がそれ。

grep atl1e /lib/modules/2.6.18-164.el5/modules.alias alias pci:v00001969d00001026svsdbcsci* atl1e # で、pxeboot側のmodules.aliasを編集。赤字が追加内容。

alias pci:v00008086d00007010svsdbcsci* ata_piix alias pci:v00001969d00001026svsdbcsci* atl1e alias pcmcia:mcffnpfnpaB474D43Apb6B1FEC94pcpd* atmel_cs 次にmodules.dep。まずは確認。赤字部分がそれ。

grep atl1e /lib/modules/2.6.18-164.el5/modules.dep /lib/modules/2.6.18-164.el5/kernel/drivers/net/atl1e/atl1e.ko: 依存モジュールはないという意味だと思われたので、pxeboot側のmodules.depは特に変更せず。

最後にpci.ids。まずは確認。赤字部分がそれ。

grep atl1e /lib/modules/2.6.18-164.el5/modules.pcimap atl1e 0x00001969 0x00001026 0xffffffff 0xffffffff 0x00000000 0x00000000 0x0 赤字部分を以下のように追加する。インデントのスペースは実際にはタブです。

(前略) 18ca XGI Technology Inc. (eXtreme Graphics Innovation) 0020 Z7/Z9 (XG20 core) 0040 Volari V3XT/V5/V8 1969 Atheros Corp. 1026 Atheros Gigabit Ethernet 197b JMicron Technology Corp. (後略) 最後にinitrd.imgを再作成する。

find .| cpio -c -o | gzip -c9 > ../initrd.img 27809 blocks # これでおしまい。

  1. クライアントインストール再挑戦→成功!

クライアントを再度poweronして、pxebootする。うまく行けばanacondaのStage2まで移行して、インストールが開始される。

cimg1369

後は再起動を促す表示が出たら、再起動。

ただしpxebootを有効にしておくと、再起動後またインストール前の画面になり、通常であれば10秒待てばHDDからブートするはずだがブートしない。これはよくわかんなかった。要調査。とりあえずはdhcpdのpxeclients部を無効にしておけばいい。こんな感じ。/etc/init.d/dhcpd restartも忘れずに。

ddns-update-style interim; ignore client-updates; #allow booting; #allow bootp; default-lease-time 21600; max-lease-time 43200; subnet 172.16.0.0 netmask 255.255.0.0 { option routers 172.16.0.1; option subnet-mask 255.255.0.0; range 172.16.10.1 172.16.10.254; default-lease-time 21600; max-lease-time 43200; # class “pxeclients” { # match if substring(option vendor-class-identifier, 0, 9) = “PXEClient”; # next-server 172.16.0.1; # filename “linux-install/pxelinux.0”; # } } クライアントがインストールしたOSでブートすれば完了。

  1. 報告書作成

これ書いた。

  1. 脳内反省会

  • 疲れた・・・
  • 世の中に情報あんまりないですね・・・
  • HDDブートできるようにしたいなあ・・・
  • インストール時にatl1eドライバも入れたい
  • 他のリポジトリも同時にインストールできるようにしたいなあ こんな感じ!?

topコマンドで出るステータスがちょっと変わっているような気がする

top output us -> User sy -> system ni -> nice id -> idle wa -> iowait hi -> H/w interrupt requests si -> S/w interrupt requests hiとsiって昔はなかったような気がしたけど・・・気のせいかもしれない

ffmpegとImageMagickでよいアニメーションGIFを作る

普通にffmpegでアニメーションGIFを作成すると、カラーマップ固定で作成されて画質が残念クオリティになるのでいろいろ調べてやっつけてみた。まるで実用的じゃない&誰得感否めないがネタ重視で。 こんな感じで。 $ mkdir /hayaidisk $ export MAGICK_TMPDIR="/hayaidisk" $ ffmpeg -i inputfile -an -r 15 -bt 1024k -f mpeg1video -vcodec pam -s 320x240 - | convert -delay 1x15 -loop 0 -limit memory 64 -limit map 128 mpg: - gif: out.gif これでconvertがちゃんと色を最適化したアニメーションGIFを作成してくれる。ディスクの許す限りどれだけ長いアニメーションもOKだぜ!エンコード死ぬほど遅いけどね・・・。

unionmountというものができるらしい。これから。

aufsのページで知った。MLのやりとりを見てるとVFSの上でUnionFSを再実装するような話になっているみたい。なるほど。そしてここにもChristoph Hellwigさんがw。頑張るなぁこの人。 Google SoCでやってるのか。 unionfs-fuseでいいのかもしれないけど。なぜかcp -al が動かないんだよね・・・。コード見てると動きそうな感じもするんだけどなぁ。とりあえずworkaroundとして、素直にFreeBSDにするというのもありかもなー。

どうもネットワーク設定はプロファイル化できるようだった

http://www.linuxhomenetworking.com/forums/showthread.php?t=15822 激しく昔からそうなっていることがわかってorz。正直最近までいちいち設定変えてた。なんというゆとり

flybackはやっぱり素敵かもしれない

いつもFedoraはVMware上で使ってるけど、そこで見たファイルをどこかで使いたい時にいつのまにか鯖側にコピーされているというのはとてもいいかもしれない!この知らない間にイイ感じになっている感がいいね〜。やっぱりコンピュータってのはこうでないと!

iphone用に動画をffmpegでエンコードする

チラ裏的に。 ffmpeg -threads 4 -i -r 29.97 -vcodec libx264 -s 480x272 -flags +loop -cmp +chroma -deblockalpha 0 -deblockbeta 0 -crf 24 -bt 256k -refs 1 -coder 0 -me umh -me_range 16 -subq 5 -partitions +parti4x4+parti8x8+partp8x8 -g 250 -keyint_min 25 -level 30 -qmin 10 -qmax 51 -trellis 2 -sc_threshold 40 -i_qfactor 0.71 -acodec libfaac -ab 128k -ar 48000 -ac 2 こんなのエンコードしてる 【ニコニコ動画】【100MB版】THE IDOLM@STER WAKAMURA RECYCLE VOL.02 (meets Perfume)高画質版+おまけ付 すげぇ。アイドルマスターもPerfumeも知らないけど余裕でお金出すよ!Perfumeにも興味出るね!ニコニコやっぱすげーよ。才能集まりすぎ! more チラ裏の裏。 でも未だにPSGでピコピコ音はさすがにアレというか。最近のゲーム音楽の人はけっこうすごいよ。 こんなのとか 【ニコニコ動画】ファイナルファンタジータクティクス 戦闘曲とか FFT こんなのとか 【ニコニコ動画】浜渦正志のバトルメドレー すげーかっけー。ゲームミュージックサイコー!!