<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>餅乾隨筆 &#187; FreeBSD</title>
	<atom:link href="http://blog.cookys.org/category/computer/freebsd/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.cookys.org</link>
	<description>重生的部落</description>
	<lastBuildDate>Tue, 04 May 2010 14:28:25 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>用 ramdisk 加速 freebsd 編譯 ports 的速度</title>
		<link>http://blog.cookys.org/2010/05/04/336/</link>
		<comments>http://blog.cookys.org/2010/05/04/336/#comments</comments>
		<pubDate>Tue, 04 May 2010 14:24:28 +0000</pubDate>
		<dc:creator>cookys</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Maintain]]></category>
		<category><![CDATA[Freebsd Ports]]></category>

		<guid isPermaLink="false">http://blog.cookys.org/?p=336</guid>
		<description><![CDATA[剛剛在很苦命的編譯 ports , 機八鴨提供了一個很有用的方式，就是把編譯過程中會產出的 object file 全都塞到 RAMDISK 中(反正現在 RAM 都很大也不知道拿來做什麼)，加上 FreeBSD 8 的 ports 開始支援多核心的 make jobs 編譯，速度可說真是飛快。
作法很簡單：
先蓋一個 RAMDISK （這裡是開 512M, 可以自己調整）
/sbin/mdmfs -M -S -o async -s 512m md0 /tmp/portsobj
然後讓他能寫入
/bin/chmod 777 /tmp/portsobj
接下來去 /etc/make.conf 把 obj 會產生的目錄指過去
WRKDIRPREFIX=/tmp/portsobj
然後去編看看，就會發現速度差很多。
然後懶人大法當然是要 shell script 一下：
#!/bin/sh
case &#8220;$1&#8243; in
create)
/sbin/mdmfs -M -S -o async -s 512m md0 /tmp/portsobj
/bin/chmod 777 /tmp/portsobj
echo &#8220;512M ramdisk created [...]]]></description>
			<content:encoded><![CDATA[<p>剛剛在很苦命的編譯 ports , <a href="http://blog.dkqk.net/">機八鴨</a>提供了一個很有用的方式，就是把編譯過程中會產出的 object file 全都塞到 RAMDISK 中(反正現在 RAM 都很大也不知道拿來做什麼)，加上 FreeBSD 8 的 ports 開始支援多核心的 make jobs 編譯，速度可說真是飛快。</p>
<p>作法很簡單：</p>
<p>先蓋一個 RAMDISK （這裡是開 512M, 可以自己調整）</p>
<blockquote><p>/sbin/mdmfs -M -S -o async -s 512m md0 /tmp/portsobj</p></blockquote>
<p>然後讓他能寫入</p>
<blockquote><p>/bin/chmod 777 /tmp/portsobj</p></blockquote>
<p>接下來去 /etc/make.conf 把 obj 會產生的目錄指過去</p>
<blockquote><p>WRKDIRPREFIX=/tmp/portsobj</p></blockquote>
<p>然後去編看看，就會發現速度差很多。<br />
然後懶人大法當然是要 shell script 一下：</p>
<blockquote><p>#!/bin/sh</p>
<p>case &#8220;$1&#8243; in<br />
create)<br />
/sbin/mdmfs -M -S -o async -s 512m md0 /tmp/portsobj<br />
/bin/chmod 777 /tmp/portsobj<br />
echo &#8220;512M ramdisk created on md0 and mounted on /tmp/portsobj&#8221;<br />
exit 0<br />
;;<br />
destory)<br />
/sbin/umount /tmp/portsobj<br />
/sbin/mdconfig -d -u 0<br />
echo &#8220;ramdisk umounted from /tmp/portsobj and destory from md0&#8243;<br />
;;<br />
*)<br />
echo &#8220;Usage: `basename $0` {create|destory}&#8221; &gt;&amp;2<br />
exit 64<br />
;;<br />
esac</p></blockquote>
<p>然後<a href="http://blog.dkqk.net/">機八鴨</a>還好心建議不要直接打 make install clean 而是用先用 pkg_add 把 package 裝完，然後再用 portmaster -bDGtw -m FORCE_PKG_REGISTER=yes 來升級，那他每次在編完每一個 ports 後都會自動清掉 obj 而不是像原本的 ports system 會全部裝完成功後才 clean。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.cookys.org/2010/05/04/336/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>pf.conf + pppoe 造成錯誤而無法載入 pf rule 的解法</title>
		<link>http://blog.cookys.org/2009/09/10/328/</link>
		<comments>http://blog.cookys.org/2009/09/10/328/#comments</comments>
		<pubDate>Wed, 09 Sep 2009 20:20:41 +0000</pubDate>
		<dc:creator>cookys</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[pf freebsd]]></category>

		<guid isPermaLink="false">http://blog.cookys.org/?p=328</guid>
		<description><![CDATA[如果遇到 PF + PPPOE 一起混著用的時候，又有 Lan connection ，有時候會開起來後 pf rule 完全沒被載入。這問題的起因就是，當 pf 先載入的時候 PPPOE client 還沒有把 daemon 跑起來，除了不知道 gateway 的 IP 外有可能連 Interface 都還沒出現。如果是 Interface 還沒出現的話，只要把該 interface (通常 pppoe 會是 tun0) 用括號包起來，像是：
ext_if_fttb=&#8221;tun0&#8243;
nat on $ext_if_fttb inet from $internal_net to {!$internal_net,!$sparq_net} -&#62; ($ext_if_fttb)
這樣 pf 就不會檢查 $ext_if_fttb 是不是存在，而如果有用到 PPPOE 的 gateway 的話則可以換成：
gw_if_fttb=&#8221;(tun0:peer)&#8221;
這樣就不用每次重開完之後還要手動進去 pfctl -f /etc/pf.conf 了。
]]></description>
			<content:encoded><![CDATA[<p>如果遇到 PF + PPPOE 一起混著用的時候，又有 Lan connection ，有時候會開起來後 pf rule 完全沒被載入。這問題的起因就是，當 pf 先載入的時候 PPPOE client 還沒有把 daemon 跑起來，除了不知道 gateway 的 IP 外有可能連 Interface 都還沒出現。如果是 Interface 還沒出現的話，只要把該 interface (通常 pppoe 會是 tun0) 用括號包起來，像是：</p>
<blockquote><p>ext_if_fttb=&#8221;tun0&#8243;<br />
nat on $ext_if_fttb inet from $internal_net to {!$internal_net,!$sparq_net} -&gt; ($ext_if_fttb)</p></blockquote>
<p>這樣 pf 就不會檢查 $ext_if_fttb 是不是存在，而如果有用到 PPPOE 的 gateway 的話則可以換成：</p>
<blockquote><p>gw_if_fttb=&#8221;(tun0:peer)&#8221;</p></blockquote>
<p>這樣就不用每次重開完之後還要手動進去 pfctl -f /etc/pf.conf 了。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.cookys.org/2009/09/10/328/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>莫名其妙被婊</title>
		<link>http://blog.cookys.org/2008/11/26/309/</link>
		<comments>http://blog.cookys.org/2008/11/26/309/#comments</comments>
		<pubDate>Tue, 25 Nov 2008 20:21:18 +0000</pubDate>
		<dc:creator>cookys</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Network]]></category>

		<guid isPermaLink="false">http://blog.cookys.org/?p=309</guid>
		<description><![CDATA[在 FreeBSD 7.1 PRELEASE 底下做比較複雜的網路環境，結果要讓 rsync + ssh 從其他網路跑進來撈備份的時候遇見很奇怪的問題：
明明就是通的，但是卻是慢到非常的誇張，比原先的線路還離譜。本來以為是 pf 擋到不該擋的，叫出 tcpdump 來看半天發現沒錯；又想說是不是走錯路，交叉測了很久也看不出啥端倪。最後比對正常跟有問題的 tcpdump 也看不出啥鬼。結果在對照［正常］組時發現：
02:52:39.274108 IP bad-len 0
02:52:39.304782 IP bad-len 0
02:52:39.334036 IP bad-len 0
02:52:39.335331 IP bad-len 0
這種東西，好奇 google 一下發現這篇，結果發現我也中大獎 -_-&#124;&#124;
sysctl net.inet.tcp.tso=0
從此過著幸福快樂的日子&#8230;&#8230;!@#$%^&#38; &#8230;&#8230;.
]]></description>
			<content:encoded><![CDATA[<p>在 FreeBSD 7.1 PRELEASE 底下做比較複雜的網路環境，結果要讓 rsync + ssh 從其他網路跑進來撈備份的時候遇見很奇怪的問題：</p>
<p>明明就是通的，但是卻是慢到非常的誇張，比原先的線路還離譜。本來以為是 pf 擋到不該擋的，叫出 tcpdump 來看半天發現沒錯；又想說是不是走錯路，交叉測了很久也看不出啥端倪。最後比對正常跟有問題的 tcpdump 也看不出啥鬼。結果在對照［正常］組時發現：</p>
<p>02:52:39.274108 IP bad-len 0<br />
02:52:39.304782 IP bad-len 0<br />
02:52:39.334036 IP bad-len 0<br />
02:52:39.335331 IP bad-len 0</p>
<p>這種東西，好奇 google 一下發現<a href="http://unix.derkeiler.com/Mailing-Lists/FreeBSD/current/2008-02/msg00186.html">這篇</a>，結果發現我也中大獎 -_-||</p>
<p>sysctl net.inet.tcp.tso=0</p>
<p>從此過著幸福快樂的日子&#8230;&#8230;!@#$%^&amp; &#8230;&#8230;.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.cookys.org/2008/11/26/309/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>could not listen on UDP socket: permission denied</title>
		<link>http://blog.cookys.org/2007/05/09/289/</link>
		<comments>http://blog.cookys.org/2007/05/09/289/#comments</comments>
		<pubDate>Wed, 09 May 2007 04:23:01 +0000</pubDate>
		<dc:creator>cookys</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://blog.cookys.org/?p=289</guid>
		<description><![CDATA[
自從家裡的老 server 爆炸，然後應爹娘要求儘速處理，於是展開移山倒海 shift 大法，把比較省電且輕巧的小白 (AM2 X2 3800+) 給帶回去暫時先把網路搶通後就沒空理他，今天上去一看發現 message 一直出現：
May 9 04:19:11 soul named[960]: could not listen on UDP socket: permission denied
May 9 04:19:11 soul named[960]: creating IPv4 interface tun0 failed; interface ignored
May 9 05:19:11 soul named[960]: could not listen on UDP socket: permission denied
May 9 05:19:11 soul named[960]: creating IPv4 interface tun0 failed; [...]]]></description>
			<content:encoded><![CDATA[<div class="entry-content">
<p>自從家裡的老 server 爆炸，然後應爹娘要求儘速處理，於是展開移山倒海 shift 大法，把比較省電且輕巧的小白 (AM2 X2 3800+) 給帶回去暫時先把網路搶通後就沒空理他，今天上去一看發現 message 一直出現：</p>
<blockquote><p>May 9 04:19:11 soul named[960]: could not listen on UDP socket: permission denied<br />
May 9 04:19:11 soul named[960]: creating IPv4 interface tun0 failed; interface ignored<br />
May 9 05:19:11 soul named[960]: could not listen on UDP socket: permission denied<br />
May 9 05:19:11 soul named[960]: creating IPv4 interface tun0 failed; interface ignored<br />
May 9 06:19:11 soul named[960]: could not listen on UDP socket: permission denied<br />
May 9 06:19:11 soul named[960]: creating IPv4 interface tun0 failed; interface ignored<br />
May 9 07:19:11 soul named[960]: could not listen on UDP socket: permission denied<br />
May 9 07:19:11 soul named[960]: creating IPv4 interface tun0 failed; interface ignored<br />
May 9 08:19:11 soul named[960]: could not listen on UDP socket: permission denied<br />
May 9 08:19:11 soul named[960]: creating IPv4 interface tun0 failed; interface ignored<br />
May 9 09:19:11 soul named[960]: could not listen on UDP socket: permission denied</p></blockquote>
<p style="text-align: left">詢問了 google 大神之後發現大概是 <a href="http://web.archive.org/web/20070820195503/http://unix.derkeiler.com/Mailing-Lists/FreeBSD/net/2006-01/msg00212.html" target="_blank">這麼一回事</a> ，所以就乖乖的照著 <a href="http://web.archive.org/web/20070820195503/http://www.freebsd.org/cgi/man.cgi?query=mac_portacl&amp;sektion=4">mac_portacl(4)</a> 去把 kernel configuration 的 options MAC 加進去，然後到 /boot/loader.conf 加入 mac_portacl_load=”YES” 接著照著 <a href="http://web.archive.org/web/20070820195503/http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/mac-portacl.html">handbook 的 example</a> 依樣畫葫蘆塞進 sysctl security.mac.portacl.rules=uid:53:udp:53,uid:53:tcp:53 然後重新啟動囉。</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.cookys.org/2007/05/09/289/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>pf + smp +  nogaint network stack = ?</title>
		<link>http://blog.cookys.org/2006/05/28/286/</link>
		<comments>http://blog.cookys.org/2006/05/28/286/#comments</comments>
		<pubDate>Sat, 27 May 2006 16:29:41 +0000</pubDate>
		<dc:creator>cookys</dc:creator>
				<category><![CDATA[Diary]]></category>
		<category><![CDATA[FreeBSD]]></category>

		<guid isPermaLink="false">http://blog.cookys.org/2006/05/28/314/</guid>
		<description><![CDATA[剛剛看到大神這篇「升級到 6.1-RELEASE」裡面喊說因為腳踏車鎖(Giant lock)太多，所以就把 root server 衝到 6.1 了，真的是勇敢的長輩 XD。不過我是看到 GIANT LOCK 才想到我忘了說我遇到的狀況，所以才趕快來紀錄一下。
話說我家美人機到了之後總是會亂 panic 及亂七八糟的事情，在這一篇有稍微提到我後來換 ipnat 之後改善很多，不過偶爾還是會從網路上消失。後來大概在五月中的時候， 看到 mailing list 有人疑似有類似的情形，環境也是 smp ，後來過了不久某篇裡面談到：

This is very similar to the UID/GID filtering problem. What appears to
be happening is on the inbound path, we pickup the pfil lock and attempt
to pickup the inp info lock, while on the outbound [...]]]></description>
			<content:encoded><![CDATA[<p>剛剛看到<a href="http://blog.gslin.org">大神</a>這篇「<a href="http://blog.gslin.org/archives/2006/05/27/615/" rel="bookmark" title="Permanent Link to &quot;升級到 6.1-RELEASE&quot;">升級到 6.1-RELEASE</a>」裡面喊說因為腳踏車鎖(Giant lock)太多，所以就把 root server 衝到 6.1 了，真的是勇敢的長輩 XD。不過我是看到 GIANT LOCK 才想到我忘了說我遇到的狀況，所以才趕快來紀錄一下。</p>
<p>話說我家美人機到了之後總是會亂 panic 及亂七八糟的事情，在<a href="http://blog.cookys.org/2006/05/08/310/">這一篇</a>有稍微提到我後來換 ipnat 之後改善很多，不過偶爾還是會從網路上消失。後來大概在五月中的時候， 看到 mailing list 有人疑似有<a href="http://lists.freebsd.org/pipermail/freebsd-current/2006-May/062955.html">類似的情形</a>，環境也是 smp ，後來過了不久<a href="http://lists.freebsd.org/pipermail/freebsd-current/2006-May/062971.html">某篇</a>裡面談到：</p>
<blockquote>
<pre>This is very similar to the UID/GID filtering problem. What appears to
be happening is on the inbound path, we pickup the pfil lock and attempt
to pickup the inp info lock, while on the outbound path, we hold the inp
info lock across ip_output which will try to pickup the pfil lock.

This problem is the result of a layering violation, in reality the
firewall should not be picking up layer 4 related locks. Myself and a
few others have been discussing this problem for quite some time now,
and hopefully it won&#39;t be long before we can come up with a solution
that will make everyone happy.

For now, you should be able to set debug.mpsafenet to  0 which will
re-enable Giant in the network stack, in theory preventing the deadlock.

debug.mpsafenet=0

in your loader.conf

Let me know if this helps</pre>
</blockquote>
<p>&nbsp;於是乎，測試了一下，把腳踏車鎖關掉，開機會看到：「WARNING: MPSAFE network stack disabled, expect reduced performance.」</p>
<blockquote><p>Copyright (c) 1992-2006 The FreeBSD Project.<br />
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The Regents of the University of California. All rights reserved.<br />
FreeBSD 6.1-STABLE #3: Wed May 17 22:41:10 CST 2006<br />
&nbsp;&nbsp;&nbsp; cookys@ddbeauty.iecs.us:/usr/obj/usr/src/sys/DDBEAUTY<br />
WARNING: MPSAFE network stack disabled, expect reduced performance.<br />
ACPI APIC Table: &lt;GBT&nbsp;&nbsp;&nbsp; AWRDACPI&gt;<br />
Timecounter &quot;i8254&quot; frequency 1193182 Hz quality 0<br />
CPU: Intel(R) Pentium(R) D&nbsp; CPU 2.66GHz (3340.93-MHz K8-class CPU)<br />
&nbsp; Origin = &quot;GenuineIntel&quot;&nbsp; Id = 0xf47&nbsp; Stepping = 7</p></blockquote>
<p>&nbsp;然後「感覺上」pf 好像反應比 ipnat 好，不過可能是錯覺 XD。雖然說腳踏車鎖一次就會綁一大堆，不過在會亂 dead lock 的狀況下也只能先打開撐著，看什麼時候他們解決 XD。至少跑到現在，兩個禮拜多都沒消失了，除了前一個禮拜被學校裝笑為把她 halt 等停電以外 :p</p>
<p>這時候該高呼，&quot;捷安特鎖&quot;我愛你嗎？(我沒有打廣告喔 @_@)&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.cookys.org/2006/05/28/286/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>eaccelerator + php5</title>
		<link>http://blog.cookys.org/2006/05/10/285/</link>
		<comments>http://blog.cookys.org/2006/05/10/285/#comments</comments>
		<pubDate>Tue, 09 May 2006 16:01:01 +0000</pubDate>
		<dc:creator>cookys</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[FreeBSD]]></category>

		<guid isPermaLink="false">http://blog.cookys.org/2006/05/10/313/</guid>
		<description><![CDATA[剛剛在弄 mediawiki 才發現原來我家的 eaccelerator 根本一直都沒跑阿，花了一些時間看到底問題出在哪裡，發現原來是被擺到了。再安裝厚的提示訊息寫著：
*****************************************************************************
You have installed the eaccelerator package.
Edit %%LOCALBASE%%/etc/php.ini and add:
zend_extension=&#34;%%PREFIX%%/lib/php/%%PHP_EXT_DIR%%/eaccelerator.so&#34;
Then create the cache directory:
mkdir /tmp/eaccelerator
chown www /tmp/eaccelerator
chmod 0700 /tmp/eaccelerator
*****************************************************************************
但是實際上如果去 /usr/local/etc/php.ini 設 zend_extension 事實上他會不理你。所以還是得設到 /usr/local/etc/php/extensions.ini 裡面去：
extension=eaccelerator.so&#160;
本來是直接 copy/paste 他的路徑，結果 php -v 下去就又被 ooxx 。所以現在看起來，是真的有跑了：
PHP 5.1.4 (cli) (built: May&#160; 9 2006 10:48:26)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
&#160;&#160;&#160; with [...]]]></description>
			<content:encoded><![CDATA[<p>剛剛在弄 mediawiki 才發現原來我家的 eaccelerator 根本一直都沒跑阿，花了一些時間看到底問題出在哪裡，發現原來是被擺到了。再安裝厚的提示訊息寫著：</p>
<blockquote><p>*****************************************************************************</p>
<p>You have installed the eaccelerator package.</p>
<p>Edit %%LOCALBASE%%/etc/php.ini and add:</p>
<p>zend_extension=&quot;%%PREFIX%%/lib/php/%%PHP_EXT_DIR%%/eaccelerator.so&quot;</p>
<p>Then create the cache directory:</p>
<p>mkdir /tmp/eaccelerator<br />
chown www /tmp/eaccelerator<br />
chmod 0700 /tmp/eaccelerator</p>
<p>*****************************************************************************</p></blockquote>
<p>但是實際上如果去 /usr/local/etc/php.ini 設 zend_extension 事實上他會不理你。所以還是得設到 /usr/local/etc/php/extensions.ini 裡面去：</p>
<blockquote><p>extension=eaccelerator.so&nbsp;</p></blockquote>
<p>本來是直接 copy/paste 他的路徑，結果 php -v 下去就又被 ooxx 。所以現在看起來，是真的有跑了：</p>
<blockquote><p>PHP 5.1.4 (cli) (built: May&nbsp; 9 2006 10:48:26)<br />
Copyright (c) 1997-2006 The PHP Group<br />
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies<br />
&nbsp;&nbsp;&nbsp; with eAccelerator v0.9.5-beta2, Copyright (c) 2004-2006 eAccelerator, by eAccelerator</p></blockquote>
<p>被 ports 的 hint message 擺道，很無言的阿！</p>
<p>PS. 前幾天&nbsp; FreeBSD 的 php 好像地震了一下：</p>
<blockquote><p>20060506:<br />
&nbsp; AFFECTS: users of PHP<br />
&nbsp; AUTHOR: ale@FreeBSD.org</p>
<p>&nbsp; The old PHP slave ports (phpN-cli, phpN-cgi and mod_phpN) were removed<br />
&nbsp; in favour of unified PHP ports that allow building any combination of<br />
&nbsp; PHP SAPIs (cli, cgi and apache module).<br />
&nbsp; The PHP CGI binary was renamed to php-cgi, so you should update<br />
&nbsp; the path in your script. To simplify the update process, *only* for<br />
&nbsp; this release a &#39;php&#39; compatibility symlink to php-cgi will be created<br />
&nbsp; if you don&#39;t select the CLI SAPI.<br />
&nbsp; Before the upgrade you *should* run &#39;make config&#39; in lang/php4 or<br />
&nbsp; lang/php5 to configure the SAPIs you want to install.<br />
&nbsp; As a consequence the default binary packages include the CLI and the<br />
&nbsp; FastCGI SAPIs.<br />
&nbsp;</p></blockquote>
<p>所以順手把他重新 make 了一次，進 php 打 make config 勾一勾然後 portupgrade -f &#39;php*&#39; 下去就搞定了 :p</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.cookys.org/2006/05/10/285/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>mediawiki + mysql5.1 beta</title>
		<link>http://blog.cookys.org/2006/05/09/284/</link>
		<comments>http://blog.cookys.org/2006/05/09/284/#comments</comments>
		<pubDate>Tue, 09 May 2006 13:35:33 +0000</pubDate>
		<dc:creator>cookys</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[FreeBSD]]></category>

		<guid isPermaLink="false">http://blog.cookys.org/2006/05/09/312/</guid>
		<description><![CDATA[剛剛在裝 mediawiki ，本來理論上 make install clean 就能搞定的東西裝了好久。我還笑著跟把妹揚說，搞不好他那裡下去打 make install clean 會直接 ok 也說不定。（把妹楊最近被惡魔化了，雖然他本來就是壞人，不過被惡魔化倒應該是頭一遭。他lab裡的機器現在是 FreeBSD 6 喔！嘿嘿）。原因是因為之前手賤然後現在就遇到很多神秘的問題。
這篇有 提過因為 mysql5.1.7 beta吃了一點小苦頭，而這個問題也同樣發生在 mediawiki 的 CREATE TABLE 的 sql 檔上面。一開始是一度懷疑是不是因為我自己白目去抓 mediawiki 的 svn (自以為以後升級比較方便，可是從 FCU 抓那邊真的是他 X 的慢&#8230;）所以爛掉，後來從 ports 裝也是相同的情形，可是現在 mysql 上面又跑幾個東西再上面了，要再 downgrade 其實也可說是頗麻煩，於是就很任命的開始找。一開始看到 Syntax error 大概有個底，照上次經驗把 TYPE 清光光大概就會動。不過後來就很莫名其妙了。
一開始發生 index key 不能 &#62; 1000 bytes 的情形，可是怎麼看都莫名其妙，後來 google 到說原來 utf8 [...]]]></description>
			<content:encoded><![CDATA[<p>剛剛在裝 mediawiki ，本來理論上 make install clean 就能搞定的東西裝了好久。我還笑著跟把妹揚說，搞不好他那裡下去打 make install clean 會直接 ok 也說不定。（把妹楊最近被惡魔化了，雖然他本來就是壞人，不過被惡魔化倒應該是頭一遭。他lab裡的機器現在是 FreeBSD 6 喔！嘿嘿）。原因是因為之前手賤然後現在就遇到很多神秘的問題。</p>
<p><a href="http://blog.cookys.org/2006/04/19/298/">這篇</a>有 提過因為 mysql5.1.7 beta吃了一點小苦頭，而這個問題也同樣發生在 mediawiki 的 CREATE TABLE 的 sql 檔上面。一開始是一度懷疑是不是因為我自己白目去抓 mediawiki 的 svn (自以為以後升級比較方便，可是從 FCU 抓那邊真的是他 X 的慢&#8230;）所以爛掉，後來從 ports 裝也是相同的情形，可是現在 mysql 上面又跑幾個東西再上面了，要再 downgrade 其實也可說是頗麻煩，於是就很任命的開始找。一開始看到 Syntax error 大概有個底，照上次經驗把 TYPE 清光光大概就會動。不過後來就很莫名其妙了。</p>
<p>一開始發生 index key 不能 &gt; 1000 bytes 的情形，可是怎麼看都莫名其妙，後來 google 到說原來 utf8 會比較機車，於是就開始 try and error 慢慢調整。之後遇到</p>
<blockquote><p>A database error has occurred Query: SET NAMES utf8</p></blockquote>
<p>然後卡關卡好久後才發現原來是因為我一開始就在 my.cnf 設了</p>
<blockquote><p>init_connect    = &#39;SET NAMES UTF8;&#39;</p></blockquote>
<p>然後 mediawiki 又自己做了一次，所以不知道該算是誰的錯？解法是把 include/Database.php Line 310 那附近的 $this-&gt;query( &#39;SET NAMES utf8&#39; ); 給幹掉，然後就天下大平了。</p>
<p>如果有需要的可以拿我亂改的 sql 檔蓋到 /maintenance/mysql5/ 底下的 tables.sql，不過爆炸不負責就是。<a href="http://blog.cookys.org/wp-content/uploads/2006/05/tables.sql">這裡下載</a>。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.cookys.org/2006/05/09/284/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>apache22 + MPM=worker 遇到神秘問題</title>
		<link>http://blog.cookys.org/2006/05/08/282/</link>
		<comments>http://blog.cookys.org/2006/05/08/282/#comments</comments>
		<pubDate>Sun, 07 May 2006 18:16:08 +0000</pubDate>
		<dc:creator>cookys</dc:creator>
				<category><![CDATA[FreeBSD]]></category>

		<guid isPermaLink="false">http://blog.cookys.org/2006/05/08/310/</guid>
		<description><![CDATA[我家美人愛鬧脾氣，從取進門來之後總是沒安份過。到現在還是會動不動就 *panic* 一下。上次追了半天甚至還換了硬碟後來發現，原來是 PF 在搗蛋，只要有開 pf 幾乎是沒一下子就沒不理人了。而且還是沒有 panic 掉，只是就直接 hang 住不知道是怎樣。後來換回很久沒用的 IPFilter + ipnat (好像從 PF port 進 base ，印象中是 5.x 之後我就 switch 過去了&#8230;那年代的 ipnat 好像還沒有 rc 好吃）。
於是呢，把 pf 那幾行 mark 掉之後加上
ipnat_enable=&#34;YES&#34;                # Start ipnat function
ipnat_rules=&#34;/etc/ipnat.rules&#34;    # [...]]]></description>
			<content:encoded><![CDATA[<p>我家美人愛鬧脾氣，從取進門來之後總是沒安份過。到現在還是會動不動就 *panic* 一下。上次追了半天甚至還換了硬碟後來發現，原來是 PF 在搗蛋，只要有開 pf 幾乎是沒一下子就沒不理人了。而且還是沒有 panic 掉，只是就直接 hang 住不知道是怎樣。後來換回很久沒用的 IPFilter + ipnat (好像從 PF port 進 base ，印象中是 5.x 之後我就 switch 過去了&#8230;那年代的 ipnat 好像還沒有 rc 好吃）。</p>
<p>於是呢，把 pf 那幾行 mark 掉之後加上</p>
<blockquote><p>ipnat_enable=&quot;YES&quot;                # Start ipnat function<br />
ipnat_rules=&quot;/etc/ipnat.rules&quot;    # rules definition file for ipnat</p></blockquote>
<p>原本想說可以就此過著幸福快樂的生活，他確實也安分了幾天，不過在開暗黑大會的時候據說某把妹揚按了 wiki 的編輯，這台主機就又失連了。衝回來看才發現又 tcp6 啥小的 panic 了 XD。想說搞不好是踩到 7-current 的地雷了，那閒閒沒事來 downgrade 好了。於是就 cvs 成 RELENG_6 的 tag 衝到 6.1-RC（理論上就是現在的 RC2 iso），不過一開 pf 還是馬上就 say 沙要那那。真是一整個獄卒，那想說好吧來升一下 ports ，明明我就才裝沒多久為啥 apache22 的版本能差那麼多。某把妹楊都已經跑到 2.2.2 了我還在很後面，明明還裝不到一個月版號就跳了兩跳阿。</p>
<p>在 make 的時候才發現，咦，怎麼 top 只看到一顆 cpu ，哇哩咧，忘了編 SMP 進去。（沒辦法阿，以前的機器都沒有 SMP 的阿阿阿阿阿）。於是又很苦的重新弄了一次 kernel ，想說好不容易可以休息了吧，要偶爾當一下我也不能阻止他了。<br />
但是好死不死，最後很手賤的 delete-old-libs ，然後似乎就有東西爆炸了 -_-。 php 就得重編，然後一連串的 recursion。到最後實在是不行，就丟給 portupgrade 去攪，弄了半天 apache 還是不肯乖乖起來。於是乎我看到 httpd-error.log 出現一大堆神秘的錯誤訊息：</p>
<blockquote><p>Fatal error &#39;kse_exit() failed for system scope thread&#39; at line 1215 in file /usr/src/lib/libpthread/thread/thr_kern.c (errno = 22)<br />
Fatal error &#39;kse_exit() failed for system scope thread&#39; at line 1215 in file /usr/src/lib/libpthread/thread/thr_kern.c (errno = 22)<br />
Fatal error &#39;kse_exit() failed for system scope thread&#39; at line 1215 in file /usr/src/lib/libpthread/thread/thr_kern.c (errno = 22)</p></blockquote>
<p>於是就跑去看 thr_kren 可是看不出所以然來&#8230;google 半天也沒相關的資訊，不知道是 keyword 給錯還是怎樣。忽然靈機一動，想說看看是不是哪些 lib 掛了，於是看了一下 ldd：</p>
<blockquote><p>ddbeauty# ldd /usr/local/sbin/httpd<br />
/usr/local/sbin/httpd:<br />
libm.so.4 =&gt; /lib/libm.so.4 (0&#215;800688000)<br />
libaprutil-1.so.2 =&gt; /usr/local/lib/libaprutil-1.so.2 (0&#215;8007a3000)<br />
libexpat.so.6 =&gt; /usr/local/lib/libexpat.so.6 (0&#215;8008ba000)<br />
libiconv.so.3 =&gt; /usr/local/lib/libiconv.so.3 (0&#215;8009dc000)<br />
libapr-1.so.2 =&gt; /usr/local/lib/libapr-1.so.2 (0&#215;800bcc000)<br />
libcrypt.so.3 =&gt; /lib/libcrypt.so.3 (0&#215;800cf2000)<br />
libpthread.so.2 =&gt; /usr/lib/libpthread.so.2 (0&#215;800e0b000)<br />
libc.so.6 =&gt; /lib/libc.so.6 (0&#215;800f35000)<br />
libpthread.so.2 =&gt; /lib/libpthread.so.2 (0&#215;80112d000)</p></blockquote>
<p>看不出所以然來阿，跟其他台比較明明是一樣的：</p>
<blockquote><p>cdst# ldd /usr/local/sbin/httpd<br />
/usr/local/sbin/httpd:<br />
libm.so.4 =&gt; /lib/libm.so.4 (0&#215;280ca000)<br />
libaprutil-1.so.2 =&gt; /usr/local/lib/libaprutil-1.so.2 (0&#215;280e0000)<br />
libexpat.so.5 =&gt; /usr/local/lib/libexpat.so.5 (0&#215;280f5000)<br />
libiconv.so.3 =&gt; /usr/local/lib/libiconv.so.3 (0&#215;28113000)<br />
libapr-1.so.2 =&gt; /usr/local/lib/libapr-1.so.2 (0&#215;28201000)<br />
libcrypt.so.3 =&gt; /lib/libcrypt.so.3 (0&#215;28224000)<br />
libpthread.so.2 =&gt; /usr/lib/libpthread.so.2 (0&#215;2823d000)<br />
libc.so.6 =&gt; /lib/libc.so.6 (0&#215;28264000)</p></blockquote>
<p>於是一籌莫展的情況下就開始惡搞，想到說 libpthread 反正是 user level thread 其實根本沒啥用，那來把他丟給 libthr 玩玩好了，於是就去改 /etc/libmap.conf (這檔案竟然沒 example ，還好我不知道哪看來記得有 man libmap.conf 好抄..）於是加了：</p>
<blockquote><p>[/usr/local/sbin/httpd]<br />
libpthread.so.2         libthr.so.2</p></blockquote>
<p>於是美人與阿啪器過著幸福快樂的日子。 一整個神秘。</p>
<p>PS. 是在 apache-worker-2.2.2 Version 2.2 of Apache web server with worker MPM. 遇到的<br />
UPDATE: 這篇草稿忘了發，沒想到才過兩天就上了 6.1-RELEASE 的 tag 了，我要不要重編咧？</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.cookys.org/2006/05/08/282/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Install FreeBSD6 on X41 tablet (2)</title>
		<link>http://blog.cookys.org/2006/04/20/277/</link>
		<comments>http://blog.cookys.org/2006/04/20/277/#comments</comments>
		<pubDate>Wed, 19 Apr 2006 17:15:57 +0000</pubDate>
		<dc:creator>cookys</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[FreeBSD]]></category>

		<guid isPermaLink="false">http://blog.cookys.org/2006/04/20/299/</guid>
		<description><![CDATA[人總是很懶惰的動物，反正灌好了嗎，反正能夠 dual-boot ，那就繼續用 Windows 吧 XD。反正都付錢買 license 了嘛 XD。
喂喂喂喂，不是這樣說的吧？好啦，上個禮拜實在爆炸到一個不行，於是很生氣的就把小黑上的 FreeBSD 開起來亂裝了。
一開始呢，先把他 cvsup 到 7-current ，然後就可以把 cvsup 淘汰掉，很歡樂的用 csup ：
改 make.conf
SUP=            /usr/bin/csup
SUPFLAGS=       -L 2
然後這裡發現有很討厭的事情，就是在 NAT 後面 fetch 似乎不會自動走 passive ftp 去抓東西，於是找了一下理論上應該是在 make.conf 加上 FETCH_CMD=fetch -U -A -p ( -p [...]]]></description>
			<content:encoded><![CDATA[<p>人總是很懶惰的動物，反正灌好了嗎，反正能夠 dual-boot ，那就繼續用 Windows 吧 XD。反正都付錢買 license 了嘛 XD。</p>
<p>喂喂喂喂，不是這樣說的吧？好啦，上個禮拜實在爆炸到一個不行，於是很生氣的就把小黑上的 FreeBSD 開起來亂裝了。</p>
<p>一開始呢，先把他 cvsup 到 7-current ，然後就可以把 cvsup 淘汰掉，很歡樂的用 csup ：</p>
<p>改 make.conf</p>
<blockquote><p>SUP=            /usr/bin/csup<br />
SUPFLAGS=       -L 2</p></blockquote>
<p>然後這裡發現有很討厭的事情，就是在 NAT 後面 fetch 似乎不會自動走 passive ftp 去抓東西，於是找了一下理論上應該是在 make.conf 加上 FETCH_CMD=fetch -U -A -p ( -p          Use passive FTP.) ，不過看起來還是很神秘的不理我，於是就直接 bind 一個外面的 ip 給他 :p 。</p>
<p>然後升級了完了之後就開始裝桌面吧，當然，習慣性的用 KDE 。 而且這次很生氣所以不是編 kde3-lite 而是直接編 kde XD。</p>
<blockquote><p>cd /usr/ports/x11/kde3  ; make install clean</p></blockquote>
<p>這邊因為耍笨忘了開 BATCH=yes ，然後再加上 FCU 網路狂斷，再加上可憐的小黑，他的硬碟是 1.8&quot; 然後只有 4200RPM (具不可靠測速指出，max transfer rate 大概只有 20MB &#8230; seek time 更是 ~!@#$%^&#8230; orz），所以這裡花了我兩天多，雖然忘了開 time 下去量 XD，更好笑的是，之前嘲笑鴨子說怎麼會耍笨到 /usr 割太小然後 diskfull ，結果這次也發生再我身上 orz 。還好 unix-like 的系統下的偉哉 ln 很好用 :p 。</p>
<p>裝完之後當然要再自己 localhost 顯示畫面啊，不然怎麼搞? 所以就得乖乖的裝 X Server ：</p>
<blockquote><p>cd /usr/ports/x11/xorg  ; make install clean</p></blockquote>
<p>然後自動生出設定檔：</p>
<blockquote><p>Xorg -configure</p></blockquote>
<p>把生出來的設定檔拷到「他該去的地方」，該去的地方可以 man xorg.conf 看最後面。</p>
<blockquote><p>cp /root/xorg.conf.new /usr/X11R6/etc/X11/xorg.conf</p></blockquote>
<p>然後抄某處的 setting 讓小紅點 scroll 功能能用(就是按中賤然後動小紅點就變成滾輪，然後本來的貼上中鍵變成左右鍵一起按）</p>
<blockquote><p>#TrackPoint Scroll<br />
Option          &quot;EmulateWheel&quot;          &quot;on&quot;<br />
Option          &quot;EmulateWheelButton&quot;    &quot;2&quot;</p></blockquote>
<p>接下來裝中文環境（其實我一直覺得英文的 look-and-feel 真的好看很多，所以搞不好可以看英文然後裝中文字型就好？）</p>
<blockquote><p>cd /usr/ports/chinese/zh-auto-tw-l10n    ; make install clean<br />
cd /usr/ports/chinese/zh_TW-kde-i18n     ; make install clean<br />
cd /usr/ports/chinese/zh_TW-koffice-i18n ; make install clean<br />
cd /usr/ports/chinese/fireflyttf         ; make install clean</p></blockquote>
<p>然後進「控制中心」，把字型改成 firefly 辛苦畫的字體「AR PL New Sung」，我是直接把所有都改成這個，然後大小除了視窗標題是 11 以外其他都 12 ，然後固定字寬的暫時用 Monospace 12 ，看起來還不至於太糟。<br />
<a href="http://blog.cookys.org/wp-content/uploads/2006/04/x41_kde_screenshot4.png" class="imagelink" title="x41_kde_screenshot4.png" rel="lightbox[277]"><img src="http://blog.cookys.org/wp-content/uploads/2006/04/x41_kde_screenshot4.png" alt="x41_kde_screenshot4.png" /></a><br />
AA 的話我是有開，由於是 LCD 也有設 sub-pixel hinting ，可以參考 statue 的 FreeBSD 中文 Howto (zh-tut) 當中的 <a href="http://netlab.cse.yzu.edu.tw/~statue/freebsd/zh-tut/fireflyttf.html" target="_blank">fireflyttf</a> ，然後把 .xinitrc 跟 .cshrc 偷出來稍微改一下之後，就可以打 startx 進去玩耍啦！</p>
<p>如果想用用中文輸入法的話，我這邊是裝 oxim ，一樣是 firefly 前輩最近在維護的輸入法，似乎是從 xcin 2.5pre2 改的 :p ，而且用了新酷音，在 freebsd 下的話裝法很簡單：</p>
<blockquote><p>cd /usr/ports/chinese/oxim ; make install clean</p></blockquote>
<p>就幫你搞定了 <img src='http://blog.cookys.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> ，然後只要在 .xinitrc 加上</p>
<blockquote><p>export XMODIFIERS=&#39;@im=oxim&#39;<br />
export GTK_IM_MODULE=oxim<br />
export QT_IM_MODULE=xim</p></blockquote>
<p>以及</p>
<blockquote><p>exec oxim &amp;</p></blockquote>
<p>喔當然，還要記得把</p>
<blockquote><p>exec startkde</p></blockquote>
<p>的註解 # 拿掉，一切就都會很完美！有中文可以上 msn，可以用整合的很不錯的 Konqueror 找資料看網頁，然後又有很多有趣的小遊戲！其實很夠了 XD。</p>
<p>當然要來點審查砲彈啦？</p>
<p>某妹的「幹」換成大張的圖，不過佔掉了畫面的 1/4 ，很有趣 XD</p>
<p><a href="http://blog.cookys.org/wp-content/uploads/2006/04/x41_kde_screenshot5.png" class="imagelink" title="x41_kde_screenshot5.png" rel="lightbox[277]"><img src="http://blog.cookys.org/wp-content/uploads/2006/04/x41_kde_screenshot5.png" alt="x41_kde_screenshot5.png" /></a></p>
<p>真的可以打中文喔！！</p>
<p><a href="http://blog.cookys.org/wp-content/uploads/2006/04/x41_kde_screenshot3.png" class="imagelink" title="x41_kde_screenshot3.png" rel="lightbox[277]"><img src="http://blog.cookys.org/wp-content/uploads/2006/04/x41_kde_screenshot3.png" alt="x41_kde_screenshot3.png" /></a><br />
很受我跟把妹偉喜愛的遊戲，某天本來要回家，把妹偉被黏上之後又玩了快一個小時才走出去&#8230;.</p>
<p><a href="http://blog.cookys.org/wp-content/uploads/2006/04/x41_kde_screenshot2.png" class="imagelink" title="x41_kde_screenshot2.png" rel="lightbox[277]"><img src="http://blog.cookys.org/wp-content/uploads/2006/04/x41_kde_screenshot2.png" alt="x41_kde_screenshot2.png" /></a><br />
最後看一下這個blog長啥鳥樣？</p>
<p><a href="http://blog.cookys.org/wp-content/uploads/2006/04/x41_kde_screenshot1.png" class="imagelink" title="x41_kde_screenshot1.png" rel="lightbox[277]"><img src="http://blog.cookys.org/wp-content/uploads/2006/04/x41_kde_screenshot1.png" alt="x41_kde_screenshot1.png" /></a> 不賴吧，快換快換！</p>
<p>然後呢，抄 /usr/local/share/skel/zh_TW.Big5/dot.cshrc 來用..把 zh_TW.Big5 改成 zh_TW.UTF-8..然後開始準備大爆炸的痛苦 UTF-8 環境 :p &lt;待續&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.cookys.org/2006/04/20/277/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Install FreeBSD6 on X41 tablet (1)</title>
		<link>http://blog.cookys.org/2005/12/16/255/</link>
		<comments>http://blog.cookys.org/2005/12/16/255/#comments</comments>
		<pubDate>Fri, 16 Dec 2005 14:22:42 +0000</pubDate>
		<dc:creator>cookys</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[FreeBSD]]></category>

		<guid isPermaLink="false">http://blog.cookys.org/2005/12/16/265/</guid>
		<description><![CDATA[據說下學期的文獻是留朕恤老師，當然要來巴結一下，至於為什麼，這個故事以後再講。
其實不只這個原因，機八鴨在 X31 上玩 FreeBSD 玩了好一陣子了，雖然他很機八都沒留 blog or wiki ，不過總是還有人可以指點，在遇到困難上面會快很多 XD。我從拿到 X31 就一直喊說要玩玩到都已經被搶走了還是沒玩到，於是乎趁這裡拜比較悠哉，就鐵了心試著來裝  FreeBSD 到 laptop 上。
沒想到困難重重啊，一開始把 combo 機接上去之後很高興的把 FreeBSD 6.0 Release Disc1 丟進去，想說大概三分鐘就可以搞定，之後再慢慢 make 就好，沒想到給我的是這張畫面：

真是歡樂到一個不行。然後試了漂長輩助教以及機八鴨的 combo 也是不行，發生同樣的情況，於是跑去抓其他舊的版本（因為據機八鴨說他在 FreeBSD6 RC 的 iso 也是開不起來，不過症狀不太一樣），從 5.1 5.2.1 5.3 5.4 都試了，其中好像只有 5.3 沒有畫面一直跑而是 hang 住，其他都一樣的情形。總不會要我用 4.X 試吧？於是一氣之下跑去抓 FreeSBIE、pfsense、DragonFlyBSD，結果還是都一樣。於是只好請教 google ，看到比較可能的情形是說：FreeBSD 6 Released BTX loader issue &#8211; BTX loader [...]]]></description>
			<content:encoded><![CDATA[<p>據說下學期的文獻是留朕恤老師，當然要來巴結一下，至於為什麼，這個故事以後再講。</p>
<p>其實不只這個原因，機八鴨在 X31 上玩 FreeBSD 玩了好一陣子了，雖然他很機八都沒留 blog or wiki ，不過總是還有人可以指點，在遇到困難上面會快很多 XD。我從拿到 X31 就一直喊說要玩玩到都已經被搶走了還是沒玩到，於是乎趁這裡拜比較悠哉，就鐵了心試著來裝  FreeBSD 到 laptop 上。</p>
<p>沒想到困難重重啊，一開始把 combo 機接上去之後很高興的把 FreeBSD 6.0 Release Disc1 丟進去，想說大概三分鐘就可以搞定，之後再慢慢 make 就好，沒想到給我的是這張畫面：</p>
<p><img width="442" height="331" alt="x41t_FreeBSD6_crash_on_BTX_Loader" src="http://blog.cookys.org/wp-content/uploads/2005/12/DSC00948.JPG" /></p>
<p>真是歡樂到一個不行。然後試了漂長輩助教以及機八鴨的 combo 也是不行，發生同樣的情況，於是跑去抓其他舊的版本（因為據機八鴨說他在 FreeBSD6 RC 的 iso 也是開不起來，不過症狀不太一樣），從 5.1 5.2.1 5.3 5.4 都試了，其中好像只有 5.3 沒有畫面一直跑而是 hang 住，其他都一樣的情形。總不會要我用 4.X 試吧？於是一氣之下跑去抓 FreeSBIE、pfsense、DragonFlyBSD，結果還是都一樣。於是只好請教 google ，看到比較可能的情形是說：<a target="_blank" href="http://lists.freebsd.org/pipermail/freebsd-stable/2005-November/019334.html">FreeBSD 6 Released BTX loader issue</a> &#8211; BTX loader 不支援 USB 裝置造成的。如我上一篇<a href="http://blog.cookys.org/2005/12/14/262/">所說</a>，難不成要如此之<a target="_blank" href="http://www.daemonology.net/depenguinator/">邪</a><a target="_blank" href="http://blog.chinaunix.net/article.php?articleId=55866&amp;blogId=132">惡</a>嗎？</p>
<p>由於<a target="_blank" href="http://www.daemonology.net/depenguinator/">「邪」</a>太過於麻煩，還要先裝 Linux ，如果讓我一不小心裝 gentoo 上去大概就黏住那就不能巴結老鄧了 ，所以我選擇了<a target="_blank" href="http://blog.chinaunix.net/article.php?articleId=55866&amp;blogId=132">「惡」</a>。</p>
<p>PXE 這東西事實上並不陌生，約在四五年前幫高中做電腦教室的時候就已經玩了一次，那時 google 打  PXE 可以說東西少的可憐，所以必須從 Intel、Realtek 那邊挖資料，然後 try and error 想辦法慢慢兜，連螃蟹卡的 boot rom 都要自己燒，還常常會有某版不能配某版的問題，實在是超麻煩。不過很有趣就是了，尤其是把整套系統兜出來之後，透過 PXE Server 開機，派 PCDOS 開機檔，然後用 config.sys 和 autoexec.bat 搭配寫開機選單，再加上 ghost server/ghost preload partition 的配置，可以說撐得上當時自己很滿意的作品。不過可惜的是當時沒有寫 doc 的觀念，只有自己習慣性的隨手寫了幾個 TXT 檔，然後跟著 server backup 起來。只是我沒想到用三台 server 做交互備份的情況下還能夠爛的如此徹底。在一年多後的某天，看到網路上有人也在搞這些東西，可是解的都不怎麼漂亮、或是說不完整，覺得把那些東西拿出來寫 doc 或分享應該不錯，才發現竟然一點文件、一點成果都不剩。</p>
<p>其實說穿了技術性不高，只是那時幾乎沒現成的工具的情況下苦工不少，全部不見了還真有點可惜。這次 build PXE Server 就非常快了。參考了<a href="http://blog.chinaunix.net/index.php?blogId=132">終極流行(toppop)</a>的<a href="http://blog.chinaunix.net/article.php?articleId=55866&amp;blogId=132">金蟬脫殼</a>這篇、以及 <a target="_blank" href="http://www.redantigua.com/mount-iso.html">mount iso</a> 的方法、還有 <a target="_blank" href="http://lp.wiki.ptt2.cc/-Diskless+FreeBSD+5.2.1+release+++PXE+++DHCP+++NFS+++NIS">Diskless FreeBSD 5.2.1 release PXE DHCP NFS NIS</a> 。大概的步驟不外乎是：</p>
<p>Mount ISO</p>
<blockquote><p>mdconfig -a -t vnode -f /your/iso/image/6.0-RELEASE-i386-disc1.iso -u 0<br />
mount -t cd9660 /dev/md0 /mnt/freebsd6</p></blockquote>
<p>Install DHCPD</p>
<blockquote><p>cd /usr/ports/net/isc-dhcp3-devel<br />
make install clean</p></blockquote>
<p>Modify RC.CONF</p>
<blockquote><p>該開的東西要開</p>
<p>ee /etc/rc.conf<br />
inetd_enable=yes</p>
<p>dhcpd_enable=&#8221;YES&#8221;                          # dhcpd enabled?<br />
dhcpd_flags=&#8221;-q&#8221;                            # command option(s)<br />
dhcpd_conf=&#8221;/usr/local/etc/dhcpd.conf&#8221;      # configuration file<br />
dhcpd_ifaces=&#8221;"                             # ethernet interface(s)<br />
dhcpd_withumask=&#8221;022&#8243;                       # file creation mask</p>
<p>nfs_server_enable=&#8221;YES&#8221;</p></blockquote>
<p>EDIT dhcpd.conf</p>
<blockquote><p>ee /usr/local/etc/dhcpd.conf<br />
在 host or network 裡加上：</p>
<blockquote><p>filename &#8220;pxeboot&#8221;;<br />
option root-path &#8220;192.168.200.254:/&#8221;;<br />
next-server 192.168.200.254;</p></blockquote>
<p>如果 tftp server 跟 dhcp server 不同台的話就由 next-server 指過去，要改 root-path 的話用 root-path 改。<br />
改完重跑： /usr/local/etc/rc.d/isc-dhcpd.sh restart</p></blockquote>
<p>EDIT inetd.conf</p>
<blockquote><p>ee /etc/inetd.conf<br />
把註解取消並改後面 boot 路徑<br />
tftp    dgram   udp     wait    root    /usr/libexec/tftpd      tftpd -l -s /home/tftp<br />
檔名由 dhcpd.conf 的 filename 指定，所以 tftpd 只要給路徑。<br />
改完重跑： /etc/rc.d/inetd restart</p></blockquote>
<p>EDIT exports</p>
<blockquote><p>ee /etc/exports</p>
<blockquote><p>#/usr -alldirs -ro<br />
/home/tftp/freebsd60 -ro -maproot=root -network=192.168.200.0 -mask=255.255.255.0<br />
#/mnt/freebsd6 /mnt/freebsd6 -maproot=root x41tablet<br />
/usr -ro -maproot=root -alldirs  -network=192.168.200.0 -mask=255.255.255.0<br />
#/diskless_ro -ro -maproot=0 -network 192.168.1.0 -mask 255.255.255.0<br />
/ -ro -maproot=root -alldirs -network=192.168.200.0 -mask=255.255.255.0</p></blockquote>
<p>改完記得重跑 mound -r<br />
kill -HUP `cat /var/run/mountd.pid`</p></blockquote>
<p>就會動了，不過跑起來一直 hang 在 rootfs：</p>
<p><img width="641" height="355" alt="freebsd_x41t_pxe_hang.PNG" src="http://blog.cookys.org/wp-content/uploads/2005/12/freebsd_x41t_pxe_hang.PNG" /><br />
找了半天不知道怎麼回事，ping 的到但是服務都沒繼續往下跑。感覺上他的 fstab 都沒有吃，花了好幾個小時實在是累了於是就放大絕招。用 VMWARE 灌進去。</p>
<p>在機八鴨的教誨之下：</p>
<blockquote><p>[上午 04:57:02] (鴨)&#8230;: 我現在跟你說要用entire disk 阿<br />
[上午 04:57:17] (鴨)&#8230;: 所以醬子相對來說會比較危險一點<br />
[上午 04:58:16] (鴨)&#8230;: 你現在的步驟是&#8230;<br />
把vmware 的vmdk 幹掉<br />
重新新增一個physical disk<br />
選entire disk<br />
[上午 04:58:31] (鴨)&#8230;: 開vmware 起來之後把freebsd 裝完<br />
[上午 04:58:59] (鴨)&#8230;: 裝好以後趁除/d9 還可以開起來的時候 dd 把 512 byte 讀出來<br />
[上午 04:59:28] (鴨)&#8230;: 讀完以後 windows 的partition 設回來active<br />
[上午 04:59:37] (鴨)&#8230;: 降子應該就好了</p></blockquote>
<p>很順利的搞定了。而且全部都在 vmware 當中搞定（危險動作請勿模仿啊 XD，搞爛恕不負責）。因為我之前就已經用工具先把磁區分好了：</p>
<p><img width="679" height="63" alt="partition_x41.PNG" src="http://blog.cookys.org/wp-content/uploads/2005/12/partition_x41.PNG" /><br />
所以在裝的時候小心，不要安裝 MBR ，然後再割分割區的時候直接用 T 把 type 設成 165 (freebsd) 然後進去切 slice 就好了。至於這裡我沒有割 /swap 因為打算跟 windows 共用 2G 的那塊 fat32 。另外在 loader 的部份為了簡單直接用 NT 的 loader ，可以參考 FreeBSD 的 FAQ 有關 <a target="_blank" href="http://www.freebsd.org/doc/en_US.ISO8859-1/books/faq/disks.html#NT-BOOTLOADER">NT Loader </a>的部份，或是 <a target="_blank" href="http://tavi.debian.org.tw/MicrosoftWindowsBootManager">MicrosoftWindowsBootManager</a>，我是照 debian 那個方法下了：</p>
<blockquote><p>dd if=/dev/ad0s1c of=/root/BootSector.FreeBSD bs=512 count=1</p></blockquote>
<p>然後把 BootSector.FreeBSD 想辦法傳出來丟到根目錄後改 boot.ini 加上：</p>
<blockquote><p>C:\BootSector.FreeBSD=&#8221;FreeBSD&#8221;</p></blockquote>
<p>並且到 FreeBSD 裡面用 fdisk -t -a -1 ad0 把 Windows XP 的 partition 設回 active ，就可以重開看成果（或是準備炸的亂七八糟了）。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.cookys.org/2005/12/16/255/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
